Shrink Optiga PRF SHA256 path#1953
Draft
benma wants to merge 1 commit into
Draft
Conversation
Replace the Optiga crypto PAL implementation with a project-owned PAL file and route the TLS PRF SHA256 implementation through the existing rust_hmac_sha256() firmware symbol instead of mbedTLS's md/sha256 wrapper stack. The Optiga PAL is the intended integration seam for this, so this keeps the change out of vendored mbedTLS internals. AES-128-CCM stays on mbedTLS exactly as before; only pal_crypt_tls_prf_sha256() is replaced. In the final linked image this removes the live Optiga mbedTLS digest/SHA256 path entirely: - md.c.obj drops out of the dependency chain - sha256.c.obj drops out of the dependency chain - mbedtls_md_* symbols disappear from the image - mbedtls_sha256_* symbols disappear from the image - pal_crypt_tls_prf_sha256() itself shrinks from 352 to 228 bytes Measured on make -j firmware: - saved 2008 bytes in build/bin/firmware.bin - saved 2008 bytes in .text This is a better result than the config-only MBEDTLS_SHA256_SMALLER change because it removes the whole live mbedTLS digest wrapper path for Optiga instead of only shrinking the SHA256 compression routine.
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.
[i teseted this and it works, but it's in draft because I did not check the code yet]
Replace the Optiga crypto PAL implementation with a project-owned PAL file and route the TLS PRF SHA256 implementation through the existing rust_hmac_sha256() firmware symbol instead of mbedTLS's md/sha256 wrapper stack.
The Optiga PAL is the intended integration seam for this, so this keeps the change out of vendored mbedTLS internals. AES-128-CCM stays on mbedTLS exactly as before; only pal_crypt_tls_prf_sha256() is replaced.
In the final linked image this removes the live Optiga mbedTLS digest/SHA256 path entirely:
Measured on make -j firmware:
This is a better result than the config-only MBEDTLS_SHA256_SMALLER change because it removes the whole live mbedTLS digest wrapper path for Optiga instead of only shrinking the SHA256 compression routine.