Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrading OpenSSL results in compiler error with sk_X509_pop_free

Tags:

c++

openssl

When I updgraded OpenSSL from 0.9.8 to 1.0.0E I now get a compiler error. The following is a simplified version:

1: #include <openssl/pem.h>  
2:
3: int main( int argc, char* argv[] )  
4: {  
5:   STACK_OF(X509)* certs = NULL;  
6:   sk_X509_pop_free(certs, X509_free);
7: }

I get the following error:

CC -g0 -I/openssl/ssl/include main.cc -o main -L/openssl/ssl/lib -lcrypto -lssl
"main.cc", line 6: Error: Different types for "?:" (extern "C" void(*)(x509_st*) and void(*)(x509_st*)).
"main.cc", line 6: Warning (Anachronism): Formal argument func of type extern "C" void(*)(void*) in call to sk_pop_free(stack_st*, extern "C" void(*)(void*)) is being passed void(*)(void*).

Binary: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped.
Compiler: CC: Sun C++ 5.9 SunOS_sparc 2007/05/03.
Operating System: Solaris 10

like image 901
Hitman Avatar asked Nov 16 '25 16:11

Hitman


1 Answers

The following code removes the error:

sk_X509_pop_free(certs, (void(*)(x509_st*))X509_free);
like image 67
Hitman Avatar answered Nov 18 '25 06:11

Hitman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!