mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-04-25 10:36:29 +00:00
Use the correct guards on the context structures for MAC/HKDF/PRF
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
4f7cae6cbe
commit
c2cbac017f
|
@ -43,7 +43,7 @@
|
||||||
#define MBEDTLS_PSA_BUILTIN_MAC
|
#define MBEDTLS_PSA_BUILTIN_MAC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PSA_WANT_ALG_HMAC)
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC) || defined(PSA_CRYPTO_DRIVER_TEST)
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
/** The HMAC algorithm in use */
|
/** The HMAC algorithm in use */
|
||||||
|
@ -55,7 +55,7 @@ typedef struct
|
||||||
} mbedtls_psa_hmac_operation_t;
|
} mbedtls_psa_hmac_operation_t;
|
||||||
|
|
||||||
#define MBEDTLS_PSA_HMAC_OPERATION_INIT {0, PSA_HASH_OPERATION_INIT, {0}}
|
#define MBEDTLS_PSA_HMAC_OPERATION_INIT {0, PSA_HASH_OPERATION_INIT, {0}}
|
||||||
#endif /* PSA_WANT_ALG_HMAC */
|
#endif /* MBEDTLS_PSA_BUILTIN_ALG_HMAC */
|
||||||
|
|
||||||
#include "mbedtls/cmac.h"
|
#include "mbedtls/cmac.h"
|
||||||
|
|
||||||
|
@ -68,12 +68,12 @@ typedef struct
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
||||||
#if defined(PSA_WANT_ALG_HMAC)
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC) || defined(PSA_CRYPTO_DRIVER_TEST)
|
||||||
mbedtls_psa_hmac_operation_t hmac;
|
mbedtls_psa_hmac_operation_t hmac;
|
||||||
#endif
|
#endif /* MBEDTLS_PSA_BUILTIN_ALG_HMAC */
|
||||||
#if defined(MBEDTLS_CMAC_C)
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CMAC) || defined(PSA_CRYPTO_DRIVER_TEST)
|
||||||
mbedtls_cipher_context_t cmac;
|
mbedtls_cipher_context_t cmac;
|
||||||
#endif
|
#endif /* MBEDTLS_PSA_BUILTIN_ALG_CMAC */
|
||||||
} ctx;
|
} ctx;
|
||||||
} mbedtls_psa_mac_operation_t;
|
} mbedtls_psa_mac_operation_t;
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ static inline struct psa_aead_operation_s psa_aead_operation_init( void )
|
||||||
return( v );
|
return( v );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_C)
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_HKDF)
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t *info;
|
uint8_t *info;
|
||||||
|
@ -184,9 +184,10 @@ typedef struct
|
||||||
unsigned int state : 2;
|
unsigned int state : 2;
|
||||||
unsigned int info_set : 1;
|
unsigned int info_set : 1;
|
||||||
} psa_hkdf_key_derivation_t;
|
} psa_hkdf_key_derivation_t;
|
||||||
#endif /* MBEDTLS_MD_C */
|
#endif /* MBEDTLS_PSA_BUILTIN_ALG_HKDF */
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_C)
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF) || \
|
||||||
|
defined(MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS)
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
PSA_TLS12_PRF_STATE_INIT, /* no input provided */
|
PSA_TLS12_PRF_STATE_INIT, /* no input provided */
|
||||||
|
@ -221,7 +222,8 @@ typedef struct psa_tls12_prf_key_derivation_s
|
||||||
/* `HMAC_hash( prk, A(i) + seed )` in the notation of RFC 5246, Sect. 5. */
|
/* `HMAC_hash( prk, A(i) + seed )` in the notation of RFC 5246, Sect. 5. */
|
||||||
uint8_t output_block[PSA_HASH_MAX_SIZE];
|
uint8_t output_block[PSA_HASH_MAX_SIZE];
|
||||||
} psa_tls12_prf_key_derivation_t;
|
} psa_tls12_prf_key_derivation_t;
|
||||||
#endif /* MBEDTLS_MD_C */
|
#endif /* MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF) ||
|
||||||
|
* MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS */
|
||||||
|
|
||||||
struct psa_key_derivation_s
|
struct psa_key_derivation_s
|
||||||
{
|
{
|
||||||
|
@ -232,8 +234,11 @@ struct psa_key_derivation_s
|
||||||
{
|
{
|
||||||
/* Make the union non-empty even with no supported algorithms. */
|
/* Make the union non-empty even with no supported algorithms. */
|
||||||
uint8_t dummy;
|
uint8_t dummy;
|
||||||
#if defined(MBEDTLS_MD_C)
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_HKDF)
|
||||||
psa_hkdf_key_derivation_t hkdf;
|
psa_hkdf_key_derivation_t hkdf;
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF) || \
|
||||||
|
defined(MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS)
|
||||||
psa_tls12_prf_key_derivation_t tls12_prf;
|
psa_tls12_prf_key_derivation_t tls12_prf;
|
||||||
#endif
|
#endif
|
||||||
} ctx;
|
} ctx;
|
||||||
|
|
Loading…
Reference in a new issue