mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-31 00:32:50 +00:00
psa_crypto_aead: add guard for CIPHER_C dependency
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
c5d9dd262b
commit
2c2adedd82
@ -43,13 +43,13 @@ static psa_status_t psa_aead_setup(
|
|||||||
psa_algorithm_t alg)
|
psa_algorithm_t alg)
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
size_t key_bits;
|
|
||||||
const mbedtls_cipher_info_t *cipher_info;
|
|
||||||
mbedtls_cipher_id_t cipher_id;
|
|
||||||
|
|
||||||
(void) key_buffer_size;
|
(void) key_buffer_size;
|
||||||
|
|
||||||
key_bits = attributes->core.bits;
|
#if defined(MBEDTLS_CIPHER_C)
|
||||||
|
const mbedtls_cipher_info_t *cipher_info;
|
||||||
|
mbedtls_cipher_id_t cipher_id;
|
||||||
|
size_t key_bits = attributes->core.bits;
|
||||||
|
|
||||||
cipher_info = mbedtls_cipher_info_from_psa(alg,
|
cipher_info = mbedtls_cipher_info_from_psa(alg,
|
||||||
attributes->core.type, key_bits,
|
attributes->core.type, key_bits,
|
||||||
@ -57,6 +57,7 @@ static psa_status_t psa_aead_setup(
|
|||||||
if (cipher_info == NULL) {
|
if (cipher_info == NULL) {
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
#endif /* MBEDTLS_CIPHER_C */
|
||||||
|
|
||||||
switch (PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, 0)) {
|
switch (PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, 0)) {
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CCM)
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CCM)
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_CIPHER_C)
|
||||||
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_psa(
|
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_psa(
|
||||||
psa_algorithm_t alg,
|
psa_algorithm_t alg,
|
||||||
psa_key_type_t key_type,
|
psa_key_type_t key_type,
|
||||||
@ -158,6 +159,7 @@ const mbedtls_cipher_info_t *mbedtls_cipher_info_from_psa(
|
|||||||
return mbedtls_cipher_info_from_values(cipher_id_tmp,
|
return mbedtls_cipher_info_from_values(cipher_id_tmp,
|
||||||
(int) key_bits, mode);
|
(int) key_bits, mode);
|
||||||
}
|
}
|
||||||
|
#endif /* MBEDTLS_CIPHER_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <mbedtls/cipher.h>
|
#include <mbedtls/cipher.h>
|
||||||
#include <psa/crypto.h>
|
#include <psa/crypto.h>
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_CIPHER_C)
|
||||||
/** Get Mbed TLS cipher information given the cipher algorithm PSA identifier
|
/** Get Mbed TLS cipher information given the cipher algorithm PSA identifier
|
||||||
* as well as the PSA type and size of the key to be used with the cipher
|
* as well as the PSA type and size of the key to be used with the cipher
|
||||||
* algorithm.
|
* algorithm.
|
||||||
@ -39,6 +40,7 @@
|
|||||||
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_psa(
|
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_psa(
|
||||||
psa_algorithm_t alg, psa_key_type_t key_type, size_t key_bits,
|
psa_algorithm_t alg, psa_key_type_t key_type, size_t key_bits,
|
||||||
mbedtls_cipher_id_t *cipher_id);
|
mbedtls_cipher_id_t *cipher_id);
|
||||||
|
#endif /* MBEDTLS_CIPHER_C */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set the key for a multipart symmetric encryption operation.
|
* \brief Set the key for a multipart symmetric encryption operation.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user