Skip to content

Commit

Permalink
Add stub for wolfSSL_set_ecdh_auto.
Browse files Browse the repository at this point in the history
  • Loading branch information
kareem-wolfssl committed May 15, 2024
1 parent c73e433 commit 4481f9b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -23192,6 +23192,17 @@ unsigned long wolfSSL_THREADID_hash(const WOLFSSL_CRYPTO_THREADID* id)
(void)id;
return 0UL;
}
/* wolfSSL_set_ecdh_auto is provided as compatible API with
* SSL_set_ecdh_auto to enable auto ecdh curve selection functionality.
* Since this functionality is enabled by default in wolfSSL,
* this API exists as a stub.
*/
int wolfSSL_set_ecdh_auto(WOLFSSL* ssl, int onoff)
{
(void)ssl;
(void)onoff;
return WOLFSSL_SUCCESS;
}
/* wolfSSL_CTX_set_ecdh_auto is provided as compatible API with
* SSL_CTX_set_ecdh_auto to enable auto ecdh curve selection functionality.
* Since this functionality is enabled by default in wolfSSL,
Expand Down
14 changes: 14 additions & 0 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -64442,6 +64442,19 @@ static int test_wolfSSL_THREADID_hash(void)
#endif /* OPENSSL_EXTRA */
return EXPECT_RESULT();
}
static int test_wolfSSL_set_ecdh_auto(void)
{
EXPECT_DECLS;
#if defined(OPENSSL_EXTRA)
WOLFSSL* ssl = NULL;

ExpectIntEQ(SSL_set_ecdh_auto(NULL,0), 1);
ExpectIntEQ(SSL_set_ecdh_auto(NULL,1), 1);
ExpectIntEQ(SSL_set_ecdh_auto(ssl,0), 1);
ExpectIntEQ(SSL_set_ecdh_auto(ssl,1), 1);
#endif /* OPENSSL_EXTRA */
return EXPECT_RESULT();
}
static int test_wolfSSL_CTX_set_ecdh_auto(void)
{
EXPECT_DECLS;
Expand Down Expand Up @@ -73030,6 +73043,7 @@ TEST_CASE testCases[] = {
/* Can't memory test as server hangs. */
TEST_DECL(test_wolfSSL_Tls13_Key_Logging_test),
TEST_DECL(test_wolfSSL_Tls13_postauth),
TEST_DECL(test_wolfSSL_set_ecdh_auto),
TEST_DECL(test_wolfSSL_CTX_set_ecdh_auto),
TEST_DECL(test_wolfSSL_set_minmax_proto_version),
TEST_DECL(test_wolfSSL_CTX_set_max_proto_version),
Expand Down
1 change: 1 addition & 0 deletions wolfssl/openssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS;
#define i2d_PKCS8PrivateKey_bio wolfSSL_PEM_write_bio_PKCS8PrivateKey
#define PKCS8_PRIV_KEY_INFO_free wolfSSL_EVP_PKEY_free
#define d2i_PKCS12_fp wolfSSL_d2i_PKCS12_fp
#define SSL_set_ecdh_auto wolfSSL_set_ecdh_auto
#define SSL_CTX_set_ecdh_auto wolfSSL_CTX_set_ecdh_auto

#define i2d_PUBKEY wolfSSL_i2d_PUBKEY
Expand Down
1 change: 1 addition & 0 deletions wolfssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,7 @@ WOLFSSL_API WOLFSSL_CTX* wolfSSL_CTX_new_ex(WOLFSSL_METHOD* method, void* heap);
WOLFSSL_ABI WOLFSSL_API WOLFSSL_CTX* wolfSSL_CTX_new(WOLFSSL_METHOD* method);
WOLFSSL_API int wolfSSL_CTX_up_ref(WOLFSSL_CTX* ctx);
#ifdef OPENSSL_EXTRA
WOLFSSL_API int wolfSSL_set_ecdh_auto(WOLFSSL* ssl, int onoff);
WOLFSSL_API int wolfSSL_CTX_set_ecdh_auto(WOLFSSL_CTX* ctx, int onoff);
WOLFSSL_API int wolfSSL_get_signature_nid(WOLFSSL* ssl, int* nid);
WOLFSSL_API int wolfSSL_get_signature_type_nid(const WOLFSSL* ssl, int* nid);
Expand Down

0 comments on commit 4481f9b

Please sign in to comment.