-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only include psa_pake_setup() and friends if some PAKE algorithms are required #7573
Only include psa_pake_setup() and friends if some PAKE algorithms are required #7573
Conversation
… required Signed-off-by: Tom Cosgrove <[email protected]>
09a4f21
to
6d62fac
Compare
Note that if we change things to just return
with the change
|
Do we care though? If these functions aren't called by anything, surely any linker from this century should remove them. Note that we might make a difference between the PAKE functions (which are not called by TF-M's crypto service) and other PSA library entry points (which are). We should probably measure the code size in a complete program rather than a library, and that complete program would need to include a call (with arguments that the compiler can't use for partial evaluation) to all the entry points we want to have in the build. |
There are a bunch more functions immediately above this: @gilles-peskine-arm this is a fair point - I discussed this with @tom-cosgrove-arm recently. Since we are using TF-M as our size optimisation use-case, we'd really have to start building TF-M to get a more complete answer, which would get complicated. I'm not sure if Tom had some ideas about improving the way we measure. But for now, I think this is OK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but seems to miss some functions that could additionally be excluded
@@ -0,0 +1,3 @@ | |||
Features | |||
* Don't include the PSA dispatch functions for PAKEs (psa_pake_setup() etc) | |||
if no PAKE algorithms are requested |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if no PAKE algorithms are requested | |
if no PAKE algorithms are requested. |
Building TF-M is the ultimately precise measurement, but we don't need to go that far to get a good approximation. We only need the crypto service (plus any function that TF-M calls directly for its own sake, I'm not sure if there are any), and even there we don't need to plug it into an actual IPC mechanism. Since the set of cryptographic services offered by TF-M does not change often, we can take a copy of the files, or even of the list of functions now, and build a basic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This removes several functions if no PAKE algorithms are specified, saving up to ~1.5KB by removing the functions
psa_pake_abort()
,psa_pake_complete_inputs()
,psa_pake_get_implicit_key()
,psa_pake_input()
,psa_pake_output()
,psa_pake_set_password_key()
,psa_pake_set_peer()
,psa_pake_set_role()
,psa_pake_set_user()
andpsa_pake_setup()
completely if they are not needed.Code size improvements for Armv8-M/Thumb2:
psa_crypto.o
PR checklist
Please tick as appropriate and edit the reasons (e.g.: "backport: not needed because this is a new feature")
development
-only