diff options
author | Werner Koch <[email protected]> | 2014-04-15 14:40:48 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-04-16 12:50:02 +0000 |
commit | efecbb7a3f0c32ea40db3a050c89f288550b05c2 (patch) | |
tree | db492f1dcea6c9f09405cf3e45dd4dbd11d43df7 | |
parent | scd: Skip S/N reading for the "undefined" application. (diff) | |
download | gnupg-efecbb7a3f0c32ea40db3a050c89f288550b05c2.tar.gz gnupg-efecbb7a3f0c32ea40db3a050c89f288550b05c2.zip |
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
-rw-r--r-- | g10/misc.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/g10/misc.c b/g10/misc.c index 9b7c8ab4e..82a13aa9a 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -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] ); |