library: replace deprecated symbols with temporary _LEGACY ones
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
f87b505511
commit
8bb5763a85
11 changed files with 75 additions and 75 deletions
|
@ -307,7 +307,7 @@ symbols, where xxx can be: USE, IMPORT, EXPORT, GENERATE, DERIVE"
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
#if (defined(PSA_WANT_ALG_ECDSA) || \
|
#if (defined(PSA_WANT_ALG_ECDSA) || \
|
||||||
defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)) && \
|
defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)) && \
|
||||||
defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR)
|
defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY)
|
||||||
#define MBEDTLS_PK_HAVE_ECDSA
|
#define MBEDTLS_PK_HAVE_ECDSA
|
||||||
#endif
|
#endif
|
||||||
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
|
@ -318,7 +318,7 @@ symbols, where xxx can be: USE, IMPORT, EXPORT, GENERATE, DERIVE"
|
||||||
|
|
||||||
/* Helper for JPAKE dependencies, will be undefined at the end of the file */
|
/* Helper for JPAKE dependencies, will be undefined at the end of the file */
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
#if defined(PSA_WANT_ALG_JPAKE) && defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR)
|
#if defined(PSA_WANT_ALG_JPAKE) && defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY)
|
||||||
#define MBEDTLS_PK_HAVE_JPAKE
|
#define MBEDTLS_PK_HAVE_JPAKE
|
||||||
#endif
|
#endif
|
||||||
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
|
@ -329,7 +329,7 @@ symbols, where xxx can be: USE, IMPORT, EXPORT, GENERATE, DERIVE"
|
||||||
|
|
||||||
/* Helper for ECDH dependencies, will be undefined at the end of the file */
|
/* Helper for ECDH dependencies, will be undefined at the end of the file */
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
#if defined(PSA_WANT_ALG_ECDH) && defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR)
|
#if defined(PSA_WANT_ALG_ECDH) && defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY)
|
||||||
#define MBEDTLS_PK_HAVE_ECDH
|
#define MBEDTLS_PK_HAVE_ECDH
|
||||||
#endif
|
#endif
|
||||||
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
|
|
|
@ -184,7 +184,7 @@ typedef struct mbedtls_pk_rsassa_pss_options {
|
||||||
#endif
|
#endif
|
||||||
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
#if defined(PSA_WANT_ALG_ECDSA)
|
#if defined(PSA_WANT_ALG_ECDSA)
|
||||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR)
|
#if defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY)
|
||||||
#define MBEDTLS_PK_CAN_ECDSA_SIGN
|
#define MBEDTLS_PK_CAN_ECDSA_SIGN
|
||||||
#endif
|
#endif
|
||||||
#if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
|
#if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
|
||||||
|
|
|
@ -341,7 +341,7 @@ extern const mbedtls_error_pair_t psa_to_ssl_errors[7];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) || \
|
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
|
defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY)
|
||||||
extern const mbedtls_error_pair_t psa_to_pk_rsa_errors[8];
|
extern const mbedtls_error_pair_t psa_to_pk_rsa_errors[8];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -42,13 +42,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) && \
|
#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) && \
|
||||||
!(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \
|
!(defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY))
|
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY))
|
||||||
#error "PSA_WANT_ALG_DETERMINISTIC_ECDSA defined, but not all prerequisites"
|
#error "PSA_WANT_ALG_DETERMINISTIC_ECDSA defined, but not all prerequisites"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PSA_WANT_ALG_ECDSA) && \
|
#if defined(PSA_WANT_ALG_ECDSA) && \
|
||||||
!(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \
|
!(defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY))
|
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY))
|
||||||
#error "PSA_WANT_ALG_ECDSA defined, but not all prerequisites"
|
#error "PSA_WANT_ALG_ECDSA defined, but not all prerequisites"
|
||||||
#endif
|
#endif
|
||||||
|
@ -60,32 +60,32 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT) && \
|
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT) && \
|
||||||
!(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
|
!(defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
|
defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
|
||||||
#error "PSA_WANT_ALG_RSA_PKCS1V15_CRYPT defined, but not all prerequisites"
|
#error "PSA_WANT_ALG_RSA_PKCS1V15_CRYPT defined, but not all prerequisites"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) && \
|
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) && \
|
||||||
!(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
|
!(defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
|
defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
|
||||||
#error "PSA_WANT_ALG_RSA_PKCS1V15_SIGN defined, but not all prerequisites"
|
#error "PSA_WANT_ALG_RSA_PKCS1V15_SIGN defined, but not all prerequisites"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PSA_WANT_ALG_RSA_OAEP) && \
|
#if defined(PSA_WANT_ALG_RSA_OAEP) && \
|
||||||
!(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
|
!(defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
|
defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
|
||||||
#error "PSA_WANT_ALG_RSA_OAEP defined, but not all prerequisites"
|
#error "PSA_WANT_ALG_RSA_OAEP defined, but not all prerequisites"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PSA_WANT_ALG_RSA_PSS) && \
|
#if defined(PSA_WANT_ALG_RSA_PSS) && \
|
||||||
!(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
|
!(defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
|
defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
|
||||||
#error "PSA_WANT_ALG_RSA_PSS defined, but not all prerequisites"
|
#error "PSA_WANT_ALG_RSA_PSS defined, but not all prerequisites"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) && \
|
#if defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY) && \
|
||||||
!defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
|
!defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
|
||||||
#error "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR defined, but not all prerequisites"
|
#error "MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY defined, but not all prerequisites"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && defined(MBEDTLS_USE_PSA_CRYPTO) && \
|
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && defined(MBEDTLS_USE_PSA_CRYPTO) && \
|
||||||
|
|
|
@ -97,7 +97,7 @@ int mbedtls_pk_error_from_psa(psa_status_t status)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) || \
|
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
|
defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY)
|
||||||
int mbedtls_pk_error_from_psa_rsa(psa_status_t status)
|
int mbedtls_pk_error_from_psa_rsa(psa_status_t status)
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
|
@ -134,7 +134,7 @@ int mbedtls_pk_error_from_psa_rsa(psa_status_t status)
|
||||||
return MBEDTLS_ERR_ERROR_GENERIC_ERROR;
|
return MBEDTLS_ERR_ERROR_GENERIC_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || PSA_WANT_KEY_TYPE_RSA_KEY_PAIR */
|
#endif /* PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY */
|
||||||
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
|
@ -1739,7 +1739,7 @@ const mbedtls_pk_info_t mbedtls_pk_ecdsa_opaque_info = {
|
||||||
NULL, /* debug - could be done later, or even left NULL */
|
NULL, /* debug - could be done later, or even left NULL */
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
|
#if defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY)
|
||||||
static int pk_opaque_rsa_decrypt(mbedtls_pk_context *pk,
|
static int pk_opaque_rsa_decrypt(mbedtls_pk_context *pk,
|
||||||
const unsigned char *input, size_t ilen,
|
const unsigned char *input, size_t ilen,
|
||||||
unsigned char *output, size_t *olen, size_t osize,
|
unsigned char *output, size_t *olen, size_t osize,
|
||||||
|
@ -1761,7 +1761,7 @@ static int pk_opaque_rsa_decrypt(mbedtls_pk_context *pk,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR */
|
#endif /* MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY */
|
||||||
|
|
||||||
const mbedtls_pk_info_t mbedtls_pk_rsa_opaque_info = {
|
const mbedtls_pk_info_t mbedtls_pk_rsa_opaque_info = {
|
||||||
MBEDTLS_PK_OPAQUE,
|
MBEDTLS_PK_OPAQUE,
|
||||||
|
@ -1774,7 +1774,7 @@ const mbedtls_pk_info_t mbedtls_pk_rsa_opaque_info = {
|
||||||
NULL, /* restartable verify - not relevant */
|
NULL, /* restartable verify - not relevant */
|
||||||
NULL, /* restartable sign - not relevant */
|
NULL, /* restartable sign - not relevant */
|
||||||
#endif
|
#endif
|
||||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
|
#if defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY)
|
||||||
pk_opaque_rsa_decrypt,
|
pk_opaque_rsa_decrypt,
|
||||||
#else
|
#else
|
||||||
NULL, /* decrypt - not available */
|
NULL, /* decrypt - not available */
|
||||||
|
|
|
@ -150,9 +150,9 @@ int MBEDTLS_DEPRECATED mbedtls_pk_error_from_psa_ecdsa(psa_status_t status);
|
||||||
int MBEDTLS_DEPRECATED mbedtls_pk_error_from_psa(psa_status_t status);
|
int MBEDTLS_DEPRECATED mbedtls_pk_error_from_psa(psa_status_t status);
|
||||||
|
|
||||||
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) || \
|
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
|
defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY)
|
||||||
int MBEDTLS_DEPRECATED mbedtls_pk_error_from_psa_rsa(psa_status_t status);
|
int MBEDTLS_DEPRECATED mbedtls_pk_error_from_psa_rsa(psa_status_t status);
|
||||||
#endif /* PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || PSA_WANT_KEY_TYPE_RSA_KEY_PAIR */
|
#endif /* PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY */
|
||||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||||
|
|
||||||
#if defined(MBEDTLS_RSA_C)
|
#if defined(MBEDTLS_RSA_C)
|
||||||
|
|
|
@ -129,9 +129,9 @@ int psa_can_do_hash(psa_algorithm_t hash_alg)
|
||||||
(void) hash_alg;
|
(void) hash_alg;
|
||||||
return global_data.drivers_initialized;
|
return global_data.drivers_initialized;
|
||||||
}
|
}
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) || \
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR)
|
defined(MBEDTLS_PSA_WANT_KEY_TYPE_DH_KEY_PAIR_LEGACY)
|
||||||
static int psa_is_dh_key_size_valid(size_t bits)
|
static int psa_is_dh_key_size_valid(size_t bits)
|
||||||
{
|
{
|
||||||
if (bits != 2048 && bits != 3072 && bits != 4096 &&
|
if (bits != 2048 && bits != 3072 && bits != 4096 &&
|
||||||
|
@ -141,9 +141,9 @@ static int psa_is_dh_key_size_valid(size_t bits)
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR ||
|
#endif /* MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY ||
|
||||||
MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY ||
|
MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY ||
|
||||||
PSA_WANT_KEY_TYPE_DH_KEY_PAIR */
|
MBEDTLS_PSA_WANT_KEY_TYPE_DH_KEY_PAIR_LEGACY */
|
||||||
|
|
||||||
psa_status_t mbedtls_to_psa_error(int ret)
|
psa_status_t mbedtls_to_psa_error(int ret)
|
||||||
{
|
{
|
||||||
|
@ -640,7 +640,7 @@ psa_status_t psa_import_key_into_slot(
|
||||||
|
|
||||||
return PSA_SUCCESS;
|
return PSA_SUCCESS;
|
||||||
} else if (PSA_KEY_TYPE_IS_ASYMMETRIC(type)) {
|
} else if (PSA_KEY_TYPE_IS_ASYMMETRIC(type)) {
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY)
|
||||||
if (PSA_KEY_TYPE_IS_DH(type)) {
|
if (PSA_KEY_TYPE_IS_DH(type)) {
|
||||||
if (psa_is_dh_key_size_valid(PSA_BYTES_TO_BITS(data_length)) == 0) {
|
if (psa_is_dh_key_size_valid(PSA_BYTES_TO_BITS(data_length)) == 0) {
|
||||||
|
@ -652,9 +652,9 @@ psa_status_t psa_import_key_into_slot(
|
||||||
key_buffer_length,
|
key_buffer_length,
|
||||||
bits);
|
bits);
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) */
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
|
||||||
if (PSA_KEY_TYPE_IS_ECC(type)) {
|
if (PSA_KEY_TYPE_IS_ECC(type)) {
|
||||||
return mbedtls_psa_ecp_import_key(attributes,
|
return mbedtls_psa_ecp_import_key(attributes,
|
||||||
|
@ -663,9 +663,9 @@ psa_status_t psa_import_key_into_slot(
|
||||||
key_buffer_length,
|
key_buffer_length,
|
||||||
bits);
|
bits);
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) */
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||||
if (PSA_KEY_TYPE_IS_RSA(type)) {
|
if (PSA_KEY_TYPE_IS_RSA(type)) {
|
||||||
return mbedtls_psa_rsa_import_key(attributes,
|
return mbedtls_psa_rsa_import_key(attributes,
|
||||||
|
@ -674,7 +674,7 @@ psa_status_t psa_import_key_into_slot(
|
||||||
key_buffer_length,
|
key_buffer_length,
|
||||||
bits);
|
bits);
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1202,7 +1202,7 @@ exit:
|
||||||
return overall_status;
|
return overall_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||||
static psa_status_t psa_get_rsa_public_exponent(
|
static psa_status_t psa_get_rsa_public_exponent(
|
||||||
const mbedtls_rsa_context *rsa,
|
const mbedtls_rsa_context *rsa,
|
||||||
|
@ -1244,7 +1244,7 @@ exit:
|
||||||
}
|
}
|
||||||
return mbedtls_to_psa_error(ret);
|
return mbedtls_to_psa_error(ret);
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
||||||
|
|
||||||
/** Retrieve all the publicly-accessible attributes of a key.
|
/** Retrieve all the publicly-accessible attributes of a key.
|
||||||
|
@ -1275,7 +1275,7 @@ psa_status_t psa_get_key_attributes(mbedtls_svc_key_id_t key,
|
||||||
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
|
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
|
||||||
|
|
||||||
switch (slot->attr.type) {
|
switch (slot->attr.type) {
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||||
case PSA_KEY_TYPE_RSA_KEY_PAIR:
|
case PSA_KEY_TYPE_RSA_KEY_PAIR:
|
||||||
case PSA_KEY_TYPE_RSA_PUBLIC_KEY:
|
case PSA_KEY_TYPE_RSA_PUBLIC_KEY:
|
||||||
|
@ -1301,7 +1301,7 @@ psa_status_t psa_get_key_attributes(mbedtls_svc_key_id_t key,
|
||||||
mbedtls_free(rsa);
|
mbedtls_free(rsa);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
||||||
default:
|
default:
|
||||||
/* Nothing else to do. */
|
/* Nothing else to do. */
|
||||||
|
@ -1431,7 +1431,7 @@ psa_status_t psa_export_public_key_internal(
|
||||||
key_buffer, key_buffer_size,
|
key_buffer, key_buffer_size,
|
||||||
data, data_size, data_length);
|
data, data_size, data_length);
|
||||||
} else if (PSA_KEY_TYPE_IS_RSA(type)) {
|
} else if (PSA_KEY_TYPE_IS_RSA(type)) {
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||||
return mbedtls_psa_rsa_export_public_key(attributes,
|
return mbedtls_psa_rsa_export_public_key(attributes,
|
||||||
key_buffer,
|
key_buffer,
|
||||||
|
@ -1442,10 +1442,10 @@ psa_status_t psa_export_public_key_internal(
|
||||||
#else
|
#else
|
||||||
/* We don't know how to convert a private RSA key to public. */
|
/* We don't know how to convert a private RSA key to public. */
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
||||||
} else if (PSA_KEY_TYPE_IS_ECC(type)) {
|
} else if (PSA_KEY_TYPE_IS_ECC(type)) {
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
|
||||||
return mbedtls_psa_ecp_export_public_key(attributes,
|
return mbedtls_psa_ecp_export_public_key(attributes,
|
||||||
key_buffer,
|
key_buffer,
|
||||||
|
@ -1456,10 +1456,10 @@ psa_status_t psa_export_public_key_internal(
|
||||||
#else
|
#else
|
||||||
/* We don't know how to convert a private ECC key to public */
|
/* We don't know how to convert a private ECC key to public */
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) */
|
||||||
} else if (PSA_KEY_TYPE_IS_DH(type)) {
|
} else if (PSA_KEY_TYPE_IS_DH(type)) {
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY)
|
||||||
return mbedtls_psa_export_ffdh_public_key(attributes,
|
return mbedtls_psa_export_ffdh_public_key(attributes,
|
||||||
key_buffer,
|
key_buffer,
|
||||||
|
@ -1468,7 +1468,7 @@ psa_status_t psa_export_public_key_internal(
|
||||||
data_length);
|
data_length);
|
||||||
#else
|
#else
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) */
|
||||||
} else {
|
} else {
|
||||||
(void) key_buffer;
|
(void) key_buffer;
|
||||||
|
@ -1907,7 +1907,7 @@ static psa_status_t psa_validate_optional_attributes(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attributes->domain_parameters_size != 0) {
|
if (attributes->domain_parameters_size != 0) {
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||||
if (PSA_KEY_TYPE_IS_RSA(slot->attr.type)) {
|
if (PSA_KEY_TYPE_IS_RSA(slot->attr.type)) {
|
||||||
mbedtls_rsa_context *rsa = NULL;
|
mbedtls_rsa_context *rsa = NULL;
|
||||||
|
@ -1948,7 +1948,7 @@ rsa_exit:
|
||||||
return mbedtls_to_psa_error(ret);
|
return mbedtls_to_psa_error(ret);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
||||||
{
|
{
|
||||||
return PSA_ERROR_INVALID_ARGUMENT;
|
return PSA_ERROR_INVALID_ARGUMENT;
|
||||||
|
@ -5728,7 +5728,7 @@ static void psa_des_set_key_parity(uint8_t *data, size_t data_size)
|
||||||
* Note: Function allocates memory for *data buffer, so given *data should be
|
* Note: Function allocates memory for *data buffer, so given *data should be
|
||||||
* always NULL.
|
* always NULL.
|
||||||
*/
|
*/
|
||||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) || \
|
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) || \
|
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) || \
|
||||||
|
@ -5897,7 +5897,7 @@ static psa_status_t psa_generate_derived_ecc_key_montgomery_helper(
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#endif /* defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY) ||
|
||||||
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) ||
|
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) ||
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) ||
|
defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) ||
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) ||
|
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) ||
|
||||||
|
@ -5917,7 +5917,7 @@ static psa_status_t psa_generate_derived_key_internal(
|
||||||
return PSA_ERROR_INVALID_ARGUMENT;
|
return PSA_ERROR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) || \
|
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) || \
|
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) || \
|
||||||
|
@ -5938,7 +5938,7 @@ static psa_status_t psa_generate_derived_key_internal(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY) ||
|
||||||
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) ||
|
defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) ||
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) ||
|
defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) ||
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) ||
|
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) ||
|
||||||
|
@ -7299,7 +7299,7 @@ static psa_status_t psa_validate_key_type_and_size_for_key_generation(
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
|
#if defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY)
|
||||||
if (PSA_KEY_TYPE_IS_RSA(type) && PSA_KEY_TYPE_IS_KEY_PAIR(type)) {
|
if (PSA_KEY_TYPE_IS_RSA(type) && PSA_KEY_TYPE_IS_KEY_PAIR(type)) {
|
||||||
if (bits > PSA_VENDOR_RSA_MAX_KEY_BITS) {
|
if (bits > PSA_VENDOR_RSA_MAX_KEY_BITS) {
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
|
@ -7311,22 +7311,22 @@ static psa_status_t psa_validate_key_type_and_size_for_key_generation(
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) */
|
#endif /* defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY) */
|
||||||
|
|
||||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR)
|
#if defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY)
|
||||||
if (PSA_KEY_TYPE_IS_ECC(type) && PSA_KEY_TYPE_IS_KEY_PAIR(type)) {
|
if (PSA_KEY_TYPE_IS_ECC(type) && PSA_KEY_TYPE_IS_KEY_PAIR(type)) {
|
||||||
/* To avoid empty block, return successfully here. */
|
/* To avoid empty block, return successfully here. */
|
||||||
return PSA_SUCCESS;
|
return PSA_SUCCESS;
|
||||||
} else
|
} else
|
||||||
#endif /* defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) */
|
#endif /* defined(MBEDTLS_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_LEGACY) */
|
||||||
|
|
||||||
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR)
|
#if defined(MBEDTLS_PSA_WANT_KEY_TYPE_DH_KEY_PAIR_LEGACY)
|
||||||
if (PSA_KEY_TYPE_IS_DH(type) && PSA_KEY_TYPE_IS_KEY_PAIR(type)) {
|
if (PSA_KEY_TYPE_IS_DH(type) && PSA_KEY_TYPE_IS_KEY_PAIR(type)) {
|
||||||
if (psa_is_dh_key_size_valid(bits) == 0) {
|
if (psa_is_dh_key_size_valid(bits) == 0) {
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR) */
|
#endif /* defined(MBEDTLS_PSA_WANT_KEY_TYPE_DH_KEY_PAIR_LEGACY) */
|
||||||
{
|
{
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
@ -7359,7 +7359,7 @@ psa_status_t psa_generate_key_internal(
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES */
|
#endif /* MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES */
|
||||||
} else
|
} else
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) && \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) && \
|
||||||
defined(MBEDTLS_GENPRIME)
|
defined(MBEDTLS_GENPRIME)
|
||||||
if (type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
|
if (type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
|
||||||
return mbedtls_psa_rsa_generate_key(attributes,
|
return mbedtls_psa_rsa_generate_key(attributes,
|
||||||
|
@ -7367,26 +7367,26 @@ psa_status_t psa_generate_key_internal(
|
||||||
key_buffer_size,
|
key_buffer_size,
|
||||||
key_buffer_length);
|
key_buffer_length);
|
||||||
} else
|
} else
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR)
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY)
|
||||||
* defined(MBEDTLS_GENPRIME) */
|
* defined(MBEDTLS_GENPRIME) */
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR)
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY)
|
||||||
if (PSA_KEY_TYPE_IS_ECC(type) && PSA_KEY_TYPE_IS_KEY_PAIR(type)) {
|
if (PSA_KEY_TYPE_IS_ECC(type) && PSA_KEY_TYPE_IS_KEY_PAIR(type)) {
|
||||||
return mbedtls_psa_ecp_generate_key(attributes,
|
return mbedtls_psa_ecp_generate_key(attributes,
|
||||||
key_buffer,
|
key_buffer,
|
||||||
key_buffer_size,
|
key_buffer_size,
|
||||||
key_buffer_length);
|
key_buffer_length);
|
||||||
} else
|
} else
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) */
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY) */
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR)
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY)
|
||||||
if (PSA_KEY_TYPE_IS_DH(type) && PSA_KEY_TYPE_IS_KEY_PAIR(type)) {
|
if (PSA_KEY_TYPE_IS_DH(type) && PSA_KEY_TYPE_IS_KEY_PAIR(type)) {
|
||||||
return mbedtls_psa_ffdh_generate_key(attributes,
|
return mbedtls_psa_ffdh_generate_key(attributes,
|
||||||
key_buffer,
|
key_buffer,
|
||||||
key_buffer_size,
|
key_buffer_size,
|
||||||
key_buffer_length);
|
key_buffer_length);
|
||||||
} else
|
} else
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR) */
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY) */
|
||||||
{
|
{
|
||||||
(void) key_buffer_length;
|
(void) key_buffer_length;
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <mbedtls/ecp.h>
|
#include <mbedtls/ecp.h>
|
||||||
#include <mbedtls/error.h>
|
#include <mbedtls/error.h>
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) || \
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) || \
|
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) || \
|
||||||
|
@ -150,13 +150,13 @@ exit:
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) ||
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) ||
|
* defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) ||
|
* defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_ALG_ECDH) */
|
* defined(MBEDTLS_PSA_BUILTIN_ALG_ECDH) */
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
|
||||||
|
|
||||||
psa_status_t mbedtls_psa_ecp_import_key(
|
psa_status_t mbedtls_psa_ecp_import_key(
|
||||||
|
@ -277,10 +277,10 @@ psa_status_t mbedtls_psa_ecp_export_public_key(
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) */
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR)
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY)
|
||||||
psa_status_t mbedtls_psa_ecp_generate_key(
|
psa_status_t mbedtls_psa_ecp_generate_key(
|
||||||
const psa_key_attributes_t *attributes,
|
const psa_key_attributes_t *attributes,
|
||||||
uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length)
|
uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length)
|
||||||
|
@ -325,7 +325,7 @@ psa_status_t mbedtls_psa_ecp_generate_key(
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) */
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_LEGACY) */
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
/* ECDSA sign/verify */
|
/* ECDSA sign/verify */
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "psa_crypto_random_impl.h"
|
#include "psa_crypto_random_impl.h"
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) || \
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_FFDH)
|
defined(MBEDTLS_PSA_BUILTIN_ALG_FFDH)
|
||||||
static psa_status_t mbedtls_psa_ffdh_set_prime_generator(size_t key_size,
|
static psa_status_t mbedtls_psa_ffdh_set_prime_generator(size_t key_size,
|
||||||
|
@ -117,11 +117,11 @@ cleanup:
|
||||||
|
|
||||||
return PSA_SUCCESS;
|
return PSA_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR ||
|
#endif /* MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY ||
|
||||||
MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY ||
|
MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY ||
|
||||||
MBEDTLS_PSA_BUILTIN_ALG_FFDH */
|
MBEDTLS_PSA_BUILTIN_ALG_FFDH */
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY)
|
||||||
psa_status_t mbedtls_psa_export_ffdh_public_key(
|
psa_status_t mbedtls_psa_export_ffdh_public_key(
|
||||||
const psa_key_attributes_t *attributes,
|
const psa_key_attributes_t *attributes,
|
||||||
|
@ -228,7 +228,7 @@ psa_status_t mbedtls_psa_ffdh_import_key(
|
||||||
return PSA_SUCCESS;
|
return PSA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR ||
|
#endif /* MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_LEGACY ||
|
||||||
MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY */
|
MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY */
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_FFDH)
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_FFDH)
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP) || \
|
defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) || \
|
defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS) || \
|
defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||||
|
|
||||||
/* Mbed TLS doesn't support non-byte-aligned key sizes (i.e. key sizes
|
/* Mbed TLS doesn't support non-byte-aligned key sizes (i.e. key sizes
|
||||||
|
@ -123,10 +123,10 @@ exit:
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP) ||
|
* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) ||
|
* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS) ||
|
* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) ||
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) || \
|
||||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||||
|
|
||||||
psa_status_t mbedtls_psa_rsa_import_key(
|
psa_status_t mbedtls_psa_rsa_import_key(
|
||||||
|
@ -235,10 +235,10 @@ psa_status_t mbedtls_psa_rsa_export_public_key(
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) ||
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) ||
|
||||||
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) */
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) && \
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY) && \
|
||||||
defined(MBEDTLS_GENPRIME)
|
defined(MBEDTLS_GENPRIME)
|
||||||
static psa_status_t psa_rsa_read_exponent(const uint8_t *domain_parameters,
|
static psa_status_t psa_rsa_read_exponent(const uint8_t *domain_parameters,
|
||||||
size_t domain_parameters_size,
|
size_t domain_parameters_size,
|
||||||
|
@ -301,7 +301,7 @@ psa_status_t mbedtls_psa_rsa_generate_key(
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR)
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY)
|
||||||
* defined(MBEDTLS_GENPRIME) */
|
* defined(MBEDTLS_GENPRIME) */
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
|
@ -64,7 +64,7 @@ const mbedtls_error_pair_t psa_to_ssl_errors[] =
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) || \
|
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) || \
|
||||||
defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
|
defined(MBEDTLS_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY)
|
||||||
const mbedtls_error_pair_t psa_to_pk_rsa_errors[] =
|
const mbedtls_error_pair_t psa_to_pk_rsa_errors[] =
|
||||||
{
|
{
|
||||||
{ PSA_SUCCESS, 0 },
|
{ PSA_SUCCESS, 0 },
|
||||||
|
|
Loading…
Reference in a new issue