mirror of
https://github.com/polhenarejos/pico-openpgp.git
synced 2026-05-28 17:11:24 +02:00
Use ecp keypair calc public instead.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Submodule pico-keys-sdk updated: 92b8c644d8...9cb83e3abc
@@ -175,15 +175,7 @@ int cmd_import_data(void) {
|
||||
mbedtls_ecp_keypair_free(&ecdsa);
|
||||
return SW_EXEC_ERROR();
|
||||
}
|
||||
#ifdef MBEDTLS_EDDSA_C
|
||||
if (ecdsa.grp.id == MBEDTLS_ECP_DP_ED25519) {
|
||||
r = mbedtls_ecp_point_edwards(&ecdsa.grp, &ecdsa.Q, &ecdsa.d, random_fill_iterator, NULL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
r = mbedtls_ecp_mul(&ecdsa.grp, &ecdsa.Q, &ecdsa.d, &ecdsa.grp.G, random_fill_iterator, NULL);
|
||||
}
|
||||
r = mbedtls_ecp_keypair_calc_public(&ecdsa, random_fill_iterator, NULL);
|
||||
if (r != 0) {
|
||||
mbedtls_ecp_keypair_free(&ecdsa);
|
||||
return SW_EXEC_ERROR();
|
||||
|
||||
@@ -738,17 +738,9 @@ int load_private_key_ecdsa(mbedtls_ecp_keypair *ctx, file_t *fkey, bool use_dek)
|
||||
return PICOKEYS_EXEC_ERROR;
|
||||
}
|
||||
mbedtls_platform_zeroize(kdata, sizeof(kdata));
|
||||
#ifdef MBEDTLS_EDDSA_C
|
||||
if (ctx->grp.id == MBEDTLS_ECP_DP_ED25519 || ctx->grp.id == MBEDTLS_ECP_DP_ED448) {
|
||||
r = mbedtls_ecp_point_edwards(&ctx->grp, &ctx->Q, &ctx->d, random_fill_iterator, NULL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
r = mbedtls_ecp_mul(&ctx->grp, &ctx->Q, &ctx->d, &ctx->grp.G, random_fill_iterator, NULL);
|
||||
}
|
||||
r = mbedtls_ecp_keypair_calc_public(ctx, random_fill_iterator, NULL);
|
||||
if (r != 0) {
|
||||
mbedtls_ecdsa_free(ctx);
|
||||
mbedtls_ecp_keypair_free(ctx);
|
||||
return PICOKEYS_EXEC_ERROR;
|
||||
}
|
||||
return PICOKEYS_OK;
|
||||
|
||||
@@ -1335,7 +1335,7 @@ static int cmd_import_asym(void) {
|
||||
mbedtls_ecdsa_free(&ecdsa);
|
||||
return SW_EXEC_ERROR();
|
||||
}
|
||||
r = mbedtls_ecp_mul(&ecdsa.grp, &ecdsa.Q, &ecdsa.d, &ecdsa.grp.G, random_fill_iterator, NULL);
|
||||
r = mbedtls_ecp_keypair_calc_public(&ecdsa, random_fill_iterator, NULL);
|
||||
if (r != 0) {
|
||||
mbedtls_ecdsa_free(&ecdsa);
|
||||
return SW_EXEC_ERROR();
|
||||
|
||||
Reference in New Issue
Block a user