mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-30 15:32:58 +00:00
pk: minor fixes (guards and a wrong assignment)
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
483738ed67
commit
c1541cb3c7
@ -213,7 +213,8 @@ typedef struct mbedtls_pk_rsassa_pss_options {
|
||||
* format and use PSA functions
|
||||
* - if !ECP_C then use new raw data and PSA functions directly.
|
||||
*/
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_ECP_C)
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_ECP_C) && \
|
||||
defined(MBEDTLS_ECP_LIGHT)
|
||||
#define MBEDTLS_PK_USE_PSA_EC_DATA
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO && !MBEDTLS_ECP_C */
|
||||
|
||||
@ -290,7 +291,7 @@ typedef struct mbedtls_pk_context {
|
||||
size_t MBEDTLS_PRIVATE(pub_raw_len); /**< Valid bytes in "pub_raw" */
|
||||
psa_ecc_family_t MBEDTLS_PRIVATE(ec_family); /**< EC family of pk */
|
||||
size_t MBEDTLS_PRIVATE(ec_bits); /**< Curve's bits of pk */
|
||||
#endif /* MBEDTLS_PK_USE_PSA_EC_PUB_KEY */
|
||||
#endif /* MBEDTLS_PK_USE_PSA_EC_DATA */
|
||||
} mbedtls_pk_context;
|
||||
|
||||
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
|
@ -194,6 +194,7 @@ void mbedtls_debug_print_ecp(const mbedtls_ssl_context *ssl, int level,
|
||||
}
|
||||
#endif /* MBEDTLS_ECP_LIGHT */
|
||||
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
#if defined(MBEDTLS_PK_USE_PSA_EC_DATA)
|
||||
void mbedtls_debug_print_psa_ec(const mbedtls_ssl_context *ssl, int level,
|
||||
const char *file, int line,
|
||||
@ -240,7 +241,6 @@ void mbedtls_debug_print_psa_ec(const mbedtls_ssl_context *ssl, int level,
|
||||
}
|
||||
#endif /* MBEDTLS_PK_USE_PSA_EC_DATA */
|
||||
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
void mbedtls_debug_print_mpi(const mbedtls_ssl_context *ssl, int level,
|
||||
const char *file, int line,
|
||||
const char *text, const mbedtls_mpi *X)
|
||||
|
@ -227,7 +227,7 @@ int mbedtls_pk_update_public_key_from_keypair(mbedtls_pk_context *pk,
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* MBEDTLS_PK_USE_PSA_EC_PUB_KEY */
|
||||
#endif /* MBEDTLS_PK_USE_PSA_EC_DATA */
|
||||
|
||||
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
|
||||
/*
|
||||
|
@ -1140,15 +1140,15 @@ static int eckey_check_pair_psa(mbedtls_pk_context *pub, mbedtls_pk_context *prv
|
||||
mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
|
||||
#if defined(MBEDTLS_PK_USE_PSA_EC_DATA)
|
||||
const psa_ecc_family_t curve = prv->ec_family;
|
||||
const size_t curve_bits = PSA_BITS_TO_BYTES(prv->ec_bits);
|
||||
const size_t curve_bits = prv->ec_bits;
|
||||
#else /* !MBEDTLS_PK_USE_PSA_EC_DATA */
|
||||
uint8_t pub_key_buf[MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH];
|
||||
size_t pub_key_len;
|
||||
size_t curve_bits;
|
||||
const psa_ecc_family_t curve =
|
||||
mbedtls_ecc_group_to_psa(mbedtls_pk_ec_ro(*prv)->grp.id, &curve_bits);
|
||||
const size_t curve_bytes = PSA_BITS_TO_BYTES(curve_bits);
|
||||
#endif /* !MBEDTLS_PK_USE_PSA_EC_DATA */
|
||||
const size_t curve_bytes = PSA_BITS_TO_BYTES(curve_bits);
|
||||
|
||||
psa_set_key_type(&key_attr, PSA_KEY_TYPE_ECC_KEY_PAIR(curve));
|
||||
psa_set_key_usage_flags(&key_attr, PSA_KEY_USAGE_EXPORT);
|
||||
|
Loading…
x
Reference in New Issue
Block a user