diff options
| author | Werner Koch <[email protected]> | 2025-11-07 10:06:00 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2025-11-07 10:06:09 +0000 |
| commit | ff916a05c434835cb615b9b889793e6af1a977a5 (patch) | |
| tree | b30f8b2dc7d69517fa504a3375372a2fc697dc9d | |
| parent | agent: Fix wiping memory in PKDECRYPT command. (diff) | |
| download | gnupg-master.tar.gz gnupg-master.zip | |
* g10/parse-packet.c (parse_key): Tweak list mode and implement
printing of "kyNNN_foo instead of just the second algos curve.
| -rw-r--r-- | g10/export.c | 2 | ||||
| -rw-r--r-- | g10/keyid.c | 3 | ||||
| -rw-r--r-- | g10/parse-packet.c | 18 |
3 files changed, 18 insertions, 5 deletions
diff --git a/g10/export.c b/g10/export.c index 5dcb9c665..493513b63 100644 --- a/g10/export.c +++ b/g10/export.c @@ -2361,7 +2361,7 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret, if (pk->version == 3) { log_info ("key %s: PGP 2.x style key (v3) export " - "not yet supported - skipped\n", keystr (keyid)); + "not supported - skipped\n", keystr (keyid)); continue; } stats->secret_count++; diff --git a/g10/keyid.c b/g10/keyid.c index bdbe90b21..f480f8155 100644 --- a/g10/keyid.c +++ b/g10/keyid.c @@ -873,7 +873,8 @@ namehash_from_uid (PKT_user_id *uid) /* * Return the number of bits used in PK. For Kyber we return the * octet count of the Kyber part and not of the ECC (thus likely - * values are 768 or 1024). + * values are 768 or 1024). Note that this function may be called + * with only pubkey_algo and pkey[] correctly set. */ unsigned int nbits_from_pk (PKT_public_key *pk) diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 32ec46b6f..baac7c649 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -2768,7 +2768,14 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen, } if (err) goto leave; - if (list_mode) + } + if (list_mode) + { /* Again so that we have all parameters in pkey[] and can + * do a look forward. We use a hack for Kyber because the + * commonly used function pubkey_string requires an extra + * buffer and, more important, its result depends on an + * configure option. */ + for (i = 0; i < npkey; i++) { es_fprintf (listfp, "\tpkey[%d]: ", i); mpi_print (listfp, pk->pkey[i], mpi_print_mode); @@ -2778,8 +2785,13 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen, || algorithm == PUBKEY_ALGO_KYBER) && i==0) { char *curve = openpgp_oid_to_str (pk->pkey[0]); - const char *name = openpgp_oid_to_curve (curve, 0); - es_fprintf (listfp, " %s (%s)", name?name:"", curve); + const char *name = openpgp_oid_to_curve (curve, 2); + + if (algorithm == PUBKEY_ALGO_KYBER) + es_fprintf (listfp, " ky%u_%s (%s)", + nbits_from_pk (pk), name?name:"", curve); + else + es_fprintf (listfp, " %s (%s)", name?name:"", curve); xfree (curve); } es_putc ('\n', listfp); |
