soc: realtek: bee: add CRYPTO_BEE_PSA_ACCELERATOR Kconfig - #303
Open
ZhiyuanTang17 wants to merge 3 commits into
Open
ZhiyuanTang17 wants to merge 3 commits into
ZhiyuanTang17 wants to merge 3 commits into
Conversation
Add a Kconfig option CRYPTO_BEE_PSA_ACCELERATOR that announces the Realtek Bee hardware crypto engine as a PSA accelerator. Selecting this option enables the PSA algorithm and key-type symbols the hardware engine supports (AES-ECB/CBC/CFB/OFB/CTR, SHA-256, HMAC, CCM, and ECDH/ECDSA for the RTL87X2G series). Wire the option to the mbedtls TF-PSA-Crypto configuration header so that PSA_CRYPTO_DRIVER_REALTEK_BEE is defined when the accelerator is enabled. Extend tests/crypto/mbedtls_psa to cover the new algorithms and add timing measurements so hardware vs. software performance can be compared at runtime. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Zhiyuan Tang <zhiyuan_tang@realsil.com.cn>
Select PSA_WANT_ALG_SHA_224 when CONFIG_SOC_SERIES_RTL87X2J is active so that the hardware SHA-224 engine is exposed through the PSA API. Update the Kconfig help text to clarify per-series acceleration scope: RTL87x2J accelerates AES, SHA-224, and SHA-256; other supported Bee SoC series accelerate AES and SHA-256. Composite algorithms such as CCM and HMAC-SHA-256 are also covered. Co-Authored-By: Claude <noreply@anthropic.com>
Add three ZTEST_USER tests to the test_mbedtls_psa suite that exercise
the PSA hash multipart API (psa_hash_operation_t) with SHA-256:
- test_sha256_multipart: psa_hash_setup -> psa_hash_update x3 ->
psa_hash_finish. Uses the NIST FIPS 180-4 448-bit test vector
("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56 B),
split into 16 + 16 + 24 byte chunks.
- test_sha256_multipart_verify: same vector split 28 + 28 bytes,
finalised via psa_hash_verify instead of psa_hash_finish.
- test_sha256_multipart_clone: feeds 32 bytes, clones the in-progress
operation with psa_hash_clone, then drives both branches
independently to completion and verifies both yield the reference
digest.
Each test reports elapsed time (ns / cycles) via TC_PRINT. Wire
suite-level setup and teardown into ZTEST_SUITE so the total wall time
across all test_mbedtls_psa tests is printed on teardown.
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a Kconfig option
CRYPTO_BEE_PSA_ACCELERATORthat announcesthe Realtek Bee hardware crypto engine as a PSA accelerator.
Selecting this option enables the PSA algorithm and key-type
symbols the hardware engine supports (AES-ECB/CBC/CFB/OFB/CTR,
SHA-256, HMAC, CCM, and ECDH/ECDSA for the RTL87X2G series).
Wire the option to the mbedtls TF-PSA-Crypto configuration header
so that
PSA_CRYPTO_DRIVER_REALTEK_BEEis defined when theaccelerator is enabled.
Extend
tests/crypto/mbedtls_psato cover the new algorithms andadd timing measurements so hardware vs. software performance can
be compared at runtime.
🤖 Generated with Claude Code