aboutsummaryrefslogtreecommitdiffstats
path: root/g10/packet.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2024-08-12 12:50:08 +0000
committerWerner Koch <[email protected]>2024-08-12 12:50:08 +0000
commit882ab7fef9bf4440900c32d7463469307224f11a (patch)
tree9544c758dc3929bd2b5cd0f45d72d072c1f705fb /g10/packet.h
parentagent: When diverting to a card show the name of unsupported algos. (diff)
downloadgnupg-882ab7fef9bf4440900c32d7463469307224f11a.tar.gz
gnupg-882ab7fef9bf4440900c32d7463469307224f11a.zip
gpg: Improve decryption diagnostic for an ADSK key.
* g10/keydb.h (GET_PUBKEYBLOCK_FLAG_ADSK): New constant. * g10/packet.h (PUBKEY_USAGE_XENC_MASK): New constant. * g10/pubkey-enc.c (get_session_key): Consider an ADSK also as "marked for encryption use". (get_it): Print a note if an ADSK key was used. Use the new get_pubkeyblock flag. * g10/getkey.c (struct getkey_ctx_s): Add field allow_adsk. (get_pubkeyblock): Factor all code out to ... (get_pubkeyblock_ext): new. (finish_lookup): Add new arg allow_adsk and make use of it. -- This patch solves two purposes: - We write a note that the ADSK key was used for decryption - We avoid running into a "oops: public key not found for preference check\n" due to ADSK keys. The error is mostly harmless but lets gpg return with an exit code of 2.
Diffstat (limited to 'g10/packet.h')
-rw-r--r--g10/packet.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/g10/packet.h b/g10/packet.h
index b16b775a2..6c3e1b80d 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -60,10 +60,14 @@
#define PUBKEY_USAGE_RENC 1024 /* Restricted encryption. */
#define PUBKEY_USAGE_TIME 2048 /* Timestamp use. */
+
/* The usage bits which can be derived from the algo. */
#define PUBKEY_USAGE_BASIC_MASK (PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC\
|PUBKEY_USAGE_CERT|PUBKEY_USAGE_AUTH)
+/* The usage bits which define encryption. */
+#define PUBKEY_USAGE_XENC_MASK (PUBKEY_USAGE_ENC | PUBKEY_USAGE_RENC)
+
/* Bitflags to convey hints on what kind of signature is created. */
#define SIGNHINT_KEYSIG 1
#define SIGNHINT_SELFSIG 2