PSA operation structures: move less-used fields to the end
Move fields around to have fewer accesses outside the 128-element Thumb direct access window. In psa_hkdf_key_derivation_t, move the large fields (output_block, prk, hmac) after the state bit-fields. Experimentally, it's slightly better to put hmac last. Other operations structures don't go outside the window, at least when not considering nested structures. Results (arm-none-eabi-gcc 7.3.1, build_arm_none_eabi_gcc_m0plus build): library/psa_crypto.o: 16510 -> 16434 (diff: 76) Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
f303c0ddeb
commit
e3d9c9d99b
1 changed files with 3 additions and 3 deletions
|
@ -186,9 +186,6 @@ typedef struct
|
|||
{
|
||||
uint8_t *MBEDTLS_PRIVATE(info);
|
||||
size_t MBEDTLS_PRIVATE(info_length);
|
||||
struct psa_mac_operation_s MBEDTLS_PRIVATE(hmac);
|
||||
uint8_t MBEDTLS_PRIVATE(prk)[PSA_HASH_MAX_SIZE];
|
||||
uint8_t MBEDTLS_PRIVATE(output_block)[PSA_HASH_MAX_SIZE];
|
||||
#if PSA_HASH_MAX_SIZE > 0xff
|
||||
#error "PSA_HASH_MAX_SIZE does not fit in uint8_t"
|
||||
#endif
|
||||
|
@ -196,6 +193,9 @@ typedef struct
|
|||
uint8_t MBEDTLS_PRIVATE(block_number);
|
||||
unsigned int MBEDTLS_PRIVATE(state) : 2;
|
||||
unsigned int MBEDTLS_PRIVATE(info_set) : 1;
|
||||
uint8_t MBEDTLS_PRIVATE(output_block)[PSA_HASH_MAX_SIZE];
|
||||
uint8_t MBEDTLS_PRIVATE(prk)[PSA_HASH_MAX_SIZE];
|
||||
struct psa_mac_operation_s MBEDTLS_PRIVATE(hmac);
|
||||
} psa_hkdf_key_derivation_t;
|
||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_HKDF */
|
||||
|
||||
|
|
Loading…
Reference in a new issue