diff options
Diffstat (limited to 'crypto/seqiv.c')
-rw-r--r-- | crypto/seqiv.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/seqiv.c b/crypto/seqiv.c index 9daa854cc485..b7bb9a2f4a31 100644 --- a/crypto/seqiv.c +++ b/crypto/seqiv.c | |||
@@ -267,6 +267,12 @@ static struct crypto_instance *seqiv_ablkcipher_alloc(struct rtattr **tb) | |||
267 | if (IS_ERR(inst)) | 267 | if (IS_ERR(inst)) |
268 | goto out; | 268 | goto out; |
269 | 269 | ||
270 | if (inst->alg.cra_ablkcipher.ivsize < sizeof(u64)) { | ||
271 | skcipher_geniv_free(inst); | ||
272 | inst = ERR_PTR(-EINVAL); | ||
273 | goto out; | ||
274 | } | ||
275 | |||
270 | inst->alg.cra_ablkcipher.givencrypt = seqiv_givencrypt_first; | 276 | inst->alg.cra_ablkcipher.givencrypt = seqiv_givencrypt_first; |
271 | 277 | ||
272 | inst->alg.cra_init = seqiv_init; | 278 | inst->alg.cra_init = seqiv_init; |
@@ -287,6 +293,12 @@ static struct crypto_instance *seqiv_aead_alloc(struct rtattr **tb) | |||
287 | if (IS_ERR(inst)) | 293 | if (IS_ERR(inst)) |
288 | goto out; | 294 | goto out; |
289 | 295 | ||
296 | if (inst->alg.cra_aead.ivsize < sizeof(u64)) { | ||
297 | aead_geniv_free(inst); | ||
298 | inst = ERR_PTR(-EINVAL); | ||
299 | goto out; | ||
300 | } | ||
301 | |||
290 | inst->alg.cra_aead.givencrypt = seqiv_aead_givencrypt_first; | 302 | inst->alg.cra_aead.givencrypt = seqiv_aead_givencrypt_first; |
291 | 303 | ||
292 | inst->alg.cra_init = seqiv_aead_init; | 304 | inst->alg.cra_init = seqiv_aead_init; |