提交 df89820e 编写于 作者: H Herbert Xu

[CRYPTO] cipher: Removed special IV checks for ECB

This patch makes IV operations on ECB fail through nocrypt_iv rather than
calling BUG().  This is needed to generalise CBC/ECB using the template
mechanism.
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 c907ee76
...@@ -399,6 +399,8 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm) ...@@ -399,6 +399,8 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm)
case CRYPTO_TFM_MODE_ECB: case CRYPTO_TFM_MODE_ECB:
ops->cit_encrypt = ecb_encrypt; ops->cit_encrypt = ecb_encrypt;
ops->cit_decrypt = ecb_decrypt; ops->cit_decrypt = ecb_decrypt;
ops->cit_encrypt_iv = nocrypt_iv;
ops->cit_decrypt_iv = nocrypt_iv;
break; break;
case CRYPTO_TFM_MODE_CBC: case CRYPTO_TFM_MODE_CBC:
......
...@@ -422,7 +422,6 @@ static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, ...@@ -422,7 +422,6 @@ static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
unsigned int nbytes, u8 *iv) unsigned int nbytes, u8 *iv)
{ {
BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv); return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv);
} }
...@@ -441,7 +440,6 @@ static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, ...@@ -441,7 +440,6 @@ static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
unsigned int nbytes, u8 *iv) unsigned int nbytes, u8 *iv)
{ {
BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv); return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册