The diff for our libcrypto below breaks the build of net/nagios/nrpe...

nagios links against OpenSSL 1.0.2 (eopenssl), builds with -nostdinc and
should not notice or care about any changes in LibreSSL's public headers.

To reproduce, apply the diff below in /usr/src/lib/libcrypto, run
make includes (no need to build libcrypto), then try to build
/usr/ports/net/nagios/nrpe.

cc -O2 -pipe   -nostdinc -I/usr/local/include/eopenssl -I/usr/include 
-I/usr/include/openssl -I/usr/include -DHAVE_CONFIG_H -I ../include -I 
./../include -o nrpe ./nrpe.c ./utils.c ./acl.c -L/usr/local/lib/eopenssl 
-Wl,-rpath,/usr/local/lib/eopenssl -L/usr/lib  -lssl -lcrypto
In file included from ./nrpe.c:27:
In file included from ../include/config.h:240:
/usr/include/openssl/rsa.h:162:2: error: unknown type name 'RSA_PSS_PARAMS'; 
did you mean 'RSA_OAEP_PARAMS'?
        RSA_PSS_PARAMS *pss;
        ^~~~~~~~~~~~~~
        RSA_OAEP_PARAMS
/usr/include/openssl/rsa.h:104:3: note: 'RSA_OAEP_PARAMS' declared here
} RSA_OAEP_PARAMS;

It obviously picks up LibreSSL's rsa.h and then looks through eopenssl's
headers included from our rsa.h where it fails to find the typedef for
RSA_PSS_PARAMS. Indeed, adding a typedef for RSA_PSS_PARAMS to 
/usr/local/include/eopenssl/openssl/ossl_typ.h "fixes" the build.

Any idea how to fix this?

Index: ossl_typ.h
===================================================================
RCS file: /cvs/src/lib/libcrypto/ossl_typ.h,v
retrieving revision 1.14
diff -u -p -r1.14 ossl_typ.h
--- ossl_typ.h  1 Nov 2021 20:53:08 -0000       1.14
+++ ossl_typ.h  22 Nov 2021 22:31:46 -0000
@@ -111,6 +111,7 @@ typedef struct dsa_method DSA_METHOD;
 
 typedef struct rsa_st RSA;
 typedef struct rsa_meth_st RSA_METHOD;
+typedef struct rsa_pss_params_st RSA_PSS_PARAMS;
 
 typedef struct rand_meth_st RAND_METHOD;
 
Index: rsa/rsa.h
===================================================================
RCS file: /cvs/src/lib/libcrypto/rsa/rsa.h,v
retrieving revision 1.51
diff -u -p -r1.51 rsa.h
--- rsa/rsa.h   4 Nov 2019 12:30:56 -0000       1.51
+++ rsa/rsa.h   22 Nov 2021 22:30:43 -0000
@@ -84,7 +84,7 @@ extern "C" {
 /* typedef struct rsa_st RSA; */
 /* typedef struct rsa_meth_st RSA_METHOD; */
 
-typedef struct rsa_pss_params_st {
+struct rsa_pss_params_st {
        X509_ALGOR *hashAlgorithm;
        X509_ALGOR *maskGenAlgorithm;
        ASN1_INTEGER *saltLength;
@@ -92,7 +92,7 @@ typedef struct rsa_pss_params_st {
 
        /* Hash algorithm decoded from maskGenAlgorithm. */
        X509_ALGOR *maskHash;
-} RSA_PSS_PARAMS;
+} /* RSA_PSS_PARAMS */;
 
 typedef struct rsa_oaep_params_st {
        X509_ALGOR *hashFunc;

Reply via email to