Hitman
Hitman

Reputation: 123

Upgrading OpenSSL results in compiler error with sk_X509_pop_free

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

Upvotes: 4

Views: 1183

Answers (1)

Hitman
Hitman

Reputation: 123

The following code removes the error:

sk_X509_pop_free(certs, (void(*)(x509_st*))X509_free);

Upvotes: 3

Related Questions