diff options
| author | Mikael Ylikoski <my@post.utfors.se> | 2003-08-17 14:04:17 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2003-08-17 14:04:17 -0700 |
| commit | f7ab034d70d50dadd7801d3970dec18edd6b07a1 (patch) | |
| tree | 19aef5b060f1f92cb59c03da65f10ded67bd57d1 /crypto/cipher.c | |
| parent | 68bc1ac97a21214d62a04468eda26c775fc1bc97 (diff) | |
[IPSEC]: Fix oops using null ciper in CBC mode.
Diffstat (limited to 'crypto/cipher.c')
| -rw-r--r-- | crypto/cipher.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crypto/cipher.c b/crypto/cipher.c index 064a158d830c..02ea57c9fb68 100644 --- a/crypto/cipher.c +++ b/crypto/cipher.c @@ -345,7 +345,6 @@ int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags) int crypto_init_cipher_ops(struct crypto_tfm *tfm) { int ret = 0; - struct crypto_alg *alg = tfm->__crt_alg; struct cipher_tfm *ops = &tfm->crt_cipher; ops->cit_setkey = setkey; @@ -381,8 +380,7 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm) BUG(); } - if (alg->cra_cipher.cia_ivsize && - ops->cit_mode != CRYPTO_TFM_MODE_ECB) { + if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) { switch (crypto_tfm_alg_blocksize(tfm)) { case 8: @@ -401,7 +399,8 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm) goto out; } - ops->cit_iv = kmalloc(alg->cra_cipher.cia_ivsize, GFP_KERNEL); + ops->cit_ivsize = crypto_tfm_alg_blocksize(tfm); + ops->cit_iv = kmalloc(ops->cit_ivsize, GFP_KERNEL); if (ops->cit_iv == NULL) ret = -ENOMEM; } |
