pk_wrap: use specific lengths for EC's private key and key-pair
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
5bc52248ef
commit
1337a4f334
2 changed files with 5 additions and 4 deletions
|
@ -257,6 +257,9 @@ static inline int mbedtls_psa_get_ecc_oid_from_id(
|
||||||
#define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH \
|
#define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH \
|
||||||
PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS)
|
PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS)
|
||||||
|
|
||||||
|
#define MBEDTLS_PSA_MAX_EC_KEY_PAIR_LENGTH \
|
||||||
|
PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS)
|
||||||
|
|
||||||
/* Expose whatever RNG the PSA subsystem uses to applications using the
|
/* Expose whatever RNG the PSA subsystem uses to applications using the
|
||||||
* mbedtls_xxx API. The declarations and definitions here need to be
|
* mbedtls_xxx API. The declarations and definitions here need to be
|
||||||
* consistent with the implementation in library/psa_crypto_random_impl.h.
|
* consistent with the implementation in library/psa_crypto_random_impl.h.
|
||||||
|
|
|
@ -692,8 +692,7 @@ static int ecdsa_verify_wrap(void *ctx_arg, mbedtls_md_type_t md_alg,
|
||||||
/* This buffer contains first the public key (consisting of two public
|
/* This buffer contains first the public key (consisting of two public
|
||||||
* points plus a header byte), then the signature (consisting of two
|
* points plus a header byte), then the signature (consisting of two
|
||||||
* public points). Size it for the public key which is one byte larger. */
|
* public points). Size it for the public key which is one byte larger. */
|
||||||
unsigned char buf[PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(
|
unsigned char buf[MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH];
|
||||||
PSA_VENDOR_ECC_MAX_CURVE_BITS )];
|
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
psa_algorithm_t psa_sig_md = PSA_ALG_ECDSA_ANY;
|
psa_algorithm_t psa_sig_md = PSA_ALG_ECDSA_ANY;
|
||||||
size_t curve_bits;
|
size_t curve_bits;
|
||||||
|
@ -876,8 +875,7 @@ static int ecdsa_sign_wrap(void *ctx_arg, mbedtls_md_type_t md_alg,
|
||||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||||
mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
|
mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
|
||||||
psa_status_t status;
|
psa_status_t status;
|
||||||
unsigned char buf[PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE(
|
unsigned char buf[MBEDTLS_PSA_MAX_EC_KEY_PAIR_LENGTH];
|
||||||
PSA_VENDOR_ECC_MAX_CURVE_BITS )];
|
|
||||||
#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
|
#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
|
||||||
psa_algorithm_t psa_sig_md =
|
psa_algorithm_t psa_sig_md =
|
||||||
PSA_ALG_DETERMINISTIC_ECDSA( mbedtls_hash_info_psa_from_md( md_alg ) );
|
PSA_ALG_DETERMINISTIC_ECDSA( mbedtls_hash_info_psa_from_md( md_alg ) );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue