OSDN Git Service

crypto: arch - use crypto_memneq instead of memcmp
[uclinux-h8/linux.git] / arch / s390 / crypto / des_s390.c
index bcca01c..200f2a1 100644 (file)
@@ -237,9 +237,9 @@ static int des3_setkey(struct crypto_tfm *tfm, const u8 *key,
        struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);
        u32 *flags = &tfm->crt_flags;
 
-       if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
-           memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2],
-                  DES_KEY_SIZE)) &&
+       if (!(crypto_memneq(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
+           crypto_memneq(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2],
+                         DES_KEY_SIZE)) &&
            (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
                *flags |= CRYPTO_TFM_RES_WEAK_KEY;
                return -EINVAL;