Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: hisilicon/des - switch to new verification routines

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Ard Biesheuvel and committed by
Herbert Xu
894b68d8 f4ed6860

+7 -11
+7 -11
drivers/crypto/hisilicon/sec/sec_algs.c
··· 9 9 10 10 #include <crypto/aes.h> 11 11 #include <crypto/algapi.h> 12 - #include <crypto/des.h> 12 + #include <crypto/internal/des.h> 13 13 #include <crypto/skcipher.h> 14 14 #include <crypto/xts.h> 15 15 #include <crypto/internal/skcipher.h> ··· 347 347 static int sec_alg_skcipher_setkey_des_ecb(struct crypto_skcipher *tfm, 348 348 const u8 *key, unsigned int keylen) 349 349 { 350 - if (keylen != DES_KEY_SIZE) 351 - return -EINVAL; 352 - 353 - return sec_alg_skcipher_setkey(tfm, key, keylen, SEC_C_DES_ECB_64); 350 + return verify_skcipher_des_key(tfm, key) ?: 351 + sec_alg_skcipher_setkey(tfm, key, keylen, SEC_C_DES_ECB_64); 354 352 } 355 353 356 354 static int sec_alg_skcipher_setkey_des_cbc(struct crypto_skcipher *tfm, 357 355 const u8 *key, unsigned int keylen) 358 356 { 359 - if (keylen != DES_KEY_SIZE) 360 - return -EINVAL; 361 - 362 - return sec_alg_skcipher_setkey(tfm, key, keylen, SEC_C_DES_CBC_64); 357 + return verify_skcipher_des_key(tfm, key) ?: 358 + sec_alg_skcipher_setkey(tfm, key, keylen, SEC_C_DES_CBC_64); 363 359 } 364 360 365 361 static int sec_alg_skcipher_setkey_3des_ecb(struct crypto_skcipher *tfm, 366 362 const u8 *key, unsigned int keylen) 367 363 { 368 - return unlikely(des3_verify_key(tfm, key)) ?: 364 + return verify_skcipher_des3_key(tfm, key) ?: 369 365 sec_alg_skcipher_setkey(tfm, key, keylen, 370 366 SEC_C_3DES_ECB_192_3KEY); 371 367 } ··· 369 373 static int sec_alg_skcipher_setkey_3des_cbc(struct crypto_skcipher *tfm, 370 374 const u8 *key, unsigned int keylen) 371 375 { 372 - return unlikely(des3_verify_key(tfm, key)) ?: 376 + return verify_skcipher_des3_key(tfm, key) ?: 373 377 sec_alg_skcipher_setkey(tfm, key, keylen, 374 378 SEC_C_3DES_CBC_192_3KEY); 375 379 }