Skip to content

Extend/Add label/id extension functions#10072

Open
night1rider wants to merge 4 commits intowolfSSL:masterfrom
night1rider:extend-cmac-api-id-label
Open

Extend/Add label/id extension functions#10072
night1rider wants to merge 4 commits intowolfSSL:masterfrom
night1rider:extend-cmac-api-id-label

Conversation

@night1rider
Copy link
Copy Markdown
Contributor

@night1rider night1rider commented Mar 25, 2026

Summary

  • Add wc_InitCmac_Id() / wc_InitCmac_Label() so CMAC can forward a hardware key-slot identifier to the underlying AES context.

  • Add wc_AesNew_Id()/ wc_AesNew_Label() and wc_NewRsaKey_Id()/wc_NewRsaKey_Label() constructors following the same pattern.

  • Refactor each algorithm's init into a single internal _common function to avoid duplication. Public API is fully backward-compatible.

  • Add per-algorithm init helpers in test.c and benchmark.c that switch between plain and Id-based init when WC_TEST_<ALG>_ID macros are defined.

  • Add test skip macros: WC_TEST_SKIP_ECC_CHECK_KEY, WC_TEST_SKIP_RSA_PRIVATE_EXPORT, WC_TEST_SKIP_ECC_PRIVATE_EXPORT, WC_TEST_SKIP_ZERO_LEN_CMAC.

@night1rider night1rider self-assigned this Mar 25, 2026
…to the AES init call

Refactor CMAC init to common function, add wc_AesNew_Id/Label API, do same for RSA new
functions, and add test init helpers for id[] support along with some test disable options
@night1rider night1rider force-pushed the extend-cmac-api-id-label branch from 8854bc6 to 3321d70 Compare March 26, 2026 16:41
@night1rider night1rider marked this pull request as ready for review March 26, 2026 17:45
Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #10072

Scan targets checked: wolfcrypt-bugs, wolfcrypt-src

No new issues found in the changed files. ✅

@night1rider night1rider changed the title Extend CMAC API to pull in label/id extension functions to pass down to the underlying AES struct Extend/Add label/id extension functions Mar 26, 2026
@night1rider night1rider requested a review from bigbrett March 26, 2026 19:38
bigbrett
bigbrett previously approved these changes Mar 26, 2026
Copy link
Copy Markdown
Contributor

@bigbrett bigbrett left a comment

Choose a reason for hiding this comment

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

Kinda hate the test/bench wrappers, but not sure what can be done about that while keeping APIs consistent, unless perhaps we just called the new variants of the functions directly and allowed them to default back to the old Init if WOLF_PRIVATE_KEY_ID wasn't defined? Might declutter. Food for thought.

OK as is.

ERROR_OUT(WC_TEST_RET_ENC_NC, done);
}

#ifndef WC_TEST_NO_ECC_CHECK_KEY
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.

nit: naming is inconsistent with other gating macros you introduced ("skip").

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated to match

@bigbrett bigbrett removed their assignment Mar 26, 2026
@night1rider night1rider force-pushed the extend-cmac-api-id-label branch from ef08f21 to cafea6b Compare March 27, 2026 22:44
@night1rider night1rider added the Not For This Release Not for release 5.9.1 label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Not For This Release Not for release 5.9.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants