Skip to content

Add error when RPK is used with DANE stub#10486

Open
embhorn wants to merge 1 commit into
wolfSSL:masterfrom
embhorn:zd21825
Open

Add error when RPK is used with DANE stub#10486
embhorn wants to merge 1 commit into
wolfSSL:masterfrom
embhorn:zd21825

Conversation

@embhorn

@embhorn embhorn commented May 14, 2026

Copy link
Copy Markdown
Member

Description

DANE support was stubbed for the compatibility layer. Ensure an actual connection errors if it is used.

Fixes zd21825

Testing

Added test cases in test_tls13_rpk_handshake

Checklist

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

@embhorn embhorn self-assigned this May 14, 2026

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #10486

Scan targets checked: wolfssl-bugs, wolfssl-src

No new issues found in the changed files. ✅

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts wolfSSL’s OpenSSL-compat verification reporting for TLS Raw Public Keys (RPK, RFC 7250) so that connections using RPK without an out-of-band trust mechanism do not report WOLFSSL_X509_V_OK via wolfSSL_get_verify_result().

Changes:

  • Introduces a new verification result code for “RPK not trusted” and exposes it in both wolfSSL and OpenSSL-compat headers.
  • Updates peer-certificate processing to set peerVerifyRet to the new RPK-untrusted code when appropriate.
  • Extends test_tls13_rpk_handshake to assert the expected verify-result behavior for RPK vs X.509 handshakes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
wolfssl/ssl.h Adds a new wolfSSL verification-result enum value for untrusted RPK.
wolfssl/openssl/x509.h Exposes the corresponding OpenSSL-compat X509_V_ERR_RPK_UNTRUSTED define.
src/internal.c Sets peerVerifyRet for RPK handshakes and adds an error-string mapping for the new code.
tests/api/test_tls13.c Adds assertions that RPK handshakes produce a non-OK verify result while X.509 handshakes remain OK.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/internal.c Outdated
Comment thread wolfssl/ssl.h
@github-actions

github-actions Bot commented May 14, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Comment thread src/internal.c
Comment thread wolfssl/ssl.h
Comment thread wolfssl/ssl.h
Comment thread wolfssl/openssl/x509.h Outdated

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #10486

Scan targets checked: wolfcrypt-rs-bugs, wolfssl-bugs, wolfssl-src

No new issues found in the changed files. ✅

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread wolfssl/ssl.h

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (2)

src/internal.c:1

  • Correct the typo in the comment: “skip following x509 version check” should be “skip following X.509 version check” (or at least “skip following x509 version check” with proper spacing was already addressed, but please also standardize “X.509” capitalization to match surrounding terminology).
    src/internal.c:1
  • The handshake failure path uses ASN_NO_SIGNER_E (an X.509-oriented error) as the transport-level error for an untrusted RPK, while also introducing a distinct verify-result code (WOLFSSL_X509_V_ERR_RPK_UNTRUSTED) under OPENSSL_EXTRA*. This can be confusing for API consumers diagnosing failures (they may see ASN_NO_SIGNER_E rather than an RPK-specific failure unless they also inspect verify_result). Recommendation: consider propagating an RPK-specific error code at the handshake error layer as well (or otherwise ensure the mapping from ASN_NO_SIGNER_E to the new RPK_UNTRUSTED reason is discoverable), to make diagnostics consistent across builds (with/without OPENSSL_EXTRA).

Comment thread tests/api/test_tls13.c
Comment on lines +2847 to +2860
*ctx_c = wolfSSL_CTX_new(method_c());
*ctx_s = wolfSSL_CTX_new(method_s());
if ((*ctx_c == NULL) || (*ctx_s == NULL))
return -1;

if (wolfSSL_CTX_load_verify_locations(*ctx_c, caCertFile, 0)
!= WOLFSSL_SUCCESS)
return -1;
if (wolfSSL_CTX_use_certificate_file(*ctx_c, clntRpkCertFile,
WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS)
return -1;
if (wolfSSL_CTX_use_PrivateKey_file(*ctx_c, cliKeyFile, CERT_FILETYPE)
!= WOLFSSL_SUCCESS)
return -1;
Comment thread tests/api/test_tls13.c
Comment on lines +3009 to +3010
ExpectIntEQ(load_file(svrRpkCertFile, &svrSpki, &svrSpkiSz), 0);
ExpectIntEQ(load_file(clntRpkCertFile, &cliSpki, &cliSpkiSz), 0);
Comment thread wolfssl/ssl.h
Comment on lines +2779 to +2781
/* Codes at or above WC_OSSL_V509_V_ERR_MAX are intentionally outside the
* contiguous range swept by the error-string test in tests/api.c. */
WOLFSSL_X509_V_ERR_RPK_UNTRUSTED = 95,
Comment thread wolfssl/ssl.h
Comment on lines +6252 to +6257
WOLFSSL_API int wolfSSL_CTX_set_expected_rpk(WOLFSSL_CTX* ctx,
const unsigned char* spki,
unsigned int spkiSz);
WOLFSSL_API int wolfSSL_set_expected_rpk(WOLFSSL* ssl,
const unsigned char* spki,
unsigned int spkiSz);

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #10486

Scan targets checked: wolfcrypt-rs-bugs, wolfssl-bugs, wolfssl-src

No new issues found in the changed files. ✅

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