> From: owner-openssl-us...@openssl.org On Behalf Of Poornima Jayaraman
> Sent: Friday, 06 March, 2009 00:49

> I have upgraded the version of OpenSSL being used by my application,
> from OpenSSL-0.9.8d to OpenSSL-0.9.8j. I get the compiler error
> 'error C2664: 'PEM_ASN1_read' : cannot convert parameter 1 from
> 'char *(__cdecl *)(void)' to 'd2i_of_void (__cdecl *)''
> when I build the application in VS2005, but the same code when
> built on VS2003 does not have any issues. In both cases, my app
> uses OpenSSL files built using VS2005 and VS2003 respectively.

> In my code, I am invoking the OpenSSL method 'PEM_read_SSL_SESSION( )',
> which is throwing the above mentioned error.

It looks like your code (making this call) is (compiled as) C++.
C++ treats some types (here, function of 'unspecified' parameters)
slightly differently than C, and it looks like the newer compiler (VS2005)
is more strictly checking these deviations than the older one (VS2003).
Or conceivably it's treating a file as C++ that should be C.

I would expect you to have the same problem on the write side;
maybe you just didn't hit that yet because this stopped your build?

> Please let me know how I can resolve this issue. And how is the invocation
> different from OpenSSL-0.9.8d to OpenSSL-0.9.8j?

The API (and functionality) in OpenSSL hasn't changed AFAICS.

1. Get the new compiler to compile as C, if that's what you wanted.

2. Continue using the old compiler. If that's OK for your app(s). And your
shop.

3. Get the new compiler to slack off this check, perhaps a lower error level
or a compatibility option. Again if OK for your app(s) and your shop.

4. Insert C shims: tiny routines, COMPILED AS C, called from your C++
that take your arguments and do the actual calls to PEM_read/write*.

5. Worst case: instead of using the PEM_* wrappers, set up a b64/file BIO
and pass it to d2i_SSL_SESSION_bio, or just de-PEM the data yourself
and pass it to d2i_SSL_SESSION.  And conversely on output.



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to