mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 534e2876ac
from
STABLE-BRANCH-1-4 against STABLE-BRANCH-2-0
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
This commit is contained in:
parent
39c5d991a8
commit
f952fe8c6d
5 changed files with 51 additions and 3 deletions
|
@ -1431,6 +1431,7 @@ gen_rsa (int algo, unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek,
|
|||
PKT_secret_key *sk;
|
||||
PKT_public_key *pk;
|
||||
gcry_sexp_t s_parms, s_key;
|
||||
const unsigned maxsize = (opt.flags.large_rsa ? 8192 : 4096);
|
||||
|
||||
assert (is_RSA(algo));
|
||||
|
||||
|
@ -1442,9 +1443,9 @@ gen_rsa (int algo, unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek,
|
|||
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 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue