[gnutls-dev] Patch for 0.9.5 for building with Forte 6 update 2 on Solaris/Sparc

Sean Gao sean.gao@sun.com
Thu May 8 16:23:19 2003


This is a multi-part message in MIME format.
--------------080204010609000009050507
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi, there
    Just completing building 0.9.5 on Solaris with Forte 6 update 2, 
and  I have done some modifications
before success.  Attached is a proposed patch, and here are some 
comments:   
    1.  gnutls-0.9.5/includes/gnutls/openssl.h          forte seems not 
accepting an empty struct without any member ...
         gnutls-0.9.5/lib/gnutls_cipher.c                   the const 
keyword makes forte failing
         gnutls-0.9.5/libextra/gnutls_srp.c                the "return 
FUNCTION();"  is not accept for a void return type function.
    2.  Even if I define __BUILTIN_VA_ARG_INCR or  __sparc, it seems 
that the including header file
         /usr/include/alloca.h is not preprocessed as expected since it 
always says that alloca is an undefined
         symbol during linking process ....  I have to do some changes, 
but my approach seems work-around
         only, hope you guys can help to correct me.  Thanks,  :-)
    3.  In the file gnutls-0.9.5.new/lib/x509/x509.c, if not giving 
tmp.data a value, it will cause core dump ...
         It should be a neglect forgetting to do so.,

Hope these could be some helpful and be taken into account

Cheers,
-Sean

--------------080204010609000009050507
Content-Type: text/plain;
 name="apatch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="apatch.txt"

diff -ru gnutls-0.9.5/includes/gnutls/openssl.h gnutls-0.9.5.new/includes/gnutls/openssl.h
--- gnutls-0.9.5/includes/gnutls/openssl.h	Wed Jan  8 01:11:20 2003
+++ gnutls-0.9.5.new/includes/gnutls/openssl.h	Tue Apr 29 17:11:04 2003
@@ -139,6 +139,7 @@
 
 typedef struct
 {
+   char * nouse;
 } RSA;
 
 #define MD5_CTX MD_CTX
diff -ru gnutls-0.9.5/lib/defines.h gnutls-0.9.5.new/lib/defines.h
--- gnutls-0.9.5/lib/defines.h	Wed Mar 12 19:20:36 2003
+++ gnutls-0.9.5.new/lib/defines.h	Tue Apr 29 18:28:08 2003
@@ -21,6 +21,8 @@
 #ifndef DEFINES_H
 # define DEFINES_H
 
+
+/*
 #ifndef __GNUC__
 # if HAVE_ALLOCA_H
 #  include <alloca.h>
@@ -28,14 +30,16 @@
 #  ifdef _AIX
 #pragma alloca
 #  else
-#   ifndef alloca	/* predefined by HP cc +Olibcalls */
+#   ifndef alloca	*//* predefined by HP cc +Olibcalls */
+/*
 char *alloca();
 #   endif
 #  endif
 # endif
 #endif
+*/
 
-
+#include <alloca.h>
 #include <config.h>
 
 #ifdef STDC_HEADERS
diff -ru gnutls-0.9.5/lib/gnutls_cipher.c gnutls-0.9.5.new/lib/gnutls_cipher.c
--- gnutls-0.9.5/lib/gnutls_cipher.c	Tue Mar  4 15:03:41 2003
+++ gnutls-0.9.5.new/lib/gnutls_cipher.c	Tue Apr 29 16:54:18 2003
@@ -64,7 +64,11 @@
 		const char *data, size_t data_size,
 		opaque * ciphertext, size_t ciphertext_size, ContentType type, int random_pad)
 {
-	const gnutls_datum plain = { (opaque*) data, data_size };
+       /*
+        * const gnutls_datum plain = { (opaque*) data, data_size };
+        */
+	gnutls_datum plain = { (opaque*) data, data_size };
+ 
 	gnutls_datum comp;
 	int ret;
 	int free_comp = 1;
diff -ru gnutls-0.9.5/lib/gnutls_mem.h gnutls-0.9.5.new/lib/gnutls_mem.h
--- gnutls-0.9.5/lib/gnutls_mem.h	Sun Feb 16 17:36:20 2003
+++ gnutls-0.9.5.new/lib/gnutls_mem.h	Tue Apr 29 18:19:34 2003
@@ -12,7 +12,7 @@
  * support alloca.
  */
 #ifdef HAVE_ALLOCA
-# define gnutls_alloca alloca
+# define gnutls_alloca __builtin_alloca
 # define gnutls_afree(x)
 #else
 # define gnutls_alloca gnutls_malloc
diff -ru gnutls-0.9.5/lib/x509/x509.c gnutls-0.9.5.new/lib/x509/x509.c
--- gnutls-0.9.5/lib/x509/x509.c	Tue Apr  1 19:03:57 2003
+++ gnutls-0.9.5.new/lib/x509/x509.c	Wed Apr 30 15:20:21 2003
@@ -1004,6 +1004,7 @@
 		return _gnutls_asn2err(result);
 	}
 	
+	tmp.data = cert_buf;
 	tmp.size = cert_buf_size;
 
 	result = gnutls_fingerprint( algo, &tmp, buf, sizeof_buf);
diff -ru gnutls-0.9.5/libextra/gnutls_openssl.c gnutls-0.9.5.new/libextra/gnutls_openssl.c
--- gnutls-0.9.5/libextra/gnutls_openssl.c	Wed Jan  8 01:11:21 2003
+++ gnutls-0.9.5.new/libextra/gnutls_openssl.c	Tue Apr 29 17:14:34 2003
@@ -920,7 +920,7 @@
     if (!md)
         return NULL;
 
-    local_md = alloca(gcry_md_get_algo_dlen(GCRY_MD_MD5));
+    local_md = __builtin_alloca(gcry_md_get_algo_dlen(GCRY_MD_MD5));
 
     gcry_md_hash_buffer(GCRY_MD_MD5, local_md, buf, len);
 
@@ -957,7 +957,7 @@
     if (!md)
         return NULL;
 
-    local_md = alloca(gcry_md_get_algo_dlen(GCRY_MD_RMD160));
+    local_md = __builtin_alloca(gcry_md_get_algo_dlen(GCRY_MD_RMD160));
 
     gcry_md_hash_buffer(GCRY_MD_RMD160, local_md, buf, len);
 
diff -ru gnutls-0.9.5/libextra/gnutls_srp.c gnutls-0.9.5.new/libextra/gnutls_srp.c
--- gnutls-0.9.5/libextra/gnutls_srp.c	Thu Mar 13 06:04:22 2003
+++ gnutls-0.9.5.new/libextra/gnutls_srp.c	Tue May  6 11:09:09 2003
@@ -641,11 +641,17 @@
  */
 
 void gnutls_srp_free_client_cred( gnutls_srp_client_credentials sc) {
-	return gnutls_srp_free_client_credentials( sc);
+    /* 
+     * return gnutls_srp_free_client_credentials( sc);
+     */
+	gnutls_srp_free_client_credentials( sc);
 }
 
 void gnutls_srp_free_server_cred( gnutls_srp_server_credentials sc) {
-	return gnutls_srp_free_server_credentials( sc);
+    /*
+     * return gnutls_srp_free_server_credentials( sc);
+     */
+	gnutls_srp_free_server_credentials( sc);
 }
 
 int gnutls_srp_allocate_client_cred( gnutls_srp_client_credentials *sc) {

--------------080204010609000009050507--