diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-12-11 05:28:59 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-12-20 07:06:24 -0500 |
commit | fed286110f4bab01f93f06c32951fbc120fb71b1 (patch) | |
tree | c6d084142644b281d53631b5ef6f6f6f1ced2161 /arch/s390 | |
parent | 369f3dabad95aaa3b04ec390d5489d9d46e51395 (diff) |
crypto: arch - use crypto_memneq instead of memcmp
Replace remaining occurences (just as we did in crypto/) under arch/*/crypto/
that make use of memcmp() for comparing keys or authentication tags for
usage with crypto_memneq(). It can simply be used as a drop-in replacement
for the normal memcmp().
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: James Yonan <james@openvpn.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/crypto/des_s390.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c index bcca01c9989d..200f2a1b599d 100644 --- a/arch/s390/crypto/des_s390.c +++ b/arch/s390/crypto/des_s390.c | |||
@@ -237,9 +237,9 @@ static int des3_setkey(struct crypto_tfm *tfm, const u8 *key, | |||
237 | struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm); | 237 | struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm); |
238 | u32 *flags = &tfm->crt_flags; | 238 | u32 *flags = &tfm->crt_flags; |
239 | 239 | ||
240 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && | 240 | if (!(crypto_memneq(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && |
241 | memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2], | 241 | crypto_memneq(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2], |
242 | DES_KEY_SIZE)) && | 242 | DES_KEY_SIZE)) && |
243 | (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) { | 243 | (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) { |
244 | *flags |= CRYPTO_TFM_RES_WEAK_KEY; | 244 | *flags |= CRYPTO_TFM_RES_WEAK_KEY; |
245 | return -EINVAL; | 245 | return -EINVAL; |