The safestack macros introduced in 1.0.0 are not correct for C++.  The problem 
probably went unnoticed because a bug in g++ makes it ignore the “language 
linkage” in function types.  The problem does show up when using the Solaris 
Studio C++ compiler.

The problem is in the CHECKED_SK_…_FUNC macros.  The functions that are 
actually passed to these macros are all declared extern “C”, but the macros 
contain type expressions that are not extern “C”.  For example:

 #define CHECKED_SK_FREE_FUNC(type, p) \
     ((void (*)(void *)) ((1 ? p : (void (*)(type *))0)))

may get called with p being sk_free, which will have been declared as extern 
“C” void sk_free(_STACK *).  The type of p will not match void (*)(type *) 
because the latter type will not be extern “C”.  The result an error like this:

"ossltest.cpp", line 7: Error: Different types for "?:" (extern "C" 
void(*)(GENERAL_NAME_st*) and void(*)(GENERAL_NAME_st*)).

I’m not sure what is the best way to resolve this.  It may require some C++ 
template trickery, or a different approach to type-checking C++ client code.

joe

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to