Skip to content

Fix TLS 1.2 PRF KDFs to pass a MAC algorithm id to wc_PRF_TLS - #24

Open
aidangarske wants to merge 1 commit into
wolfSSL:masterfrom
aidangarske:tls12-prf-mac-alg
Open

Fix TLS 1.2 PRF KDFs to pass a MAC algorithm id to wc_PRF_TLS#24
aidangarske wants to merge 1 commit into
wolfSSL:masterfrom
aidangarske:tls12-prf-mac-alg

Conversation

@aidangarske

@aidangarske aidangarske commented Aug 21, 2026

Copy link
Copy Markdown
Member
  • wolfpsa_kdf_tls12_prf and wolfpsa_kdf_tls12_psk_to_ms passed a WC_HASH_TYPE_*
    value to wc_PRF_TLS, which expects a wc_MACAlgorithm id.
  • The enums differ: WC_HASH_TYPE_SHA256 equals sha512_mac, so wc_PRF selected the
    wrong hash — HASH_TYPE_E on builds without SHA-512, and a wrong SHA-512 digest
    on builds with it.
  • Adds wolfpsa_prf_mac_from_alg() mapping the PSA hash to the wc_MACAlgorithm
    enum, used at both wc_PRF_TLS call sites.
  • Only SHA-256/384/512 map; smaller or truncated hashes return NOT_SUPPORTED
    rather than silently promoting to SHA-256.
  • Corrects the test_kdf_tls12_psk_to_ms_* reference calls, which passed the same
    wrong enum, and adds test_tls12_prf checking output against a
    wc_PRF_TLS(sha256_mac) reference.
  • Tested with the PSA-Arch dev_apis crypto conformance suite on the STM32H563
    M33MU emulator: the TLS 1.2 PRF key-derivation test caught it since sha 512 wasnt enabled

@aidangarske aidangarske self-assigned this Aug 21, 2026
Copilot AI lite review requested due to automatic review settings August 21, 2026 23:11

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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