Fix dev-python/m2crypto for openssl 1.1 |
||
Issue description
m2crypto-0.22.3-r4 fails to build with openssl-1.1.0f.
x86_64-cros-linux-gnu-clang -O2 -pipe -O2 -pipe -march=corei7 -g -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -clang-syntax -fPIC -I/usr/include/python2.7 -I/tmp/portage/dev-python/m2crypto-0.22.3-r4/work/M2Crypto-0.22.3/SWIG -c SWIG/_m2crypto_wrap.c -o /tmp/portage/dev-python/m2crypto-0.22.3-r4/work/M2Crypto-0.22.3-python2_7/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -DTHREADING
SWIG/_m2crypto_wrap.c:3230:35: error: use of undeclared identifier 'CRYPTO_NUM_LOCKS'
static PyThread_type_lock lock_cs[CRYPTO_NUM_LOCKS];
^
SWIG/_m2crypto_wrap.c:3231:24: error: use of undeclared identifier 'CRYPTO_NUM_LOCKS'
static long lock_count[CRYPTO_NUM_LOCKS];
^
SWIG/_m2crypto_wrap.c:3260:21: error: use of undeclared identifier 'CRYPTO_NUM_LOCKS'
for (i=0; i<CRYPTO_NUM_LOCKS; i++) {
^
SWIG/_m2crypto_wrap.c:3264:9: warning: implicit declaration of function 'CRYPTO_set_id_callback' is invalid in C99 [-Wimplicit-function-declaration]
CRYPTO_set_id_callback(threading_id_callback);
^
SWIG/_m2crypto_wrap.c:3276:21: error: use of undeclared identifier 'CRYPTO_NUM_LOCKS'
for (i=0; i<CRYPTO_NUM_LOCKS; i++) {
^
SWIG/_m2crypto_wrap.c:3541:5: warning: implicit declaration of function 'SSLeay_add_all_algorithms' is invalid in C99 [-Wimplicit-function-declaration]
SSLeay_add_all_algorithms();
^
SWIG/_m2crypto_wrap.c:3986:12: error: variable has incomplete type 'BIGNUM' (aka 'struct bignum_st')
BIGNUM rnd;
^
usr/include/openssl/ossl_typ.h:80:16: note: forward declaration of 'struct bignum_st'
typedef struct bignum_st BIGNUM;
^
SWIG/_m2crypto_wrap.c:3990:5: warning: implicit declaration of function 'BN_init' is invalid in C99 [-Wimplicit-function-declaration]
BN_init(&rnd);
^
SWIG/_m2crypto_wrap.c:4015:12: error: variable has incomplete type 'BIGNUM' (aka 'struct bignum_st')
BIGNUM rnd;
^
usr/include/openssl/ossl_typ.h:80:16: note: forward declaration of 'struct bignum_st'
typedef struct bignum_st BIGNUM;
^
SWIG/_m2crypto_wrap.c:4146:11: warning: 'RAND_pseudo_bytes' is deprecated [-Wdeprecated-declarations]
ret = RAND_pseudo_bytes(blob, n);
^
usr/include/openssl/rand.h:47:1: note: 'RAND_pseudo_bytes' has been explicitly marked deprecated here
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
^
usr/include/x86_64-cros-linux-gnu/openssl/opensslconf.h:125:34: note: expanded from macro 'DEPRECATEDIN_1_1_0'
# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f)
^
usr/include/x86_64-cros-linux-gnu/openssl/opensslconf.h:100:53: note: expanded from macro 'DECLARE_DEPRECATED'
# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated));
^
SWIG/_m2crypto_wrap.c:4260:34: error: incomplete definition of type 'struct evp_md_ctx_st'
if (!(blob = PyMem_Malloc(ctx->digest->md_size))) {
~~~^
usr/include/openssl/ossl_typ.h:92:16: note: forward declaration of 'struct evp_md_ctx_st'
typedef struct evp_md_ctx_st EVP_MD_CTX;
^
SWIG/_m2crypto_wrap.c:4277:42: error: invalid application of 'sizeof' to an incomplete type 'HMAC_CTX' (aka 'struct hmac_ctx_st')
if (!(ctx = (HMAC_CTX *)PyMem_Malloc(sizeof(HMAC_CTX)))) {
^ ~~~~~~~~~~
usr/include/openssl/ossl_typ.h:102:16: note: forward declaration of 'struct hmac_ctx_st'
typedef struct hmac_ctx_st HMAC_CTX;
^
SWIG/_m2crypto_wrap.c:4281:5: warning: implicit declaration of function 'HMAC_CTX_init' is invalid in C99 [-Wimplicit-function-declaration]
HMAC_CTX_init(ctx);
^
SWIG/_m2crypto_wrap.c:4286:5: warning: implicit declaration of function 'HMAC_CTX_cleanup' is invalid in C99 [-Wimplicit-function-declaration]
HMAC_CTX_cleanup(ctx);
^
SWIG/_m2crypto_wrap.c:4297:5: warning: 'HMAC_Init' is deprecated [-Wdeprecated-declarations]
HMAC_Init(ctx, kbuf, klen, md);
^
usr/include/openssl/hmac.h:28:1: note: 'HMAC_Init' has been explicitly marked deprecated here
DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
^
usr/include/x86_64-cros-linux-gnu/openssl/opensslconf.h:125:34: note: expanded from macro 'DEPRECATEDIN_1_1_0'
# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f)
^
usr/include/x86_64-cros-linux-gnu/openssl/opensslconf.h:100:53: note: expanded from macro 'DECLARE_DEPRECATED'
# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated));
^
SWIG/_m2crypto_wrap.c:4319:34: error: incomplete definition of type 'struct hmac_ctx_st'
if (!(blob = PyMem_Malloc(ctx->md->md_size))) {
~~~^
usr/include/openssl/ossl_typ.h:102:16: note: forward declaration of 'struct hmac_ctx_st'
typedef struct hmac_ctx_st HMAC_CTX;
^
SWIG/_m2crypto_wrap.c:4355:48: error: invalid application of 'sizeof' to an incomplete type 'EVP_CIPHER_CTX' (aka 'struct evp_cipher_ctx_st')
if (!(ctx = (EVP_CIPHER_CTX *)PyMem_Malloc(sizeof(EVP_CIPHER_CTX)))) {
^ ~~~~~~~~~~~~~~~~
usr/include/openssl/ossl_typ.h:90:16: note: forward declaration of 'struct evp_cipher_ctx_st'
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
^
SWIG/_m2crypto_wrap.c:4436:34: error: incomplete definition of type 'struct evp_cipher_ctx_st'
if (!(obuf = PyMem_Malloc(ctx->cipher->block_size))) {
~~~^
usr/include/openssl/ossl_typ.h:90:16: note: forward declaration of 'struct evp_cipher_ctx_st'
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
^
SWIG/_m2crypto_wrap.c:4573:17: error: incomplete definition of type 'struct evp_pkey_st'
switch (pkey->type) {
~~~~^
usr/include/openssl/ossl_typ.h:93:16: note: forward declaration of 'struct evp_pkey_st'
typedef struct evp_pkey_st EVP_PKEY;
^
SWIG/_m2crypto_wrap.c:4805:10: warning: implicit declaration of function 'DH_generate_parameters' is invalid in C99 [-Wimplicit-function-declaration]
dh = DH_generate_parameters(plen, g, gendh_callback, (void *)pyfunc);
^
SWIG/_m2crypto_wrap.c:4805:8: warning: incompatible integer to pointer conversion assigning to 'DH *' (aka 'struct dh_st *') from 'int' [-Wint-conversion]
dh = DH_generate_parameters(plen, g, gendh_callback, (void *)pyfunc);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SWIG/_m2crypto_wrap.c:4851:12: error: incomplete definition of type 'struct dh_st'
if (!dh->p) {
~~^
usr/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
SWIG/_m2crypto_wrap.c:4855:24: error: incomplete definition of type 'struct dh_st'
return bn_to_mpi(dh->p);
~~^
usr/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
SWIG/_m2crypto_wrap.c:4859:12: error: incomplete definition of type 'struct dh_st'
if (!dh->g) {
~~^
usr/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
SWIG/_m2crypto_wrap.c:4863:24: error: incomplete definition of type 'struct dh_st'
return bn_to_mpi(dh->g);
~~^
usr/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
SWIG/_m2crypto_wrap.c:4867:12: error: incomplete definition of type 'struct dh_st'
if (!dh->pub_key) {
~~^
usr/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
SWIG/_m2crypto_wrap.c:4871:24: error: incomplete definition of type 'struct dh_st'
return bn_to_mpi(dh->pub_key);
~~^
usr/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
SWIG/_m2crypto_wrap.c:4875:12: error: incomplete definition of type 'struct dh_st'
if (!dh->priv_key) {
~~^
usr/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
9 warnings and 20 errors generated.
,
Jun 22 2017
,
Jun 22 2017
Work to fix m2crypto for OpenSSL 1.1 has not yet been completed upstream. However, there is a WIP merge request was opened 10 months ago, and last updated 2 months ago: https://gitlab.com/m2crypto/m2crypto/merge_requests/98 Even with the above patches applied, m2crypto still relies on some deprecated OpenSSL APIs (e.g., DH_generate_parameters). To get a working M2Crypto python module, I had to build openssl-1.1.0f without an "--api=" option, to force minimum API level to 0 and therefore include the deprecated APIs.
,
Jun 24 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/overlays/portage-stable/+/1ff77ea24bf7990fa5b7ce48d7786467dd020a4c commit 1ff77ea24bf7990fa5b7ce48d7786467dd020a4c Author: Daniel Kurtz <djkurtz@chromium.org> Date: Sat Jun 24 05:56:38 2017 dev-python/typing: Import from gentoo dev-pyhon/typing is required to build dev-python/m2crypto-0.26.0, which itself is required to build against OpenSSL 1.1. Pull latest from upstream gentoo with small changes: * KEYWORDS=* * EAPI=5 * Remove 3_6 from PYTHON_COMPAT Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> BUG=chromium:734499 TEST=sudo emerge typing => Builds ok Change-Id: If0da3c1d81379c1cb6288e274d8fce5a13609e3a Reviewed-on: https://chromium-review.googlesource.com/544492 Commit-Ready: Daniel Kurtz <djkurtz@chromium.org> Tested-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> [add] https://crrev.com/1ff77ea24bf7990fa5b7ce48d7786467dd020a4c/dev-python/typing/Manifest [add] https://crrev.com/1ff77ea24bf7990fa5b7ce48d7786467dd020a4c/dev-python/typing/metadata.xml [add] https://crrev.com/1ff77ea24bf7990fa5b7ce48d7786467dd020a4c/dev-python/typing/typing-3.5.3.0.ebuild
,
Jun 24 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/overlays/portage-stable/+/d079bd1d34a8623774a9449cd5f03e26d5ff9c60 commit d079bd1d34a8623774a9449cd5f03e26d5ff9c60 Author: Daniel Kurtz <djkurtz@chromium.org> Date: Sat Jun 24 05:56:38 2017 dev-lang/swig: Update to latest from gentoo The latest dev-lang/swig fixes a bug when parsing string literals in macros. This is required to build m2crypto with OpenSSL 1.1. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> BUG=chromium:734499 TEST=sudo emerge swig => build ok TEST=Also rebuild dependent packages w/ build_packages Change-Id: I1de5be3411efd81750841874b6a6ba1d26ad7b7b Reviewed-on: https://chromium-review.googlesource.com/545396 Commit-Ready: Daniel Kurtz <djkurtz@chromium.org> Tested-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> [rename] https://crrev.com/d079bd1d34a8623774a9449cd5f03e26d5ff9c60/dev-lang/swig/swig-3.0.12.ebuild [modify] https://crrev.com/d079bd1d34a8623774a9449cd5f03e26d5ff9c60/dev-lang/swig/Manifest [modify] https://crrev.com/d079bd1d34a8623774a9449cd5f03e26d5ff9c60/dev-lang/swig/metadata.xml |
||
►
Sign in to add a comment |
||
Comment 1 by djkurtz@chromium.org
, Jun 19 2017