diff --git a/src/ssl.c b/src/ssl.c index 3a6bedafd..54fe121d2 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -18418,14 +18418,6 @@ int wolfSSL_X509_CRL_verify(WOLFSSL_X509_CRL* crl, WOLFSSL_EVP_PKEY* key) } #endif -#ifndef NO_WOLFSSL_STUB -void wolfSSL_X509_STORE_CTX_set_error(WOLFSSL_X509_STORE_CTX* ctx, int err) -{ - (void)ctx; - (void)err; - WOLFSSL_STUB("X509_STORE_CTX_set_error"); -} -#endif #ifdef OPENSSL_EXTRA void wolfSSL_X509_STORE_CTX_set_time(WOLFSSL_X509_STORE_CTX* ctx, @@ -18780,6 +18772,20 @@ int wolfSSL_get_ex_data_X509_STORE_CTX_idx(void) } +/* Set an error stat in the X509 STORE CTX + * + * Returns positive index on success and negative values on failure + */ +void wolfSSL_X509_STORE_CTX_set_error(WOLFSSL_X509_STORE_CTX* ctx, int er) +{ + WOLFSSL_ENTER("wolfSSL_X509_STORE_CTX_set_error"); + + if (ctx != NULL) { + ctx->error = er; + } +} + + /* Sets a function callback that will send information about the state of all * WOLFSSL objects that have been created by the WOLFSSL_CTX structure passed * in. diff --git a/tests/api.c b/tests/api.c index 0d506b4a1..80f760b9a 100644 --- a/tests/api.c +++ b/tests/api.c @@ -14355,6 +14355,8 @@ static void test_wolfSSL_X509_STORE_CTX(void) AssertIntEQ(X509_STORE_add_cert(str, x509), SSL_SUCCESS); AssertIntEQ(X509_STORE_CTX_init(ctx, str, x509, NULL), SSL_SUCCESS); AssertIntEQ(SSL_get_ex_data_X509_STORE_CTX_idx(), 0); + X509_STORE_CTX_set_error(ctx, -5); + X509_STORE_CTX_set_error(NULL, -5); X509_STORE_CTX_free(ctx); diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index bf213265a..2a654887c 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -897,8 +897,6 @@ WOLFSSL_API WOLFSSL_ASN1_TIME* wolfSSL_X509_CRL_get_nextUpdate(WOLFSSL_X509_CRL* WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_X509_get_pubkey(WOLFSSL_X509*); WOLFSSL_API int wolfSSL_X509_CRL_verify(WOLFSSL_X509_CRL*, WOLFSSL_EVP_PKEY*); -WOLFSSL_API void wolfSSL_X509_STORE_CTX_set_error(WOLFSSL_X509_STORE_CTX*, - int); WOLFSSL_API void wolfSSL_X509_OBJECT_free_contents(WOLFSSL_X509_OBJECT*); WOLFSSL_API WOLFSSL_PKCS8_PRIV_KEY_INFO* wolfSSL_d2i_PKCS8_PKEY_bio( WOLFSSL_BIO* bio, WOLFSSL_PKCS8_PRIV_KEY_INFO** pkey); @@ -943,6 +941,8 @@ WOLFSSL_API void wolfSSL_CTX_set_client_CA_list(WOLFSSL_CTX*, WOLF_STACK_OF(WOLFSSL_X509_NAME)*); WOLFSSL_API void* wolfSSL_X509_STORE_CTX_get_ex_data(WOLFSSL_X509_STORE_CTX*, int); WOLFSSL_API int wolfSSL_get_ex_data_X509_STORE_CTX_idx(void); +WOLFSSL_API void wolfSSL_X509_STORE_CTX_set_error( + WOLFSSL_X509_STORE_CTX* ctx, int er); WOLFSSL_API void* wolfSSL_get_ex_data(const WOLFSSL*, int); WOLFSSL_API void wolfSSL_CTX_set_default_passwd_cb_userdata(WOLFSSL_CTX*,