Skip to content

Conversation

@miyazakh
Copy link
Contributor

@miyazakh miyazakh commented Dec 26, 2025

Description

Qt nightly Jenkins tests started failing after PR9522 was merged. OpenSSL performs date validation even when there are other verification issues. This PR reverts the removed logic and now uses X509StoreVerifyCertDate().

Testing

Add unit test
Run qt unit test

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@miyazakh miyazakh self-assigned this Dec 26, 2025
@devin-ai-integration
Copy link
Contributor

🛟 Devin Lifeguard found 3 likely issues in this PR

  • no-memory-leaks snippet: Call X509_free(ca); immediately before setting ca = NULL; (and remove the second X509_free(cert)), in both newly-added blocks of test_wolfSSL_X509_STORE_check_time.
  • check-all-return-codes snippet: Capture and assert the return value from X509_VERIFY_PARAM_set_flags(), e.g. ExpectIntEQ(X509_VERIFY_PARAM_set_flags(store->param, WOLFSSL_NO_CHECK_TIME), 1);.
  • pointer-null-check snippet: Change the condition to if (ctx->store != NULL && ctx->store->verify_cb != NULL) before using ctx->store->verify_cb.

@miyazakh
please take a look at the above issues which Devin flagged. Devin will not fix these issues automatically.

@miyazakh
Copy link
Contributor Author

retest this please

Found unhandled org.jenkinsci.plugins.workflow.support.steps.AgentOfflineException exception:

@miyazakh miyazakh removed their assignment Dec 26, 2025
ret = ASN_BEFORE_DATE_E;
}
}
#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are moving away from port specific code in wolfSSL. WOLFSSL_QT already enables OPENSSL_ALL.

Suggested change
#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
#if defined(OPENSSL_ALL)

#endif
}

#if !defined(NO_ASN_TIME) && (defined(OPENSSL_ALL) || defined(WOLFSSL_QT))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if !defined(NO_ASN_TIME) && (defined(OPENSSL_ALL) || defined(WOLFSSL_QT))
#if !defined(NO_ASN_TIME) && defined(OPENSSL_ALL)

#if !defined(NO_ASN_TIME) && (defined(OPENSSL_ALL) || defined(WOLFSSL_QT))
if (ret != WC_NO_ERR_TRACE(ASN_BEFORE_DATE_E) &&
ret != WC_NO_ERR_TRACE(ASN_AFTER_DATE_E)) {
/* With Qt and OpenSSL, we need to check the certificate's date
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* With Qt and OpenSSL, we need to check the certificate's date
/* With OpenSSL, we need to check the certificate's date

ret = X509StoreVerifyCertDate(ctx, ret);
SetupStoreCtxError(ctx, ret);
if (ctx->store->verify_cb)
ret = ctx->store->verify_cb(ret >= 0 ? 1 : 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't only ret == 0 be success?

Comment on lines +449 to +450
ret = ctx->store->verify_cb(ret >= 0 ? 1 : 0,
ctx) == 1 ? WOLFSSL_SUCCESS : -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much more readable.

Suggested change
ret = ctx->store->verify_cb(ret >= 0 ? 1 : 0,
ctx) == 1 ? WOLFSSL_SUCCESS : -1;
ret = ret == 0 ? 1 : 0
if (ctx->store->verify_cb(ret, ctx) == 1)
ret = WOLFSSL_SUCCESS;
else
ret = -1;

Comment on lines +46 to +55
static int X509Callback(int ok, X509_STORE_CTX *ctx)
{

if (!ok) {
last_errcode[err_index] = X509_STORE_CTX_get_error(ctx);
last_errdepth[err_index++] = X509_STORE_CTX_get_error_depth(ctx);
}
/* Always return OK to allow verification to continue.*/
return 1;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some bounds check to err_index.

Comment on lines +46 to +55
static int X509Callback(int ok, X509_STORE_CTX *ctx)
{

if (!ok) {
last_errcode[err_index] = X509_STORE_CTX_get_error(ctx);
last_errdepth[err_index++] = X509_STORE_CTX_get_error_depth(ctx);
}
/* Always return OK to allow verification to continue.*/
return 1;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write a new callback and place it next to relevant tests. Keep X509Callback as is for test_X509_STORE_InvalidCa and write a new callback function for test_wolfSSL_X509_STORE_check_time. This will make it easier to manage.

#include <tests/api/api.h>
#include <tests/api/test_ossl_x509_str.h>

#if (defined(OPENSSL_ALL) || defined(WOLFSSL_QT)) && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if (defined(OPENSSL_ALL) || defined(WOLFSSL_QT)) && \
#if defined(OPENSSL_ALL) && \

wolfSSL_X509_free(cert);
cert = NULL;

#if (defined(OPENSSL_ALL) || defined(WOLFSSL_QT)) && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if (defined(OPENSSL_ALL) || defined(WOLFSSL_QT)) && \
#if defined(OPENSSL_ALL) && \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants