Whamcloud - gitweb
LU-9183 llite: handle make the string hashes salt the hash
[fs/lustre-release.git] / lustre / utils / gss / lgss_sk.c
index 15ff3fc..d036450 100644 (file)
@@ -83,15 +83,15 @@ enum cfs_crypto_hash_alg sk_name2hmac(char *name)
 
        /* convert to lower case */
        while (name[i]) {
-               putchar(tolower(name[i]));
+               name[i] = tolower(name[i]);
                i++;
        }
 
-       if (strcmp(name, "none"))
+       if (strcmp(name, "none") == 0)
                return CFS_HASH_ALG_NULL;
 
        algo = cfs_crypto_hash_alg(name);
-       if ((algo != CFS_HASH_ALG_SHA256) ||
+       if ((algo != CFS_HASH_ALG_SHA256) &&
            (algo != CFS_HASH_ALG_SHA512))
                return SK_HMAC_INVALID;
 
@@ -133,8 +133,9 @@ static void usage(FILE *fp, char *program)
                "client)\n");
        fprintf(fp, "-k|--key-bits   <len>      Shared key length in bits "
                "(Default: %d)\n", SK_DEFAULT_SK_KEYLEN);
-       fprintf(fp, "-d|--data       <file>     Key random data source "
-               "(Default: /dev/random)\n\n");
+       fprintf(fp, "-d|--data       <file>     Key data source for new keys "
+               "(Default: /dev/random)\n");
+       fprintf(fp, "                        Not a seed value.  This is the actual key value.\n\n");
        fprintf(fp, "Other Options:\n");
        fprintf(fp, "-v|--verbose           Increase verbosity for errors\n");
        exit(EXIT_FAILURE);
@@ -498,6 +499,10 @@ int main(int argc, char **argv)
                fprintf(stderr, "error: invalid HMAC algorithm specified\n");
                return EXIT_FAILURE;
        }
+       if (modify && datafile) {
+               fprintf(stderr, "error: data file option not valid in key modify\n");
+               return EXIT_FAILURE;
+       }
 
        if (modify) {
                config = sk_read_file(modify);