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

crypto: sun4i/des - switch to new verification routines

Cc: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>
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
08d4b408 b5d0ba83

+7 -21
+6 -20
drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
··· 542 542 unsigned int keylen) 543 543 { 544 544 struct sun4i_tfm_ctx *op = crypto_skcipher_ctx(tfm); 545 - struct sun4i_ss_ctx *ss = op->ss; 546 - u32 flags; 547 - u32 tmp[DES_EXPKEY_WORDS]; 548 - int ret; 545 + int err; 549 546 550 - if (unlikely(keylen != DES_KEY_SIZE)) { 551 - dev_err(ss->dev, "Invalid keylen %u\n", keylen); 552 - crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); 553 - return -EINVAL; 554 - } 555 - 556 - flags = crypto_skcipher_get_flags(tfm); 557 - 558 - ret = des_ekey(tmp, key); 559 - if (unlikely(!ret) && (flags & CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)) { 560 - crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_WEAK_KEY); 561 - dev_dbg(ss->dev, "Weak key %u\n", keylen); 562 - return -EINVAL; 563 - } 547 + err = verify_skcipher_des_key(tfm, key); 548 + if (err) 549 + return err; 564 550 565 551 op->keylen = keylen; 566 552 memcpy(op->key, key, keylen); ··· 564 578 struct sun4i_tfm_ctx *op = crypto_skcipher_ctx(tfm); 565 579 int err; 566 580 567 - err = des3_verify_key(tfm, key); 568 - if (unlikely(err)) 581 + err = verify_skcipher_des3_key(tfm, key); 582 + if (err) 569 583 return err; 570 584 571 585 op->keylen = keylen;
+1 -1
drivers/crypto/sunxi-ss/sun4i-ss.h
··· 29 29 #include <crypto/internal/hash.h> 30 30 #include <crypto/internal/skcipher.h> 31 31 #include <crypto/aes.h> 32 - #include <crypto/des.h> 32 + #include <crypto/internal/des.h> 33 33 #include <crypto/internal/rng.h> 34 34 #include <crypto/rng.h> 35 35