Created from downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=543634
Description of problem: The openssl/asn1.h header file is buggy. For a C program this causes compiler warnings. For a C++ program this causes compiler errors, because C++ is a strongly typed language. Version-Release number of selected component (if applicable): openssl-devel-1.0.0-0.13.beta4.fc12.x86_64 How reproducible: Always. Steps to Reproduce: 1. Compile the attatched test program: https://bugzilla.redhat.com/attachment.cgi?id=375537 Actual results: 2. With gcc it compiles but gives warnings: [ell...@localhost ~]$ LANG=C gcc -o test test.c -lssl test.c: In function 'main': test.c:12: warning: passing argument 1 of 'i2d_ASN1_SET' from incompatible pointer type /usr/include/openssl/asn1.h:894: note: expected 'struct stack_st_OPENSSL_BLOCK *' but argument is of type 'struct _STACK *' test.c:14: warning: passing argument 1 of 'i2d_ASN1_SET' from incompatible pointer type /usr/include/openssl/asn1.h:894: note: expected 'struct stack_st_OPENSSL_BLOCK *' but argument is of type 'struct _STACK *' 3. With g++ it fails to compile, because the type mismatches are considered errors: [ell...@localhost ~]$ LANG=C g++ -o test test.c -lssl test.c: In function 'int main()': test.c:12: error: cannot convert '_STACK*' to 'stack_st_OPENSSL_BLOCK*' for argument '1' to 'int i2d_ASN1_SET(stack_st_OPENSSL_BLOCK*, unsigned char**, int (*)(void*, unsigned char**), int, int, int)' test.c:14: error: cannot convert '_STACK*' to 'stack_st_OPENSSL_BLOCK*' for argument '1' to 'int i2d_ASN1_SET(stack_st_OPENSSL_BLOCK*, unsigned char**, int (*)(void*, unsigned char**), int, int, int)' Expected results: No warnings in C, working compilation in C++. Additional info: There are 4 macros in openssl/asn1.h which are defined using STACK_OF(OPENSSL_BLOCK). However, by the time theses macros are being resolved all the arguments have been put through the CHECKED_xxx macros and been anonymized and are simply _STACK pointers. The 4 macros are: i2d_ASN1_SET, d2i_ASN1_SET, ASN1_seq_unpack, and ASN1_seq_pack. This is a rather clumsy workaround for the bug: https://bugzilla.redhat.com/attachment.cgi?id=375568 This compiles without warnings/error for C and C++: [ell...@localhost ~]$ gcc -o test test-wo.c -lssl [ell...@localhost ~]$ g++ -o test test-wo.c -lssl [ell...@localhost ~]$ ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager majord...@openssl.org