Skip to content

Add Spake2p support to test framework#308

Open
sigvartmh wants to merge 3 commits into
Mbed-TLS:mainfrom
sigvartmh:spake2p-test-framework
Open

Add Spake2p support to test framework#308
sigvartmh wants to merge 3 commits into
Mbed-TLS:mainfrom
sigvartmh:spake2p-test-framework

Conversation

@sigvartmh

Copy link
Copy Markdown

Description

Adding test vectors from the RFC for SPAKE2+ to be used with the PR in TF-PSA-Crypto

PR checklist

Please add the numbers (or links) of the associated pull requests for consuming branches. You can omit branches where this pull request is not needed.

  • [https://github.com/SPAKE2+ PSA PAKE API support TF-PSA-Crypto#810 ] TF-PSA-Crypto development PR provided # | not required because:
  • TF-PSA-Crypto 1.1 PR provided # | not required because:
  • mbedtls development PR provided # | not required because: No change added to MBEDTLS
  • mbedtls 4.1 PR provided # | not required because: ^
  • mbedtls 3.6 PR provided # | not required because: ^

Notes for the submitter

Please refer to the contributing guidelines, especially the
checklist for PR contributors.

Help make review efficient:

  • Multiple simple commits
    • please structure your PR into a series of small commits, each of which does one thing
  • Avoid force-push
    • please do not force-push to update your PR - just add new commit(s)
  • See our Guidelines for Contributors for more details about the review process.

Teach crypto_knowledge.KeyType about SPAKE2+ keys so the test generators
can reason about them:
  - SPAKE2P_KEY_SIZES: SPAKE2+ (RFC 9383) is defined over secp_r1
    P-256/P-384/P-521, with the curve bit size as the key size;
  - SPAKE2P_KEY_DATA: valid registration material (w0||w1 for a key pair,
    w0||L for a public key) used as the export representation;
  - sizes_to_test() returns the SPAKE2+ sizes for supported ECC families
    (and nothing for unsupported families), and key_material() returns the
    registration material for SPAKE2+ key types.

Signed-off-by: Sigvart Hovland <Sigvart.Hovland@silabs.com>
Now that crypto_knowledge models SPAKE2+ keys, let the PSA test
generators handle them:
  - psa_information: stop discarding the SPAKE2+ key types so they take
    part in systematic key-type generation;
  - generate_psa_tests: emit not-supported and storage cases for SPAKE2+
    (parametrised by ECC family), skip key *generation* (SPAKE2+ keys are
    password-derived registration material, not random), skip them in
    op-fail generation (PAKE-only policy), and skip key types with no
    testable size.

Signed-off-by: Sigvart Hovland <Sigvart.Hovland@silabs.com>
Extend mbedtls_test_psa_exported_key_sanity_check() to handle SPAKE2+
key types: the export representation is the registration material
(w0||w1 for a key pair, w0||L for a public key), so check the exported
length against PSA_EXPORT_KEY_OUTPUT_SIZE.

Signed-off-by: Sigvart Hovland <Sigvart.Hovland@silabs.com>
@minosgalanakis minosgalanakis added enhancement New feature or request needs-preceding-pr Requires another PR to be merged first size-s Estimated task size: small (~2d) needs-review Every commit must be reviewed by at least two team members. needs-ci Needs to pass CI tests needs-reviewer This PR needs someone to pick it up for review priority-low Low priority - this may not receive review soon needs-info An issue or PR which needs further info from the reporter / author labels Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs-ci Needs to pass CI tests needs-info An issue or PR which needs further info from the reporter / author needs-preceding-pr Requires another PR to be merged first needs-review Every commit must be reviewed by at least two team members. needs-reviewer This PR needs someone to pick it up for review priority-low Low priority - this may not receive review soon size-s Estimated task size: small (~2d)

Projects

Status: No status
Status: In Development

Development

Successfully merging this pull request may close these issues.

2 participants