Commit cc4bd9f2 authored by Herbert Xu's avatar Herbert Xu

crypto: marvell - Forbid 2-key 3DES in FIPS mode

This patch forbids the use of 2-key 3DES (K1 == K3) in FIPS mode.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent dba434a9
...@@ -299,13 +299,12 @@ static int mv_cesa_des_setkey(struct crypto_skcipher *cipher, const u8 *key, ...@@ -299,13 +299,12 @@ static int mv_cesa_des_setkey(struct crypto_skcipher *cipher, const u8 *key,
static int mv_cesa_des3_ede_setkey(struct crypto_skcipher *cipher, static int mv_cesa_des3_ede_setkey(struct crypto_skcipher *cipher,
const u8 *key, unsigned int len) const u8 *key, unsigned int len)
{ {
struct crypto_tfm *tfm = crypto_skcipher_tfm(cipher); struct mv_cesa_des_ctx *ctx = crypto_skcipher_ctx(cipher);
struct mv_cesa_des_ctx *ctx = crypto_tfm_ctx(tfm); int err;
if (len != DES3_EDE_KEY_SIZE) { err = des3_verify_key(cipher, key);
crypto_skcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN); if (unlikely(err))
return -EINVAL; return err;
}
memcpy(ctx->key, key, DES3_EDE_KEY_SIZE); memcpy(ctx->key, key, DES3_EDE_KEY_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment