Skip to content

Commit 1e75a23

Browse files
committed
Address code review
1 parent 74ac2cd commit 1e75a23

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

src/dtls13.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,10 +1464,8 @@ int Dtls13ParseUnifiedRecordLayer(WOLFSSL* ssl, const byte* input,
14641464
hdrInfo->recordLength = inputSize - idx;
14651465
}
14661466

1467-
#ifdef HAVE_NULL_CIPHER
14681467
/* Do not encrypt record numbers with null cipher. See RFC 9150 Sec 9 */
14691468
if (ssl->specs.bulk_cipher_algorithm != wolfssl_cipher_null)
1470-
#endif /*HAVE_NULL_CIPHER */
14711469
{
14721470
/* minimum size for a dtls1.3 packet is 16 bytes (to have enough
14731471
* ciphertext to create record number xor mask).

tests/api.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94090,11 +94090,23 @@ static int test_dtls13_basic_connection_id(void)
9409094090
unsigned char server_cid[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
9409194091
unsigned char readBuf[30];
9409294092
const char* params[] = {
94093+
#ifndef NO_SHA256
94094+
#ifdef WOLFSSL_AES_128
94095+
#ifdef HAVE_AESGCM
9409394096
"TLS13-AES128-GCM-SHA256",
94097+
#endif
94098+
#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
9409494099
"TLS13-CHACHA20-POLY1305-SHA256",
94100+
#endif
94101+
#ifdef HAVE_AESCCM
9409594102
"TLS13-AES128-CCM-8-SHA256",
9409694103
"TLS13-AES128-CCM-SHA256",
94104+
#endif
94105+
#endif
94106+
#ifdef HAVE_NULL_CIPHER
9409794107
"TLS13-SHA256-SHA256",
94108+
#endif
94109+
#endif
9409894110
};
9409994111
size_t i;
9410094112

@@ -94117,8 +94129,8 @@ static int test_dtls13_basic_connection_id(void)
9411794129
ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
9411894130
wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method), 0);
9411994131

94120-
ExpectIntEQ(wolfSSL_set_cipher_list(ssl_c, params[i]), 1);
94121-
ExpectIntEQ(wolfSSL_set_cipher_list(ssl_s, params[i]), 1);
94132+
ExpectIntEQ(wolfSSL_set_cipher_list(ssl_c, params[i]), WOLFSSL_SUCCESS);
94133+
ExpectIntEQ(wolfSSL_set_cipher_list(ssl_s, params[i]), WOLFSSL_SUCCESS);
9412294134

9412394135
ExpectIntEQ(wolfSSL_dtls_cid_use(ssl_c), 1);
9412494136
ExpectIntEQ(wolfSSL_dtls_cid_set(ssl_c, server_cid, sizeof(server_cid)),
@@ -94147,15 +94159,10 @@ static int test_dtls13_basic_connection_id(void)
9414794159
ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
9414894160
ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
9414994161
ExpectNotNull(CLIENT_CID());
94150-
/* Server second flight */
94151-
ExpectIntEQ(wolfSSL_negotiate(ssl_s), 1);
94152-
ExpectNotNull(SERVER_CID());
94153-
/* Client third flight */
94154-
ExpectIntEQ(wolfSSL_negotiate(ssl_c), 1);
94155-
ExpectNotNull(CLIENT_CID());
9415694162
/* Server process flight */
9415794163
ExpectIntEQ(wolfSSL_negotiate(ssl_s), 1);
94158-
ExpectNull(SERVER_CID()); /* No data should be sent */
94164+
/* Client process flight */
94165+
ExpectIntEQ(wolfSSL_negotiate(ssl_c), 1);
9415994166

9416094167
/* Write some data */
9416194168
ExpectIntEQ(wolfSSL_write(ssl_c, params[i], XSTRLEN(params[i])),

wolfcrypt/src/wc_port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3401,8 +3401,8 @@ void *mymemmem(const void *haystack, size_t haystacklen,
34013401
const void *needle, size_t needlelen)
34023402
{
34033403
size_t i, j;
3404-
const char* h = haystack;
3405-
const char* n = needle;
3404+
const char* h = (const char*)haystack;
3405+
const char* n = (const char*)needle;
34063406
if (needlelen > haystacklen)
34073407
return NULL;
34083408
for (i = 0; i <= haystacklen - needlelen; i++) {

0 commit comments

Comments
 (0)