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: cesa/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
9bfa85eb 3ca20b65

+8 -17
+8 -17
drivers/crypto/marvell/cipher.c
··· 10 10 */ 11 11 12 12 #include <crypto/aes.h> 13 - #include <crypto/des.h> 13 + #include <crypto/internal/des.h> 14 14 15 15 #include "cesa.h" 16 16 ··· 272 272 static int mv_cesa_des_setkey(struct crypto_skcipher *cipher, const u8 *key, 273 273 unsigned int len) 274 274 { 275 - struct crypto_tfm *tfm = crypto_skcipher_tfm(cipher); 276 - struct mv_cesa_des_ctx *ctx = crypto_tfm_ctx(tfm); 277 - u32 tmp[DES_EXPKEY_WORDS]; 278 - int ret; 275 + struct mv_cesa_des_ctx *ctx = crypto_skcipher_ctx(cipher); 276 + int err; 279 277 280 - if (len != DES_KEY_SIZE) { 281 - crypto_skcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN); 282 - return -EINVAL; 283 - } 284 - 285 - ret = des_ekey(tmp, key); 286 - if (!ret && (tfm->crt_flags & CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)) { 287 - tfm->crt_flags |= CRYPTO_TFM_RES_WEAK_KEY; 288 - return -EINVAL; 289 - } 278 + err = verify_skcipher_des_key(cipher, key); 279 + if (err) 280 + return err; 290 281 291 282 memcpy(ctx->key, key, DES_KEY_SIZE); 292 283 ··· 290 299 struct mv_cesa_des_ctx *ctx = crypto_skcipher_ctx(cipher); 291 300 int err; 292 301 293 - err = des3_verify_key(cipher, key); 294 - if (unlikely(err)) 302 + err = verify_skcipher_des3_key(cipher, key); 303 + if (err) 295 304 return err; 296 305 297 306 memcpy(ctx->key, key, DES3_EDE_KEY_SIZE);