]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Use ASN1_NULL when writing parameters for RSA signatures. This makes us comply with...
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 5 Dec 2010 15:33:01 +0000 (16:33 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 5 Dec 2010 15:44:56 +0000 (16:44 +0100)
NEWS
lib/gnutls_sig.c
lib/x509/common.c
lib/x509/common.h
lib/x509/mpi.c
lib/x509/sign.c

diff --git a/NEWS b/NEWS
index d19e0a1036c9da91e44f31fd72cc011a51ce1d0c..cae51e941a22b464b0f7a76eb3d71827e1f7a8df 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ See the end for copying conditions.
 
 ** gnutls-serv: Corrected a buffer overflow. Reported and patch by Tomas Mraz.
 
+** libgnutls: Use ASN1_NULL when writing parameters for RSA signatures. 
+This makes us comply with RFC3279. Reported by Michael Rommel.
+
 ** libgnutls: Reverted default behavior for verification and
 introduced GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT. Thus by default
 V1 trusted CAs are allowed, unless the new flag is specified.
index 10ca29b2b8b28d6022a43d2a33b7edac00b7f155..e5f319a9e69cc3fad70d682c1dbcb67b90716f3c 100644 (file)
@@ -40,6 +40,7 @@
 #include <libtasn1.h>
 #include <ext_signature.h>
 #include <gnutls_state.h>
+#include <x509/common.h>
 
 static int
 _gnutls_tls_sign (gnutls_session_t session,
@@ -90,7 +91,7 @@ _gnutls_rsa_encode_sig (gnutls_mac_algorithm_t algo,
 
   /* Use NULL parameters. */
   if ((result = asn1_write_value (di, "digestAlgorithm.parameters",
-                                 "\x05\x00", 2)) != ASN1_SUCCESS)
+                                 ASN1_NULL, ASN1_NULL_SIZE)) != ASN1_SUCCESS)
     {
       gnutls_assert ();
       asn1_delete_structure (&di);
index ce29bffaff017c38e3437b4a9036b845aececd00..9d1392ea04386a75fa3582ba97251d2dcffb4280 100644 (file)
@@ -1178,7 +1178,7 @@ _gnutls_x509_encode_and_copy_PKI_params (ASN1_TYPE dst,
        */
       _gnutls_str_cpy (name, sizeof (name), dst_name);
       _gnutls_str_cat (name, sizeof (name), ".algorithm.parameters");
-      result = asn1_write_value (dst, name, NULL, 0);
+      result = asn1_write_value (dst, name, ASN1_NULL, ASN1_NULL_SIZE);
       if (result != ASN1_SUCCESS)
        {
          gnutls_assert ();
index 53a94ef9457416e5d751a481967d3828ecc12041..855640699ed8bde3367f43b2349808bdf81a6ee4 100644 (file)
@@ -59,6 +59,9 @@
 #define SIG_GOST_R3410_94_OID "1.2.643.2.2.4"
 #define SIG_GOST_R3410_2001_OID "1.2.643.2.2.3"
 
+#define ASN1_NULL "\x05\x00"
+#define ASN1_NULL_SIZE 2
+
 int _gnutls_x509_set_time (ASN1_TYPE c2, const char *where, time_t tim);
 
 int _gnutls_x509_decode_octet_string (const char *string_type,
index 76747f251cc18fc3410dd1ac57b148a8725928af..c55b7a6d28f7404a143249bc776baa1b188a73f9 100644 (file)
@@ -452,7 +452,10 @@ _gnutls_x509_write_sig_params (ASN1_TYPE dst, const char *dst_name,
   _gnutls_str_cpy (name, sizeof (name), dst_name);
   _gnutls_str_cat (name, sizeof (name), ".parameters");
 
-  result = asn1_write_value (dst, name, NULL, 0);
+  if (pk_algorithm == GNUTLS_PK_RSA)
+    result = asn1_write_value (dst, name, ASN1_NULL, ASN1_NULL_SIZE);
+  else
+    result = asn1_write_value (dst, name, NULL, 0);
 
   if (result != ASN1_SUCCESS && result != ASN1_ELEMENT_NOT_FOUND)
     {
index b2fd7c2764d1aa04625dbb8a93b7d02662cd0089..3734f8e8258ca3be6c268be542dc33f545a24a6f 100644 (file)
@@ -83,7 +83,7 @@ encode_ber_digest_info (gnutls_digest_algorithm_t hash,
      Regardless of what is correct, this appears to be what most
      implementations do.  */
   result = asn1_write_value (dinfo, "digestAlgorithm.parameters",
-                            "\x05\x00", 2);
+                            ASN1_NULL, ASN1_NULL_SIZE);
   if (result != ASN1_SUCCESS)
     {
       gnutls_assert ();