1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

Only pass the driver-relevant portion of the context struct

Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
Steven Cooreman
2020-09-09 12:01:43 +02:00
parent 5240e8b519
commit fb81aa5889
4 changed files with 89 additions and 83 deletions

View File

@@ -77,6 +77,16 @@ extern "C" {
#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 @@ struct psa_cipher_operation_s
{
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;
};