« Return to Thread: Fw: Question on enhancing OpenSSL logs

RE: Fw: Question on enhancing OpenSSL logs

by Dave Thompson-5 :: Rate this Message:

| View in Thread

> From: owner-openssl-users@... On Behalf Of Marek.Marcola@...
> Sent: Monday, 21 May, 2012 11:11
(-dev dropped)

> This looks like declaration mismatch, you should send more info (used
> compilers, environment), maybe simple test code.

> owner-openssl-users@... wrote on 05/21/2012 02:52:15 PM:

> > Cannot assign extern "C" void(*)(ssl_st*,int,int) to extern "C"
> void(*)() at a line where we have
> > "SSL_CTX_set_info_callback(ctx, ssl_connection_info_cb);"
> >
> > We are doing the same as mentioned in the below mail chain.
> >
> > Can you pleas help us in resolving this. Thanks in advance.
> >

What version of openssl? All the versions I have back to early 0.9.8
declare SSL_CTX_set_info_callback to take void(*)(const SSL*,int,int).
I have a few 0.9.7 versions that make it a macro which assigns to
(ctx)->info_callback, but that is declared the same way.

If you have a very old openssl that uses the K&R1-style declaration
void(*cb)(), this exposes an incompatibility between C++ and C.
In C () still has the K&R1 meaning of 'unknown (but non-vararg
default-promoted) arguments' and only (void) means 'no arguments'.
In C++ either (void) or () means 'no arguments'.

If you are using such an old version, you'll need to make the
part of your app that calls _set_info_callback C instead of C++.
(If you don't want to convert much/all, you could write a 2-line
C wrapper that is called from your C++.) But much better use a
newer version that has better security _and_ support.

Also note your callback should have its first parameter a pointer to
>const< SSL or equivalently const struct ssl_st, or in C++ just
const ssl_st (but in C++ the whole function must be extern "C").
In both C++ and C a pointer to const T and a pointer to nonconst T
are formally incompatible, although in practice they interchange.


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

 « Return to Thread: Fw: Question on enhancing OpenSSL logs