linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix MIC buffer sizing in selftest
@ 2025-11-13 13:55 Joep Duin
  2025-11-21  4:37 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Joep Duin @ 2025-11-13 13:55 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S . Miller, linux-crypto, linux-kernel, Joep Duin,
	Joep Duin

From: Joep Duin <165405982+joepduin@users.noreply.github.com>

Signed-off-by: Joep Duin <joepduin12@gmail.com>
---
 crypto/krb5/selftest.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/crypto/krb5/selftest.c b/crypto/krb5/selftest.c
index 4519c572d37e..82b2b6a3607d 100644
--- a/crypto/krb5/selftest.c
+++ b/crypto/krb5/selftest.c
@@ -427,10 +427,10 @@ static int krb5_test_one_mic(const struct krb5_mic_test *test, void *buf)
 	memcpy(buf + offset, plain.data, plain.len);
 
 	/* Generate a MIC generation request. */
-	sg_init_one(sg, buf, 1024);
+	sg_init_one(sg, buf, message_len);
 
-	ret = crypto_krb5_get_mic(krb5, ci, NULL, sg, 1, 1024,
-				  krb5->cksum_len, plain.len);
+	ret = crypto_krb5_get_mic(krb5, ci, NULL, sg, 1, message_len,
+                   krb5->cksum_len, plain.len);
 	if (ret < 0) {
 		CHECK(1);
 		pr_warn("Get MIC failed %d\n", ret);
-- 
2.51.2


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

* Re: [PATCH] fix MIC buffer sizing in selftest
  2025-11-13 13:55 [PATCH] fix MIC buffer sizing in selftest Joep Duin
@ 2025-11-21  4:37 ` Herbert Xu
  2025-11-21  9:12   ` David Howells
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2025-11-21  4:37 UTC (permalink / raw)
  To: Joep Duin
  Cc: davem, linux-crypto, linux-kernel, 165405982+joepduin, joepduin12,
	David Howells

Joep Duin <joepduin12@gmail.com> wrote:
> From: Joep Duin <165405982+joepduin@users.noreply.github.com>
> 
> Signed-off-by: Joep Duin <joepduin12@gmail.com>
> ---
> crypto/krb5/selftest.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/crypto/krb5/selftest.c b/crypto/krb5/selftest.c
> index 4519c572d37e..82b2b6a3607d 100644
> --- a/crypto/krb5/selftest.c
> +++ b/crypto/krb5/selftest.c
> @@ -427,10 +427,10 @@ static int krb5_test_one_mic(const struct krb5_mic_test *test, void *buf)
>        memcpy(buf + offset, plain.data, plain.len);
> 
>        /* Generate a MIC generation request. */
> -       sg_init_one(sg, buf, 1024);
> +       sg_init_one(sg, buf, message_len);
> 
> -       ret = crypto_krb5_get_mic(krb5, ci, NULL, sg, 1, 1024,
> -                                 krb5->cksum_len, plain.len);
> +       ret = crypto_krb5_get_mic(krb5, ci, NULL, sg, 1, message_len,
> +                   krb5->cksum_len, plain.len);

I have no idea what you're trying to fix here.  Please explain
the problem.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH] fix MIC buffer sizing in selftest
  2025-11-21  4:37 ` Herbert Xu
@ 2025-11-21  9:12   ` David Howells
  0 siblings, 0 replies; 3+ messages in thread
From: David Howells @ 2025-11-21  9:12 UTC (permalink / raw)
  To: Joep Duin, Herbert Xu; +Cc: dhowells, davem, linux-crypto, linux-kernel

Herbert Xu <herbert@gondor.apana.org.au> wrote:

> >        /* Generate a MIC generation request. */
> > -       sg_init_one(sg, buf, 1024);
> > +       sg_init_one(sg, buf, message_len);
> > 
> > -       ret = crypto_krb5_get_mic(krb5, ci, NULL, sg, 1, 1024,
> > -                                 krb5->cksum_len, plain.len);
> > +       ret = crypto_krb5_get_mic(krb5, ci, NULL, sg, 1, message_len,
> > +                   krb5->cksum_len, plain.len);

The buffer doesn't need to fit exactly, it just needs to be big enough to hold
the output produced, but it can be bigger.

David


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

end of thread, other threads:[~2025-11-21  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13 13:55 [PATCH] fix MIC buffer sizing in selftest Joep Duin
2025-11-21  4:37 ` Herbert Xu
2025-11-21  9:12   ` David Howells

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).