Skip to content

Commit

Permalink
account for correct return value of cipher stack push and clSuite use…
Browse files Browse the repository at this point in the history
… case after rebase
  • Loading branch information
JacobBarthelmeh committed Jan 24, 2025
1 parent 41e00dc commit 9b04a4f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -15190,7 +15190,7 @@ WOLFSSL_STACK* wolfSSL_sk_new_cipher(void)
return sk;
}

/* return 1 on success 0 on fail */
/* returns the number of elements in stack on success, 0 on fail */
int wolfSSL_sk_CIPHER_push(WOLF_STACK_OF(WOLFSSL_CIPHER)* sk,
WOLFSSL_CIPHER* cipher)
{
Expand Down Expand Up @@ -17835,7 +17835,7 @@ void wolfSSL_sk_GENERIC_pop_free(WOLFSSL_STACK* sk,
wolfSSL_sk_pop_free(sk, (wolfSSL_sk_freefunc)f);
}

/* return 1 on success 0 on fail */
/* returns the number of elements in stack on success, 0 on fail */
int wolfSSL_sk_GENERIC_push(WOLFSSL_STACK* sk, void* generic)
{
WOLFSSL_ENTER("wolfSSL_sk_GENERIC_push");
Expand Down Expand Up @@ -22014,7 +22014,7 @@ WOLF_STACK_OF(WOLFSSL_CIPHER)* wolfSSL_get_client_ciphers(WOLFSSL* ssl)
/* in_stack is checked in wolfSSL_CIPHER_description */
cipher.in_stack = 1;

if (wolfSSL_sk_CIPHER_push(ret, &cipher) != WOLFSSL_SUCCESS) {
if (wolfSSL_sk_CIPHER_push(ret, &cipher) <= 0) {
WOLFSSL_MSG("Error pushing client cipher onto stack");
wolfSSL_sk_CIPHER_free(ret);
ret = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/tls13.c
Original file line number Diff line number Diff line change
Expand Up @@ -7055,7 +7055,7 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
}
/* Can't check ssl->extensions here as SigAlgs are unconditionally
set by TLSX_PopulateExtensions */
if (args->clSuites->hashSigAlgoSz == 0) {
if (ssl->clSuites->hashSigAlgoSz == 0) {
WOLFSSL_MSG("Client did not send a SignatureAlgorithms extension");
ERROR_OUT(INCOMPLETE_DATA, exit_dch);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -61445,7 +61445,7 @@ static int test_wolfSSL_get_client_ciphers_on_result(WOLFSSL* ssl) {
ExpectIntEQ(sk_SSL_CIPHER_num(ciphers), 1);
current = sk_SSL_CIPHER_value(ciphers, 0);
ExpectNotNull(current);
ExpectStrEQ("ECDHE-RSA-AES128-GCM-SHA256",
ExpectStrEQ("TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
SSL_CIPHER_get_name(current));
}
return EXPECT_RESULT();
Expand Down Expand Up @@ -69840,7 +69840,7 @@ static int test_wolfSSL_X509_NAME_ENTRY(void)
ExpectNotNull(entry = X509_NAME_ENTRY_create_by_NID(NULL, NID_commonName,
0x0c, cn, (int)sizeof(cn)));
ExpectIntEQ(X509_NAME_add_entry(nm, entry, -1, 0), SSL_SUCCESS);
ExpectIntEQ(X509_NAME_ENTRY_set(X509_NAME_get_entry(nm, 1)), 1);
ExpectIntEQ(X509_NAME_ENTRY_set(X509_NAME_get_entry(nm, 1)), 2);

#ifdef WOLFSSL_CERT_EXT
ExpectIntEQ(X509_NAME_add_entry_by_txt(NULL, NULL, MBSTRING_UTF8,
Expand Down

0 comments on commit 9b04a4f

Please sign in to comment.