Gilles Peskine f5d7eef11f 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.

In aead_operation_t, tag_length was outside the window. The details depend
on the sizes of contexts included in ctx. Make the large ctx be the last
field.

In mbedtls_psa_hmac_operation_t, the opad field is outside the window when
SHA-512 is enabled. Moving opad before hash_ctx only saves 4 bytes and made
the structure clumsy, so I left it alone.

Results (arm-none-eabi-gcc 7.3.1, build_arm_none_eabi_gcc_m0plus build):
library/psa_crypto.o: 16246 -> 16166 (diff: 80)
library/psa_crypto_aead.o: 952 -> 928 (diff: 24)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-11-16 15:00:17 +01:00
..
crypto_builtin_composites.h
crypto_builtin_primitives.h
crypto_compat.h
crypto_config.h
crypto_driver_common.h
crypto_driver_contexts_composites.h
crypto_driver_contexts_primitives.h
crypto_extra.h
crypto_platform.h
crypto_se_driver.h
crypto_sizes.h Add missing PSA_HASH_BLOCK_LENGTH macro. 2021-11-03 12:38:57 +01:00
crypto_struct.h PSA operation structures: move less-used fields to the end 2021-11-16 15:00:17 +01:00
crypto_types.h
crypto_values.h Reorder macro definitions 2021-11-03 12:44:08 +01:00
crypto.h