Add unit tests for HMAC-SM3 #879

Open
opened 2026-08-26 07:58:36 -05:00 by ronald-cron-arm · 0 comments
ronald-cron-arm commented 2026-08-26 07:58:36 -05:00 (Migrated from github.com)

Suggested enhancement

The built-in HMAC PSA Crypto driver is based on the PSA Crypto hash APIs thus nothing to do to add support for HMAC-SM3 when the PSA Crypto hash APIs support SM3.

Add in test_suite_psa_crypto test cases based on the test functions check_key_policy, mac_key_policy, mac_setup, mac_sign, mac_verify and mac_sign_verify_multi similarly to what is done for SHA2 hash algorithms:

  • Use the four test vectors of GM/T 0042-2015 Appendix D.3 and adapt the long key test cases 6 and 7 of RFC 4231 for SM3 .
  • same "truncated" test cases testing as for SHA-512.

Add in test_suite_psa_crypto_metadata.data the test case based on hmac_algorithm.

Depends on: https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/874

Justification

TF-PSA-Crypto needs this to test HMAC-SM3 support.

### Suggested enhancement The built-in HMAC PSA Crypto driver is based on the PSA Crypto hash APIs thus nothing to do to add support for HMAC-SM3 when the PSA Crypto hash APIs support SM3. Add in `test_suite_psa_crypto` test cases based on the test functions `check_key_policy`, `mac_key_policy`, `mac_setup`, `mac_sign`, `mac_verify` and `mac_sign_verify_multi` similarly to what is done for SHA2 hash algorithms: - Use the four test vectors of [GM/T 0042-2015 Appendix D.3](http://www.gmbz.org.cn/file/2018-01-10/384aaf7c-7530-4290-b314-24264065db9e.pdf) and adapt the long key test cases 6 and 7 of RFC 4231 for SM3 . - same "truncated" test cases testing as for SHA-512. Add in `test_suite_psa_crypto_metadata.data` the test case based on `hmac_algorithm`. Depends on: https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/874 ### Justification TF-PSA-Crypto needs this to test HMAC-SM3 support.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto#879
No description provided.