Skip to content

Commit 403fcc5

Browse files
committed
Fix for PQC enabled handshake
When PQC Kyber support is enabled, incoming KeyShare messages are tested regarding the named group is a PQC Kyber group (pure or hybrid). The boundaries of this test are way too loose (large gap between the pure ones and the hybrid ones). This could result in failing handshakes in case a client uses GREASE (Generate Random Extensions And Sustain Extensibility), as there group numbers in the large gap are used. The fix is just to make sure that the PQC test uses the two small boundaries of the PQC named groups. The lower bound for the hybrid groups has also been updated to reflect the current OQS definition. Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
1 parent 6500444 commit 403fcc5

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

wolfssl/internal.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,8 @@ enum Misc {
18501850
(MIN_FFHDE_GROUP <= (group) && (group) <= MAX_FFHDE_GROUP)
18511851
#ifdef HAVE_PQC
18521852
#define WOLFSSL_NAMED_GROUP_IS_PQC(group) \
1853-
(WOLFSSL_PQC_MIN <= (group) && (group) <= WOLFSSL_PQC_MAX)
1853+
((WOLFSSL_PQC_SIMPLE_MIN <= (group) && (group) <= WOLFSSL_PQC_SIMPLE_MAX) || \
1854+
(WOLFSSL_PQC_HYBRID_MIN <= (group) && (group) <= WOLFSSL_PQC_HYBRID_MAX))
18541855
#else
18551856
#define WOLFSSL_NAMED_GROUP_IS_PQC(group) ((void)(group), 0)
18561857
#endif /* HAVE_PQC */

wolfssl/ssl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4004,7 +4004,7 @@ enum {
40044004
WOLFSSL_KYBER_LEVEL5 = 573, /* KYBER_1024 */
40054005
WOLFSSL_PQC_SIMPLE_MAX = 573,
40064006

4007-
WOLFSSL_PQC_HYBRID_MIN = 12052,
4007+
WOLFSSL_PQC_HYBRID_MIN = 12090,
40084008
WOLFSSL_P256_KYBER_LEVEL1 = 12090,
40094009
WOLFSSL_P384_KYBER_LEVEL3 = 12092,
40104010
WOLFSSL_P521_KYBER_LEVEL5 = 12093,

0 commit comments

Comments
 (0)