From 5bcd3cc217d29ac4e15d9781f80ba6f023f144a8 Mon Sep 17 00:00:00 2001 From: Waleed Elmelegy Date: Wed, 20 Nov 2024 11:43:37 +0000 Subject: [PATCH] Add internal struct for iop export public-key context Signed-off-by: Waleed Elmelegy --- .../include/psa/crypto_builtin_composites.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tf-psa-crypto/include/psa/crypto_builtin_composites.h b/tf-psa-crypto/include/psa/crypto_builtin_composites.h index 14e759b13..c6bd0fdfd 100644 --- a/tf-psa-crypto/include/psa/crypto_builtin_composites.h +++ b/tf-psa-crypto/include/psa/crypto_builtin_composites.h @@ -248,4 +248,22 @@ typedef struct { #define MBEDTLS_PSA_KEY_AGREEMENT_IOP_INIT { 0 } #endif +/* Context structure for the Mbed TLS interruptible export public-key implementation. */ +typedef struct { +#if defined(MBEDTLS_ECP_C) && defined(MBEDTLS_ECP_RESTARTABLE) + mbedtls_ecp_keypair *MBEDTLS_PRIVATE(key); + mbedtls_ecp_restart_ctx MBEDTLS_PRIVATE(restart_ctx); + uint32_t MBEDTLS_PRIVATE(num_ops); +#else + /* Make the struct non-empty if algs not supported. */ + unsigned MBEDTLS_PRIVATE(dummy); +#endif +} mbedtls_psa_export_public_key_iop_operation_t; + +#if defined(MBEDTLS_ECP_C) && defined(MBEDTLS_ECP_RESTARTABLE) +#define MBEDTLS_PSA_EXPORT_PUBLIC_KEY_IOP_INIT { 0, MBEDTLS_ECP_RESTART_INIT, 0 } +#else +#define MBEDTLS_PSA_EXPORT_PUBLIC_KEY_IOP_INIT { 0 } +#endif + #endif /* PSA_CRYPTO_BUILTIN_COMPOSITES_H */