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

Define OPENSSL_API_COMPAT to 0x10101000L #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jhrozek
Copy link

@jhrozek jhrozek commented May 17, 2021

This enables compiling cjose on systems that only ship openssl v3.

It is not a very systematic patch, but at least cjose builds...

@moschlar
Copy link

I'm not sure whether I did something else wrong, but this leads to the build failing with openssl 1.1.1:

jws.c: In function '_cjose_jws_build_sig_ec':
jws.c:577:16: error: implicit declaration of function 'BN_num_bytes' [-Werror=implicit-function-declaration]
  577 |     int rlen = BN_num_bytes(pr);
      |                ^~~~~~~~~~~~
jws.c:579:5: error: implicit declaration of function 'BN_bn2bin' [-Werror=implicit-function-declaration]
  579 |     BN_bn2bin(pr, jws->sig + jws->sig_len / 2 - rlen);
      |     ^~~~~~~~~
jws.c: In function '_cjose_jws_verify_sig_ec':
jws.c:1013:18: error: implicit declaration of function 'BN_new'; did you mean 'BIO_new'? [-Werror=implicit-function-declaration]
 1013 |     BIGNUM *pr = BN_new(), *ps = BN_new();
      |                  ^~~~~~
      |                  BIO_new
jws.c:1013:18: error: initialization of 'BIGNUM *' {aka 'struct bignum_st *'} from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
jws.c:1013:34: error: initialization of 'BIGNUM *' {aka 'struct bignum_st *'} from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
 1013 |     BIGNUM *pr = BN_new(), *ps = BN_new();
      |                                  ^~~~~~
jws.c:1014:5: error: implicit declaration of function 'BN_bin2bn' [-Werror=implicit-function-declaration]
 1014 |     BN_bin2bn(jws->sig, key_len, pr);
      |     ^~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:544: libcjose_la-jws.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
libtool: compile:  gcc -DPACKAGE_NAME=\"cjose\" -DPACKAGE_TARNAME=\"cjose\" -DPACKAGE_VERSION=\"0.6.1\" "-DPACKAGE_STRING=\"cjose 0.6.1\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"cjose\" -DVERSION=\"0.6.1\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_LIBCRYPTO=1 -DHAVE_LIBJANSSON=1 -I. -I/include -Wdate-time -D_FORTIFY_SOURCE=2 -std=gnu99 --pedantic -Wall -Werror -g -O2 -I../include -g -O2 -ffile-prefix-map=/build/cjose-0.6.1+dfsg1=. -fstack-protector-strong -Wformat -Werror=format-security -c jwk.c -o libcjose_la-jwk.o >/dev/null 2>&1
jwe.c: In function '_cjose_jwe_encrypt_dat_a256gcm':
jwe.c:937:5: error: implicit declaration of function 'EVP_CIPHER_CTX_init'; did you mean 'EVP_CIPHER_CTX_nid'? [-Werror=implicit-function-declaration]
  937 |     EVP_CIPHER_CTX_init(ctx);
      |     ^~~~~~~~~~~~~~~~~~~
      |     EVP_CIPHER_CTX_nid
cc1: all warnings being treated as errors
make[2]: *** [Makefile:537: libcjose_la-jwe.lo] Error 1
make[2]: Leaving directory '/build/cjose-0.6.1+dfsg1/src'
make[1]: *** [Makefile:465: all-recursive] Error 1
make[1]: Leaving directory '/build/cjose-0.6.1+dfsg1'

@jhrozek
Copy link
Author

jhrozek commented Feb 23, 2022

Yeah, sorry, I never tested building using this patch and 1.1.1. We do use the patch in RHEL-9 to build with openssl 3.0, though. Not sure how much it'd help you, but the specfile and the patch are public: https://gitlab.com/redhat/centos-stream/rpms/cjose

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

Successfully merging this pull request may close these issues.

2 participants