mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-03 01:13:37 +00:00
Don't access psa_key_attributes_t.core
Access the fields of `psa_key_attributes_t` directly rather than through the `core` field. This makes the `core` field obsolete. This commit is fully automated: ``` git ls-files '*.h' '*.c' '*.function' '*.jinja' | xargs perl -l -i -pe '$core = qr/\b(core\b|MBEDTLS_PRIVATE\(core\))/; s/->$core\./->/g; s/&(\w+)\.$core\./&$1./g; s/(\w+)\.$core/$1/g' ``` Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
7a5d9201c1
commit
2f107ae000
@ -59,7 +59,7 @@ static inline void psa_set_key_enrollment_algorithm(
|
||||
psa_key_attributes_t *attributes,
|
||||
psa_algorithm_t alg2)
|
||||
{
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2) = alg2;
|
||||
attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2) = alg2;
|
||||
}
|
||||
|
||||
/** Retrieve the enrollment algorithm policy from key attributes.
|
||||
@ -71,7 +71,7 @@ static inline void psa_set_key_enrollment_algorithm(
|
||||
static inline psa_algorithm_t psa_get_key_enrollment_algorithm(
|
||||
const psa_key_attributes_t *attributes)
|
||||
{
|
||||
return attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2);
|
||||
return attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2);
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
|
||||
@ -129,8 +129,8 @@ static inline void psa_set_key_slot_number(
|
||||
psa_key_attributes_t *attributes,
|
||||
psa_key_slot_number_t slot_number)
|
||||
{
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(flags) |= MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER;
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(slot_number) = slot_number;
|
||||
attributes->MBEDTLS_PRIVATE(flags) |= MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER;
|
||||
attributes->MBEDTLS_PRIVATE(slot_number) = slot_number;
|
||||
}
|
||||
|
||||
/** Remove the slot number attribute from a key attribute structure.
|
||||
@ -142,7 +142,7 @@ static inline void psa_set_key_slot_number(
|
||||
static inline void psa_clear_key_slot_number(
|
||||
psa_key_attributes_t *attributes)
|
||||
{
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(flags) &=
|
||||
attributes->MBEDTLS_PRIVATE(flags) &=
|
||||
~MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER;
|
||||
}
|
||||
|
||||
|
@ -362,12 +362,12 @@ static inline struct psa_key_attributes_s psa_key_attributes_init(void)
|
||||
static inline void psa_set_key_id(psa_key_attributes_t *attributes,
|
||||
mbedtls_svc_key_id_t key)
|
||||
{
|
||||
psa_key_lifetime_t lifetime = attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(lifetime);
|
||||
psa_key_lifetime_t lifetime = attributes->MBEDTLS_PRIVATE(lifetime);
|
||||
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(id) = key;
|
||||
attributes->MBEDTLS_PRIVATE(id) = key;
|
||||
|
||||
if (PSA_KEY_LIFETIME_IS_VOLATILE(lifetime)) {
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(lifetime) =
|
||||
attributes->MBEDTLS_PRIVATE(lifetime) =
|
||||
PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
|
||||
PSA_KEY_LIFETIME_PERSISTENT,
|
||||
PSA_KEY_LIFETIME_GET_LOCATION(lifetime));
|
||||
@ -377,26 +377,26 @@ static inline void psa_set_key_id(psa_key_attributes_t *attributes,
|
||||
static inline mbedtls_svc_key_id_t psa_get_key_id(
|
||||
const psa_key_attributes_t *attributes)
|
||||
{
|
||||
return attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(id);
|
||||
return attributes->MBEDTLS_PRIVATE(id);
|
||||
}
|
||||
|
||||
#ifdef MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
|
||||
static inline void mbedtls_set_key_owner_id(psa_key_attributes_t *attributes,
|
||||
mbedtls_key_owner_id_t owner)
|
||||
{
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(id).MBEDTLS_PRIVATE(owner) = owner;
|
||||
attributes->MBEDTLS_PRIVATE(id).MBEDTLS_PRIVATE(owner) = owner;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void psa_set_key_lifetime(psa_key_attributes_t *attributes,
|
||||
psa_key_lifetime_t lifetime)
|
||||
{
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(lifetime) = lifetime;
|
||||
attributes->MBEDTLS_PRIVATE(lifetime) = lifetime;
|
||||
if (PSA_KEY_LIFETIME_IS_VOLATILE(lifetime)) {
|
||||
#ifdef MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(id).MBEDTLS_PRIVATE(key_id) = 0;
|
||||
attributes->MBEDTLS_PRIVATE(id).MBEDTLS_PRIVATE(key_id) = 0;
|
||||
#else
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(id) = 0;
|
||||
attributes->MBEDTLS_PRIVATE(id) = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -404,7 +404,7 @@ static inline void psa_set_key_lifetime(psa_key_attributes_t *attributes,
|
||||
static inline psa_key_lifetime_t psa_get_key_lifetime(
|
||||
const psa_key_attributes_t *attributes)
|
||||
{
|
||||
return attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(lifetime);
|
||||
return attributes->MBEDTLS_PRIVATE(lifetime);
|
||||
}
|
||||
|
||||
static inline void psa_extend_key_usage_flags(psa_key_usage_t *usage_flags)
|
||||
@ -422,53 +422,53 @@ static inline void psa_set_key_usage_flags(psa_key_attributes_t *attributes,
|
||||
psa_key_usage_t usage_flags)
|
||||
{
|
||||
psa_extend_key_usage_flags(&usage_flags);
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(usage) = usage_flags;
|
||||
attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(usage) = usage_flags;
|
||||
}
|
||||
|
||||
static inline psa_key_usage_t psa_get_key_usage_flags(
|
||||
const psa_key_attributes_t *attributes)
|
||||
{
|
||||
return attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(usage);
|
||||
return attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(usage);
|
||||
}
|
||||
|
||||
static inline void psa_set_key_algorithm(psa_key_attributes_t *attributes,
|
||||
psa_algorithm_t alg)
|
||||
{
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg) = alg;
|
||||
attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg) = alg;
|
||||
}
|
||||
|
||||
static inline psa_algorithm_t psa_get_key_algorithm(
|
||||
const psa_key_attributes_t *attributes)
|
||||
{
|
||||
return attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg);
|
||||
return attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg);
|
||||
}
|
||||
|
||||
static inline void psa_set_key_type(psa_key_attributes_t *attributes,
|
||||
psa_key_type_t type)
|
||||
{
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(type) = type;
|
||||
attributes->MBEDTLS_PRIVATE(type) = type;
|
||||
}
|
||||
|
||||
static inline psa_key_type_t psa_get_key_type(
|
||||
const psa_key_attributes_t *attributes)
|
||||
{
|
||||
return attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(type);
|
||||
return attributes->MBEDTLS_PRIVATE(type);
|
||||
}
|
||||
|
||||
static inline void psa_set_key_bits(psa_key_attributes_t *attributes,
|
||||
size_t bits)
|
||||
{
|
||||
if (bits > PSA_MAX_KEY_BITS) {
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(bits) = PSA_KEY_BITS_TOO_LARGE;
|
||||
attributes->MBEDTLS_PRIVATE(bits) = PSA_KEY_BITS_TOO_LARGE;
|
||||
} else {
|
||||
attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(bits) = (psa_key_bits_t) bits;
|
||||
attributes->MBEDTLS_PRIVATE(bits) = (psa_key_bits_t) bits;
|
||||
}
|
||||
}
|
||||
|
||||
static inline size_t psa_get_key_bits(
|
||||
const psa_key_attributes_t *attributes)
|
||||
{
|
||||
return attributes->MBEDTLS_PRIVATE(core).MBEDTLS_PRIVATE(bits);
|
||||
return attributes->MBEDTLS_PRIVATE(bits);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -568,7 +568,7 @@ psa_status_t psa_import_key_into_slot(
|
||||
size_t *key_buffer_length, size_t *bits)
|
||||
{
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
psa_key_type_t type = attributes->core.type;
|
||||
psa_key_type_t type = attributes->type;
|
||||
|
||||
/* zero-length keys are never supported. */
|
||||
if (data_length == 0) {
|
||||
@ -578,7 +578,7 @@ psa_status_t psa_import_key_into_slot(
|
||||
if (key_type_is_raw_bytes(type)) {
|
||||
*bits = PSA_BYTES_TO_BITS(data_length);
|
||||
|
||||
status = psa_validate_unstructured_key_bit_size(attributes->core.type,
|
||||
status = psa_validate_unstructured_key_bit_size(attributes->type,
|
||||
*bits);
|
||||
if (status != PSA_SUCCESS) {
|
||||
return status;
|
||||
@ -1245,8 +1245,8 @@ psa_status_t psa_get_key_slot_number(
|
||||
const psa_key_attributes_t *attributes,
|
||||
psa_key_slot_number_t *slot_number)
|
||||
{
|
||||
if (attributes->core.flags & MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER) {
|
||||
*slot_number = attributes->core.slot_number;
|
||||
if (attributes->flags & MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER) {
|
||||
*slot_number = attributes->slot_number;
|
||||
return PSA_SUCCESS;
|
||||
} else {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
@ -1275,7 +1275,7 @@ psa_status_t psa_export_key_internal(
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
uint8_t *data, size_t data_size, size_t *data_length)
|
||||
{
|
||||
psa_key_type_t type = attributes->core.type;
|
||||
psa_key_type_t type = attributes->type;
|
||||
|
||||
if (key_type_is_raw_bytes(type) ||
|
||||
PSA_KEY_TYPE_IS_RSA(type) ||
|
||||
@ -1341,7 +1341,7 @@ psa_status_t psa_export_public_key_internal(
|
||||
size_t data_size,
|
||||
size_t *data_length)
|
||||
{
|
||||
psa_key_type_t type = attributes->core.type;
|
||||
psa_key_type_t type = attributes->type;
|
||||
|
||||
if (PSA_KEY_TYPE_IS_PUBLIC_KEY(type) &&
|
||||
(PSA_KEY_TYPE_IS_RSA(type) || PSA_KEY_TYPE_IS_ECC(type) ||
|
||||
@ -1518,7 +1518,7 @@ static psa_status_t psa_validate_key_attributes(
|
||||
}
|
||||
}
|
||||
|
||||
status = psa_validate_key_policy(&attributes->core.policy);
|
||||
status = psa_validate_key_policy(&attributes->policy);
|
||||
if (status != PSA_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
@ -1532,7 +1532,7 @@ static psa_status_t psa_validate_key_attributes(
|
||||
}
|
||||
|
||||
/* Reject invalid flags. These should not be reachable through the API. */
|
||||
if (attributes->core.flags & ~(MBEDTLS_PSA_KA_MASK_EXTERNAL_ONLY |
|
||||
if (attributes->flags & ~(MBEDTLS_PSA_KA_MASK_EXTERNAL_ONLY |
|
||||
MBEDTLS_PSA_KA_MASK_DUAL_USE)) {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
@ -1652,7 +1652,7 @@ static psa_status_t psa_start_key_creation(
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!PSA_KEY_LIFETIME_IS_VOLATILE(attributes->core.lifetime)) {
|
||||
if (!PSA_KEY_LIFETIME_IS_VOLATILE(attributes->lifetime)) {
|
||||
psa_crypto_prepare_transaction(PSA_CRYPTO_TRANSACTION_CREATE_KEY);
|
||||
psa_crypto_transaction.key.lifetime = slot->attr.lifetime;
|
||||
psa_crypto_transaction.key.slot = slot_number;
|
||||
@ -1852,14 +1852,14 @@ static psa_status_t psa_validate_optional_attributes(
|
||||
const psa_key_slot_t *slot,
|
||||
const psa_key_attributes_t *attributes)
|
||||
{
|
||||
if (attributes->core.type != 0) {
|
||||
if (attributes->core.type != slot->attr.type) {
|
||||
if (attributes->type != 0) {
|
||||
if (attributes->type != slot->attr.type) {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
if (attributes->core.bits != 0) {
|
||||
if (attributes->core.bits != slot->attr.bits) {
|
||||
if (attributes->bits != 0) {
|
||||
if (attributes->bits != slot->attr.bits) {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
@ -1903,7 +1903,7 @@ psa_status_t psa_import_key(const psa_key_attributes_t *attributes,
|
||||
* with storage ( MBEDTLS_PSA_CRYPTO_SE_C ) ),we have to allocate a
|
||||
* buffer to hold the imported key material. */
|
||||
if (slot->key.data == NULL) {
|
||||
if (psa_key_lifetime_is_external(attributes->core.lifetime)) {
|
||||
if (psa_key_lifetime_is_external(attributes->lifetime)) {
|
||||
status = psa_driver_wrapper_get_key_buffer_size_from_key_data(
|
||||
attributes, data, data_length, &storage_size);
|
||||
if (status != PSA_SUCCESS) {
|
||||
@ -2023,12 +2023,12 @@ psa_status_t psa_copy_key(mbedtls_svc_key_id_t source_key,
|
||||
* equal to the ones of the source key. So it is safe to inherit
|
||||
* them from the source key now."
|
||||
* */
|
||||
actual_attributes.core.bits = source_slot->attr.bits;
|
||||
actual_attributes.core.type = source_slot->attr.type;
|
||||
actual_attributes.bits = source_slot->attr.bits;
|
||||
actual_attributes.type = source_slot->attr.type;
|
||||
|
||||
|
||||
status = psa_restrict_key_policy(source_slot->attr.type,
|
||||
&actual_attributes.core.policy,
|
||||
&actual_attributes.policy,
|
||||
&source_slot->attr.policy);
|
||||
if (status != PSA_SUCCESS) {
|
||||
goto exit;
|
||||
@ -2057,7 +2057,7 @@ psa_status_t psa_copy_key(mbedtls_svc_key_id_t source_key,
|
||||
* - For opaque keys this translates to an invocation of the drivers'
|
||||
* copy_key entry point through the dispatch layer.
|
||||
* */
|
||||
if (psa_key_lifetime_is_external(actual_attributes.core.lifetime)) {
|
||||
if (psa_key_lifetime_is_external(actual_attributes.lifetime)) {
|
||||
status = psa_driver_wrapper_get_key_buffer_size(&actual_attributes,
|
||||
&storage_size);
|
||||
if (status != PSA_SUCCESS) {
|
||||
@ -2878,7 +2878,7 @@ psa_status_t psa_sign_hash_builtin(
|
||||
psa_algorithm_t alg, const uint8_t *hash, size_t hash_length,
|
||||
uint8_t *signature, size_t signature_size, size_t *signature_length)
|
||||
{
|
||||
if (attributes->core.type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
|
||||
if (attributes->type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
|
||||
if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) ||
|
||||
PSA_ALG_IS_RSA_PSS(alg)) {
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) || \
|
||||
@ -2893,7 +2893,7 @@ psa_status_t psa_sign_hash_builtin(
|
||||
} else {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
} else if (PSA_KEY_TYPE_IS_ECC(attributes->core.type)) {
|
||||
} else if (PSA_KEY_TYPE_IS_ECC(attributes->type)) {
|
||||
if (PSA_ALG_IS_ECDSA(alg)) {
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)
|
||||
@ -2939,7 +2939,7 @@ psa_status_t psa_verify_hash_builtin(
|
||||
psa_algorithm_t alg, const uint8_t *hash, size_t hash_length,
|
||||
const uint8_t *signature, size_t signature_length)
|
||||
{
|
||||
if (PSA_KEY_TYPE_IS_RSA(attributes->core.type)) {
|
||||
if (PSA_KEY_TYPE_IS_RSA(attributes->type)) {
|
||||
if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) ||
|
||||
PSA_ALG_IS_RSA_PSS(alg)) {
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) || \
|
||||
@ -2954,7 +2954,7 @@ psa_status_t psa_verify_hash_builtin(
|
||||
} else {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
} else if (PSA_KEY_TYPE_IS_ECC(attributes->core.type)) {
|
||||
} else if (PSA_KEY_TYPE_IS_ECC(attributes->type)) {
|
||||
if (PSA_ALG_IS_ECDSA(alg)) {
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)
|
||||
@ -3450,7 +3450,7 @@ psa_status_t mbedtls_psa_sign_hash_start(
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
size_t required_hash_length;
|
||||
|
||||
if (!PSA_KEY_TYPE_IS_ECC(attributes->core.type)) {
|
||||
if (!PSA_KEY_TYPE_IS_ECC(attributes->type)) {
|
||||
return PSA_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@ -3467,8 +3467,8 @@ psa_status_t mbedtls_psa_sign_hash_start(
|
||||
/* Ensure num_ops is zero'ed in case of context re-use. */
|
||||
operation->num_ops = 0;
|
||||
|
||||
status = mbedtls_psa_ecp_load_representation(attributes->core.type,
|
||||
attributes->core.bits,
|
||||
status = mbedtls_psa_ecp_load_representation(attributes->type,
|
||||
attributes->bits,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
&operation->ctx);
|
||||
@ -3666,7 +3666,7 @@ psa_status_t mbedtls_psa_verify_hash_start(
|
||||
size_t coordinate_bytes = 0;
|
||||
size_t required_hash_length = 0;
|
||||
|
||||
if (!PSA_KEY_TYPE_IS_ECC(attributes->core.type)) {
|
||||
if (!PSA_KEY_TYPE_IS_ECC(attributes->type)) {
|
||||
return PSA_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@ -3685,8 +3685,8 @@ psa_status_t mbedtls_psa_verify_hash_start(
|
||||
/* Ensure num_ops is zero'ed in case of context re-use. */
|
||||
operation->num_ops = 0;
|
||||
|
||||
status = mbedtls_psa_ecp_load_representation(attributes->core.type,
|
||||
attributes->core.bits,
|
||||
status = mbedtls_psa_ecp_load_representation(attributes->type,
|
||||
attributes->bits,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
&operation->ctx);
|
||||
@ -5818,7 +5818,7 @@ static psa_status_t psa_generate_derived_key_internal(
|
||||
|
||||
slot->attr.bits = (psa_key_bits_t) bits;
|
||||
|
||||
if (psa_key_lifetime_is_external(slot->attr.core.lifetime)) {
|
||||
if (psa_key_lifetime_is_external(slot->attr.lifetime)) {
|
||||
status = psa_driver_wrapper_get_key_buffer_size(&slot->attr,
|
||||
&storage_size);
|
||||
if (status != PSA_SUCCESS) {
|
||||
@ -5901,7 +5901,7 @@ psa_status_t psa_key_derivation_output_key_ext(
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
|
||||
if (status == PSA_SUCCESS) {
|
||||
status = psa_generate_derived_key_internal(slot,
|
||||
attributes->core.bits,
|
||||
attributes->bits,
|
||||
operation);
|
||||
}
|
||||
if (status == PSA_SUCCESS) {
|
||||
@ -7319,7 +7319,7 @@ psa_status_t psa_generate_key_internal(
|
||||
uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length)
|
||||
{
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
psa_key_type_t type = attributes->core.type;
|
||||
psa_key_type_t type = attributes->type;
|
||||
|
||||
/* Only used for RSA */
|
||||
(void) params;
|
||||
@ -7392,12 +7392,12 @@ psa_status_t psa_generate_key_ext(const psa_key_attributes_t *attributes,
|
||||
}
|
||||
|
||||
/* Reject any attempt to create a public key. */
|
||||
if (PSA_KEY_TYPE_IS_PUBLIC_KEY(attributes->core.type)) {
|
||||
if (PSA_KEY_TYPE_IS_PUBLIC_KEY(attributes->type)) {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE)
|
||||
if (attributes->core.type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
|
||||
if (attributes->type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
|
||||
if (params->flags != 0) {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
@ -7418,17 +7418,17 @@ psa_status_t psa_generate_key_ext(const psa_key_attributes_t *attributes,
|
||||
* with storage ( MBEDTLS_PSA_CRYPTO_SE_C ) ),we have to allocate a
|
||||
* buffer to hold the generated key material. */
|
||||
if (slot->key.data == NULL) {
|
||||
if (PSA_KEY_LIFETIME_GET_LOCATION(attributes->core.lifetime) ==
|
||||
if (PSA_KEY_LIFETIME_GET_LOCATION(attributes->lifetime) ==
|
||||
PSA_KEY_LOCATION_LOCAL_STORAGE) {
|
||||
status = psa_validate_key_type_and_size_for_key_generation(
|
||||
attributes->core.type, attributes->core.bits);
|
||||
attributes->type, attributes->bits);
|
||||
if (status != PSA_SUCCESS) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
key_buffer_size = PSA_EXPORT_KEY_OUTPUT_SIZE(
|
||||
attributes->core.type,
|
||||
attributes->core.bits);
|
||||
attributes->type,
|
||||
attributes->bits);
|
||||
} else {
|
||||
status = psa_driver_wrapper_get_key_buffer_size(
|
||||
attributes, &key_buffer_size);
|
||||
|
@ -33,10 +33,10 @@ static psa_status_t psa_aead_setup(
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
mbedtls_cipher_id_t cipher_id;
|
||||
mbedtls_cipher_mode_t mode;
|
||||
size_t key_bits = attributes->core.bits;
|
||||
size_t key_bits = attributes->bits;
|
||||
(void) key_buffer_size;
|
||||
|
||||
status = mbedtls_cipher_values_from_psa(alg, attributes->core.type,
|
||||
status = mbedtls_cipher_values_from_psa(alg, attributes->type,
|
||||
&key_bits, &mode, &cipher_id);
|
||||
if (status != PSA_SUCCESS) {
|
||||
return status;
|
||||
@ -49,7 +49,7 @@ static psa_status_t psa_aead_setup(
|
||||
/* CCM allows the following tag lengths: 4, 6, 8, 10, 12, 14, 16.
|
||||
* The call to mbedtls_ccm_encrypt_and_tag or
|
||||
* mbedtls_ccm_auth_decrypt will validate the tag length. */
|
||||
if (PSA_BLOCK_CIPHER_BLOCK_LENGTH(attributes->core.type) != 16) {
|
||||
if (PSA_BLOCK_CIPHER_BLOCK_LENGTH(attributes->type) != 16) {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ static psa_status_t psa_aead_setup(
|
||||
/* GCM allows the following tag lengths: 4, 8, 12, 13, 14, 15, 16.
|
||||
* The call to mbedtls_gcm_crypt_and_tag or
|
||||
* mbedtls_gcm_auth_decrypt will validate the tag length. */
|
||||
if (PSA_BLOCK_CIPHER_BLOCK_LENGTH(attributes->core.type) != 16) {
|
||||
if (PSA_BLOCK_CIPHER_BLOCK_LENGTH(attributes->type) != 16) {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
|
@ -289,14 +289,14 @@ static psa_status_t psa_cipher_setup(
|
||||
int ret = 0;
|
||||
size_t key_bits;
|
||||
const mbedtls_cipher_info_t *cipher_info = NULL;
|
||||
psa_key_type_t key_type = attributes->core.type;
|
||||
psa_key_type_t key_type = attributes->type;
|
||||
|
||||
(void) key_buffer_size;
|
||||
|
||||
mbedtls_cipher_init(&operation->ctx.cipher);
|
||||
|
||||
operation->alg = alg;
|
||||
key_bits = attributes->core.bits;
|
||||
key_bits = attributes->bits;
|
||||
cipher_info = mbedtls_cipher_info_from_psa(alg, key_type,
|
||||
key_bits, NULL);
|
||||
if (cipher_info == NULL) {
|
||||
|
@ -216,8 +216,8 @@ psa_status_t mbedtls_psa_ecp_import_key(
|
||||
mbedtls_ecp_keypair *ecp = NULL;
|
||||
|
||||
/* Parse input */
|
||||
status = mbedtls_psa_ecp_load_representation(attributes->core.type,
|
||||
attributes->core.bits,
|
||||
status = mbedtls_psa_ecp_load_representation(attributes->type,
|
||||
attributes->bits,
|
||||
data,
|
||||
data_length,
|
||||
&ecp);
|
||||
@ -225,7 +225,7 @@ psa_status_t mbedtls_psa_ecp_import_key(
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (PSA_KEY_TYPE_ECC_GET_FAMILY(attributes->core.type) ==
|
||||
if (PSA_KEY_TYPE_ECC_GET_FAMILY(attributes->type) ==
|
||||
PSA_ECC_FAMILY_MONTGOMERY) {
|
||||
*bits = ecp->grp.nbits + 1;
|
||||
} else {
|
||||
@ -235,7 +235,7 @@ psa_status_t mbedtls_psa_ecp_import_key(
|
||||
/* Re-export the data to PSA export format. There is currently no support
|
||||
* for other input formats then the export format, so this is a 1-1
|
||||
* copy operation. */
|
||||
status = mbedtls_psa_ecp_export_key(attributes->core.type,
|
||||
status = mbedtls_psa_ecp_export_key(attributes->type,
|
||||
ecp,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
@ -308,7 +308,7 @@ psa_status_t mbedtls_psa_ecp_export_public_key(
|
||||
mbedtls_ecp_keypair *ecp = NULL;
|
||||
|
||||
status = mbedtls_psa_ecp_load_representation(
|
||||
attributes->core.type, attributes->core.bits,
|
||||
attributes->type, attributes->bits,
|
||||
key_buffer, key_buffer_size, &ecp);
|
||||
if (status != PSA_SUCCESS) {
|
||||
return status;
|
||||
@ -316,7 +316,7 @@ psa_status_t mbedtls_psa_ecp_export_public_key(
|
||||
|
||||
status = mbedtls_psa_ecp_export_key(
|
||||
PSA_KEY_TYPE_ECC_PUBLIC_KEY(
|
||||
PSA_KEY_TYPE_ECC_GET_FAMILY(attributes->core.type)),
|
||||
PSA_KEY_TYPE_ECC_GET_FAMILY(attributes->type)),
|
||||
ecp, data, data_size, data_length);
|
||||
|
||||
mbedtls_ecp_keypair_free(ecp);
|
||||
@ -337,9 +337,9 @@ psa_status_t mbedtls_psa_ecp_generate_key(
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
|
||||
psa_ecc_family_t curve = PSA_KEY_TYPE_ECC_GET_FAMILY(
|
||||
attributes->core.type);
|
||||
attributes->type);
|
||||
mbedtls_ecp_group_id grp_id =
|
||||
mbedtls_ecc_group_from_psa(curve, attributes->core.bits);
|
||||
mbedtls_ecc_group_from_psa(curve, attributes->bits);
|
||||
|
||||
const mbedtls_ecp_curve_info *curve_info =
|
||||
mbedtls_ecp_curve_info_from_grp_id(grp_id);
|
||||
@ -389,8 +389,8 @@ psa_status_t mbedtls_psa_ecdsa_sign_hash(
|
||||
size_t curve_bytes;
|
||||
mbedtls_mpi r, s;
|
||||
|
||||
status = mbedtls_psa_ecp_load_representation(attributes->core.type,
|
||||
attributes->core.bits,
|
||||
status = mbedtls_psa_ecp_load_representation(attributes->type,
|
||||
attributes->bits,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
&ecp);
|
||||
@ -476,8 +476,8 @@ psa_status_t mbedtls_psa_ecdsa_verify_hash(
|
||||
|
||||
(void) alg;
|
||||
|
||||
status = mbedtls_psa_ecp_load_representation(attributes->core.type,
|
||||
attributes->core.bits,
|
||||
status = mbedtls_psa_ecp_load_representation(attributes->type,
|
||||
attributes->bits,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
&ecp);
|
||||
@ -541,14 +541,14 @@ psa_status_t mbedtls_psa_key_agreement_ecdh(
|
||||
size_t *shared_secret_length)
|
||||
{
|
||||
psa_status_t status;
|
||||
if (!PSA_KEY_TYPE_IS_ECC_KEY_PAIR(attributes->core.type) ||
|
||||
if (!PSA_KEY_TYPE_IS_ECC_KEY_PAIR(attributes->type) ||
|
||||
!PSA_ALG_IS_ECDH(alg)) {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
mbedtls_ecp_keypair *ecp = NULL;
|
||||
status = mbedtls_psa_ecp_load_representation(
|
||||
attributes->core.type,
|
||||
attributes->core.bits,
|
||||
attributes->type,
|
||||
attributes->bits,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
&ecp);
|
||||
|
@ -151,7 +151,7 @@ psa_status_t mbedtls_psa_ffdh_export_public_key(
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
mbedtls_mpi GX, G, X, P;
|
||||
psa_key_type_t type = attributes->core.type;
|
||||
psa_key_type_t type = attributes->type;
|
||||
|
||||
if (PSA_KEY_TYPE_IS_PUBLIC_KEY(type)) {
|
||||
if (key_buffer_size > data_size) {
|
||||
@ -167,7 +167,7 @@ psa_status_t mbedtls_psa_ffdh_export_public_key(
|
||||
mbedtls_mpi_init(&GX); mbedtls_mpi_init(&G);
|
||||
mbedtls_mpi_init(&X); mbedtls_mpi_init(&P);
|
||||
|
||||
size_t key_len = PSA_BITS_TO_BYTES(attributes->core.bits);
|
||||
size_t key_len = PSA_BITS_TO_BYTES(attributes->bits);
|
||||
|
||||
status = mbedtls_psa_ffdh_set_prime_generator(key_len, &P, &G);
|
||||
|
||||
@ -283,7 +283,7 @@ psa_status_t mbedtls_psa_ffdh_key_agreement(
|
||||
mbedtls_mpi_init(&K);
|
||||
|
||||
status = mbedtls_psa_ffdh_set_prime_generator(
|
||||
PSA_BITS_TO_BYTES(attributes->core.bits), &P, &G);
|
||||
PSA_BITS_TO_BYTES(attributes->bits), &P, &G);
|
||||
|
||||
if (status != PSA_SUCCESS) {
|
||||
goto cleanup;
|
||||
|
@ -116,7 +116,7 @@ psa_status_t mbedtls_psa_rsa_import_key(
|
||||
mbedtls_rsa_context *rsa = NULL;
|
||||
|
||||
/* Parse input */
|
||||
status = mbedtls_psa_rsa_load_representation(attributes->core.type,
|
||||
status = mbedtls_psa_rsa_load_representation(attributes->type,
|
||||
data,
|
||||
data_length,
|
||||
&rsa);
|
||||
@ -130,7 +130,7 @@ psa_status_t mbedtls_psa_rsa_import_key(
|
||||
* representation in the key slot. Export representation in case of RSA is
|
||||
* the smallest representation that's allowed as input, so a straight-up
|
||||
* allocation of the same size as the input buffer will be large enough. */
|
||||
status = mbedtls_psa_rsa_export_key(attributes->core.type,
|
||||
status = mbedtls_psa_rsa_export_key(attributes->type,
|
||||
rsa,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
@ -196,7 +196,7 @@ psa_status_t mbedtls_psa_rsa_export_public_key(
|
||||
mbedtls_rsa_context *rsa = NULL;
|
||||
|
||||
status = mbedtls_psa_rsa_load_representation(
|
||||
attributes->core.type, key_buffer, key_buffer_size, &rsa);
|
||||
attributes->type, key_buffer, key_buffer_size, &rsa);
|
||||
if (status != PSA_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
@ -261,13 +261,13 @@ psa_status_t mbedtls_psa_rsa_generate_key(
|
||||
ret = mbedtls_rsa_gen_key(&rsa,
|
||||
mbedtls_psa_get_random,
|
||||
MBEDTLS_PSA_RANDOM_STATE,
|
||||
(unsigned int) attributes->core.bits,
|
||||
(unsigned int) attributes->bits,
|
||||
exponent);
|
||||
if (ret != 0) {
|
||||
return mbedtls_to_psa_error(ret);
|
||||
}
|
||||
|
||||
status = mbedtls_psa_rsa_export_key(attributes->core.type,
|
||||
status = mbedtls_psa_rsa_export_key(attributes->type,
|
||||
&rsa, key_buffer, key_buffer_size,
|
||||
key_buffer_length);
|
||||
mbedtls_rsa_free(&rsa);
|
||||
@ -325,7 +325,7 @@ psa_status_t mbedtls_psa_rsa_sign_hash(
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
mbedtls_md_type_t md_alg;
|
||||
|
||||
status = mbedtls_psa_rsa_load_representation(attributes->core.type,
|
||||
status = mbedtls_psa_rsa_load_representation(attributes->type,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
&rsa);
|
||||
@ -424,7 +424,7 @@ psa_status_t mbedtls_psa_rsa_verify_hash(
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
mbedtls_md_type_t md_alg;
|
||||
|
||||
status = mbedtls_psa_rsa_load_representation(attributes->core.type,
|
||||
status = mbedtls_psa_rsa_load_representation(attributes->type,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
&rsa);
|
||||
@ -536,11 +536,11 @@ psa_status_t mbedtls_psa_asymmetric_encrypt(const psa_key_attributes_t *attribut
|
||||
(void) output_size;
|
||||
(void) output_length;
|
||||
|
||||
if (PSA_KEY_TYPE_IS_RSA(attributes->core.type)) {
|
||||
if (PSA_KEY_TYPE_IS_RSA(attributes->type)) {
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP)
|
||||
mbedtls_rsa_context *rsa = NULL;
|
||||
status = mbedtls_psa_rsa_load_representation(attributes->core.type,
|
||||
status = mbedtls_psa_rsa_load_representation(attributes->type,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
&rsa);
|
||||
@ -632,11 +632,11 @@ psa_status_t mbedtls_psa_asymmetric_decrypt(const psa_key_attributes_t *attribut
|
||||
|
||||
*output_length = 0;
|
||||
|
||||
if (attributes->core.type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
|
||||
if (attributes->type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP)
|
||||
mbedtls_rsa_context *rsa = NULL;
|
||||
status = mbedtls_psa_rsa_load_representation(attributes->core.type,
|
||||
status = mbedtls_psa_rsa_load_representation(attributes->type,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
&rsa);
|
||||
|
@ -49,7 +49,7 @@ psa_status_t sign_hash(
|
||||
size_t signature_size,
|
||||
size_t *signature_length)
|
||||
{
|
||||
if (attributes->core.type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
|
||||
if (attributes->type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
|
||||
if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) ||
|
||||
PSA_ALG_IS_RSA_PSS(alg)) {
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
@ -71,7 +71,7 @@ psa_status_t sign_hash(
|
||||
} else {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
} else if (PSA_KEY_TYPE_IS_ECC(attributes->core.type)) {
|
||||
} else if (PSA_KEY_TYPE_IS_ECC(attributes->type)) {
|
||||
if (PSA_ALG_IS_ECDSA(alg)) {
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
(defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||
@ -116,7 +116,7 @@ psa_status_t verify_hash(
|
||||
const uint8_t *signature,
|
||||
size_t signature_length)
|
||||
{
|
||||
if (PSA_KEY_TYPE_IS_RSA(attributes->core.type)) {
|
||||
if (PSA_KEY_TYPE_IS_RSA(attributes->type)) {
|
||||
if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) ||
|
||||
PSA_ALG_IS_RSA_PSS(alg)) {
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
@ -138,7 +138,7 @@ psa_status_t verify_hash(
|
||||
} else {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
} else if (PSA_KEY_TYPE_IS_ECC(attributes->core.type)) {
|
||||
} else if (PSA_KEY_TYPE_IS_ECC(attributes->type)) {
|
||||
if (PSA_ALG_IS_ECDSA(alg)) {
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
(defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||
|
@ -61,7 +61,7 @@ void format_storage_data_check(data_t *key_data,
|
||||
|
||||
TEST_CALLOC(file_data, file_data_length);
|
||||
psa_format_key_data_for_storage(key_data->x, key_data->len,
|
||||
&attributes.core,
|
||||
&attributes,
|
||||
file_data);
|
||||
|
||||
TEST_MEMORY_COMPARE(expected_file_data->x, expected_file_data->len,
|
||||
@ -90,7 +90,7 @@ void parse_storage_data_check(data_t *file_data,
|
||||
|
||||
status = psa_parse_key_data_from_storage(file_data->x, file_data->len,
|
||||
&key_data, &key_data_length,
|
||||
&attributes.core);
|
||||
&attributes);
|
||||
|
||||
TEST_EQUAL(status, expected_status);
|
||||
if (status != PSA_SUCCESS) {
|
||||
|
@ -952,7 +952,7 @@ void key_creation_import_export(int lifetime_arg, int min_slot, int restart)
|
||||
psa_set_key_slot_number(&attributes, min_slot);
|
||||
|
||||
if (PSA_KEY_LIFETIME_IS_VOLATILE(lifetime)) {
|
||||
attributes.core.id = returned_id;
|
||||
attributes.id = returned_id;
|
||||
} else {
|
||||
psa_set_key_id(&attributes, returned_id);
|
||||
}
|
||||
|
@ -359,19 +359,19 @@ void mock_import(int mock_alloc_return_value,
|
||||
|
||||
if (mock_alloc_return_value == PSA_SUCCESS) {
|
||||
TEST_ASSERT(mbedtls_svc_key_id_equal(
|
||||
mock_import_data.attributes.core.id, id));
|
||||
mock_import_data.attributes.id, id));
|
||||
} else {
|
||||
TEST_ASSERT(MBEDTLS_SVC_KEY_ID_GET_KEY_ID(
|
||||
mock_import_data.attributes.core.id) == 0);
|
||||
mock_import_data.attributes.id) == 0);
|
||||
TEST_ASSERT(MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(
|
||||
mock_import_data.attributes.core.id) == 0);
|
||||
mock_import_data.attributes.id) == 0);
|
||||
}
|
||||
|
||||
TEST_ASSERT(mock_import_data.attributes.core.lifetime ==
|
||||
TEST_ASSERT(mock_import_data.attributes.lifetime ==
|
||||
(mock_alloc_return_value == PSA_SUCCESS ? lifetime : 0));
|
||||
TEST_ASSERT(mock_import_data.attributes.core.policy.usage ==
|
||||
TEST_ASSERT(mock_import_data.attributes.policy.usage ==
|
||||
(mock_alloc_return_value == PSA_SUCCESS ? PSA_KEY_USAGE_EXPORT : 0));
|
||||
TEST_ASSERT(mock_import_data.attributes.core.type ==
|
||||
TEST_ASSERT(mock_import_data.attributes.type ==
|
||||
(mock_alloc_return_value == PSA_SUCCESS ? PSA_KEY_TYPE_RAW_DATA : 0));
|
||||
|
||||
if (expected_result == PSA_SUCCESS) {
|
||||
@ -474,19 +474,19 @@ void mock_generate(int mock_alloc_return_value,
|
||||
|
||||
if (mock_alloc_return_value == PSA_SUCCESS) {
|
||||
TEST_ASSERT(mbedtls_svc_key_id_equal(
|
||||
mock_generate_data.attributes.core.id, id));
|
||||
mock_generate_data.attributes.id, id));
|
||||
} else {
|
||||
TEST_ASSERT(MBEDTLS_SVC_KEY_ID_GET_KEY_ID(
|
||||
mock_generate_data.attributes.core.id) == 0);
|
||||
mock_generate_data.attributes.id) == 0);
|
||||
TEST_ASSERT(MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(
|
||||
mock_generate_data.attributes.core.id) == 0);
|
||||
mock_generate_data.attributes.id) == 0);
|
||||
}
|
||||
|
||||
TEST_ASSERT(mock_generate_data.attributes.core.lifetime ==
|
||||
TEST_ASSERT(mock_generate_data.attributes.lifetime ==
|
||||
(mock_alloc_return_value == PSA_SUCCESS ? lifetime : 0));
|
||||
TEST_ASSERT(mock_generate_data.attributes.core.policy.usage ==
|
||||
TEST_ASSERT(mock_generate_data.attributes.policy.usage ==
|
||||
(mock_alloc_return_value == PSA_SUCCESS ? PSA_KEY_USAGE_EXPORT : 0));
|
||||
TEST_ASSERT(mock_generate_data.attributes.core.type ==
|
||||
TEST_ASSERT(mock_generate_data.attributes.type ==
|
||||
(mock_alloc_return_value == PSA_SUCCESS ? PSA_KEY_TYPE_RAW_DATA : 0));
|
||||
|
||||
if (expected_result == PSA_SUCCESS) {
|
||||
|
@ -458,7 +458,7 @@ void create_fail(int lifetime_arg, int id_arg,
|
||||
* PSA key attributes APIs thus accessing to the attributes
|
||||
* directly.
|
||||
*/
|
||||
attributes.core.id = id;
|
||||
attributes.id = id;
|
||||
} else {
|
||||
psa_set_key_id(&attributes, id);
|
||||
}
|
||||
@ -992,7 +992,7 @@ void non_reusable_key_slots_integrity_in_case_of_key_slot_starvation()
|
||||
* Check that we can now access the persistent key again.
|
||||
*/
|
||||
PSA_ASSERT(psa_get_key_attributes(persistent_key, &attributes));
|
||||
TEST_ASSERT(mbedtls_svc_key_id_equal(attributes.core.id,
|
||||
TEST_ASSERT(mbedtls_svc_key_id_equal(attributes.id,
|
||||
persistent_key));
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user