mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-10 15:45:34 +00:00
Avoid empty unions
When no algorithms are present in a category (e.g. no AEAD algorithm), the union in the corresponding operation structure was empty, which is not valid C. Add a dummy field to avoid this.
This commit is contained in:
parent
9a1ba0dd3f
commit
058e0b9963
@ -50,6 +50,7 @@ struct psa_hash_operation_s
|
|||||||
psa_algorithm_t alg;
|
psa_algorithm_t alg;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
||||||
#if defined(MBEDTLS_MD2_C)
|
#if defined(MBEDTLS_MD2_C)
|
||||||
mbedtls_md2_context md2;
|
mbedtls_md2_context md2;
|
||||||
#endif
|
#endif
|
||||||
@ -84,6 +85,7 @@ struct psa_mac_operation_s
|
|||||||
uint8_t mac_size;
|
uint8_t mac_size;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
||||||
#if defined(MBEDTLS_MD_C)
|
#if defined(MBEDTLS_MD_C)
|
||||||
mbedtls_md_context_t hmac;
|
mbedtls_md_context_t hmac;
|
||||||
#endif
|
#endif
|
||||||
@ -102,6 +104,7 @@ struct psa_cipher_operation_s
|
|||||||
uint8_t block_size;
|
uint8_t block_size;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
||||||
} ctx;
|
} ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -115,6 +118,7 @@ struct psa_aead_operation_s
|
|||||||
uint8_t block_size;
|
uint8_t block_size;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
||||||
} ctx;
|
} ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user