Skip to content

Commit 3f361e1

Browse files
committed
pk: minor fix to code and comments
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
1 parent 6468400 commit 3f361e1

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

library/pk.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ int mbedtls_pk_check_pair(const mbedtls_pk_context *pub,
819819
if (pub->pk_info->type != MBEDTLS_PK_RSA) {
820820
return prv->pk_info->check_pair_func(pub, prv, f_rng, p_rng);
821821
} else
822-
#endif
822+
#endif /* MBEDTLS_USE_PSA_CRYPTO */
823823
return prv->pk_info->check_pair_func(pub->pk_ctx, prv->pk_ctx, f_rng, p_rng);
824824
}
825825

library/pkparse.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,9 @@ static int pk_use_ecparams(const mbedtls_asn1_buf *params, mbedtls_pk_context *p
471471
if ((ret = pk_group_id_from_specified(params, &grp_id)) != 0) {
472472
return ret;
473473
}
474-
#else
474+
#else /* MBEDTLS_PK_PARSE_EC_EXTENDED */
475475
return MBEDTLS_ERR_PK_KEY_INVALID_FORMAT;
476-
#endif
476+
#endif /* MBEDTLS_PK_PARSE_EC_EXTENDED */
477477
}
478478

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

589589
return 0;
590590
}
591-
#else /* MBEDTLS_USE_PSA_CRYPTO*/
591+
#else /* MBEDTLS_USE_PSA_CRYPTO */
592592
/*
593593
* Use EC parameters to initialise an EC group
594594
*
@@ -1125,9 +1125,9 @@ static int pk_parse_key_sec1_der(mbedtls_ecp_keypair *eck,
11251125

11261126
#if defined(MBEDTLS_USE_PSA_CRYPTO)
11271127
if ((ret = pk_get_ecpubkey(&p, end2, pk)) == 0) {
1128-
#else
1128+
#else /* MBEDTLS_USE_PSA_CRYPTO */
11291129
if ((ret = pk_get_ecpubkey(&p, end2, eck)) == 0) {
1130-
#endif
1130+
#endif /* MBEDTLS_USE_PSA_CRYPTO */
11311131
pubkey_done = 1;
11321132
} else {
11331133
/*

library/pkwrite.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static int pk_write_ec_pubkey(unsigned char **p, unsigned char *start,
112112

113113
len = pk->pk_raw_len;
114114

115-
if ((*p - start) < (long int) len) {
115+
if (((size_t) (*p - start)) < len) {
116116
return MBEDTLS_ERR_PK_BUFFER_TOO_SMALL;
117117
}
118118

0 commit comments

Comments
 (0)