libressl / openbsd

Source code pulled from OpenBSD for LibreSSL - this includes most of the library and supporting code. The place to contribute to this code is via the OpenBSD CVS tree. Please mail patches to tech@openbsd.org, instead of submitting pull requests, since this tree is often rebased.
231 stars 92 forks source link

Varying declarations of BN_print #53

Closed pascal-cuoq closed 9 years ago

pascal-cuoq commented 9 years ago

The header bn.h defines the function BN_print differently depending whether bio.h is included:

#ifdef HEADER_BIO_H
int BN_print(BIO *fp, const BIGNUM *a);
#else
int BN_print(void *fp, const BIGNUM *a);
#endif

Only one type is allowable for BN_print, the type with which the function is defined (C11 6.2.7:2 “All declarations that refer to the same object or function shall have compatible type; otherwise, the behavior is undefined”). The types void * and BIO * are not compatible, and neither are the types of functions taking one or the other as argument.

Does anyone know what problem the hack above is supposed to solve and whether it is still useful?

bob-beck commented 9 years ago

Whatever it was meant to solve in the 90's doesn't matter anymore... Let's just include the proper header ahead of time.. fixed in tree..