aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2021-10-28 05:23:15 +0000
committerNIIBE Yutaka <[email protected]>2021-10-28 05:23:15 +0000
commitb1a2e1904e0c694755f21b453e063173b4e474f5 (patch)
treeca5b9098f1fecdcce8513bd91e8b55c942bcd57a
parentexperiment: Fix importing new448 secret key. (diff)
downloadgnupg-b1a2e1904e0c694755f21b453e063173b4e474f5.tar.gz
gnupg-b1a2e1904e0c694755f21b453e063173b4e474f5.zip
experiment: Fix exporting protecte secret key for new448.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--agent/cvt-openpgp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/agent/cvt-openpgp.c b/agent/cvt-openpgp.c
index 939b1d837..a8d11eb65 100644
--- a/agent/cvt-openpgp.c
+++ b/agent/cvt-openpgp.c
@@ -1477,6 +1477,27 @@ convert_to_openpgp (ctrl_t ctrl, gcry_sexp_t s_key, const char *passphrase,
if (err)
return err;
+ if (curve)
+ {
+ const char *curvename;
+ int pubkey_algo;
+
+ curvename = gcry_sexp_nth_string (curve, 1);
+
+ if (curvename && !strcmp (curvename, "Ed448"))
+ pubkey_algo = PUBKEY_ALGO_EDDSA;
+ else if (curvename && !strcmp (curvename, "X448"))
+ pubkey_algo = PUBKEY_ALGO_ECDH;
+ else
+ pubkey_algo = 0;
+
+ if (pubkey_algo)
+ {
+ err = openpgp_fixup_key_448 (pubkey_algo, &array[0]);
+ err = openpgp_fixup_key_448 (pubkey_algo, &array[1]);
+ }
+ }
+
gcry_create_nonce (protect_iv, sizeof protect_iv);
gcry_create_nonce (salt, sizeof salt);
/* We need to use the encoded S2k count. It is not possible to