aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2021-10-21 06:58:34 +0000
committerNIIBE Yutaka <[email protected]>2021-10-21 06:58:34 +0000
commitcfe3752bd1bd944abe317d3dfd469d3ea2de7b9b (patch)
treec7db807e6ea8ff92183a232df80a82c77051dd9a
parentexperiment: Fix for 448 pubkey. (diff)
downloadgnupg-cfe3752bd1bd944abe317d3dfd469d3ea2de7b9b.tar.gz
gnupg-cfe3752bd1bd944abe317d3dfd469d3ea2de7b9b.zip
experiment: Fix keygrip and signature for 448.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--g10/keyid.c9
-rw-r--r--g10/sign.c2
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;
}