Skip to content

Commit a048395

Browse files
authored
Merge pull request #10941 from Frauschi/rfc_compliance
Compliance to new RFCs
2 parents 425d8f8 + 2214063 commit a048395

13 files changed

Lines changed: 170 additions & 23 deletions

File tree

.wolfssl_known_macro_extras

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@ WOLFSSL_SNIFFER_NO_RECOVERY
10051005
WOLFSSL_SP_ARM32_UDIV
10061006
WOLFSSL_SP_FAST_NCT_EXPTMOD
10071007
WOLFSSL_SP_INT_SQR_VOLATILE
1008+
WOLFSSL_SSLKEYLOGFILE_USE_ENV
10081009
WOLFSSL_STACK_CHECK
10091010
WOLFSSL_STM32C5
10101011
WOLFSSL_STM32F3

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5732,7 +5732,7 @@ then
57325732
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PSK_ONE_ID"
57335733
fi
57345734

5735-
# Certificate Authentication with External PSK (RFC 8773bis)
5735+
# Certificate Authentication with External PSK (RFC 9973, obsoletes RFC 8773)
57365736
AC_ARG_ENABLE([cert-with-extern-psk],
57375737
[AS_HELP_STRING([--enable-cert-with-extern-psk],[Enable Certificate Authentication with External PSKs for TLS 1.3 (default: disabled)])],
57385738
[ ENABLED_CERT_WITH_EXTERN_PSK=$enableval ],

doc/dox_comments/header_files/ssl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15313,7 +15313,7 @@ void wolfSSL_set_psk_server_tls13_callback(WOLFSSL* ssl,
1531315313
\ingroup Setup
1531415314

1531515315
\brief Enable or disable TLS 1.3 certificate authentication with external
15316-
PSK (RFC8773bis) on a context.
15316+
PSK (RFC 9973) on a context.
1531715317

1531815318
When enabled, wolfSSL advertises and accepts the
1531915319
`tls_cert_with_extern_psk` extension for TLS 1.3 handshakes using external
@@ -15348,7 +15348,7 @@ int wolfSSL_CTX_set_cert_with_extern_psk(WOLFSSL_CTX* ctx, int state);
1534815348
\ingroup Setup
1534915349

1535015350
\brief Enable or disable TLS 1.3 certificate authentication with external
15351-
PSK (RFC8773bis) on a connection.
15351+
PSK (RFC 9973) on a connection.
1535215352

1535315353
This call applies to a single WOLFSSL object. Any non-zero \p state value
1535415354
enables the feature and zero disables it.

scripts/sniffer-tls13-keylog.sslkeylog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# RFC 9850: reader must ignore comment lines, blank lines, and malformed
2+
# lines such as the INCOMPLETE_KEYLOG_LINE entry below
3+
4+
INCOMPLETE_KEYLOG_LINE deadbeef
15
CLIENT_HANDSHAKE_TRAFFIC_SECRET b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 cfe4b2e9ef157938936ed15627e65338e6b5f5b251b1718e28b028eabecf3633
26
CLIENT_HANDSHAKE_TRAFFIC_SECRET b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 cfe4b2e9ef157938936ed15627e65338e6b5f5b251b1718e28b028eabecf3633
37
SERVER_HANDSHAKE_TRAFFIC_SECRET b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 737fd782b2e50c4982011f0ec7249d3f91b7e9e25529631c4794cfd4a83ceaf1

src/internal.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23006,6 +23006,13 @@ const char* AlertTypeToString(int type)
2300623006
return certificate_required_str;
2300723007
}
2300823008

23009+
case general_error:
23010+
{
23011+
static const char general_error_str[] =
23012+
"general_error";
23013+
return general_error_str;
23014+
}
23015+
2300923016
case no_application_protocol:
2301023017
{
2301123018
static const char no_application_protocol_str[] =

src/sniffer.c

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7582,7 +7582,10 @@ static int parseKeyLogFile(const char* fileName, char* error)
75827582
/* 2 chars for Hexadecimal representation, plus null terminator */
75837583
char clientRandomHex[2 * CLIENT_RANDOM_LENGTH + 1] = {0};
75847584
char secretHex[2 * SECRET_LENGTH + 1] = {0};
7585-
7585+
/* One keylog record. RFC 9850 requires line based parsing so that comment
7586+
* and malformed lines cannot desynchronize the fields. Sized to hold the
7587+
* longest valid line plus separators and terminator. */
7588+
char line[256];
75867589

75877590
file = fopen(fileName, "r");
75887591
if (file == NULL) {
@@ -7591,10 +7594,27 @@ static int parseKeyLogFile(const char* fileName, char* error)
75917594
return WOLFSSL_SNIFFER_ERROR;
75927595
}
75937596

7594-
/* Format specifiers for each column should be:
7595-
* MAX_PREFIX_LENGTH, 2*CLIENT_RANDOM_LENGTH, and 2*SECRET_LENGTH */
7596-
while (fscanf(file, "%31s %64s %96s", prefix, clientRandomHex, secretHex)
7597-
== 3) {
7597+
while (fgets(line, (int)sizeof(line), file) != NULL) {
7598+
/* RFC 9850 Section 1: ignore empty lines and lines whose first
7599+
* character is the octothorpe ('#') comment marker. */
7600+
if (line[0] == '#' || line[0] == '\n' || line[0] == '\r' ||
7601+
line[0] == '\0') {
7602+
continue;
7603+
}
7604+
7605+
/* Clear the field buffers so that a short field on one line cannot
7606+
* pick up stale bytes left by a previous line. */
7607+
XMEMSET(prefix, 0, sizeof(prefix));
7608+
XMEMSET(clientRandomHex, 0, sizeof(clientRandomHex));
7609+
XMEMSET(secretHex, 0, sizeof(secretHex));
7610+
7611+
/* RFC 9850 Section 2: silently ignore lines that do not conform to the
7612+
* "label SP random SP secret" format so that secrets can still be
7613+
* recovered from a corrupted file. */
7614+
if (sscanf(line, "%31s %64s %96s", prefix, clientRandomHex, secretHex)
7615+
!= 3) {
7616+
continue;
7617+
}
75987618

75997619
if (XSTRCMP(prefix, "CLIENT_RANDOM") == 0) {
76007620
type = SNIFFER_SECRET_TLS12_MASTER_SECRET;
@@ -7621,6 +7641,14 @@ static int parseKeyLogFile(const char* fileName, char* error)
76217641
continue;
76227642
}
76237643

7644+
/* The client random is always CLIENT_RANDOM_LENGTH bytes. Reject a
7645+
* line whose random field is not the exact expected length. The secret
7646+
* length is left variable because it depends on the negotiated hash. */
7647+
if (XSTRLEN(clientRandomHex) != (size_t)(2 * CLIENT_RANDOM_LENGTH)) {
7648+
fprintf(stderr, "malformed client random for prefix: %s\n", prefix);
7649+
continue;
7650+
}
7651+
76247652
hexToBin(clientRandomHex, clientRandom, CLIENT_RANDOM_LENGTH);
76257653
hexToBin(secretHex, secret, SECRET_LENGTH);
76267654
ret = addSecretNode(clientRandom, type, secret, error);
@@ -7629,13 +7657,15 @@ static int parseKeyLogFile(const char* fileName, char* error)
76297657
fclose(file);
76307658
ForceZero(secret, SECRET_LENGTH);
76317659
ForceZero(secretHex, sizeof(secretHex));
7660+
ForceZero(line, sizeof(line));
76327661
return ret;
76337662
}
76347663
}
76357664
fclose(file);
76367665

76377666
ForceZero(secret, SECRET_LENGTH);
76387667
ForceZero(secretHex, sizeof(secretHex));
7668+
ForceZero(line, sizeof(line));
76397669
return 0;
76407670
}
76417671

src/ssl.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3722,7 +3722,18 @@ int tlsShowSecrets(WOLFSSL* ssl, void* secret, int secretSz,
37223722

37233723
#if !defined(NO_FILESYSTEM) && defined(WOLFSSL_SSLKEYLOGFILE)
37243724
{
3725-
FILE* f = XFOPEN(WOLFSSL_SSLKEYLOGFILE_OUTPUT, "a");
3725+
const char* keyLogFile = WOLFSSL_SSLKEYLOGFILE_OUTPUT;
3726+
FILE* f;
3727+
#ifdef WOLFSSL_SSLKEYLOGFILE_USE_ENV
3728+
/* RFC 9850: prefer the SSLKEYLOGFILE environment variable so other
3729+
* tools can share the path, else use the compile-time path. XGETENV is
3730+
* NULL where environment access is unavailable. Opt-in so a build with
3731+
* the variable exported for other applications is not affected. */
3732+
const char* keyLogEnv = XGETENV("SSLKEYLOGFILE");
3733+
if (keyLogEnv != NULL && keyLogEnv[0] != '\0')
3734+
keyLogFile = keyLogEnv;
3735+
#endif
3736+
f = XFOPEN(keyLogFile, "a");
37263737
if (f != XBADFILE) {
37273738
XFWRITE(pmsBuf, 1, pmsPos, f);
37283739
XFCLOSE(f);

src/tls.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
* WOLFSSL_SNIFFER: Enable TLS packet sniffing support default: off
103103
* WOLFSSL_SNIFFER_KEYLOGFILE: Sniffer keylog file support default: off
104104
* WOLFSSL_SSLKEYLOGFILE: Enable SSL key log file output default: off
105+
* WOLFSSL_SSLKEYLOGFILE_USE_ENV: Use SSLKEYLOGFILE env var path default: off
105106
* WOLFSSL_SRTP: Enable SRTP extension support default: off
106107
* WOLFSSL_DUAL_ALG_CERTS: Enable dual algorithm certificates default: off
107108
* WOLFSSL_HAVE_PRF: Enable TLS PRF function access default: off
@@ -16712,7 +16713,7 @@ int TLSX_PopulateExtensions(WOLFSSL* ssl, byte isServer)
1671216713
#endif
1671316714
#if defined(WOLFSSL_CERT_WITH_EXTERN_PSK)
1671416715
if (ssl->options.certWithExternPsk) {
16715-
/* RFC8773bis requires psk_dhe_ke with cert_with_extern_psk. */
16716+
/* RFC 9973 requires psk_dhe_ke with cert_with_extern_psk. */
1671616717
modes |= 1 << PSK_DHE_KE;
1671716718
}
1671816719
#endif
@@ -18775,12 +18776,12 @@ WOLFSSL_TEST_VIS int TLSX_Parse(WOLFSSL* ssl, const byte* input, word16 length,
1877518776

1877618777
if (msgType == client_hello && isRequest) {
1877718778
TLSX* pskm;
18778-
/* RFC8773bis: CH2 after HRR must keep CH1's extension set. */
18779+
/* RFC 9973: CH2 after HRR must keep CH1's extension set. */
1877918780
if (secondClientHello && !prevHasPskWithCert) {
1878018781
WOLFSSL_ERROR_VERBOSE(EXT_NOT_ALLOWED);
1878118782
return EXT_NOT_ALLOWED;
1878218783
}
18783-
/* RFC8773bis: cert_with_extern_psk depends on these extensions. */
18784+
/* RFC 9973: cert_with_extern_psk depends on these extensions. */
1878418785
if (!hasPsk || !hasPskModes || !hasKeyShare || !hasSg ||
1878518786
!hasSigAlg) {
1878618787
WOLFSSL_ERROR_VERBOSE(EXT_MISSING);
@@ -18798,7 +18799,7 @@ WOLFSSL_TEST_VIS int TLSX_Parse(WOLFSSL* ssl, const byte* input, word16 length,
1879818799
}
1879918800
#endif
1880018801
pskm = TLSX_Find(ssl->extensions, TLSX_PSK_KEY_EXCHANGE_MODES);
18801-
/* RFC8773bis requires client support for psk_dhe_ke mode. */
18802+
/* RFC 9973 requires client support for psk_dhe_ke mode. */
1880218803
if (pskm == NULL || (pskm->val & (1 << PSK_DHE_KE)) == 0) {
1880318804
WOLFSSL_ERROR_VERBOSE(EXT_NOT_ALLOWED);
1880418805
return EXT_NOT_ALLOWED;
@@ -18814,7 +18815,7 @@ WOLFSSL_TEST_VIS int TLSX_Parse(WOLFSSL* ssl, const byte* input, word16 length,
1881418815
}
1881518816
else if (msgType == client_hello && isRequest && secondClientHello &&
1881618817
prevHasPskWithCert) {
18817-
/* RFC8773bis: reject dropping the extension in CH2 after HRR. */
18818+
/* RFC 9973: reject dropping the extension in CH2 after HRR. */
1881818819
WOLFSSL_ERROR_VERBOSE(EXT_NOT_ALLOWED);
1881918820
return EXT_NOT_ALLOWED;
1882018821
}

src/tls13.c

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
* (no ciphersuite requires it currently)
7373
* WOLFSSL_ERROR_CODE_OPENSSL: Use OpenSSL-compatible error codes default: off
7474
* WOLFSSL_SSLKEYLOGFILE_OUTPUT: Set key log output file path default: off
75+
* WOLFSSL_SSLKEYLOGFILE_USE_ENV: Use SSLKEYLOGFILE env var path default: off
7576
* WOLFSSL_RW_THREADED: Enable read/write threading support default: off
7677
* WOLFSSL_ASYNC_IO: Enable async I/O operations default: off
7778
* WOLFSSL_NONBLOCK_OCSP: Non-blocking OCSP processing default: off
@@ -6004,12 +6005,12 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
60046005
#endif
60056006
#ifdef WOLFSSL_CERT_WITH_EXTERN_PSK
60066007
if (ssl->options.certWithExternPsk && psk->resumption) {
6007-
/* RFC8773bis mode requires external PSK, not ticket resumption. */
6008+
/* RFC 9973 mode requires external PSK, not ticket resumption. */
60086009
WOLFSSL_ERROR_VERBOSE(PSK_KEY_ERROR);
60096010
return PSK_KEY_ERROR;
60106011
}
60116012
if (ssl->options.certWithExternPsk && ssl->options.shSentKeyShare == 0) {
6012-
/* RFC8773bis Sec. 3: cert_with_extern_psk requires psk_dhe_ke;
6013+
/* RFC 9973 Sect. 3: cert_with_extern_psk requires psk_dhe_ke;
60136014
* a ServerHello without a key_share confirms only psk_ke. */
60146015
WOLFSSL_MSG("cert_with_extern_psk: ServerHello missing key_share");
60156016
WOLFSSL_ERROR_VERBOSE(EXT_MISSING);
@@ -6244,8 +6245,10 @@ static int DoTls13CertificateRequest(WOLFSSL* ssl, const byte* input,
62446245
*inOutIdx += OPAQUE16_LEN;
62456246
if ((*inOutIdx - begin) + len > size)
62466247
return BUFFER_ERROR;
6247-
if (len == 0)
6248-
return INVALID_PARAMETER;
6248+
/* RFC 9846 Section 4.4.2: CertificateRequest.extensions has a lower bound of
6249+
* 0, so an empty extensions block is parsed rather than rejected here. A
6250+
* request missing the mandatory signature_algorithms extension is caught by
6251+
* the check below. */
62496252
if ((ret = TLSX_Parse(ssl, input + *inOutIdx, len, certificate_request,
62506253
&peerSuites))) {
62516254
return ret;
@@ -6554,7 +6557,7 @@ static int DoPreSharedKeys(WOLFSSL* ssl, const byte* input, word32 inputSz,
65546557
}
65556558
if (ret == WOLFSSL_TICKET_RET_OK) {
65566559
#if defined(WOLFSSL_CERT_WITH_EXTERN_PSK) && defined(HAVE_SESSION_TICKET)
6557-
/* RFC 8773bis Sect. 5.1: all PSKs listed alongside
6560+
/* RFC 9973 Sect. 5.1: all PSKs listed alongside
65586561
* tls_cert_with_extern_psk MUST be external PSKs. A successfully
65596562
* decrypted session ticket identity is a resumption PSK, so the
65606563
* server MUST abort with illegal_parameter regardless of whether
@@ -6879,7 +6882,7 @@ static int CheckPreSharedKeys(WOLFSSL* ssl, const byte* input, word32 helloSz,
68796882
extEarlyData = TLSX_Find(ssl->extensions, TLSX_EARLY_DATA);
68806883
if (extEarlyData != NULL) {
68816884
/* Check if accepting early data and first PSK.
6882-
* RFC 8773bis: early_data is not compatible with
6885+
* RFC 9973: early_data is not compatible with
68836886
* cert_with_extern_psk, so skip key derivation in that case. */
68846887
if (ssl->earlyData != no_early_data && first
68856888
&& ssl->options.maxEarlyDataSz > 0
@@ -6949,7 +6952,7 @@ static int CheckPreSharedKeys(WOLFSSL* ssl, const byte* input, word32 helloSz,
69496952
ssl->options.sendVerify = SEND_CERT;
69506953
certExt->resp = 1;
69516954
#ifdef WOLFSSL_EARLY_DATA
6952-
/* RFC 8773bis: early_data is not compatible with
6955+
/* RFC 9973: early_data is not compatible with
69536956
* cert_with_extern_psk. TLSX_Parse already rejects the
69546957
* combination in the ClientHello, but clear the response flag
69556958
* here as a defense-in-depth measure. */
@@ -12401,6 +12404,19 @@ int SendTls13KeyUpdate(WOLFSSL* ssl)
1240112404
}
1240212405
#endif /* WOLFSSL_DTLS13 */
1240312406

12407+
if (!ssl->options.dtls) {
12408+
/* RFC 9846 Section 4.7.3: a sending implementation MUST NOT allow its
12409+
* number of key updates to exceed 2^48-1. Receivers MUST NOT enforce
12410+
* this on the peer. */
12411+
if (w64GTE(ssl->keys.keyUpdateCount,
12412+
w64From32(TLS13_KEY_UPDATE_MAX_HI32,
12413+
TLS13_KEY_UPDATE_MAX_LO32))) {
12414+
WOLFSSL_MSG("TLS 1.3 key update count at maximum; refusing "
12415+
"KeyUpdate");
12416+
return BAD_STATE_E;
12417+
}
12418+
}
12419+
1240412420
outputSz = OPAQUE8_LEN + MAX_MSG_EXTRA;
1240512421
/* Check buffers are big enough and grow if needed. */
1240612422
if ((ret = CheckAvailableSize(ssl, outputSz)) != 0)
@@ -12472,6 +12488,9 @@ int SendTls13KeyUpdate(WOLFSSL* ssl)
1247212488
return ret;
1247312489
if ((ret = SetKeysSide(ssl, ENCRYPT_SIDE_ONLY)) != 0)
1247412490
return ret;
12491+
12492+
/* Count this key update against the RFC 9846 sender limit. */
12493+
w64Increment(&ssl->keys.keyUpdateCount);
1247512494
}
1247612495

1247712496

@@ -16419,10 +16438,25 @@ int tls13ShowSecrets(WOLFSSL* ssl, int id, const unsigned char* secret,
1641916438
byte clientRandom[RAN_LEN];
1642016439
int clientRandomSz;
1642116440
XFILE fp;
16441+
#if defined(WOLFSSL_SSLKEYLOGFILE_OUTPUT) && defined(WOLFSSL_SSLKEYLOGFILE_USE_ENV)
16442+
const char* keyLogFile;
16443+
#endif
1642216444

1642316445
(void) ctx;
1642416446
#ifdef WOLFSSL_SSLKEYLOGFILE_OUTPUT
16447+
#ifdef WOLFSSL_SSLKEYLOGFILE_USE_ENV
16448+
/* RFC 9850: prefer the SSLKEYLOGFILE environment variable so tools such as
16449+
* curl and Wireshark can share the path, else use the compile-time path.
16450+
* XGETENV resolves to NULL where environment access is unavailable. Opt-in
16451+
* so a build with the variable exported for other applications is not
16452+
* affected. */
16453+
keyLogFile = XGETENV("SSLKEYLOGFILE");
16454+
if (keyLogFile == NULL || keyLogFile[0] == '\0')
16455+
keyLogFile = WOLFSSL_SSLKEYLOGFILE_OUTPUT;
16456+
fp = XFOPEN(keyLogFile, "ab");
16457+
#else
1642516458
fp = XFOPEN(WOLFSSL_SSLKEYLOGFILE_OUTPUT, "ab");
16459+
#endif
1642616460
if (fp == XBADFILE) {
1642716461
return BAD_FUNC_ARG;
1642816462
}

tests/api/test_tls13.c

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ int test_tls13_cert_with_extern_psk_rejects_resumption(void)
12061206
ssl_s = NULL;
12071207

12081208
/* Step 2: attempt to resume while also offering cert_with_extern_psk.
1209-
* RFC 8773bis Sect. 5.1 requires all PSKs offered alongside
1209+
* RFC 9973 Sect. 5.1 requires all PSKs offered alongside
12101210
* cert_with_extern_psk to be external PSKs. The client MUST therefore
12111211
* suppress the resumption ticket identity from the pre_shared_key
12121212
* extension. The handshake succeeds as a cert_with_extern_psk handshake
@@ -8652,3 +8652,52 @@ int test_tls13_AEAD_limit_KU_aes128_ccm_8_sha256(void)
86528652
return EXPECT_RESULT();
86538653
}
86548654

8655+
/* RFC 9846 Section 4.7.3: a sending implementation MUST NOT allow its number of
8656+
* key updates to exceed 2^48-1. Establish a TLS 1.3 connection and exercise both
8657+
* sides of the boundary: one update seeded just below the ceiling must succeed
8658+
* and advance the sender count to exactly 2^48-1, and a further update once the
8659+
* count has reached the ceiling must be refused with BAD_STATE_E without
8660+
* advancing the count. The count is inspected directly because
8661+
* SendTls13KeyUpdate enforces the limit before touching the transport. */
8662+
int test_tls13_KeyUpdate_sender_limit(void)
8663+
{
8664+
EXPECT_DECLS;
8665+
#if defined(WOLFSSL_TLS13) && !defined(NO_WOLFSSL_CLIENT) && \
8666+
!defined(NO_WOLFSSL_SERVER) && \
8667+
defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES)
8668+
struct test_memio_ctx test_ctx;
8669+
WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
8670+
WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
8671+
8672+
XMEMSET(&test_ctx, 0, sizeof(test_ctx));
8673+
8674+
ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
8675+
wolfTLSv1_3_client_method, wolfTLSv1_3_server_method), 0);
8676+
ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
8677+
8678+
if (EXPECT_SUCCESS() && ssl_c != NULL) {
8679+
w64wrapper ceiling;
8680+
8681+
ceiling = w64From32(TLS13_KEY_UPDATE_MAX_HI32, TLS13_KEY_UPDATE_MAX_LO32);
8682+
8683+
/* One below the ceiling: the update is allowed and must advance the
8684+
* sender count by one, reaching exactly 2^48-1. */
8685+
ssl_c->keys.keyUpdateCount = w64From32(TLS13_KEY_UPDATE_MAX_HI32,
8686+
TLS13_KEY_UPDATE_MAX_LO32 - 1);
8687+
ExpectIntEQ(wolfSSL_update_keys(ssl_c), WOLFSSL_SUCCESS);
8688+
ExpectTrue(w64Equal(ssl_c->keys.keyUpdateCount, ceiling));
8689+
8690+
/* At the ceiling: a further update must be refused rather than
8691+
* advancing the count past 2^48-1. */
8692+
ExpectIntEQ(wolfSSL_update_keys(ssl_c), WC_NO_ERR_TRACE(BAD_STATE_E));
8693+
ExpectTrue(w64Equal(ssl_c->keys.keyUpdateCount, ceiling));
8694+
}
8695+
8696+
wolfSSL_free(ssl_c);
8697+
wolfSSL_free(ssl_s);
8698+
wolfSSL_CTX_free(ctx_c);
8699+
wolfSSL_CTX_free(ctx_s);
8700+
#endif
8701+
return EXPECT_RESULT();
8702+
}
8703+

0 commit comments

Comments
 (0)