summaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-01-05 13:49:06 +0100
committerWerner Koch <wk@gnupg.org>2016-01-05 13:51:05 +0100
commite70f7a54f29d727def2cfe9ea5ab9d461b4ce842 (patch)
tree0146eb21d448ceff4d9388cdc9d50c418b1aad98 /g10
parentagent: Typo fix for help text. (diff)
downloadgnupg2-e70f7a54f29d727def2cfe9ea5ab9d461b4ce842.tar.xz
gnupg2-e70f7a54f29d727def2cfe9ea5ab9d461b4ce842.zip
gpg: Align notes about minimal keysize with actual checks.
* g10/keygen.c (ask_keysize): Use 768 for the minimal value for DSA in export mode. Improve readability. -- GnuPG-bug-id: 2209 Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10')
-rw-r--r--g10/keygen.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/g10/keygen.c b/g10/keygen.c
index 992e572e4..921e93807 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -2006,15 +2006,13 @@ ask_algo (ctrl_t ctrl, int addmode, int *r_subkey_algo, unsigned int *r_usage,
static unsigned
ask_keysize (int algo, unsigned int primary_keysize)
{
- unsigned int nbits, min, def = DEFAULT_STD_KEYSIZE, max=4096;
+ unsigned int nbits;
+ unsigned int min = 1024;
+ unsigned int def = DEFAULT_STD_KEYSIZE;
+ unsigned int max = 4096;
int for_subkey = !!primary_keysize;
int autocomp = 0;
- if(opt.expert)
- min=512;
- else
- min=1024;
-
if (primary_keysize && !opt.expert)
{
/* Deduce the subkey size from the primary key size. */
@@ -2029,9 +2027,11 @@ ask_keysize (int algo, unsigned int primary_keysize)
goto leave;
}
+ /* Deviations from the standard values. */
switch(algo)
{
case PUBKEY_ALGO_DSA:
+ min = opt.expert? 768 : 1024;
def=2048;
max=3072;
break;
@@ -2048,10 +2048,6 @@ ask_keysize (int algo, unsigned int primary_keysize)
def=255;
max=441;
break;
-
- case PUBKEY_ALGO_RSA:
- min=1024;
- break;
}
tty_printf(_("%s keys may be between %u and %u bits long.\n"),