diff --git a/src/x509_str.c b/src/x509_str.c index e24715e07..99f195b4e 100644 --- a/src/x509_str.c +++ b/src/x509_str.c @@ -440,26 +440,26 @@ static int X509StoreVerifyCert(WOLFSSL_X509_STORE_CTX* ctx) WOLFSSL_SUCCESS : ret; #endif } - #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. - */ - ret = X509StoreVerifyCertDate(ctx, ret); - SetupStoreCtxError(ctx, ret); - ret = ret == WOLFSSL_SUCCESS ? 1 : 0; - if (ctx->store->verify_cb) { - if (ctx->store->verify_cb(ret, ctx) == 1) { - ret = WOLFSSL_SUCCESS; - } - else { - ret = -1; - } +#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. + */ + ret = X509StoreVerifyCertDate(ctx, ret); + SetupStoreCtxError(ctx, ret); + ret = ret == WOLFSSL_SUCCESS ? 1 : 0; + if (ctx->store->verify_cb) { + if (ctx->store->verify_cb(ret, ctx) == 1) { + ret = WOLFSSL_SUCCESS; + } + else { + ret = -1; } } - #endif + } +#endif return ret; }