Skip to content

Commit

Permalink
Merge pull request #7948 from anhu/MATCH_SUITE
Browse files Browse the repository at this point in the history
Convert MATCH_SUITE_ERROR to OpenSSL error in wolfSSL_get_error()
  • Loading branch information
douzzer authored Sep 12, 2024
2 parents de3c45a + 9e204dc commit b736d78
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4132,10 +4132,10 @@ int wolfSSL_get_error(WOLFSSL* ssl, int ret)
return WOLFSSL_ERROR_WANT_WRITE; /* convert to OpenSSL type */
else if (ssl->error == WC_NO_ERR_TRACE(ZERO_RETURN) ||
ssl->options.shutdownDone)
{
return WOLFSSL_ERROR_ZERO_RETURN; /* convert to OpenSSL type */
}
#ifdef OPENSSL_EXTRA
else if (ssl->error == WC_NO_ERR_TRACE(MATCH_SUITE_ERROR))
return WOLFSSL_ERROR_SYSCALL; /* convert to OpenSSL type */
else if (ssl->error == WC_NO_ERR_TRACE(SOCKET_PEER_CLOSED_E))
return WOLFSSL_ERROR_SYSCALL; /* convert to OpenSSL type */
#endif
Expand Down
22 changes: 20 additions & 2 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -61312,11 +61312,23 @@ static int test_wolfSSL_curves_mismatch(void)
#endif
#ifndef WOLFSSL_NO_TLS12
{wolfTLSv1_2_client_method, wolfTLSv1_2_server_method, "TLS 1.2",
WC_NO_ERR_TRACE(FATAL_ERROR), WC_NO_ERR_TRACE(MATCH_SUITE_ERROR)},
WC_NO_ERR_TRACE(FATAL_ERROR),
#ifdef OPENSSL_EXTRA
WC_NO_ERR_TRACE(WOLFSSL_ERROR_SYSCALL)
#else
WC_NO_ERR_TRACE(MATCH_SUITE_ERROR)
#endif
},
#endif
#ifndef NO_OLD_TLS
{wolfTLSv1_1_client_method, wolfTLSv1_1_server_method, "TLS 1.1",
WC_NO_ERR_TRACE(FATAL_ERROR), WC_NO_ERR_TRACE(MATCH_SUITE_ERROR)},
WC_NO_ERR_TRACE(FATAL_ERROR),
#ifdef OPENSSL_EXTRA
WC_NO_ERR_TRACE(WOLFSSL_ERROR_SYSCALL)
#else
WC_NO_ERR_TRACE(MATCH_SUITE_ERROR)
#endif
},
#endif
};

Expand Down Expand Up @@ -90059,8 +90071,14 @@ static int test_wrong_cs_downgrade(void)
test_ctx.c_len = sizeof(test_wrong_cs_downgrade_sh);

ExpectIntNE(wolfSSL_connect(ssl_c), WOLFSSL_SUCCESS);
#ifdef OPENSSL_EXTRA
ExpectIntEQ(wolfSSL_get_error(ssl_c, WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR)),
WC_NO_ERR_TRACE(WOLFSSL_ERROR_SYSCALL));
#else
ExpectIntEQ(wolfSSL_get_error(ssl_c, WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR)),
WC_NO_ERR_TRACE(MATCH_SUITE_ERROR));
#endif /* OPENSSL_EXTRA */


wolfSSL_free(ssl_c);
wolfSSL_CTX_free(ctx_c);
Expand Down

0 comments on commit b736d78

Please sign in to comment.