From: Nikos Mavrogiannopoulos Date: Wed, 24 Feb 2010 22:32:27 +0000 (+0100) Subject: Added a forgoten by god OID for RSA. Warn using the actual OID X-Git-Tag: gnutls_2_11_3~310 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e5db8e4f2a7874ebd047e0744a41157f2ad50866;p=thirdparty%2Fgnutls.git Added a forgoten by god OID for RSA. Warn using the actual OID on unknown public key algorithms. --- diff --git a/lib/gnutls_algorithms.c b/lib/gnutls_algorithms.c index 1e0cefcd64..08c2ad9032 100644 --- a/lib/gnutls_algorithms.c +++ b/lib/gnutls_algorithms.c @@ -2174,10 +2174,13 @@ struct gnutls_pk_entry typedef struct gnutls_pk_entry gnutls_pk_entry; static const gnutls_pk_entry pk_algorithms[] = { + /* having duplicate entries is ok, as long as the one + * we want to return OID from is first */ {"RSA", PK_PKIX1_RSA_OID, GNUTLS_PK_RSA}, + {"RSA (X.509)", PK_X509_RSA_OID, GNUTLS_PK_RSA}, {"DSA", PK_DSA_OID, GNUTLS_PK_DSA}, - {"GOST R 34.10-2001", PK_GOST_R3410_2001_OID, 0}, - {"GOST R 34.10-94", PK_GOST_R3410_94_OID, 0}, + {"GOST R 34.10-2001", PK_GOST_R3410_2001_OID, GNUTLS_PK_UNKNOWN}, + {"GOST R 34.10-94", PK_GOST_R3410_94_OID, GNUTLS_PK_UNKNOWN}, {0, 0, 0} }; diff --git a/lib/x509/common.c b/lib/x509/common.c index ce29bffaff..c3e52f0867 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -1284,10 +1284,14 @@ _gnutls_x509_get_pk_algorithm (ASN1_TYPE src, const char *src_name, } algo = _gnutls_x509_oid2pk_algorithm (oid); + if (algo == GNUTLS_PK_UNKNOWN) + { + _gnutls_x509_log + ("%s: unknown public key algorithm: %s\n", __func__, oid); + } if (bits == NULL) { - gnutls_free (str); return algo; } @@ -1363,9 +1367,6 @@ _gnutls_x509_get_pk_algorithm (ASN1_TYPE src, const char *src_name, _gnutls_mpi_release (¶ms[3]); } break; - default: - _gnutls_x509_log - ("_gnutls_x509_get_pk_algorithm: unhandled algorithm %d\n", algo); } gnutls_free (str); diff --git a/lib/x509/common.h b/lib/x509/common.h index a2a94fea54..e52e32c115 100644 --- a/lib/x509/common.h +++ b/lib/x509/common.h @@ -41,6 +41,7 @@ /* public key algorithm's OIDs */ #define PK_PKIX1_RSA_OID "1.2.840.113549.1.1.1" +#define PK_X509_RSA_OID "2.5.8.1.1" #define PK_DSA_OID "1.2.840.10040.4.1" #define PK_GOST_R3410_94_OID "1.2.643.2.2.20" #define PK_GOST_R3410_2001_OID "1.2.643.2.2.19"