1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-09 23:39:51 +02:00

gpg: Fix use of deprecated RSA_E and RSA_E with newer libgcrypts.

* g10/misc.c (pubkey_get_npkey): Map RSA_E and RSA_S to RSA.
(pubkey_get_nskey): Ditto.
(pubkey_get_nsig): Ditto.
(pubkey_get_nenc): Ditto.
(pubkey_nbits): Take care of RSA_E and RSA_S.
--

The problem was that parse_key did not know about RSA_S and thus used
an opaque MPI which later crashed Libgcrypt. It is possible to fix
that also in Libgcrypt but we better do it here as well.

A test key using RSA_S is 0x98EEB6F7D87171CF.

Reported-by: Hanno Böck
This commit is contained in:
Werner Koch 2014-04-15 16:40:48 +02:00
parent dc941bdaec
commit efecbb7a3f

View File

@ -1359,6 +1359,9 @@ pubkey_get_npkey( int algo )
if (algo == GCRY_PK_ELG_E)
algo = GCRY_PK_ELG;
else if (algo == GCRY_PK_RSA_E || algo == GCRY_PK_RSA_S)
algo = GCRY_PK_RSA;
if (gcry_pk_algo_info (map_pk_openpgp_to_gcry (algo),
GCRYCTL_GET_ALGO_NPKEY, NULL, &n))
n = 0;
@ -1379,6 +1382,9 @@ pubkey_get_nskey( int algo )
if (algo == GCRY_PK_ELG_E)
algo = GCRY_PK_ELG;
else if (algo == GCRY_PK_RSA_E || algo == GCRY_PK_RSA_S)
algo = GCRY_PK_RSA;
if (gcry_pk_algo_info (map_pk_openpgp_to_gcry (algo),
GCRYCTL_GET_ALGO_NSKEY, NULL, &n ))
n = 0;
@ -1399,6 +1405,9 @@ pubkey_get_nsig( int algo )
if (algo == GCRY_PK_ELG_E)
algo = GCRY_PK_ELG;
else if (algo == GCRY_PK_RSA_E || algo == GCRY_PK_RSA_S)
algo = GCRY_PK_RSA;
if (gcry_pk_algo_info (map_pk_openpgp_to_gcry (algo),
GCRYCTL_GET_ALGO_NSIGN, NULL, &n))
n = 0;
@ -1419,6 +1428,9 @@ pubkey_get_nenc( int algo )
if (algo == GCRY_PK_ELG_E)
algo = GCRY_PK_ELG;
else if (algo == GCRY_PK_RSA_E || algo == GCRY_PK_RSA_S)
algo = GCRY_PK_RSA;
if (gcry_pk_algo_info (map_pk_openpgp_to_gcry (algo),
GCRYCTL_GET_ALGO_NENCR, NULL, &n ))
n = 0;
@ -1443,7 +1455,9 @@ pubkey_nbits( int algo, gcry_mpi_t *key )
"(public-key(elg(p%m)(g%m)(y%m)))",
key[0], key[1], key[2] );
}
else if( algo == GCRY_PK_RSA ) {
else if (algo == GCRY_PK_RSA
|| algo == GCRY_PK_RSA_S
|| algo == GCRY_PK_RSA_E ) {
rc = gcry_sexp_build ( &sexp, NULL,
"(public-key(rsa(n%m)(e%m)))",
key[0], key[1] );