Skip to content

Commit 1dc40c5

Browse files
authored
Merge pull request #9165 from effbiae/key-present
align two portions of src/internal.c prior to refactor
2 parents f1ef484 + 8e9a04c commit 1dc40c5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/internal.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32603,6 +32603,9 @@ static int DoServerKeyExchange(WOLFSSL* ssl, const byte* input,
3260332603
ERROR_OUT(ECC_CURVE_ERROR, exit_dske);
3260432604
}
3260532605
ssl->ecdhCurveOID = (word32)curveOid;
32606+
#if defined(WOLFSSL_TLS13) || defined(HAVE_FFDHE)
32607+
ssl->namedGroup = 0;
32608+
#endif
3260632609

3260732610
length = input[args->idx++];
3260832611
if ((args->idx - args->begin) + length > size) {
@@ -32617,7 +32620,7 @@ static int DoServerKeyExchange(WOLFSSL* ssl, const byte* input,
3261732620
if (ret != 0) {
3261832621
goto exit_dske;
3261932622
}
32620-
} else if (ssl->peerEccKeyPresent) {
32623+
} else if (ssl->peerX25519KeyPresent) {
3262132624
ret = ReuseKey(ssl, DYNAMIC_TYPE_CURVE25519,
3262232625
ssl->peerX25519Key);
3262332626
ssl->peerX25519KeyPresent = 0;
@@ -32660,7 +32663,7 @@ static int DoServerKeyExchange(WOLFSSL* ssl, const byte* input,
3266032663
if (ret != 0) {
3266132664
goto exit_dske;
3266232665
}
32663-
} else if (ssl->peerEccKeyPresent) {
32666+
} else if (ssl->peerX448KeyPresent) {
3266432667
ret = ReuseKey(ssl, DYNAMIC_TYPE_CURVE448,
3266532668
ssl->peerX448Key);
3266632669
ssl->peerX448KeyPresent = 0;
@@ -32695,7 +32698,7 @@ static int DoServerKeyExchange(WOLFSSL* ssl, const byte* input,
3269532698
break;
3269632699
}
3269732700
#endif
32698-
32701+
#ifdef HAVE_ECC
3269932702
if (ssl->peerEccKey == NULL) {
3270032703
ret = AllocKey(ssl, DYNAMIC_TYPE_ECC,
3270132704
(void**)&ssl->peerEccKey);
@@ -32713,11 +32716,15 @@ static int DoServerKeyExchange(WOLFSSL* ssl, const byte* input,
3271332716
curveId = wc_ecc_get_oid((word32)curveOid, NULL, NULL);
3271432717
if (wc_ecc_import_x963_ex(input + args->idx, length,
3271532718
ssl->peerEccKey, curveId) != 0) {
32719+
#ifdef WOLFSSL_EXTRA_ALERTS
32720+
SendAlert(ssl, alert_fatal, illegal_parameter);
32721+
#endif
3271632722
ERROR_OUT(ECC_PEERKEY_ERROR, exit_dske);
3271732723
}
3271832724

3271932725
args->idx += length;
3272032726
ssl->peerEccKeyPresent = 1;
32727+
#endif
3272132728
break;
3272232729
}
3272332730
#endif /* (HAVE_ECC || HAVE_CURVE25519 || HAVE_CURVE448) && !NO_PSK */

0 commit comments

Comments
 (0)