cifsd: move fips_enabled check before the str_to_key()
authorNamjae Jeon <namjae.jeon@samsung.com>
Wed, 26 May 2021 06:25:40 +0000 (15:25 +0900)
committerNamjae Jeon <namjae.jeon@samsung.com>
Wed, 26 May 2021 09:11:53 +0000 (18:11 +0900)
Move fips_enabled check before the str_to_key().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifsd/auth.c

index 6b90aac..9263c9c 100644 (file)
@@ -92,14 +92,13 @@ smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)
        unsigned char key2[8];
        struct des_ctx ctx;
 
-       str_to_key(key, key2);
-
        if (fips_enabled) {
                ksmbd_debug(AUTH,
                        "FIPS compliance enabled: DES not permitted\n");
                return -ENOENT;
        }
 
+       str_to_key(key, key2);
        des_expand_key(&ctx, key2, DES_KEY_SIZE);
        des_encrypt(&ctx, out, in);
        memzero_explicit(&ctx, sizeof(ctx));