2929#include <crypto/aes.h>
3030#include <crypto/algapi.h>
3131#include <crypto/ctr.h>
32- #include <crypto/des.h>
32+ #include <crypto/internal/ des.h>
3333#include <crypto/scatterwalk.h>
3434
3535#include <linux/platform_data/crypto-ux500.h>
@@ -987,26 +987,13 @@ static int des_ablkcipher_setkey(struct crypto_ablkcipher *cipher,
987987 const u8 * key , unsigned int keylen )
988988{
989989 struct cryp_ctx * ctx = crypto_ablkcipher_ctx (cipher );
990- u32 * flags = & cipher -> base .crt_flags ;
991- u32 tmp [DES_EXPKEY_WORDS ];
992- int ret ;
990+ int err ;
993991
994992 pr_debug (DEV_DBG_NAME " [%s]" , __func__ );
995- if (keylen != DES_KEY_SIZE ) {
996- * flags |= CRYPTO_TFM_RES_BAD_KEY_LEN ;
997- pr_debug (DEV_DBG_NAME " [%s]: CRYPTO_TFM_RES_BAD_KEY_LEN" ,
998- __func__ );
999- return - EINVAL ;
1000- }
1001993
1002- ret = des_ekey (tmp , key );
1003- if (unlikely (ret == 0 ) &&
1004- (* flags & CRYPTO_TFM_REQ_FORBID_WEAK_KEYS )) {
1005- * flags |= CRYPTO_TFM_RES_WEAK_KEY ;
1006- pr_debug (DEV_DBG_NAME " [%s]: CRYPTO_TFM_RES_WEAK_KEY" ,
1007- __func__ );
1008- return - EINVAL ;
1009- }
994+ err = verify_ablkcipher_des_key (cipher , key );
995+ if (err )
996+ return err ;
1010997
1011998 memcpy (ctx -> key , key , keylen );
1012999 ctx -> keylen = keylen ;
@@ -1019,17 +1006,13 @@ static int des3_ablkcipher_setkey(struct crypto_ablkcipher *cipher,
10191006 const u8 * key , unsigned int keylen )
10201007{
10211008 struct cryp_ctx * ctx = crypto_ablkcipher_ctx (cipher );
1022- u32 flags ;
10231009 int err ;
10241010
10251011 pr_debug (DEV_DBG_NAME " [%s]" , __func__ );
10261012
1027- flags = crypto_ablkcipher_get_flags (cipher );
1028- err = __des3_verify_key (& flags , key );
1029- if (unlikely (err )) {
1030- crypto_ablkcipher_set_flags (cipher , flags );
1013+ err = verify_ablkcipher_des3_key (cipher , key );
1014+ if (err )
10311015 return err ;
1032- }
10331016
10341017 memcpy (ctx -> key , key , keylen );
10351018 ctx -> keylen = keylen ;
0 commit comments