On Thu, Jan 05, 2006 at 02:35:54PM +0000, Gary Hawkins wrote:
> Hi all,
>
> I am a relatively new user to NewPKI and I am trying to compile the
> 2.0.0rc1 from source (since the official Debian package seems to be the
> previous version 2.0.0beta4). The official newpki-server 2.0.0beta4-4
> package from the official Debian 'testing' repository), but When I try to
> build newpki-libs from source using dpkg-buildpackage using the tarball
> from the newpki.org site, the compilation fails with the following error:
>
[...]
> ASN1/Asn1Helper.cpp:594: error: invalid conversion from `int (*)()' to `int
> (*)(void*, unsigned char**)'
> ASN1/Asn1Helper.cpp:675: error: invalid conversion from `unsigned char**'
> to `
> const unsigned char**'
> make[3]: *** [libnewpki_la-Asn1Helper.lo] Error 1
I am working on the debian packages, some patches are needed to
compile with g++ 4 (and the other packages newpki-server and
newpki-client need some work too).
I have joined the patch for newpki-lib to this mail.
Frederic: would you please consider applying it to your next release ?
It would also be great to get the debian/ subdirs in sync, when my
packages will be ready.
>
> Please can anyone tell me why this is failing? I am attempting to compile
> this using the latest Debian testing (etch) distribution with gcc-4.0 but
> compilation also fails using gcc-3.3 (as you can see from the local above).
bad, bad casts ;) Recent g++ versions are more pedantic on types.
>
> (Also I've noticed that the version number for the debian package it is
> trying to build is still claiming to be 2.0.0beta4 even though the tarball
> I downloaded is definitely -rc1.)
Yes, the debian packages are not up to date (I'm working on it).
Regards,
Pierre
diff -urNad newpki-lib-2.0.0~/src/ASN1/Asn1Helper.cpp
newpki-lib-2.0.0/src/ASN1/Asn1Helper.cpp
--- newpki-lib-2.0.0~/src/ASN1/Asn1Helper.cpp 2005-12-22 22:45:51.000000000
+0100
+++ newpki-lib-2.0.0/src/ASN1/Asn1Helper.cpp 2005-12-22 22:45:51.000000000
+0100
@@ -537,7 +537,7 @@
return false;
}
//Do signature
- if(ASN1_sign((int (*)())i2d_ASN1_OCTET_STRING,
cryptinfo.get_sig()->algor, NULL, cryptinfo.get_sig()->digest, (char*)datas,
(EVP_PKEY*)sig_pkey, sig_md) <= 0)
+ if(ASN1_sign((int (*)(void*, unsigned char**))i2d_ASN1_OCTET_STRING,
cryptinfo.get_sig()->algor, NULL, cryptinfo.get_sig()->digest, (char*)datas,
(EVP_PKEY*)sig_pkey, sig_md) <= 0)
{
NEWPKIerr(CRYPTO_ERROR_TXT, ERROR_ABORT);
ASN1_OCTET_STRING_free(datas);
@@ -591,7 +591,7 @@
}
//We can verify the signature
- if (ASN1_verify((int(*)())i2d_ASN1_OCTET_STRING,
cryptinfo.get_sig()->algor, cryptinfo.get_sig()->digest, (char*)datas,
(EVP_PKEY*)sig_pkey) <= 0)
+ if (ASN1_verify((int(*)(void*, unsigned char**))i2d_ASN1_OCTET_STRING,
cryptinfo.get_sig()->algor, cryptinfo.get_sig()->digest, (char*)datas,
(EVP_PKEY*)sig_pkey) <= 0)
{
NEWPKIerr(CRYPTO_ERROR_TXT, ERROR_ABORT);
ASN1_OCTET_STRING_free(datas);
@@ -672,7 +672,7 @@
OPENSSL_cleanse(key, keylen);
p = der_body;
- *a = ASN1_item_d2i(NULL, &p, der_body_len, it);
+ *a = ASN1_item_d2i(NULL, (const unsigned char**)&p, der_body_len, it);
if(!*a)
{
NEWPKIerr(CRYPTO_ERROR_TXT, ERROR_ABORT);
diff -urNad newpki-lib-2.0.0~/src/ASN1/NewPKIObject.cpp
newpki-lib-2.0.0/src/ASN1/NewPKIObject.cpp
--- newpki-lib-2.0.0~/src/ASN1/NewPKIObject.cpp 2005-12-22 22:45:51.000000000
+0100
+++ newpki-lib-2.0.0/src/ASN1/NewPKIObject.cpp 2005-12-22 22:45:51.000000000
+0100
@@ -242,7 +242,7 @@
p = buffer;
- if(! (*datas = ASN1_item_d2i(NULL, &p, outl, it)) )
+ if(! (*datas = ASN1_item_d2i(NULL, (const unsigned char **)&p, outl,
it)) )
{
NEWPKIerr(CRYPTO_ERROR_TXT, ERROR_BAD_DATAS);
free(buffer);
diff -urNad newpki-lib-2.0.0~/src/PKI_CERT.cpp newpki-lib-2.0.0/src/PKI_CERT.cpp
--- newpki-lib-2.0.0~/src/PKI_CERT.cpp 2005-12-22 22:45:51.000000000 +0100
+++ newpki-lib-2.0.0/src/PKI_CERT.cpp 2005-12-22 22:45:51.000000000 +0100
@@ -194,7 +194,7 @@
}
tmp_data=data;
- if(!d2i_X509(&cert,&data,dsize))
+ if(!d2i_X509(&cert,(const unsigned char **)&data,dsize))
{
NEWPKIerr(CRYPTO_ERROR_TXT, ERROR_ABORT);
free(tmp_data);
diff -urNad newpki-lib-2.0.0~/src/PKI_CRL.cpp newpki-lib-2.0.0/src/PKI_CRL.cpp
--- newpki-lib-2.0.0~/src/PKI_CRL.cpp 2005-12-22 22:45:51.000000000 +0100
+++ newpki-lib-2.0.0/src/PKI_CRL.cpp 2005-12-22 22:45:51.000000000 +0100
@@ -122,7 +122,7 @@
}
tmp_data=data;
- if(!d2i_X509_CRL(&crl,&data,dsize))
+ if(!d2i_X509_CRL(&crl,(const unsigned char **)&data,dsize))
{
NEWPKIerr(CRYPTO_ERROR_TXT, ERROR_CONVERT_CRL_X509CRL);
free(tmp_data);
@@ -458,9 +458,9 @@
continue;
p = ex->value->data;
if(method->it)
- rtmp =
(ASN1_ENUMERATED*)ASN1_item_d2i(NULL, &p, ex->value->length,
ASN1_ITEM_ptr(method->it));
+ rtmp =
(ASN1_ENUMERATED*)ASN1_item_d2i(NULL, (const unsigned char **)&p,
ex->value->length, ASN1_ITEM_ptr(method->it));
else
- rtmp =
(ASN1_ENUMERATED*)method->d2i(NULL, &p, ex->value->length);
+ rtmp =
(ASN1_ENUMERATED*)method->d2i(NULL, (const unsigned char **)&p,
ex->value->length);
if(!rtmp)
continue;
rev_inf.reason = ASN1_ENUMERATED_get(rtmp);
diff -urNad newpki-lib-2.0.0~/src/PKI_CSR.cpp newpki-lib-2.0.0/src/PKI_CSR.cpp
--- newpki-lib-2.0.0~/src/PKI_CSR.cpp 2005-12-22 22:45:51.000000000 +0100
+++ newpki-lib-2.0.0/src/PKI_CSR.cpp 2005-12-22 22:45:51.000000000 +0100
@@ -172,7 +172,7 @@
}
tmp_data=data;
- if(!d2i_X509_REQ(&m_csr,&data,dsize))
+ if(!d2i_X509_REQ(&m_csr,(const unsigned char **)&data,dsize))
{
NEWPKIerr(CRYPTO_ERROR_TXT, ERROR_CONVERT_CSR_X509REQ);
free(tmp_data);
diff -urNad newpki-lib-2.0.0~/src/PKI_P7B.cpp newpki-lib-2.0.0/src/PKI_P7B.cpp
--- newpki-lib-2.0.0~/src/PKI_P7B.cpp 2005-12-22 22:45:51.000000000 +0100
+++ newpki-lib-2.0.0/src/PKI_P7B.cpp 2005-12-22 22:45:51.000000000 +0100
@@ -150,7 +150,7 @@
}
tmp_data=data;
- if(!d2i_PKCS7(&m_p7b,&data,dsize))
+ if(!d2i_PKCS7(&m_p7b,(const unsigned char **)&data,dsize))
{
NEWPKIerr(CRYPTO_ERROR_TXT, ERROR_ABORT);
free(tmp_data);
diff -urNad newpki-lib-2.0.0~/src/PKI_PKCS12.cpp
newpki-lib-2.0.0/src/PKI_PKCS12.cpp
--- newpki-lib-2.0.0~/src/PKI_PKCS12.cpp 2005-12-22 22:45:51.000000000
+0100
+++ newpki-lib-2.0.0/src/PKI_PKCS12.cpp 2005-12-22 22:45:51.000000000 +0100
@@ -306,7 +306,7 @@
}
p = outdatas;
- p12 = d2i_PKCS12(NULL, &p, outdataslen);
+ p12 = d2i_PKCS12(NULL, (const unsigned char **)&p, outdataslen);
if(!p12)
{
NEWPKIerr(CRYPTO_ERROR_TXT, ERROR_ABORT);
diff -urNad newpki-lib-2.0.0~/src/PKI_RSA.cpp newpki-lib-2.0.0/src/PKI_RSA.cpp
--- newpki-lib-2.0.0~/src/PKI_RSA.cpp 2005-12-22 22:45:51.000000000 +0100
+++ newpki-lib-2.0.0/src/PKI_RSA.cpp 2005-12-22 22:45:51.000000000 +0100
@@ -351,7 +351,7 @@
}
tmp_data=data;
- if(!d2i_PrivateKey(EVP_PKEY_RSA, &pkey, &data, dsize))
+ if(!d2i_PrivateKey(EVP_PKEY_RSA, &pkey, (const unsigned char **)&data,
dsize))
{
NEWPKIerr(CRYPTO_ERROR_TXT, ERROR_CONVERT_KEY_EVP_PKEY);
free(tmp_data);
diff -urNad newpki-lib-2.0.0~/src/SessionsCache.h
newpki-lib-2.0.0/src/SessionsCache.h
--- newpki-lib-2.0.0~/src/SessionsCache.h 2004-05-23 21:46:32.000000000
+0200
+++ newpki-lib-2.0.0/src/SessionsCache.h 2005-12-22 22:46:21.000000000
+0100
@@ -28,6 +28,7 @@
#include "NewPKI.h"
#include "CriticalSection.h"
#include <openssl/ssl.h>
+#include <openssl/md5.h>
#include <map>
#include <mString.h>