diff options
| author | Daniel Kahn Gillmor <[email protected]> | 2014-10-09 20:54:15 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2014-10-10 11:40:38 +0000 |
| commit | 6cabb7a2a18f871b8c3d5de58bcdc5aaa5b201af (patch) | |
| tree | 14299bcebf1e30e3b69e8f53adfe08afabdb0f65 /g10/keygen.c | |
| parent | gpg: Skip overlong keys and a print a warning. (diff) | |
| download | gnupg-6cabb7a2a18f871b8c3d5de58bcdc5aaa5b201af.tar.gz gnupg-6cabb7a2a18f871b8c3d5de58bcdc5aaa5b201af.zip | |
gpg: Add build and runtime support for larger RSA keys
* configure.ac: Added --enable-large-secmem option.
* g10/options.h: Add opt.flags.large_rsa.
* g10/gpg.c: Contingent on configure option: adjust secmem size,
add gpg --enable-large-rsa, bound to opt.flags.large_rsa.
* g10/keygen.c: Adjust max RSA size based on opt.flags.large_rsa
* doc/gpg.texi: Document --enable-large-rsa.
--
This is a cherry-pick of 534e2876acc05f9f8d9b54c18511fe768d77dfb5 from
STABLE-BRANCH-1-4 against master
Some older implementations built and used RSA keys up to 16Kib, but
the larger secret keys now fail when used by more recent GnuPG, due to
secure memory limitations.
Building with ./configure --enable-large-secmem will make gpg
capable of working with those secret keys, as well as permitting the
use of a new gpg option --enable-large-rsa, which let gpg generate RSA
keys up to 8Kib when used with --batch --gen-key.
Debian-bug-id: 739424
Minor edits by wk.
GnuPG-bug-id: 1732
Diffstat (limited to 'g10/keygen.c')
| -rw-r--r-- | g10/keygen.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/g10/keygen.c b/g10/keygen.c index 229f2bfed..1c8d70e98 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -1555,6 +1555,7 @@ gen_rsa (int algo, unsigned int nbits, KBNODE pub_root, int err; char *keyparms; char nbitsstr[35]; + const unsigned maxsize = (opt.flags.large_rsa ? 8192 : 4096); assert (is_RSA(algo)); @@ -1566,9 +1567,9 @@ gen_rsa (int algo, unsigned int nbits, KBNODE pub_root, nbits = 2048; log_info (_("keysize invalid; using %u bits\n"), nbits ); } - else if (nbits > 4096) + else if (nbits > maxsize) { - nbits = 4096; + nbits = maxsize; log_info (_("keysize invalid; using %u bits\n"), nbits ); } |
