Subject: | PATCH: win32 and solaris compile support |
Hi Ionut,
This patch should get PKCS10 building on the Solaris and Win32 platforms.
Cheers
Dave
Subject: | pkcs10_solaris_win32.patch |
diff -Naur old/Makefile.PL new/Makefile.PL
--- old/Makefile.PL 2006-02-02 07:44:20.000000000 +1100
+++ new/Makefile.PL 2015-08-13 19:33:47.132327045 +1000
@@ -9,7 +9,7 @@
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'PKCS10.pm',
AUTHOR => 'JoNO <jonozzz@yahoo.com>') : ()),
- LIBS => ['-L/usr/local/ssl/lib -lcrypto'],
- DEFINE => '-DPERL5 -Wall',
+ LIBS => $^O eq 'MSWin32' ? ['-leay32'] : ['-lcrypto'],
+ DEFINE => $Config::Config{myuname} =~ /sunos|solaris/i ? '-DPERL5' : '-DPERL5 -Wall',
INC => '-I/usr/local/ssl/include',
);
diff -Naur old/PKCS10.xs new/PKCS10.xs
--- old/PKCS10.xs 2015-08-08 16:11:32.000000000 +1000
+++ new/PKCS10.xs 2015-08-13 19:13:09.063717409 +1000
@@ -9,8 +9,6 @@
#include <openssl/x509v3.h>
#include <openssl/err.h>
-#include "ppport.h"
-
typedef struct
{
X509_REQ* req;
@@ -145,7 +143,7 @@
continue;
}
- if (!X509_NAME_add_entry_by_txt(n, (unsigned char*)ne_types[i], chtype, (unsigned char*)ne_values[i], -1,-1,mval[i]))
+ if (!X509_NAME_add_entry_by_txt(n, (const char*)ne_types[i], chtype, (const unsigned char *)ne_values[i], -1,-1,mval[i]))
goto error;
}
@@ -170,7 +168,7 @@
* because we wont reference any other sections.
*/
-int add_ext(STACK_OF(X509_REQUEST) *sk, X509_REQ *req, int nid, char *value)
+int add_ext(STACK_OF(X509_EXTENSION) *sk, X509_REQ *req, int nid, char *value)
{
X509_EXTENSION *ex;
X509V3_CTX v3ctx;
@@ -185,13 +183,13 @@
/* Add an extention by setting the raw ASN1 octet string.
*/
-int add_ext_raw(STACK_OF(X509_REQUEST) *sk, int nid, unsigned char *value, int length)
+int add_ext_raw(STACK_OF(X509_EXTENSION) *sk, int nid, char *value, int length)
{
X509_EXTENSION *ex;
ASN1_STRING *asn;
asn = M_ASN1_OCTET_STRING_new();
- ASN1_OCTET_STRING_set(asn, value, length);
+ ASN1_OCTET_STRING_set(asn, (unsigned char *) value, length);
ex = X509_EXTENSION_create_by_NID(NULL, nid, 0, asn);
if (!ex)
@@ -556,8 +554,8 @@
int utf8;
PREINIT:
- unsigned char* subj;
- int subj_length;
+ char* subj;
+ STRLEN subj_length;
CODE:
subj = SvPV(subj_SV, subj_length);
@@ -576,8 +574,8 @@
SV* ext_SV;
PREINIT:
- unsigned char* ext;
- int ext_length;
+ char* ext;
+ STRLEN ext_length;
CODE:
ext = SvPV(ext_SV, ext_length);
@@ -599,9 +597,10 @@
SV* ext_SV;
PREINIT:
- unsigned char* oid;
- unsigned char* ext;
- int ext_length, nid;
+ char* oid;
+ char* ext;
+ STRLEN ext_length;
+ int nid;
CODE:
oid = SvPV(oid_SV, ext_length);
@@ -627,9 +626,10 @@
SV* ext_SV;
PREINIT:
- unsigned char* oid;
- unsigned char* ext;
- int ext_length, nid;
+ char* oid;
+ char* ext;
+ STRLEN ext_length;
+ int nid;
CODE:
oid = SvPV(oid_SV, ext_length);
@@ -662,7 +662,7 @@
if(pkcs10->exts)
sk_X509_EXTENSION_pop_free(pkcs10->exts, X509_EXTENSION_free);
} else {
- RETVAL = NULL;
+ RETVAL = 0;
}
OUTPUT:
@@ -674,8 +674,8 @@
SV* filename_SV;
PREINIT:
- unsigned char* filename;
- int filename_length;
+ char* filename;
+ STRLEN filename_length;
FILE* fp;
X509_REQ *req;