linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: testmgr - properly mark the end of scatterlist
@ 2020-01-27 12:33 Gilad Ben-Yossef
  2020-01-28  2:40 ` Eric Biggers
  0 siblings, 1 reply; 2+ messages in thread
From: Gilad Ben-Yossef @ 2020-01-27 12:33 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Eric Biggers
  Cc: Ofir Drang, linux-crypto, linux-kernel

The inauthentic AEAD test were using a scatterlist which
could have a mismarked end node.

Fixes: 49763fc6b1 ("crypto: testmgr - generate inauthentic AEAD test vectors")
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>

---
 crypto/testmgr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 88f33c0efb23..6c432aecff97 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2225,6 +2225,8 @@ static void generate_aead_message(struct aead_request *req,
 			generate_random_bytes((u8 *)vec->ptext, vec->plen);
 			sg_set_buf(&src[i++], vec->ptext, vec->plen);
 		}
+		if (i)
+			sg_mark_end(&src[(i-1)]);
 		sg_init_one(&dst, vec->ctext, vec->alen + vec->clen);
 		memcpy(iv, vec->iv, ivsize);
 		aead_request_set_callback(req, 0, crypto_req_done, &wait);
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: testmgr - properly mark the end of scatterlist
  2020-01-27 12:33 [PATCH] crypto: testmgr - properly mark the end of scatterlist Gilad Ben-Yossef
@ 2020-01-28  2:40 ` Eric Biggers
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2020-01-28  2:40 UTC (permalink / raw)
  To: Gilad Ben-Yossef
  Cc: Herbert Xu, David S. Miller, Ofir Drang, linux-crypto, linux-kernel

On Mon, Jan 27, 2020 at 02:33:11PM +0200, Gilad Ben-Yossef wrote:
> The inauthentic AEAD test were using a scatterlist which
> could have a mismarked end node.
> 
> Fixes: 49763fc6b1 ("crypto: testmgr - generate inauthentic AEAD test vectors")
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> 
> ---
>  crypto/testmgr.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/crypto/testmgr.c b/crypto/testmgr.c
> index 88f33c0efb23..6c432aecff97 100644
> --- a/crypto/testmgr.c
> +++ b/crypto/testmgr.c
> @@ -2225,6 +2225,8 @@ static void generate_aead_message(struct aead_request *req,
>  			generate_random_bytes((u8 *)vec->ptext, vec->plen);
>  			sg_set_buf(&src[i++], vec->ptext, vec->plen);
>  		}
> +		if (i)
> +			sg_mark_end(&src[(i-1)]);
>  		sg_init_one(&dst, vec->ctext, vec->alen + vec->clen);
>  		memcpy(iv, vec->iv, ivsize);
>  		aead_request_set_callback(req, 0, crypto_req_done, &wait);

As I responded in the other thread
(https://lkml.kernel.org/linux-crypto/20200128023455.GC960@sol.localdomain/),
I'm not sure this is really a bug.  There's a length passed along with the
scatterlist, and my understanding is that algorithms aren't supposed to look
beyond that length.  So the scatterlist end marker isn't really relevant.

- Eric

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-28  2:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-27 12:33 [PATCH] crypto: testmgr - properly mark the end of scatterlist Gilad Ben-Yossef
2020-01-28  2:40 ` Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).