From cfe3752bd1bd944abe317d3dfd469d3ea2de7b9b Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Thu, 21 Oct 2021 15:58:34 +0900 Subject: experiment: Fix keygrip and signature for 448. Signed-off-by: NIIBE Yutaka --- g10/keyid.c | 9 +++++---- g10/sign.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/g10/keyid.c b/g10/keyid.c index 8264fe9d6..e365b84f0 100644 --- a/g10/keyid.c +++ b/g10/keyid.c @@ -1063,11 +1063,12 @@ keygrip_from_pk (PKT_public_key *pk, unsigned char *array) case PUBKEY_ALGO_ECDSA: case PUBKEY_ALGO_ECDH: { - char *curve = openpgp_oid_to_str (pk->pkey[0]); - if (!curve) + char *curve_oid = openpgp_oid_to_str (pk->pkey[0]); + if (!curve_oid) err = gpg_error_from_syserror (); else { + const char *curve = openpgp_oid_to_curve (curve_oid, 1); gcry_mpi_t pubkey = openpgp_ecc_parse_key (pk->pubkey_algo, curve, pk->pkey[1]); @@ -1078,8 +1079,8 @@ keygrip_from_pk (PKT_public_key *pk, unsigned char *array) && openpgp_oid_is_cv25519 (pk->pkey[0]))? "(public-key(ecc(curve%s)(flags djb-tweak)(q%m)))": "(public-key(ecc(curve%s)(q%m)))", - curve, pubkey); - xfree (curve); + curve_oid, pubkey); + xfree (curve_oid); gcry_mpi_release (pubkey); } } diff --git a/g10/sign.c b/g10/sign.c index c7bfff89c..4a0004381 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -441,7 +441,7 @@ sos_sig_448 (gcry_mpi_t r, gcry_mpi_t s) memcpy (p+1, p_r, 57); memcpy (p+1+57, p_s, 57); - a = gcry_mpi_set_opaque (NULL, p, 0); + a = gcry_mpi_set_opaque (NULL, p, 7+57*2*8); gcry_mpi_set_flag (a, GCRYMPI_FLAG_USER2); return a; } -- cgit v1.2.3