mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Fix segv with RSA_S keys.
* g10/misc.c (pubkey_get_npkey, pubkey_get_nskey) (pubkey_get_nsig, pubkey_get_nenc): Map all RSA algo ids to GCRY_PK_RSA. -- The problem is that Libgcrypt has no more support for the alternate RSA ids and thus if asking for the number of parameters, they will return zero. Now, this leads to packing the key parameters into an opaque MPI but because the algorithm id is actually known to GPG, it assumes valid RSA parameters. An example key with RSA_S is 0x5434509D.
This commit is contained in:
parent
b42bc48dfb
commit
30ec869b8c
1 changed files with 8 additions and 0 deletions
|
@ -1377,6 +1377,8 @@ pubkey_get_npkey (int algo)
|
|||
/* All other algorithms match those of Libgcrypt. */
|
||||
if (algo == GCRY_PK_ELG_E)
|
||||
algo = GCRY_PK_ELG;
|
||||
else if (is_RSA (algo))
|
||||
algo = GCRY_PK_RSA;
|
||||
|
||||
if (gcry_pk_algo_info (algo, GCRYCTL_GET_ALGO_NPKEY, NULL, &n))
|
||||
n = 0;
|
||||
|
@ -1399,6 +1401,8 @@ pubkey_get_nskey (int algo)
|
|||
/* All other algorithms match those of Libgcrypt. */
|
||||
if (algo == GCRY_PK_ELG_E)
|
||||
algo = GCRY_PK_ELG;
|
||||
else if (is_RSA (algo))
|
||||
algo = GCRY_PK_RSA;
|
||||
|
||||
if (gcry_pk_algo_info( algo, GCRYCTL_GET_ALGO_NSKEY, NULL, &n ))
|
||||
n = 0;
|
||||
|
@ -1419,6 +1423,8 @@ pubkey_get_nsig (int algo)
|
|||
|
||||
if (algo == GCRY_PK_ELG_E)
|
||||
algo = GCRY_PK_ELG;
|
||||
else if (is_RSA (algo))
|
||||
algo = GCRY_PK_RSA;
|
||||
|
||||
if (gcry_pk_algo_info( algo, GCRYCTL_GET_ALGO_NSIGN, NULL, &n))
|
||||
n = 0;
|
||||
|
@ -1440,6 +1446,8 @@ pubkey_get_nenc (int algo)
|
|||
|
||||
if (algo == GCRY_PK_ELG_E)
|
||||
algo = GCRY_PK_ELG;
|
||||
else if (is_RSA (algo))
|
||||
algo = GCRY_PK_RSA;
|
||||
|
||||
if (gcry_pk_algo_info( algo, GCRYCTL_GET_ALGO_NENCR, NULL, &n ))
|
||||
n = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue