crypto: ccree/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>
This commit is contained in:

committed by
Herbert Xu

parent
b525041633
commit
00cd6b233f
@@ -5,7 +5,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <crypto/algapi.h>
|
||||
#include <crypto/internal/skcipher.h>
|
||||
#include <crypto/des.h>
|
||||
#include <crypto/internal/des.h>
|
||||
#include <crypto/xts.h>
|
||||
#include <crypto/sm4.h>
|
||||
#include <crypto/scatterwalk.h>
|
||||
@@ -411,16 +411,9 @@ static int cc_cipher_setkey(struct crypto_skcipher *sktfm, const u8 *key,
|
||||
* HW does the expansion on its own.
|
||||
*/
|
||||
if (ctx_p->flow_mode == S_DIN_to_DES) {
|
||||
u32 tmp[DES3_EDE_EXPKEY_WORDS];
|
||||
if (keylen == DES3_EDE_KEY_SIZE &&
|
||||
__des3_ede_setkey(tmp, &tfm->crt_flags, key,
|
||||
DES3_EDE_KEY_SIZE)) {
|
||||
dev_dbg(dev, "weak 3DES key");
|
||||
return -EINVAL;
|
||||
} else if (!des_ekey(tmp, key) &&
|
||||
(crypto_tfm_get_flags(tfm) &
|
||||
CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)) {
|
||||
tfm->crt_flags |= CRYPTO_TFM_RES_WEAK_KEY;
|
||||
if ((keylen == DES3_EDE_KEY_SIZE &&
|
||||
verify_skcipher_des3_key(sktfm, key)) ||
|
||||
verify_skcipher_des_key(sktfm, key)) {
|
||||
dev_dbg(dev, "weak DES key");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user