The ASN1_dup function prototype was removed from libcrypto on October 24 when the major ASN1 cleanup happened. However, the function itself was not removed, it is still present in asn1/a_dup.c and the function is listed in Symbols.list. This results in issues if there is any code calling the function. The prototype is:
void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); If the prototype is not declared in the header, the return value and all arguments are expected to be of type int, and on I32LP64 platforms, that means that if ASN1_dup is called, it will probably return an invalid pointer. The removal of the ASN1_dup prototype causes a segfault when using the ruby openssl extension (which calls the function). I've tested that this fixes the issue. This patch keeps the !LIBRESSL_INTERNAL guard around the defintion, but that could be removed. OKs? Alternatively, if we really do want to delete the function, we should delete the definition in addition to the prototype, and remove the function from Symbols.list. In that case, please let me know what an appopriate replacement would be, so I can inform the ruby openssl extension developers. Thanks, Jeremy Index: asn1.h =================================================================== RCS file: /cvs/src/lib/libcrypto/asn1/asn1.h,v retrieving revision 1.52 diff -u -p -r1.52 asn1.h --- asn1.h 9 Nov 2018 03:42:30 -0000 1.52 +++ asn1.h 29 Nov 2018 21:37:30 -0000 @@ -825,6 +825,12 @@ int ASN1_object_size(int constructed, in void *ASN1_item_dup(const ASN1_ITEM *it, void *x); +#ifndef LIBRESSL_INTERNAL + +void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); + +#endif /* !LIBRESSL_INTERNAL */ + void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x); #define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \