PK: fix (some) size macros #679

Merged
mpg merged 10 commits from pk-fix-size-macros into development 2026-02-03 12:19:13 -06:00
mpg commented 2026-01-30 06:23:17 -06:00 (Migrated from github.com)

Description

Resolves https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/671 and addresses the silly mistakes identified in https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/476#issuecomment-3804806635

PR checklist

  • changelog not required because: internal fixes
  • framework PR not required
  • mbedtls development PR not required because: crypto only
  • mbedtls 3.6 PR not required because: 1.x only
  • tests provided
## Description Resolves https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/671 and addresses the silly mistakes identified in https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/476#issuecomment-3804806635 ## PR checklist - [x] **changelog** not required because: internal fixes - [x] **framework PR** not required - [x] **mbedtls development PR** not required because: crypto only - [x] **mbedtls 3.6 PR** not required because: 1.x only - **tests** provided
mpg commented 2026-01-30 06:27:38 -06:00 (Migrated from github.com)

addresses the silly mistakes identified in #476 (comment)

Evidence:

% gcc -Iinclude -Icore -I drivers/builtin/include -Os -fstack-usage -c drivers/builtin/src/pk*.c
% egrep -h '[^:]([0-9]{4}|[5-9][0-9]{2})' pk*.su | awk '{print $2" "$1}' | sort -rn
2480 drivers/builtin/src/pk.c:902:12:copy_from_psa
2432 drivers/builtin/src/pk.c:710:21:export_import_into_psa
2416 drivers/builtin/src/pkwrite.c:37:12:pk_write_rsa_der.isra
640 drivers/builtin/src/pk.c:813:12:import_public_into_psa.constprop
576 drivers/builtin/src/pkwrite.c:58:12:pk_write_rsa_pubkey
528 drivers/builtin/src/pkparse.c:381:12:pk_use_ecparams

We can see that the two functions with 1000-something stack size are indeed gone, compared to https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/476#issuecomment-3804650796

> addresses the silly mistakes identified in [#476 (comment)](https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/476#issuecomment-3804806635) Evidence: ``` % gcc -Iinclude -Icore -I drivers/builtin/include -Os -fstack-usage -c drivers/builtin/src/pk*.c % egrep -h '[^:]([0-9]{4}|[5-9][0-9]{2})' pk*.su | awk '{print $2" "$1}' | sort -rn 2480 drivers/builtin/src/pk.c:902:12:copy_from_psa 2432 drivers/builtin/src/pk.c:710:21:export_import_into_psa 2416 drivers/builtin/src/pkwrite.c:37:12:pk_write_rsa_der.isra 640 drivers/builtin/src/pk.c:813:12:import_public_into_psa.constprop 576 drivers/builtin/src/pkwrite.c:58:12:pk_write_rsa_pubkey 528 drivers/builtin/src/pkparse.c:381:12:pk_use_ecparams ``` We can see that the two functions with 1000-something stack size are indeed gone, compared to https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/476#issuecomment-3804650796
valeriosetti (Migrated from github.com) approved these changes 2026-01-30 16:38:08 -06:00
bjwtaylor (Migrated from github.com) approved these changes 2026-02-03 09:31:53 -06:00
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!679
No description provided.