Commit 369f3dab authored by Tom Lendacky's avatar Tom Lendacky Committed by Herbert Xu

crypto: ccp - Remove user triggerable pr_err calls

Remove the pr_err calls that are issued during parameter
checking in some AES operations. This will eliminate the
possibility of filling up syslog through these paths.
Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d5aa8095
...@@ -63,10 +63,8 @@ static int ccp_do_cmac_update(struct ahash_request *req, unsigned int nbytes, ...@@ -63,10 +63,8 @@ static int ccp_do_cmac_update(struct ahash_request *req, unsigned int nbytes,
unsigned int len, need_pad, sg_count; unsigned int len, need_pad, sg_count;
int ret; int ret;
if (!ctx->u.aes.key_len) { if (!ctx->u.aes.key_len)
pr_err("AES key not set\n");
return -EINVAL; return -EINVAL;
}
if (nbytes) if (nbytes)
rctx->null_msg = 0; rctx->null_msg = 0;
......
...@@ -125,20 +125,14 @@ static int ccp_aes_xts_crypt(struct ablkcipher_request *req, ...@@ -125,20 +125,14 @@ static int ccp_aes_xts_crypt(struct ablkcipher_request *req,
unsigned int unit; unsigned int unit;
int ret; int ret;
if (!ctx->u.aes.key_len) { if (!ctx->u.aes.key_len)
pr_err("AES key not set\n");
return -EINVAL; return -EINVAL;
}
if (req->nbytes & (AES_BLOCK_SIZE - 1)) { if (req->nbytes & (AES_BLOCK_SIZE - 1))
pr_err("AES request size is not a multiple of the block size\n");
return -EINVAL; return -EINVAL;
}
if (!req->info) { if (!req->info)
pr_err("AES IV not supplied");
return -EINVAL; return -EINVAL;
}
for (unit = 0; unit < ARRAY_SIZE(unit_size_map); unit++) for (unit = 0; unit < ARRAY_SIZE(unit_size_map); unit++)
if (!(req->nbytes & (unit_size_map[unit].size - 1))) if (!(req->nbytes & (unit_size_map[unit].size - 1)))
......
...@@ -76,24 +76,18 @@ static int ccp_aes_crypt(struct ablkcipher_request *req, bool encrypt) ...@@ -76,24 +76,18 @@ static int ccp_aes_crypt(struct ablkcipher_request *req, bool encrypt)
unsigned int iv_len = 0; unsigned int iv_len = 0;
int ret; int ret;
if (!ctx->u.aes.key_len) { if (!ctx->u.aes.key_len)
pr_err("AES key not set\n");
return -EINVAL; return -EINVAL;
}
if (((ctx->u.aes.mode == CCP_AES_MODE_ECB) || if (((ctx->u.aes.mode == CCP_AES_MODE_ECB) ||
(ctx->u.aes.mode == CCP_AES_MODE_CBC) || (ctx->u.aes.mode == CCP_AES_MODE_CBC) ||
(ctx->u.aes.mode == CCP_AES_MODE_CFB)) && (ctx->u.aes.mode == CCP_AES_MODE_CFB)) &&
(req->nbytes & (AES_BLOCK_SIZE - 1))) { (req->nbytes & (AES_BLOCK_SIZE - 1)))
pr_err("AES request size is not a multiple of the block size\n");
return -EINVAL; return -EINVAL;
}
if (ctx->u.aes.mode != CCP_AES_MODE_ECB) { if (ctx->u.aes.mode != CCP_AES_MODE_ECB) {
if (!req->info) { if (!req->info)
pr_err("AES IV not supplied");
return -EINVAL; return -EINVAL;
}
memcpy(rctx->iv, req->info, AES_BLOCK_SIZE); memcpy(rctx->iv, req->info, AES_BLOCK_SIZE);
iv_sg = &rctx->iv_sg; iv_sg = &rctx->iv_sg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment