From 6392c2b42054ab0e4b8ab91a1f7265711fb377b0 Mon Sep 17 00:00:00 2001 From: Hideki Miyazaki Date: Thu, 8 Jan 2026 07:10:25 +0900 Subject: [PATCH] undo changes fix indentation --- src/x509_str.c | 8 ++++---- tests/api/test_ossl_x509_str.c | 34 +++++++++++++++++++++------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/x509_str.c b/src/x509_str.c index e3a6e1f07..e24715e07 100644 --- a/src/x509_str.c +++ b/src/x509_str.c @@ -443,10 +443,10 @@ static int X509StoreVerifyCert(WOLFSSL_X509_STORE_CTX* ctx) #if !defined(NO_ASN_TIME) && defined(OPENSSL_ALL) if (ret != WC_NO_ERR_TRACE(ASN_BEFORE_DATE_E) && ret != WC_NO_ERR_TRACE(ASN_AFTER_DATE_E)) { - /* With OpenSSL, we need to check the certificate's date - * after certificate manager verification, - * as it skips date validation when other errors are present. - */ + /* With OpenSSL, we need to check the certificate's date + * after certificate manager verification, + * as it skips date validation when other errors are present. + */ ret = X509StoreVerifyCertDate(ctx, ret); SetupStoreCtxError(ctx, ret); ret = ret == WOLFSSL_SUCCESS ? 1 : 0; diff --git a/tests/api/test_ossl_x509_str.c b/tests/api/test_ossl_x509_str.c index db05e9b0d..79f1ce558 100644 --- a/tests/api/test_ossl_x509_str.c +++ b/tests/api/test_ossl_x509_str.c @@ -39,23 +39,10 @@ #if defined(OPENSSL_ALL) && \ !defined(NO_RSA) && !defined(NO_FILESYSTEM) -static int last_errcode; -static int last_errdepth; static int last_errcodes[10]; static int last_errdepths[10]; static int err_index = 0; -static int X509Callback(int ok, X509_STORE_CTX *ctx) -{ - - if (!ok) { - last_errcode = X509_STORE_CTX_get_error(ctx); - last_errdepth = X509_STORE_CTX_get_error_depth(ctx); - } - /* Always return OK to allow verification to continue.*/ - return 1; -} - static int X509CallbackCount(int ok, X509_STORE_CTX *ctx) { if (!ok) { @@ -1029,6 +1016,24 @@ int test_X509_STORE_untrusted(void) return EXPECT_RESULT(); } +#if defined(OPENSSL_ALL) && !defined(NO_RSA) && !defined(NO_FILESYSTEM) + +static int last_errcode; +static int last_errdepth; + +static int X509Callback(int ok, X509_STORE_CTX *ctx) +{ + + if (!ok) { + last_errcode = X509_STORE_CTX_get_error(ctx); + last_errdepth = X509_STORE_CTX_get_error_depth(ctx); + } + /* Always return OK to allow verification to continue.*/ + return 1; +} + +#endif + int test_X509_STORE_InvalidCa(void) { EXPECT_DECLS; @@ -1043,6 +1048,9 @@ int test_X509_STORE_InvalidCa(void) X509* cert = NULL; STACK_OF(X509)* untrusted = NULL; + last_errcode = 0; + last_errdepth = 0; + ExpectTrue((fp = XFOPEN(srvfile, "rb")) != XBADFILE); ExpectNotNull(cert = PEM_read_X509(fp, 0, 0, 0 ));