]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Added a forgoten by god OID for RSA. Warn using the actual OID
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 24 Feb 2010 22:32:27 +0000 (23:32 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Thu, 3 Jun 2010 17:40:26 +0000 (19:40 +0200)
on unknown public key algorithms.

lib/gnutls_algorithms.c
lib/x509/common.c
lib/x509/common.h

index 1e0cefcd64432cdc4d55b67315066d7e81ca9346..08c2ad903235c2c7741d778ce31876df9d6bfd47 100644 (file)
@@ -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}
 };
 
index ce29bffaff017c38e3437b4a9036b845aececd00..c3e52f0867640cf4def5d5b59d58e0e175e01137 100644 (file)
@@ -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 (&params[3]);
       }
       break;
-    default:
-      _gnutls_x509_log
-       ("_gnutls_x509_get_pk_algorithm: unhandled algorithm %d\n", algo);
     }
 
   gnutls_free (str);
index a2a94fea548eff10fff1cd0cceeb03fc9340e8c8..e52e32c115510926533f6a97110387e00af71495 100644 (file)
@@ -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"