lkml.org 
[lkml]   [2020]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 16/22] crypto: ccree - add check for xts input length equal to zero
Date
From: Andrei Botila <andrei.botila@nxp.com>

Standardize the way input lengths equal to 0 are handled in all skcipher
algorithms. All the algorithms return 0 for input lengths equal to zero.
This change has implications not only for xts(aes) but also for cts(cbc(aes))
and cts(cbc(paes)).

Cc: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Andrei Botila <andrei.botila@nxp.com>
---
drivers/crypto/ccree/cc_cipher.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c
index 076669dc1035..112bb8b4dce6 100644
--- a/drivers/crypto/ccree/cc_cipher.c
+++ b/drivers/crypto/ccree/cc_cipher.c
@@ -912,17 +912,18 @@ static int cc_cipher_process(struct skcipher_request *req,

/* STAT_PHASE_0: Init and sanity checks */

- if (validate_data_size(ctx_p, nbytes)) {
- dev_dbg(dev, "Unsupported data size %d.\n", nbytes);
- rc = -EINVAL;
- goto exit_process;
- }
if (nbytes == 0) {
/* No data to process is valid */
rc = 0;
goto exit_process;
}

+ if (validate_data_size(ctx_p, nbytes)) {
+ dev_dbg(dev, "Unsupported data size %d.\n", nbytes);
+ rc = -EINVAL;
+ goto exit_process;
+ }
+
if (ctx_p->fallback_on) {
struct skcipher_request *subreq = skcipher_request_ctx(req);

--
2.17.1
\
 
 \ /
  Last update: 2020-08-07 18:23    [W:0.160 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site