Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building ruby 2.5.0 fails with libressl 2.7.0 #192

Closed
chdiza opened this issue Mar 23, 2018 · 2 comments
Closed

Building ruby 2.5.0 fails with libressl 2.7.0 #192

chdiza opened this issue Mar 23, 2018 · 2 comments

Comments

@chdiza
Copy link

chdiza commented Mar 23, 2018

On macOS (10.13.3), building ruby 2.5.0 with libressl 2.6.4 works great. But with libressl 2.7.0 ruby fails to build, giving the error messages pasted below.

I opened this with libressl, and they pointed me here. In that thread there are a couple of proposed patches.

Error(s):

compiling openssl_missing.c
compiling objspace_dump.c
In file included from openssl_missing.c:21:
./openssl_missing.h:173:1: error: static declaration of 'EVP_PKEY_get0_RSA' follows non-static declaration
IMPL_PKEY_GETTER(RSA, rsa)
^
./openssl_missing.h:149:22: note: expanded from macro 'IMPL_PKEY_GETTER'
static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \
                     ^
<scratch space>:118:1: note: expanded from here
EVP_PKEY_get0_RSA
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/evp.h:878:16: note: previous declaration is here
struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
               ^
In file included from openssl_missing.c:21:
./openssl_missing.h:174:1: error: static declaration of 'RSA_get0_key' follows non-static declaration
IMPL_KEY_ACCESSOR3(RSA, key, n, e, d, (n == obj->n || e == obj->e || (obj->d && d == obj->d)))
^
./openssl_missing.h:161:20: note: expanded from macro 'IMPL_KEY_ACCESSOR3'
static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \
                   ^
<scratch space>:118:1: note: expanded from here
RSA_get0_key
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/rsa.h:399:6: note: previous declaration is here
void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
     ^
In file included from openssl_missing.c:21:
./openssl_missing.h:174:1: error: static declaration of 'RSA_set0_key' follows non-static declaration
IMPL_KEY_ACCESSOR3(RSA, key, n, e, d, (n == obj->n || e == obj->e || (obj->d && d == obj->d)))
^
./openssl_missing.h:165:19: note: expanded from macro 'IMPL_KEY_ACCESSOR3'
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2, BIGNUM *a3) { \
                  ^
<scratch space>:118:1: note: expanded from here
RSA_set0_key
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/rsa.h:401:5: note: previous declaration is here
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
    ^
In file included from openssl_missing.c:21:
./openssl_missing.h:175:1: error: static declaration of 'RSA_get0_factors' follows non-static declaration
IMPL_KEY_ACCESSOR2(RSA, factors, p, q, (p == obj->p || q == obj->q))
^
./openssl_missing.h:152:20: note: expanded from macro 'IMPL_KEY_ACCESSOR2'
static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2) { \
                   ^
<scratch space>:118:1: note: expanded from here
RSA_get0_factors
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/rsa.h:405:6: note: previous declaration is here
void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
     ^
In file included from openssl_missing.c:21:
./openssl_missing.h:175:1: error: static declaration of 'RSA_set0_factors' follows non-static declaration
IMPL_KEY_ACCESSOR2(RSA, factors, p, q, (p == obj->p || q == obj->q))
^
./openssl_missing.h:155:19: note: expanded from macro 'IMPL_KEY_ACCESSOR2'
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \
                  ^
<scratch space>:118:1: note: expanded from here
RSA_set0_factors
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/rsa.h:406:5: note: previous declaration is here
int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
    ^
In file included from openssl_missing.c:21:
./openssl_missing.h:176:1: error: static declaration of 'RSA_get0_crt_params' follows non-static declaration
IMPL_KEY_ACCESSOR3(RSA, crt_params, dmp1, dmq1, iqmp, (dmp1 == obj->dmp1 || dmq1 == obj->dmq1 || iqmp == obj->iqmp))
^
./openssl_missing.h:161:20: note: expanded from macro 'IMPL_KEY_ACCESSOR3'
static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \
                   ^
<scratch space>:118:1: note: expanded from here
RSA_get0_crt_params
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/rsa.h:402:6: note: previous declaration is here
void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
     ^
In file included from openssl_missing.c:21:
./openssl_missing.h:176:1: error: static declaration of 'RSA_set0_crt_params' follows non-static declaration
IMPL_KEY_ACCESSOR3(RSA, crt_params, dmp1, dmq1, iqmp, (dmp1 == obj->dmp1 || dmq1 == obj->dmq1 || iqmp == obj->iqmp))
^
./openssl_missing.h:165:19: note: expanded from macro 'IMPL_KEY_ACCESSOR3'
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2, BIGNUM *a3) { \
                  ^
<scratch space>:118:1: note: expanded from here
RSA_set0_crt_params
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/rsa.h:404:5: note: previous declaration is here
int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
    ^
In file included from openssl_missing.c:21:
./openssl_missing.h:180:1: error: static declaration of 'EVP_PKEY_get0_DSA' follows non-static declaration
IMPL_PKEY_GETTER(DSA, dsa)
^
./openssl_missing.h:149:22: note: expanded from macro 'IMPL_PKEY_GETTER'
static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \
                     ^
<scratch space>:118:1: note: expanded from here
EVP_PKEY_get0_DSA
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/evp.h:884:16: note: previous declaration is here
struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey);
               ^
In file included from openssl_missing.c:21:
./openssl_missing.h:181:1: error: static declaration of 'DSA_get0_key' follows non-static declaration
IMPL_KEY_ACCESSOR2(DSA, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
^
./openssl_missing.h:152:20: note: expanded from macro 'IMPL_KEY_ACCESSOR2'
static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2) { \
                   ^
<scratch space>:118:1: note: expanded from here
DSA_get0_key
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/dsa.h:265:6: note: previous declaration is here
void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key);
     ^
In file included from openssl_missing.c:21:
./openssl_missing.h:181:1: error: static declaration of 'DSA_set0_key' follows non-static declaration
IMPL_KEY_ACCESSOR2(DSA, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
^
./openssl_missing.h:155:19: note: expanded from macro 'IMPL_KEY_ACCESSOR2'
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \
                  ^
<scratch space>:118:1: note: expanded from here
DSA_set0_key
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/dsa.h:266:5: note: previous declaration is here
int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
    ^
In file included from openssl_missing.c:21:
./openssl_missing.h:182:1: error: static declaration of 'DSA_get0_pqg' follows non-static declaration
IMPL_KEY_ACCESSOR3(DSA, pqg, p, q, g, (p == obj->p || q == obj->q || g == obj->g))
^
./openssl_missing.h:161:20: note: expanded from macro 'IMPL_KEY_ACCESSOR3'
static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \
                   ^
<scratch space>:118:1: note: expanded from here
DSA_get0_pqg
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/dsa.h:262:6: note: previous declaration is here
void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q,
     ^
In file included from openssl_missing.c:21:
./openssl_missing.h:182:1: error: static declaration of 'DSA_set0_pqg' follows non-static declaration
IMPL_KEY_ACCESSOR3(DSA, pqg, p, q, g, (p == obj->p || q == obj->q || g == obj->g))
^
./openssl_missing.h:165:19: note: expanded from macro 'IMPL_KEY_ACCESSOR3'
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2, BIGNUM *a3) { \
                  ^
<scratch space>:118:1: note: expanded from here
DSA_set0_pqg
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/dsa.h:264:5: note: previous declaration is here
int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
    ^
In file included from openssl_missing.c:21:
./openssl_missing.h:186:1: error: static declaration of 'EVP_PKEY_get0_DH' follows non-static declaration
IMPL_PKEY_GETTER(DH, dh)
^
./openssl_missing.h:149:22: note: expanded from macro 'IMPL_PKEY_GETTER'
static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \
                     ^
<scratch space>:118:1: note: expanded from here
EVP_PKEY_get0_DH
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/evp.h:890:15: note: previous declaration is here
struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey);
              ^
In file included from openssl_missing.c:21:
./openssl_missing.h:187:1: error: static declaration of 'DH_get0_key' follows non-static declaration
IMPL_KEY_ACCESSOR2(DH, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
^
./openssl_missing.h:152:20: note: expanded from macro 'IMPL_KEY_ACCESSOR2'
static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2) { \
                   ^
<scratch space>:118:1: note: expanded from here
DH_get0_key
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/dh.h:196:6: note: previous declaration is here
void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key);
     ^
In file included from openssl_missing.c:21:
./openssl_missing.h:187:1: error: static declaration of 'DH_set0_key' follows non-static declaration
IMPL_KEY_ACCESSOR2(DH, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
^
./openssl_missing.h:155:19: note: expanded from macro 'IMPL_KEY_ACCESSOR2'
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \
                  ^
<scratch space>:118:1: note: expanded from here
DH_set0_key
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/dh.h:197:5: note: previous declaration is here
int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
    ^
In file included from openssl_missing.c:21:
./openssl_missing.h:188:1: error: static declaration of 'DH_get0_pqg' follows non-static declaration
IMPL_KEY_ACCESSOR3(DH, pqg, p, q, g, (p == obj->p || obj->q && q == obj->q || g == obj->g))
^
./openssl_missing.h:161:20: note: expanded from macro 'IMPL_KEY_ACCESSOR3'
static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \
                   ^
<scratch space>:118:1: note: expanded from here
DH_get0_pqg
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/dh.h:193:6: note: previous declaration is here
void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q,
     ^
In file included from openssl_missing.c:21:
./openssl_missing.h:188:1: error: static declaration of 'DH_set0_pqg' follows non-static declaration
IMPL_KEY_ACCESSOR3(DH, pqg, p, q, g, (p == obj->p || obj->q && q == obj->q || g == obj->g))
^
./openssl_missing.h:165:19: note: expanded from macro 'IMPL_KEY_ACCESSOR3'
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2, BIGNUM *a3) { \
                  ^
<scratch space>:118:1: note: expanded from here
DH_set0_pqg
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/dh.h:195:5: note: previous declaration is here
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
    ^
In file included from openssl_missing.c:21:
./openssl_missing.h:189:23: error: static declaration of 'DH_get0_engine' follows non-static declaration
static inline ENGINE *DH_get0_engine(DH *dh) { return dh->engine; }
                      ^
/usr/local/Cellar/libressl/2.7.0/include/openssl/dh.h:192:9: note: previous declaration is here
ENGINE *DH_get0_engine(DH *d);
        ^
In file included from openssl_missing.c:21:
./openssl_missing.h:193:1: error: static declaration of 'EVP_PKEY_get0_EC_KEY' follows non-static declaration
IMPL_PKEY_GETTER(EC_KEY, ec)
^
./openssl_missing.h:149:22: note: expanded from macro 'IMPL_PKEY_GETTER'
static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \
                     ^
<scratch space>:118:1: note: expanded from here
EVP_PKEY_get0_EC_KEY
^
/usr/local/Cellar/libressl/2.7.0/include/openssl/evp.h:896:19: note: previous declaration is here
struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey);
                  ^
19 errors generated.
make[2]: *** [openssl_missing.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
@4a6f656c
Copy link

LibreSSL 2.7.x provides additional OpenSSL API - Ruby should build against it by taking the HAVE_OPAQUE_OPENSSL code path. The existing structs have not been made opaque so the test for this still takes the other code path - something like the following against ext/openssl/extconf.rb should be all that's necessary:

@@ -122,8 +122,11 @@ OpenSSL.check_func_or_macro("SSL_get_server_tmp_key",
have_func("SSL_is_server")
+
+ # added in 1.1.0
+if try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x2070000fL", "openssl/opensslv.h") or \
+    not have_struct_member("SSL", "ctx", "openssl/ssl.h")
+  $defs.push("-DHAVE_OPAQUE_OPENSSL")
+end
 have_func("CRYPTO_lock") || $defs.push("-DHAVE_OPENSSL_110_THREADING_API")
-have_struct_member("SSL", "ctx", "openssl/ssl.h") || $defs.push("-DHAVE_OPAQUE_OPENSSL")
 have_func("BN_GENCB_new")
 have_func("BN_GENCB_free")
 have_func("BN_GENCB_get_arg")

@chdiza
Copy link
Author

chdiza commented May 2, 2018

Any movement on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants