aboutsummaryrefslogtreecommitdiffstats
path: root/g10/parse-packet.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2025-11-14 14:58:35 +0000
committerWerner Koch <[email protected]>2025-11-14 15:03:06 +0000
commite5473262e88473a101241e7b4860882ebeb1ed97 (patch)
tree88edc4725d0680bf97a17624e169b0e011357b83 /g10/parse-packet.c
parentagent: Support protection for Kyber keys. (diff)
downloadgnupg-e5473262e88473a101241e7b4860882ebeb1ed97.tar.gz
gnupg-e5473262e88473a101241e7b4860882ebeb1ed97.zip
gpg: Allow the export of Kyber secret keys.
* g10/export.c (match_curve_skey_pk): Allow the ECC part of a Kyber key. (secret_key_to_mode1003): Add arg is_part2. Add code to allow a second call to merge the Kyber part to the secret key s-exp. (receive_seckey_from_agent): Add arg is_part2 and forward it. (do_export_one_keyblock): Detect a dual key and handle it accordingly. * g10/parse-packet.c (parse_key): In the secret key list code also print the second s-expr of a dual key. -- GnuPG-bug-id: 7315
Diffstat (limited to 'g10/parse-packet.c')
-rw-r--r--g10/parse-packet.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index baac7c649..aac3a988c 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -3079,9 +3079,22 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen,
if (mpi_print_mode)
{
char *tmpsxp = canon_sexp_to_string (tmpp, pktlen);
+ size_t len1 = gcry_sexp_canon_len (tmpp, pktlen, NULL, NULL);
+ const char *tp = tmpp;
+
es_fprintf (listfp, "\tskey[%d]: %s\n", npkey,
tmpsxp? trim_trailing_spaces (tmpsxp)
/* */: "[invalid S-expression]");
+ if (len1 && len1 < pktlen
+ && tp[len1] == '(' && tp[pktlen-1] == ')' )
+ {
+ /* Second s-expression from a dual key. */
+ xfree (tmpsxp);
+ tmpsxp = canon_sexp_to_string (tp+len1, pktlen-len1);
+ es_fprintf (listfp, "\t part-2: %s\n",
+ tmpsxp? trim_trailing_spaces (tmpsxp)
+ /* */: "[invalid S-expression]");
+ }
xfree (tmpsxp);
}
else