Skip to content

Commit

Permalink
pk: minor fix to code and comments
Browse files Browse the repository at this point in the history
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
  • Loading branch information
valeriosetti committed Mar 21, 2023
1 parent c5d33dd commit cc7296e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion library/pk.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ int mbedtls_pk_check_pair(const mbedtls_pk_context *pub,
if (pub->pk_info->type != MBEDTLS_PK_RSA) {
return prv->pk_info->check_pair_func(pub, prv, f_rng, p_rng);
} else
#endif
#endif /* MBEDTLS_USE_PSA_CRYPTO */
return prv->pk_info->check_pair_func(pub->pk_ctx, prv->pk_ctx, f_rng, p_rng);
}

Expand Down
10 changes: 5 additions & 5 deletions library/pkparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,9 @@ static int pk_use_ecparams(const mbedtls_asn1_buf *params, mbedtls_pk_context *p
if ((ret = pk_group_id_from_specified(params, &grp_id)) != 0) {
return ret;
}
#else
#else /* MBEDTLS_PK_PARSE_EC_EXTENDED */
return MBEDTLS_ERR_PK_KEY_INVALID_FORMAT;
#endif
#endif /* MBEDTLS_PK_PARSE_EC_EXTENDED */
}

ec_family = mbedtls_ecc_group_to_psa(grp_id, &bits);
Expand Down Expand Up @@ -588,7 +588,7 @@ static int pk_get_ecpubkey(unsigned char **p, const unsigned char *end,

return 0;
}
#else /* MBEDTLS_USE_PSA_CRYPTO*/
#else /* MBEDTLS_USE_PSA_CRYPTO */
/*
* Use EC parameters to initialise an EC group
*
Expand Down Expand Up @@ -1125,9 +1125,9 @@ static int pk_parse_key_sec1_der(mbedtls_ecp_keypair *eck,

#if defined(MBEDTLS_USE_PSA_CRYPTO)
if ((ret = pk_get_ecpubkey(&p, end2, pk)) == 0) {
#else
#else /* MBEDTLS_USE_PSA_CRYPTO */
if ((ret = pk_get_ecpubkey(&p, end2, eck)) == 0) {
#endif
#endif /* MBEDTLS_USE_PSA_CRYPTO */
pubkey_done = 1;
} else {
/*
Expand Down
2 changes: 1 addition & 1 deletion library/pkwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static int pk_write_ec_pubkey(unsigned char **p, unsigned char *start,

len = pk->pk_raw_len;

if ((*p - start) < (long int) len) {
if (((size_t)(*p - start)) < len) {
return MBEDTLS_ERR_PK_BUFFER_TOO_SMALL;
}

Expand Down

0 comments on commit cc7296e

Please sign in to comment.