forked from luck/tmp_suning_uos_patched
crypto: sun4i-ss - Forbid 2-key 3DES in FIPS mode
This patch forbids the use of 2-key 3DES (K1 == K3) in FIPS mode. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com> Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
beebb714e7
commit
aee118139a
|
@ -533,13 +533,12 @@ int sun4i_ss_des3_setkey(struct crypto_skcipher *tfm, const u8 *key,
|
|||
unsigned int keylen)
|
||||
{
|
||||
struct sun4i_tfm_ctx *op = crypto_skcipher_ctx(tfm);
|
||||
struct sun4i_ss_ctx *ss = op->ss;
|
||||
int err;
|
||||
|
||||
err = des3_verify_key(tfm, key);
|
||||
if (unlikely(err))
|
||||
return err;
|
||||
|
||||
if (unlikely(keylen != 3 * DES_KEY_SIZE)) {
|
||||
dev_err(ss->dev, "Invalid keylen %u\n", keylen);
|
||||
crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
|
||||
return -EINVAL;
|
||||
}
|
||||
op->keylen = keylen;
|
||||
memcpy(op->key, key, keylen);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user