src/hg/gsid/gsidMember/paypalSignEncrypt.c 1.3

1.3 2009/04/14 07:20:02 galt
rearranging to get openssl to compile with gcc4, mainly by eliminating use of common.h and openssl together wherever possible
Index: src/hg/gsid/gsidMember/paypalSignEncrypt.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/gsid/gsidMember/paypalSignEncrypt.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -B -U 4 -r1.2 -r1.3
--- src/hg/gsid/gsidMember/paypalSignEncrypt.c	8 May 2007 06:06:23 -0000	1.2
+++ src/hg/gsid/gsidMember/paypalSignEncrypt.c	14 Apr 2009 07:20:02 -0000	1.3
@@ -1,13 +1,27 @@
 /* paypalSignEncrypt.h - routines to sign and encrypt button data using openssl */
 
+#include <string.h>
+
 #include "paypalSignEncrypt.h"
 
 /* The following code comes directly from PayPal's ButtonEncyption.cpp file, and has been
    modified only to work with C
 */
 
-char* sign_and_encrypt(const char *data, RSA *rsa, X509 *x509, X509 *PPx509, bool verbose)
+#include "openssl/buffer.h"
+#include "openssl/bio.h"
+#include "openssl/sha.h"
+#include "openssl/rand.h"
+#include "openssl/err.h"
+#include "openssl/rsa.h"
+#include "openssl/evp.h"
+#include "openssl/x509.h"
+#include "openssl/x509v3.h"
+#include "openssl/pkcs7.h"
+#include "openssl/pem.h"
+
+char* sign_and_encrypt(const char *data, RSA *rsa, X509 *x509, X509 *PPx509, int verbose)
 /* sign and encrypt button data for safe delivery to paypal */
 {
 	char *ret = NULL;
 	EVP_PKEY *pkey;
@@ -105,9 +119,9 @@
 	}
 
 	BIO_flush(bio);
 	len = BIO_get_mem_data(bio, &str);
-	ret = needMem(sizeof(char)*(len+1));
+	ret = malloc(sizeof(char)*(len+1));
 	memcpy(ret, str, len);
 	ret[len] = 0;
 
 end:
@@ -123,9 +137,9 @@
 	return ret;
 }
 
 
-char* sign_and_encryptFromFiles(const char *data, char *keyFile, char *certFile, char *ppCertFile, bool verbose)
+char* sign_and_encryptFromFiles(const char *data, char *keyFile, char *certFile, char *ppCertFile, int verbose)
 /* sign and encrypt button data for safe delivery to paypal, use keys/certs in specified filenames */
 {
     ERR_load_crypto_strings();
     OpenSSL_add_all_algorithms();