Only pass the driver-relevant portion of the context struct
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
diff --git a/include/psa/crypto_struct.h b/include/psa/crypto_struct.h
index 5ac1875..b26588f 100644
--- a/include/psa/crypto_struct.h
+++ b/include/psa/crypto_struct.h
@@ -77,6 +77,16 @@
#include "mbedtls/sha256.h"
#include "mbedtls/sha512.h"
+typedef struct {
+ /** Unique ID indicating which driver got assigned to do the
+ * operation. Since driver contexts are driver-specific, swapping
+ * drivers halfway through the operation is not supported.
+ * ID values are auto-generated in psa_driver_wrappers.h */
+ unsigned int id;
+ /** Context structure for the assigned driver, when id is not zero. */
+ void* ctx;
+} psa_operation_driver_context_t;
+
struct psa_hash_operation_s
{
psa_algorithm_t alg;
@@ -165,12 +175,7 @@
{
unsigned dummy; /* Enable easier initializing of the union. */
mbedtls_cipher_context_t cipher;
-#if defined(MBEDTLS_PSA_CRYPTO_DRIVERS)
- struct {
- unsigned int id;
- void* ctx;
- } driver;
-#endif
+ psa_operation_driver_context_t driver;
} ctx;
};