All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj at gmail.com>
To: iwd at lists.01.org
Subject: [PATCH] sae: pass exact length to l_ecc_point_from_data
Date: Fri, 21 Jan 2022 10:32:37 -0800	[thread overview]
Message-ID: <20220121183237.2549872-1-prestwoj@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

l_ecc_point_from_data now strictly enforces the buffer length.
---
 src/sae.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/sae.c b/src/sae.c
index b0f80bb6..dc07db4b 100644
--- a/src/sae.c
+++ b/src/sae.c
@@ -413,6 +413,7 @@ static struct l_ecc_point *sae_compute_pwe(const struct l_ecc_curve *curve,
 	struct l_ecc_scalar *qnr;
 	uint8_t qnr_bin[L_ECC_SCALAR_MAX_BYTES] = {0};
 	struct l_ecc_point *pwe;
+	unsigned int bytes = l_ecc_curve_get_scalar_bytes(curve);
 
 	/* create qr/qnr prior to beginning hunting-and-pecking loop */
 	qr = sae_new_residue(curve, true);
@@ -493,7 +494,7 @@ static struct l_ecc_point *sae_compute_pwe(const struct l_ecc_curve *curve,
 		return NULL;
 	}
 
-	pwe = l_ecc_point_from_data(curve, !is_odd + 2, x, sizeof(x));
+	pwe = l_ecc_point_from_data(curve, !is_odd + 2, x, bytes);
 	if (!pwe)
 		l_error("computing y failed, was x quadratic residue?");
 
-- 
2.31.1

             reply	other threads:[~2022-01-21 18:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 18:32 James Prestwood [this message]
2022-01-21 19:46 [PATCH] sae: pass exact length to l_ecc_point_from_data Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220121183237.2549872-1-prestwoj@gmail.com \
    --to=unknown@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.