pk_internal: small renaming for mbedtls_pk_get_group_id()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
bcd305913f
commit
f9362b7324
6 changed files with 11 additions and 11 deletions
|
@ -85,7 +85,7 @@ static inline mbedtls_ecp_keypair *mbedtls_pk_ec_rw(const mbedtls_pk_context pk)
|
|||
#endif /* !MBEDTLS_PK_USE_PSA_EC_DATA */
|
||||
|
||||
#if defined(MBEDTLS_PK_HAVE_ECC_KEYS)
|
||||
static inline mbedtls_ecp_group_id mbedtls_pk_get_group_id(const mbedtls_pk_context *pk)
|
||||
static inline mbedtls_ecp_group_id mbedtls_pk_get_ec_group_id(const mbedtls_pk_context *pk)
|
||||
{
|
||||
mbedtls_ecp_group_id id;
|
||||
|
||||
|
@ -125,7 +125,7 @@ static inline mbedtls_ecp_group_id mbedtls_pk_get_group_id(const mbedtls_pk_cont
|
|||
|
||||
static inline int mbedtls_pk_is_rfc8410(const mbedtls_pk_context *pk)
|
||||
{
|
||||
mbedtls_ecp_group_id id = mbedtls_pk_get_group_id(pk);
|
||||
mbedtls_ecp_group_id id = mbedtls_pk_get_ec_group_id(pk);
|
||||
|
||||
return MBEDTLS_PK_IS_RFC8410_GROUP_ID(id);
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ static int pk_write_ec_rfc8410_der(unsigned char **p, unsigned char *buf,
|
|||
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(p, buf, len));
|
||||
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(p, buf, MBEDTLS_ASN1_OCTET_STRING));
|
||||
|
||||
grp_id = mbedtls_pk_get_group_id(pk);
|
||||
grp_id = mbedtls_pk_get_ec_group_id(pk);
|
||||
/* privateKeyAlgorithm */
|
||||
if ((ret = mbedtls_oid_get_oid_by_ec_grp_algid(grp_id, &oid, &oid_len)) != 0) {
|
||||
return ret;
|
||||
|
@ -452,7 +452,7 @@ static int pk_write_ec_der(unsigned char **p, unsigned char *buf,
|
|||
len += pub_len;
|
||||
|
||||
/* parameters */
|
||||
grp_id = mbedtls_pk_get_group_id(pk);
|
||||
grp_id = mbedtls_pk_get_ec_group_id(pk);
|
||||
MBEDTLS_ASN1_CHK_ADD(par_len, pk_write_ec_param(p, buf, grp_id));
|
||||
MBEDTLS_ASN1_CHK_ADD(par_len, mbedtls_asn1_write_len(p, buf, par_len));
|
||||
MBEDTLS_ASN1_CHK_ADD(par_len, mbedtls_asn1_write_tag(p, buf,
|
||||
|
@ -600,7 +600,7 @@ int mbedtls_pk_write_pubkey_der(const mbedtls_pk_context *key, unsigned char *bu
|
|||
pk_type = mbedtls_pk_get_type(key);
|
||||
#if defined(MBEDTLS_PK_HAVE_ECC_KEYS)
|
||||
if (pk_type == MBEDTLS_PK_ECKEY) {
|
||||
ec_grp_id = mbedtls_pk_get_group_id(key);
|
||||
ec_grp_id = mbedtls_pk_get_ec_group_id(key);
|
||||
}
|
||||
#endif /* MBEDTLS_PK_HAVE_ECC_KEYS */
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
|
@ -609,7 +609,7 @@ int mbedtls_pk_write_pubkey_der(const mbedtls_pk_context *key, unsigned char *bu
|
|||
#if defined(MBEDTLS_PK_HAVE_ECC_KEYS)
|
||||
if (PSA_KEY_TYPE_IS_ECC(opaque_key_type)) {
|
||||
pk_type = MBEDTLS_PK_ECKEY;
|
||||
ec_grp_id = mbedtls_pk_get_group_id(key);
|
||||
ec_grp_id = mbedtls_pk_get_ec_group_id(key);
|
||||
} else
|
||||
#endif /* MBEDTLS_PK_HAVE_ECC_KEYS */
|
||||
if (PSA_KEY_TYPE_IS_RSA(opaque_key_type)) {
|
||||
|
|
|
@ -7422,7 +7422,7 @@ static int ssl_parse_certificate_verify(mbedtls_ssl_context *ssl,
|
|||
/* and in the unlikely case the above assumption no longer holds
|
||||
* we are making sure that pk_ec() here does not return a NULL
|
||||
*/
|
||||
mbedtls_ecp_group_id grp_id = mbedtls_pk_get_group_id(pk);
|
||||
mbedtls_ecp_group_id grp_id = mbedtls_pk_get_ec_group_id(pk);
|
||||
if (grp_id == MBEDTLS_ECP_DP_NONE) {
|
||||
MBEDTLS_SSL_DEBUG_MSG(1, ("invalid group ID"));
|
||||
return MBEDTLS_ERR_SSL_INTERNAL_ERROR;
|
||||
|
|
|
@ -2016,7 +2016,7 @@ static int ssl_get_ecdh_params_from_cert(mbedtls_ssl_context *ssl)
|
|||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
uint16_t tls_id = 0;
|
||||
psa_key_type_t key_type = PSA_KEY_TYPE_NONE;
|
||||
mbedtls_ecp_group_id grp_id = mbedtls_pk_get_group_id(peer_pk);
|
||||
mbedtls_ecp_group_id grp_id = mbedtls_pk_get_ec_group_id(peer_pk);
|
||||
|
||||
if (mbedtls_ssl_check_curve(ssl, grp_id) != 0) {
|
||||
MBEDTLS_SSL_DEBUG_MSG(1, ("bad server certificate (ECDH curve)"));
|
||||
|
|
|
@ -664,7 +664,7 @@ static int ssl_check_key_curve(mbedtls_pk_context *pk,
|
|||
uint16_t *curves_tls_id)
|
||||
{
|
||||
uint16_t *curr_tls_id = curves_tls_id;
|
||||
mbedtls_ecp_group_id grp_id = mbedtls_pk_get_group_id(pk);
|
||||
mbedtls_ecp_group_id grp_id = mbedtls_pk_get_ec_group_id(pk);
|
||||
mbedtls_ecp_group_id curr_grp_id;
|
||||
|
||||
while (*curr_tls_id != 0) {
|
||||
|
@ -2651,7 +2651,7 @@ static int ssl_get_ecdh_params_from_cert(mbedtls_ssl_context *ssl)
|
|||
case MBEDTLS_PK_ECKEY_DH:
|
||||
case MBEDTLS_PK_ECDSA:
|
||||
key = mbedtls_pk_ec_rw(*pk);
|
||||
grp_id = mbedtls_pk_get_group_id(pk);
|
||||
grp_id = mbedtls_pk_get_ec_group_id(pk);
|
||||
if (grp_id == MBEDTLS_ECP_DP_NONE) {
|
||||
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ static int x509_profile_check_key(const mbedtls_x509_crt_profile *profile,
|
|||
if (pk_alg == MBEDTLS_PK_ECDSA ||
|
||||
pk_alg == MBEDTLS_PK_ECKEY ||
|
||||
pk_alg == MBEDTLS_PK_ECKEY_DH) {
|
||||
const mbedtls_ecp_group_id gid = mbedtls_pk_get_group_id(pk);
|
||||
const mbedtls_ecp_group_id gid = mbedtls_pk_get_ec_group_id(pk);
|
||||
|
||||
if (gid == MBEDTLS_ECP_DP_NONE) {
|
||||
return -1;
|
||||
|
|
Loading…
Reference in a new issue