[gnutls-dev] size_t, int and 64 bit machines

Deanna Phillips deanna at sdf.lonestar.org
Wed Mar 21 04:22:12 CET 2007


Hello,

I noticed some size_t and int mixing that causes the
set_pkcs12_cred test to fail on OpenBSD/sparc64.

Here, sizeof int is 4, and sizeof size_t is 8.  Several warnings
such as this are produced:

gnutls_x509.c:1897: warning: passing arg 2 of `read_binary_file' from incompatible pointer type

The simple fix for that particular test was -

   typedef struct
   {
     unsigned char *data;
-    unsigned int size;
+    size_t size;
   } gnutls_datum_t;


Here's a patch to use size_t consistently.  This gets rid of all
but a few of these compiler warnings.  With this applied, all
tests pass on sparc64, i386, amd64 and alpha.

Also included here is a patch that allows the pcks1-padding test
to run on systems that pad wc(1) output with spaces, and another
to include netinet/in.h for struct sockaddr_in in the anonself
test.

Thanks for providing tests.  :)


diff -urp gnutls-1.6.1.orig/doc/examples/ex-crq.c gnutls-1.6.1/doc/examples/ex-crq.c
--- gnutls-1.6.1.orig/doc/examples/ex-crq.c	Fri Jun 16 11:35:46 2006
+++ gnutls-1.6.1/doc/examples/ex-crq.c	Sun Mar 18 20:15:03 2007
@@ -19,7 +19,7 @@ main (void)
   gnutls_x509_crq_t crq;
   gnutls_x509_privkey_t key;
   unsigned char buffer[10 * 1024];
-  int buffer_size = sizeof (buffer);
+  size_t buffer_size = sizeof (buffer);
 
   gnutls_global_init ();
 
diff -urp gnutls-1.6.1.orig/doc/examples/ex-pkcs12.c gnutls-1.6.1/doc/examples/ex-pkcs12.c
--- gnutls-1.6.1.orig/doc/examples/ex-pkcs12.c	Fri Jun 16 11:35:46 2006
+++ gnutls-1.6.1/doc/examples/ex-pkcs12.c	Sun Mar 18 20:15:03 2007
@@ -23,7 +23,7 @@ write_pkcs12 (const gnutls_datum_t * cer
   int ret, bag_index;
   gnutls_pkcs12_bag_t bag, key_bag;
   char pkcs12_struct[10 * 1024];
-  int pkcs12_struct_size;
+  size_t pkcs12_struct_size;
   FILE *fd;
 
   /* A good idea might be to use gnutls_x509_privkey_get_key_id()
diff -urp gnutls-1.6.1.orig/doc/examples/ex-rfc2818.c gnutls-1.6.1/doc/examples/ex-rfc2818.c
--- gnutls-1.6.1.orig/doc/examples/ex-rfc2818.c	Fri Jun 16 11:35:46 2006
+++ gnutls-1.6.1/doc/examples/ex-rfc2818.c	Sun Mar 18 20:15:04 2007
@@ -14,7 +14,8 @@ verify_certificate (gnutls_session_t ses
 {
   unsigned int status;
   const gnutls_datum_t *cert_list;
-  int cert_list_size, ret;
+  int ret;
+  size_t cert_list_size;
   gnutls_x509_crt_t cert;
 
 
diff -urp gnutls-1.6.1.orig/doc/examples/ex-x509-info.c gnutls-1.6.1/doc/examples/ex-x509-info.c
--- gnutls-1.6.1.orig/doc/examples/ex-x509-info.c	Wed Nov 15 09:51:19 2006
+++ gnutls-1.6.1/doc/examples/ex-x509-info.c	Sun Mar 18 20:15:04 2007
@@ -40,7 +40,7 @@ print_x509_certificate_info (gnutls_sess
   unsigned int algo, bits;
   time_t expiration_time, activation_time;
   const gnutls_datum_t *cert_list;
-  unsigned int cert_list_size = 0;
+  size_t cert_list_size = 0;
   gnutls_x509_crt_t cert;
 
   /* This function only works for X.509 certificates.
@@ -50,7 +50,7 @@ print_x509_certificate_info (gnutls_sess
 
   cert_list = gnutls_certificate_get_peers (session, &cert_list_size);
 
-  printf ("Peer provided %d certificates.\n", cert_list_size);
+  printf ("Peer provided %zu certificates.\n", cert_list_size);
 
   if (cert_list_size > 0)
     {
diff -urp gnutls-1.6.1.orig/includes/gnutls/gnutls.h.in gnutls-1.6.1/includes/gnutls/gnutls.h.in
--- gnutls-1.6.1.orig/includes/gnutls/gnutls.h.in	Mon Nov  6 09:48:10 2006
+++ gnutls-1.6.1/includes/gnutls/gnutls.h.in	Sun Mar 18 20:15:04 2007
@@ -308,7 +308,7 @@ extern "C"
   typedef struct
   {
     unsigned char *data;
-    unsigned int size;
+    size_t size;
   } gnutls_datum_t;
 
 
@@ -981,7 +981,7 @@ extern "C"
    */
   const gnutls_datum_t *gnutls_certificate_get_peers (gnutls_session_t
 						      session,
-						      unsigned int
+						      size_t
 						      *list_size);
   const gnutls_datum_t *gnutls_certificate_get_ours (gnutls_session_t
 						     session);
diff -urp gnutls-1.6.1.orig/includes/gnutls/gnutlsxx.h gnutls-1.6.1/includes/gnutls/gnutlsxx.h
--- gnutls-1.6.1.orig/includes/gnutls/gnutlsxx.h	Mon Aug  7 08:40:23 2006
+++ gnutls-1.6.1/includes/gnutls/gnutlsxx.h	Sun Mar 18 20:15:04 2007
@@ -177,7 +177,7 @@ class session
         
         void get_our_certificate(gnutls_datum & cert) const;
         bool get_peers_certificate(std::vector<gnutls_datum_t> &out_certs) const;
-        bool get_peers_certificate(const gnutls_datum_t** certs, unsigned int *certs_size) const;
+        bool get_peers_certificate(const gnutls_datum_t** certs, size_t *certs_size) const;
 
         time_t get_peers_certificate_activation_time() const;
         time_t get_peers_certificate_expiration_time() const;
diff -urp gnutls-1.6.1.orig/lib/gnutls_dh_primes.c gnutls-1.6.1/lib/gnutls_dh_primes.c
--- gnutls-1.6.1.orig/lib/gnutls_dh_primes.c	Wed Mar  8 05:44:59 2006
+++ gnutls-1.6.1/lib/gnutls_dh_primes.c	Sun Mar 18 20:15:04 2007
@@ -416,8 +416,8 @@ gnutls_dh_params_export_pkcs3 (gnutls_dh
 			       size_t * params_data_size)
 {
   ASN1_TYPE c2;
-  int result, _params_data_size;
-  size_t g_size, p_size;
+  int result; 
+  size_t g_size, p_size, _params_data_size;
   opaque *p_data, *g_data;
   opaque *all_data;
 
@@ -506,7 +506,7 @@ gnutls_dh_params_export_pkcs3 (gnutls_dh
     {				/* PEM */
       opaque *tmp;
       opaque *out;
-      int len;
+      size_t len;
 
       len = 0;
       asn1_der_coding (c2, "", NULL, &len, NULL);
diff -urp gnutls-1.6.1.orig/lib/gnutls_ui.c gnutls-1.6.1/lib/gnutls_ui.c
--- gnutls-1.6.1.orig/lib/gnutls_ui.c	Wed Mar  8 05:44:59 2006
+++ gnutls-1.6.1/lib/gnutls_ui.c	Sun Mar 18 20:15:04 2007
@@ -472,7 +472,7 @@ gnutls_certificate_get_ours (gnutls_sess
   **/
 const gnutls_datum_t *
 gnutls_certificate_get_peers (gnutls_session_t
-			      session, unsigned int *list_size)
+			      session, size_t *list_size)
 {
   cert_auth_info_t info;
 
diff -urp gnutls-1.6.1.orig/lib/gnutlsxx.cpp gnutls-1.6.1/lib/gnutlsxx.cpp
--- gnutls-1.6.1.orig/lib/gnutlsxx.cpp	Thu Jun  1 15:49:01 2006
+++ gnutls-1.6.1/lib/gnutlsxx.cpp	Sun Mar 18 20:15:04 2007
@@ -237,7 +237,7 @@ bool session::is_resumed() const
 bool session::get_peers_certificate(std::vector<gnutls_datum_t> &out_certs) const
 {
     const gnutls_datum_t *certs;
-    unsigned int certs_size;
+    size_t certs_size;
     
     certs = gnutls_certificate_get_peers (this->s, &certs_size);
     
@@ -249,7 +249,7 @@ bool session::get_peers_certificate(std:
     return true;
 }
 
-bool session::get_peers_certificate(const gnutls_datum_t** certs, unsigned int *certs_size) const
+bool session::get_peers_certificate(const gnutls_datum_t** certs, size_t *certs_size) const
 {
     *certs = gnutls_certificate_get_peers (this->s, certs_size);
     
diff -urp gnutls-1.6.1.orig/lib/minitasn1/coding.c gnutls-1.6.1/lib/minitasn1/coding.c
--- gnutls-1.6.1.orig/lib/minitasn1/coding.c	Thu Oct 19 16:00:49 2006
+++ gnutls-1.6.1/lib/minitasn1/coding.c	Sun Mar 18 20:15:04 2007
@@ -871,7 +871,7 @@ _asn1_ordering_set_of (unsigned char *de
   *
   **/
 asn1_retCode
-asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len,
+asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, size_t *len,
 		 char *ErrorDescription)
 {
   node_asn *node, *p, *p2;
diff -urp gnutls-1.6.1.orig/lib/minitasn1/libtasn1.h gnutls-1.6.1/lib/minitasn1/libtasn1.h
--- gnutls-1.6.1.orig/lib/minitasn1/libtasn1.h	Thu Oct 19 16:00:51 2006
+++ gnutls-1.6.1/lib/minitasn1/libtasn1.h	Sun Mar 18 20:15:04 2007
@@ -172,7 +172,7 @@ extern "C"
 					int *num);
 
   asn1_retCode asn1_der_coding (ASN1_TYPE element, const char *name,
-				void *ider, int *len, char *ErrorDescription);
+				void *ider, size_t *len, char *ErrorDescription);
 
   asn1_retCode asn1_der_decoding (ASN1_TYPE * element, const void *ider,
 				  int len, char *errorDescription);
diff -urp gnutls-1.6.1.orig/lib/minitasn1/structure.c gnutls-1.6.1/lib/minitasn1/structure.c
--- gnutls-1.6.1.orig/lib/minitasn1/structure.c	Thu Oct 19 16:00:49 2006
+++ gnutls-1.6.1/lib/minitasn1/structure.c	Sun Mar 18 20:15:04 2007
@@ -1184,7 +1184,7 @@ asn1_copy_node (ASN1_TYPE dst, const cha
   int result;
   ASN1_TYPE dst_node;
   void *data = NULL;
-  int size = 0;
+  size_t size = 0;
 
   result = asn1_der_coding (src, src_name, NULL, &size, NULL);
   if (result != ASN1_MEM_ERROR)
diff -urp gnutls-1.6.1.orig/lib/x509/common.c gnutls-1.6.1/lib/x509/common.c
--- gnutls-1.6.1.orig/lib/x509/common.c	Wed Dec 27 13:31:35 2006
+++ gnutls-1.6.1/lib/x509/common.c	Sun Mar 18 20:15:04 2007
@@ -709,7 +709,8 @@ _gnutls_x509_export_int (ASN1_TYPE asn1_
 			 int tmp_buf_size, unsigned char *output_data,
 			 size_t * output_data_size)
 {
-  int result, len;
+  int result; 
+  size_t len;
   if (tmp_buf_size == 0)
     tmp_buf_size = 16 * 1024;
 
@@ -933,8 +934,9 @@ int
 _gnutls_x509_der_encode (ASN1_TYPE src, const char *src_name,
 			 gnutls_datum_t * res, int str)
 {
-  int size, result;
-  int asize;
+  int result;
+  size_t size, asize;
+
   opaque *data = NULL;
   ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
 
diff -urp gnutls-1.6.1.orig/lib/x509/privkey_pkcs8.c gnutls-1.6.1/lib/x509/privkey_pkcs8.c
--- gnutls-1.6.1.orig/lib/x509/privkey_pkcs8.c	Wed Mar  8 05:44:59 2006
+++ gnutls-1.6.1/lib/x509/privkey_pkcs8.c	Sun Mar 18 20:15:04 2007
@@ -136,8 +136,8 @@ static int
 encode_to_private_key_info (gnutls_x509_privkey_t pkey,
 			    gnutls_datum_t * der, ASN1_TYPE * pkey_info)
 {
-  int result, len;
-  size_t size;
+  int result;
+  size_t size, len;
   opaque *data = NULL;
   opaque null = 0;
 
diff -urp gnutls-1.6.1.orig/lib/x509/sign.c gnutls-1.6.1/lib/x509/sign.c
--- gnutls-1.6.1.orig/lib/x509/sign.c	Wed Mar  8 11:26:54 2006
+++ gnutls-1.6.1/lib/x509/sign.c	Sun Mar 18 20:15:04 2007
@@ -259,7 +259,7 @@ _gnutls_x509_sign_tbs (ASN1_TYPE cert, c
 {
   int result;
   opaque *buf;
-  int buf_size;
+  size_t buf_size;
   gnutls_datum_t tbs;
 
   buf_size = 0;
diff -urp gnutls-1.6.1.orig/lib/x509/x509.c gnutls-1.6.1/lib/x509/x509.c
--- gnutls-1.6.1.orig/lib/x509/x509.c	Sun Sep 24 04:19:48 2006
+++ gnutls-1.6.1/lib/x509/x509.c	Sun Mar 18 20:15:04 2007
@@ -1324,7 +1324,7 @@ gnutls_x509_crt_get_fingerprint (gnutls_
 				 void *buf, size_t * sizeof_buf)
 {
   opaque *cert_buf;
-  int cert_buf_size;
+  size_t cert_buf_size;
   int result;
   gnutls_datum_t tmp;
 
diff -urp gnutls-1.6.1.orig/libextra/gnutls_openssl.c gnutls-1.6.1/libextra/gnutls_openssl.c
--- gnutls-1.6.1.orig/libextra/gnutls_openssl.c	Sun Aug 13 16:34:09 2006
+++ gnutls-1.6.1/libextra/gnutls_openssl.c	Sun Mar 18 20:15:04 2007
@@ -340,7 +340,7 @@ const X509 *
 SSL_get_peer_certificate (SSL * ssl)
 {
   const gnutls_datum_t *cert_list;
-  int cert_list_size = 0;
+  size_t cert_list_size = 0;
 
   cert_list = gnutls_certificate_get_peers (ssl->gnutls_state,
 					    &cert_list_size);
@@ -354,7 +354,7 @@ int
 SSL_connect (SSL * ssl)
 {
   X509_STORE_CTX *store;
-  int cert_list_size = 0;
+  size_t cert_list_size = 0;
   int err;
   int i, j;
   int x_priority[GNUTLS_MAX_ALGORITHM_NUM];
@@ -409,7 +409,7 @@ int
 SSL_accept (SSL * ssl)
 {
   X509_STORE_CTX *store;
-  int cert_list_size = 0;
+  size_t cert_list_size = 0;
   int err;
   int i, j;
   int x_priority[GNUTLS_MAX_ALGORITHM_NUM];
diff -urp gnutls-1.6.1.orig/libextra/openssl_compat.c gnutls-1.6.1/libextra/openssl_compat.c
--- gnutls-1.6.1.orig/libextra/openssl_compat.c	Wed Mar  8 05:44:59 2006
+++ gnutls-1.6.1/libextra/openssl_compat.c	Sun Mar 18 20:15:04 2007
@@ -531,7 +531,7 @@ gnutls_x509_extract_certificate_pk_algor
   -*/
 int
 gnutls_x509_extract_certificate_dn_string (char *buf,
-					   unsigned int sizeof_buf,
+					   size_t sizeof_buf,
 					   const gnutls_datum_t * cert,
 					   int issuer)
 {
diff -urp gnutls-1.6.1.orig/libextra/openssl_compat.h gnutls-1.6.1/libextra/openssl_compat.h
--- gnutls-1.6.1.orig/libextra/openssl_compat.h	Wed Mar  8 05:44:59 2006
+++ gnutls-1.6.1/libextra/openssl_compat.h	Sun Mar 18 20:15:04 2007
@@ -34,7 +34,7 @@ int gnutls_x509_extract_dn_string (const
 int gnutls_x509_extract_certificate_dn (const gnutls_datum_t *,
 					gnutls_x509_dn *);
 int gnutls_x509_extract_certificate_dn_string (char *buf,
-					       unsigned int sizeof_buf,
+					       size_t sizeof_buf,
 					       const gnutls_datum_t * cert,
 					       int issuer);
 int gnutls_x509_extract_certificate_issuer_dn (const gnutls_datum_t *,
diff -urp gnutls-1.6.1.orig/src/common.c gnutls-1.6.1/src/common.c
--- gnutls-1.6.1.orig/src/common.c	Wed Jul  5 17:32:53 2006
+++ gnutls-1.6.1/src/common.c	Sun Mar 18 20:15:04 2007
@@ -111,7 +111,7 @@ print_x509_info (gnutls_session session,
       return;
     }
 
-  printf (" - Got a certificate list of %d certificates.\n\n",
+  printf (" - Got a certificate list of %zu certificates.\n\n",
 	  cert_list_size);
 
   for (j = 0; j < (unsigned int) cert_list_size; j++)
@@ -244,10 +244,10 @@ print_x509_info (gnutls_session session,
 		  if (ret >= 0)
 		    {
 		      print = SU (raw_to_string (e.data, e.size));
-		      printf (" # e [%d bits]: %s\n", e.size * 8, print);
+		      printf (" # e [%zu bits]: %s\n", e.size * 8, print);
 
 		      print = SU (raw_to_string (m.data, m.size));
-		      printf (" # m [%d bits]: %s\n", m.size * 8, print);
+		      printf (" # m [%zu bits]: %s\n", m.size * 8, print);
 
 		      gnutls_free (e.data);
 		      gnutls_free (m.data);
@@ -261,16 +261,16 @@ print_x509_info (gnutls_session session,
 		  if (ret >= 0)
 		    {
 		      print = SU (raw_to_string (p.data, p.size));
-		      printf (" # p [%d bits]: %s\n", p.size * 8, print);
+		      printf (" # p [%zu bits]: %s\n", p.size * 8, print);
 
 		      print = SU (raw_to_string (q.data, q.size));
-		      printf (" # q [%d bits]: %s\n", q.size * 8, print);
+		      printf (" # q [%zu bits]: %s\n", q.size * 8, print);
 
 		      print = SU (raw_to_string (g.data, g.size));
-		      printf (" # g [%d bits]: %s\n", g.size * 8, print);
+		      printf (" # g [%zu bits]: %s\n", g.size * 8, print);
 
 		      print = SU (raw_to_string (y.data, y.size));
-		      printf (" # y [%d bits]: %s\n", y.size * 8, print);
+		      printf (" # y [%zu bits]: %s\n", y.size * 8, print);
 
 		      gnutls_free (p.data);
 		      gnutls_free (q.data);
@@ -315,7 +315,7 @@ print_openpgp_info (gnutls_session sessi
   size_t name_len = sizeof (name);
   gnutls_openpgp_key crt;
   const gnutls_datum *cert_list;
-  int cert_list_size = 0;
+  size_t cert_list_size = 0;
   time_t expiret;
   time_t activet;
 
diff -urp gnutls-1.6.1.orig/src/crypt.c gnutls-1.6.1/src/crypt.c
--- gnutls-1.6.1.orig/src/crypt.c	Sun Aug  6 11:25:50 2006
+++ gnutls-1.6.1/src/crypt.c	Sun Mar 18 20:15:04 2007
@@ -144,7 +144,7 @@ generate_create_conf (char *tpasswd_conf
 	  g = gnutls_srp_2048_group_generator;
 	}
 
-      printf ("\nGroup %d, of %d bits:\n", index, n.size * 8);
+      printf ("\nGroup %d, of %zu bits:\n", index, n.size * 8);
       print_num ("Generator", &g);
       print_num ("Prime", &n);
 
@@ -187,7 +187,7 @@ _verify_passwd_int (const char *username
 {
   char _salt[1024];
   gnutls_datum tmp, raw_salt, new_verifier;
-  int salt_size;
+  size_t salt_size;
   char *pos;
 
   if (salt == NULL || verifier == NULL)
diff -urp gnutls-1.6.1.orig/src/prime.c gnutls-1.6.1/src/prime.c
--- gnutls-1.6.1.orig/src/prime.c	Fri May 12 08:02:35 2006
+++ gnutls-1.6.1/src/prime.c	Sun Mar 18 20:15:04 2007
@@ -107,7 +107,7 @@ generate_prime (int bits, int how)
     {
 
       fprintf (outfile, "/* generator */\n");
-      fprintf (outfile, "\nconst uint8 g[%d] = { ", g.size);
+      fprintf (outfile, "\nconst uint8 g[%zu] = { ", g.size);
 
       for (i = 0; i < g.size; i++)
 	{
@@ -141,8 +141,8 @@ generate_prime (int bits, int how)
 
   if (cparams)
     {
-      fprintf (outfile, "/* prime - %d bits */\n", p.size * 8);
-      fprintf (outfile, "\nconst uint8 prime[%d] = { ", p.size);
+      fprintf (outfile, "/* prime - %zu bits */\n", p.size * 8);
+      fprintf (outfile, "\nconst uint8 prime[%zu] = { ", p.size);
 
       for (i = 0; i < p.size; i++)
 	{
diff -urp gnutls-1.6.1.orig/src/tests.c gnutls-1.6.1/src/tests.c
--- gnutls-1.6.1.orig/src/tests.c	Thu Sep 21 07:27:59 2006
+++ gnutls-1.6.1/src/tests.c	Sun Mar 18 20:15:04 2007
@@ -50,7 +50,7 @@ int tls1_1_ok = 0;
 /* keep session info */
 static char *session_data = NULL;
 static char session_id[32];
-static int session_data_size = 0, session_id_size = 0;
+static size_t session_data_size = 0, session_id_size = 0;
 static int sfree = 0;
 static int handshake_output = 0;
 
@@ -368,11 +368,11 @@ test_export_info (gnutls_session session
 
 	  print = raw_to_string (exp2.data, exp2.size);
 	  if (print)
-	    printf (" Exponent [%d bits]: %s\n", exp2.size * 8, print);
+	    printf (" Exponent [%zu bits]: %s\n", exp2.size * 8, print);
 
 	  print = raw_to_string (mod2.data, mod2.size);
 	  if (print)
-	    printf (" Modulus [%d bits]: %s\n", mod2.size * 8, print);
+	    printf (" Modulus [%zu bits]: %s\n", mod2.size * 8, print);
 
 	  if (mod2.size != mod.size || exp2.size != exp.size ||
 	      memcmp (mod2.data, mod.data, mod.size) != 0 ||
@@ -439,16 +439,16 @@ test_dhe_group (gnutls_session session)
 
       print = raw_to_string (gen.data, gen.size);
       if (print)
-	printf (" Generator [%d bits]: %s\n", gen.size * 8, print);
+	printf (" Generator [%zu bits]: %s\n", gen.size * 8, print);
 
       print = raw_to_string (prime.data, prime.size);
       if (print)
-	printf (" Prime [%d bits]: %s\n", prime.size * 8, print);
+	printf (" Prime [%zu bits]: %s\n", prime.size * 8, print);
 
       gnutls_dh_get_pubkey (session, &pubkey2);
       print = raw_to_string (pubkey2.data, pubkey2.size);
       if (print)
-	printf (" Pubkey [%d bits]: %s\n", pubkey2.size * 8, print);
+	printf (" Pubkey [%zu bits]: %s\n", pubkey2.size * 8, print);
 
       if (pubkey2.data && pubkey2.size == pubkey.size &&
 	  memcmp (pubkey.data, pubkey2.data, pubkey.size) == 0)
@@ -999,7 +999,7 @@ test_session_resume2 (gnutls_session ses
 {
   int ret;
   char tmp_session_id[32];
-  int tmp_session_id_size;
+  size_t tmp_session_id_size;
 
   if (session == NULL)
     return TEST_IGNORE;
diff -urp gnutls-1.6.1.orig/tests/anonself.c gnutls-1.6.1/tests/anonself.c
--- gnutls-1.6.1.orig/tests/anonself.c	Fri Jun 16 11:35:47 2006
+++ gnutls-1.6.1/tests/anonself.c	Sun Mar 18 20:15:04 2007
@@ -30,6 +30,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include <netinet/in.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
 #include <arpa/inet.h>
diff -urp gnutls-1.6.1.orig/tests/pkcs1-padding/pkcs1-pad gnutls-1.6.1/tests/pkcs1-padding/pkcs1-pad
--- gnutls-1.6.1.orig/tests/pkcs1-padding/pkcs1-pad	Tue Oct 24 07:14:07 2006
+++ gnutls-1.6.1/tests/pkcs1-padding/pkcs1-pad	Sun Mar 18 20:15:04 2007
@@ -30,10 +30,10 @@ EXPECT1=2101
 $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-ok.pem | tee out1
 $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken.pem | tee out2
 
-out1oks=`grep 'Verified.' out1 | wc -l`
-out2oks=`grep 'Verified.' out2 | wc -l`
-out1fails=`grep 'Not verified.' out1 | wc -l`
-out2fails=`grep 'Not verified.' out2 | wc -l`
+out1oks=`grep 'Verified.' out1 | wc -l | tr -d " "`
+out2oks=`grep 'Verified.' out2 | wc -l | tr -d " "`
+out1fails=`grep 'Not verified.' out1 | wc -l | tr -d " "`
+out2fails=`grep 'Not verified.' out2 | wc -l | tr -d " "`
 
 rm -f out1 out2
 
@@ -54,10 +54,10 @@ EXPECT2=1001
 $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-ok2.pem | tee out1
 $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken2.pem | tee out2
 
-out1oks=`grep 'Verified.' out1 | wc -l`
-out2oks=`grep 'Verified.' out2 | wc -l`
-out1fails=`grep 'Not verified.' out1 | wc -l`
-out2fails=`grep 'Not verified.' out2 | wc -l`
+out1oks=`grep 'Verified.' out1 | wc -l | tr -d " "`
+out2oks=`grep 'Verified.' out2 | wc -l | tr -d " "`
+out1fails=`grep 'Not verified.' out1 | wc -l | tr -d " "`
+out2fails=`grep 'Not verified.' out2 | wc -l | tr -d " "`
 
 rm -f out1 out2
 
@@ -78,8 +78,8 @@ EXPECT3=11
 
 $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken3.pem | tee out1
 
-out1oks=`grep 'Verified.' out1 | wc -l`
-out1fails=`grep 'Not verified.' out1 | wc -l`
+out1oks=`grep 'Verified.' out1 | wc -l | tr -d " "`
+out1fails=`grep 'Not verified.' out1 | wc -l | tr -d " "`
 
 rm -f out1
 




More information about the Gnutls-dev mailing list