diff --git a/crypto/authencesn.c b/crypto/authencesn.c index 2cc933e2f790..e08032e80f18 100644 --- a/crypto/authencesn.c +++ b/crypto/authencesn.c @@ -185,6 +185,9 @@ static int crypto_authenc_esn_encrypt(struct aead_request *req) struct scatterlist *src, *dst; int err; + if (assoclen < 8) + return -EINVAL; + sg_init_table(areq_ctx->src, 2); src = scatterwalk_ffwd(areq_ctx->src, req->src, assoclen); dst = src; @@ -275,6 +278,9 @@ static int crypto_authenc_esn_decrypt(struct aead_request *req) u32 tmp[2]; int err; + if (assoclen < 8) + return -EINVAL; + cryptlen -= authsize; if (req->src != dst) {