aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/getkey.c8
-rw-r--r--g10/gpg.c7
-rw-r--r--g10/options.h3
3 files changed, 18 insertions, 0 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index a5effb606..a841aeec8 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -3804,6 +3804,14 @@ finish_lookup (kbnode_t keyblock, unsigned int req_usage, int want_exact,
req_usage, pk->pubkey_usage);
continue;
}
+ if (opt.flags.disable_pqc_encryption
+ && pk->pubkey_algo == PUBKEY_ALGO_KYBER)
+ {
+ if (DBG_LOOKUP)
+ log_debug ("\tsubkey skipped due to option %s\n",
+ "--disable-pqc-encryption");
+ continue;
+ }
n_subkeys++;
if (pk->flags.revoked)
diff --git a/g10/gpg.c b/g10/gpg.c
index 994b83b94..db898c41d 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -461,6 +461,7 @@ enum cmd_and_opt_values
oAssertPubkeyAlgo,
oKbxBufferSize,
oRequirePQCEncryption,
+ oDisablePQCEncryption,
oProcAllSigs,
oNoop
@@ -907,6 +908,7 @@ static gpgrt_opt_t opts[] = {
ARGPARSE_s_s (oDigestAlgo, "digest-algo", "@"),
ARGPARSE_s_s (oCertDigestAlgo, "cert-digest-algo", "@"),
ARGPARSE_s_n (oRequirePQCEncryption, "require-pqc-encryption", "@"),
+ ARGPARSE_s_n (oDisablePQCEncryption, "disable-pqc-encryption", "@"),
ARGPARSE_header (NULL, N_("Options for unattended use")),
@@ -3095,6 +3097,11 @@ main (int argc, char **argv)
case oMinRSALength: opt.min_rsa_length = pargs.r.ret_ulong; break;
case oRequirePQCEncryption:
opt.flags.require_pqc_encryption = 1;
+ opt.flags.disable_pqc_encryption = 0;
+ break;
+ case oDisablePQCEncryption:
+ if (!opt.flags.require_pqc_encryption)
+ opt.flags.disable_pqc_encryption = 1;
break;
case oRFC2440Text: opt.rfc2440_text=1; break;
diff --git a/g10/options.h b/g10/options.h
index 6f5017196..89f04526f 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -308,6 +308,9 @@ struct
unsigned int require_compliance:1;
/* Fail encryption unless a PQC algorithm is used. */
unsigned int require_pqc_encryption:1;
+ /* Do not use PQC subkeys for encryption. This is never set if
+ * require_pqc_encryption is also set. */
+ unsigned int disable_pqc_encryption:1;
/* Process all signatures even in batch mode. */
unsigned int proc_all_sigs:1;
} flags;