iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/7] sae: fix a spec violation with duplicate commits
@ 2021-09-08 18:18 James Prestwood
  2021-09-08 18:18 ` [PATCH v2 2/7] sae: don't send commit/confirm in confirmed state James Prestwood
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: James Prestwood @ 2021-09-08 18:18 UTC (permalink / raw)
  To: iwd

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

If a commit is received while in an accepted state the spec states
the scalar should be checked against the previous commit and if
equal the message should be silently dropped.
---
 src/sae.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

v2:
 * Changed to check the scalar rather than always ignore.

diff --git a/src/sae.c b/src/sae.c
index 62fd6c88..c14b646f 100644
--- a/src/sae.c
+++ b/src/sae.c
@@ -1182,10 +1182,32 @@ static int sae_verify_accepted(struct sae_sm *sm, uint16_t trans,
 {
 	uint16_t sc;
 
-	/* spec does not specify what to do here, so print and discard */
-	if (trans != SAE_STATE_CONFIRMED) {
+	/*
+	 * 12.4.8.6.1 Parent process behavior
+	 *
+	 * "Upon receipt of an SAE Commit message... and it is in Accepted
+	 * state, the scalar in the received frame is checked against the
+	 * peer-scalar used in authentication of the existing protocol instance
+	 * (in Accepted state). If it is identical, the frame shall be dropped"
+	 */
+	if (trans == SAE_STATE_COMMITTED) {
+		bool drop;
+		unsigned int nbytes = l_ecc_curve_get_scalar_bytes(sm->curve);
+		struct l_ecc_scalar *p_scalar;
+
+		if (len < nbytes + 2)
+			return -EMSGSIZE;
+
+		p_scalar = l_ecc_scalar_new(sm->curve, frame + 2, nbytes);
+
+		drop = l_ecc_scalars_are_equal(sm->p_scalar, p_scalar);
+		l_ecc_scalar_free(p_scalar);
+
+		if (drop)
+			return -EBADMSG;
+
 		l_error("received transaction %u in accepted state", trans);
-		return -EBADMSG;
+		return -EPROTO;
 	}
 
 	if (sm->sync > SAE_SYNC_MAX)
-- 
2.31.1

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

end of thread, other threads:[~2021-09-08 19:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 18:18 [PATCH v2 1/7] sae: fix a spec violation with duplicate commits James Prestwood
2021-09-08 18:18 ` [PATCH v2 2/7] sae: don't send commit/confirm in confirmed state James Prestwood
2021-09-08 19:25   ` Denis Kenzior
2021-09-08 18:19 ` [PATCH v2 3/7] auth-proto: document acceptable return values for auth-protos James Prestwood
2021-09-08 19:29   ` Denis Kenzior
2021-09-08 18:19 ` [PATCH v2 4/7] fils: change fatal return code to -EPROTO James Prestwood
2021-09-08 19:35   ` Denis Kenzior
2021-09-08 18:19 ` [PATCH v2 5/7] ft: " James Prestwood
2021-09-08 19:33   ` Denis Kenzior
2021-09-08 18:19 ` [PATCH v2 6/7] netdev: handle non-fatal auth-proto returns James Prestwood
2021-09-08 19:43   ` Denis Kenzior
2021-09-08 18:19 ` [PATCH v2 7/7] auto-t: add sae test for non-acked commit James Prestwood
2021-09-08 19:20 ` [PATCH v2 1/7] sae: fix a spec violation with duplicate commits Denis Kenzior

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