mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Add boilerplate for dispatching MAC operations
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
@ -51,4 +51,32 @@ typedef struct
|
||||
} psa_hmac_internal_data;
|
||||
#endif /* MBEDTLS_MD_C */
|
||||
|
||||
#include "mbedtls/cmac.h"
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CMAC) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC)
|
||||
#define MBEDTLS_PSA_BUILTIN_MAC
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
psa_algorithm_t alg;
|
||||
/* To be fleshed out in a later commit. */
|
||||
} mbedtls_psa_mac_operation_t;
|
||||
|
||||
#define MBEDTLS_PSA_MAC_OPERATION_INIT {0, {0}}
|
||||
|
||||
/*
|
||||
* BEYOND THIS POINT, TEST DRIVER DECLARATIONS ONLY.
|
||||
*/
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
|
||||
typedef mbedtls_psa_mac_operation_t mbedtls_transparent_test_driver_mac_operation_t;
|
||||
typedef mbedtls_psa_mac_operation_t mbedtls_opaque_test_driver_mac_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT MBEDTLS_PSA_MAC_OPERATION_INIT
|
||||
#define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT MBEDTLS_PSA_MAC_OPERATION_INIT
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
|
||||
#endif /* PSA_CRYPTO_BUILTIN_COMPOSITES_H */
|
||||
|
@ -49,5 +49,14 @@
|
||||
* are formatted as `'drivername'_ctx`. This allows for procedural generation
|
||||
* of both this file and the content of psa_crypto_driver_wrappers.c */
|
||||
|
||||
typedef union {
|
||||
unsigned dummy; /* Make sure this union is always non-empty */
|
||||
mbedtls_psa_mac_operation_t mbedtls_ctx;
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_transparent_test_driver_mac_operation_t transparent_test_driver_ctx;
|
||||
mbedtls_opaque_test_driver_mac_operation_t opaque_test_driver_ctx;
|
||||
#endif
|
||||
} psa_driver_mac_context_t;
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */
|
||||
/* End of automatically generated file. */
|
||||
|
@ -137,6 +137,7 @@ struct psa_mac_operation_s
|
||||
unsigned int has_input : 1;
|
||||
unsigned int is_sign : 1;
|
||||
uint8_t mac_size;
|
||||
unsigned int id;
|
||||
union
|
||||
{
|
||||
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
||||
@ -146,10 +147,11 @@ struct psa_mac_operation_s
|
||||
#if defined(MBEDTLS_CMAC_C)
|
||||
mbedtls_cipher_context_t cmac;
|
||||
#endif
|
||||
psa_driver_mac_context_t driver;
|
||||
} ctx;
|
||||
};
|
||||
|
||||
#define PSA_MAC_OPERATION_INIT {0, 0, 0, 0, 0, 0, 0, {0}}
|
||||
#define PSA_MAC_OPERATION_INIT {0, 0, 0, 0, 0, 0, 0, 0, {0}}
|
||||
static inline struct psa_mac_operation_s psa_mac_operation_init( void )
|
||||
{
|
||||
const struct psa_mac_operation_s v = PSA_MAC_OPERATION_INIT;
|
||||
|
Reference in New Issue
Block a user