wahern / luaossl

Most comprehensive OpenSSL module in the Lua universe.
http://25thandclement.com/~william/projects/luaossl.html
Other
140 stars 49 forks source link

Does not compile without deprecated OpenSSL APIs #203

Open neheb opened 2 years ago

neheb commented 2 years ago

Compile with -DOPENSSL_API_COMPAT=0x10100000L to see the failures. Mostly missing headers. Example:

src/openssl.c: In function 'ossl_version':
src/openssl.c:3081:38: warning: implicit declaration of function 'SSLeay'; did you mean 'SSLerr'? [-Wimplicit-function-declaration]
 3081 |                 auxL_pushunsigned(L, SSLeay());
      |                                      ^~~~~~
      |                                      SSLerr
In file included from src/openssl.c:90:
src/openssl.c:3083:35: warning: implicit declaration of function 'SSLeay_version'; did you mean 'SSL_version'? [-Wimplicit-function-declaration]
 3083 |                 lua_pushstring(L, SSLeay_version(auxL_checkinteger(L, 1, INT_MIN, INT_MAX)));
      |                                   ^~~~~~~~~~~~~~
src/../vendor/compat53/c-api/compat-5.3.h:143:25: note: in definition of macro 'lua_pushstring'
  143 |   (lua_pushstring((L), (s)), lua_tostring((L), -1))
      |                         ^
src/openssl.c:3083:35: warning: passing argument 2 of 'lua_pushstring' makes pointer from integer without a cast [-Wint-conversion]
 3083 |                 lua_pushstring(L, SSLeay_version(auxL_checkinteger(L, 1, INT_MIN, INT_MAX)));
src/../vendor/compat53/c-api/compat-5.3.h:143:25: note: in definition of macro 'lua_pushstring'
  143 |   (lua_pushstring((L), (s)), lua_tostring((L), -1))
      |                         ^
In file included from src/openssl.c:85:
/home/mangix/devstuff/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include/lua.h:176:59: note: expected 'const char *' but argument is of type 'int'
  176 | LUA_API void  (lua_pushstring) (lua_State *L, const char *s);
      |                                               ~~~~~~~~~~~~^
src/openssl.c: In function 'pk_new':
src/openssl.c:4204:37: warning: implicit declaration of function 'RSA_new'; did you mean 'SSL_new'? [-Wimplicit-function-declaration]
 4204 |                         if (!(rsa = RSA_new()))
      |                                     ^~~~~~~
      |                                     SSL_new
src/openssl.c:4204:35: warning: assignment to 'RSA *' {aka 'struct rsa_st *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
 4204 |                         if (!(rsa = RSA_new()))
      |                                   ^
src/openssl.c:4207:30: warning: implicit declaration of function 'RSA_generate_key_ex' [-Wimplicit-function-declaration]
 4207 |                         if (!RSA_generate_key_ex(rsa, bits, exp, 0)) {
      |                              ^~~~~~~~~~~~~~~~~~~
src/openssl.c:4208:33: warning: implicit declaration of function 'RSA_free'; did you mean 'SSL_free'? [-Wimplicit-function-declaration]
 4208 |                                 RSA_free(rsa);
      |                                 ^~~~~~~~
      |                                 SSL_free
src/openssl.c:4224:37: warning: implicit declaration of function 'DSA_new'; did you mean 'SSL_new'? [-Wimplicit-function-declaration]
 4224 |                         if (!(dsa = DSA_new()))
      |                                     ^~~~~~~
      |                                     SSL_new
src/openssl.c:4224:35: warning: assignment to 'DSA *' {aka 'struct dsa_st *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
 4224 |                         if (!(dsa = DSA_new()))
      |                                   ^
src/openssl.c:4227:30: warning: implicit declaration of function 'DSA_generate_parameters_ex'; did you mean 'BN_generate_prime_ex'? [-Wimplicit-function-declaration]
 4227 |                         if (!DSA_generate_parameters_ex(dsa, bits, 0, 0, 0, 0, 0)) {
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              BN_generate_prime_ex
src/openssl.c:4228:33: warning: implicit declaration of function 'DSA_free'; did you mean 'SSL_free'? [-Wimplicit-function-declaration]
 4228 |                                 DSA_free(dsa);
      |                                 ^~~~~~~~
      |                                 SSL_free
src/openssl.c:4232:30: warning: implicit declaration of function 'DSA_generate_key'; did you mean 'EC_KEY_generate_key'? [-Wimplicit-function-declaration]
 4232 |                         if (!DSA_generate_key(dsa)) {
      |                              ^~~~~~~~~~~~~~~~
      |                              EC_KEY_generate_key
src/openssl.c:4263:44: warning: implicit declaration of function 'DH_new'; did you mean 'pk_new'? [-Wimplicit-function-declaration]
 4263 |                                 if (!(dh = DH_new()))
      |                                            ^~~~~~
      |                                            pk_new
src/openssl.c:4263:42: warning: assignment to 'DH *' {aka 'struct dh_st *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
 4263 |                                 if (!(dh = DH_new()))
      |                                          ^
src/openssl.c:4266:38: warning: implicit declaration of function 'DH_generate_parameters_ex'; did you mean 'BN_generate_prime_ex'? [-Wimplicit-function-declaration]
 4266 |                                 if (!DH_generate_parameters_ex(dh, bits, generator, 0)) {
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      BN_generate_prime_ex
src/openssl.c:4267:41: warning: implicit declaration of function 'DH_free'; did you mean 'BN_free'? [-Wimplicit-function-declaration]
 4267 |                                         DH_free(dh);
      |                                         ^~~~~~~
      |                                         BN_free
src/openssl.c:4273:30: warning: implicit declaration of function 'DH_generate_key'; did you mean 'EC_KEY_generate_key'? [-Wimplicit-function-declaration]
 4273 |                         if (!DH_generate_key(dh)) {
      |                              ^~~~~~~~~~~~~~~
      |                              EC_KEY_generate_key
src/openssl.c: In function 'pk_decrypt':
src/openssl.c:4557:26: error: 'RSA_PKCS1_PADDING' undeclared (first use in this function)
 4557 |         int rsaPadding = RSA_PKCS1_PADDING; /* default for `openssl rsautl` */
      |                          ^~~~~~~~~~~~~~~~~
src/openssl.c:4557:26: note: each undeclared identifier is reported only once for each function it appears in
src/openssl.c:4577:43: warning: implicit declaration of function 'EVP_PKEY_CTX_set_rsa_padding'; did you mean 'EVP_PKEY_CTX_set_app_data'? [-Wimplicit-function-declaration]
 4577 |         if (base_type == EVP_PKEY_RSA && !EVP_PKEY_CTX_set_rsa_padding(ctx, rsaPadding))
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                           EVP_PKEY_CTX_set_app_data
src/openssl.c: In function 'pk_encrypt':
src/openssl.c:4616:26: error: 'RSA_PKCS1_PADDING' undeclared (first use in this function)
 4616 |         int rsaPadding = RSA_PKCS1_PADDING; /* default for `openssl rsautl` */
      |                          ^~~~~~~~~~~~~~~~~
src/openssl.c: In function 'pk_pushparam':
src/openssl.c:4938:17: warning: implicit declaration of function 'RSA_get0_key' [-Wimplicit-function-declaration]
 4938 |                 RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &i, NULL, NULL);
      |                 ^~~~~~~~~~~~
src/openssl.c:4956:17: warning: implicit declaration of function 'RSA_get0_factors' [-Wimplicit-function-declaration]
 4956 |                 RSA_get0_factors(EVP_PKEY_get0_RSA(pkey), &i, NULL);
      |                 ^~~~~~~~~~~~~~~~
src/openssl.c:4968:17: warning: implicit declaration of function 'RSA_get0_crt_params'; did you mean 'SSL_get0_param'? [-Wimplicit-function-declaration]
 4968 |                 RSA_get0_crt_params(EVP_PKEY_get0_RSA(pkey), &i, NULL, NULL);
      |                 ^~~~~~~~~~~~~~~~~~~
      |                 SSL_get0_param
src/openssl.c:4985:17: warning: implicit declaration of function 'DSA_get0_pqg' [-Wimplicit-function-declaration]
 4985 |                 DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &i, NULL, NULL);
      |                 ^~~~~~~~~~~~
src/openssl.c:5000:17: warning: implicit declaration of function 'DSA_get0_key'; did you mean 'DES_set_key'? [-Wimplicit-function-declaration]
 5000 |                 DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &i, NULL);
      |                 ^~~~~~~~~~~~
      |                 DES_set_key
src/openssl.c:5010:17: warning: implicit declaration of function 'DH_get0_pqg' [-Wimplicit-function-declaration]
 5010 |                 DH_get0_pqg(EVP_PKEY_get0_DH(pkey), &i, NULL, NULL);
      |                 ^~~~~~~~~~~
src/openssl.c:5020:17: warning: implicit declaration of function 'DH_get0_key' [-Wimplicit-function-declaration]
 5020 |                 DH_get0_key(EVP_PKEY_get0_DH(pkey), &i, NULL);
      |                 ^~~~~~~~~~~
src/openssl.c: In function 'pk_setparam':
src/openssl.c:5085:17: warning: implicit declaration of function 'RSA_set0_key'; did you mean 'DES_set_key'? [-Wimplicit-function-declaration]
 5085 |                 RSA_set0_key(EVP_PKEY_get0_RSA(pkey), i, NULL, NULL);
      |                 ^~~~~~~~~~~~
      |                 DES_set_key
src/openssl.c:5100:17: warning: implicit declaration of function 'RSA_set0_factors' [-Wimplicit-function-declaration]
 5100 |                 RSA_set0_factors(EVP_PKEY_get0_RSA(pkey), i, NULL);
      |                 ^~~~~~~~~~~~~~~~
src/openssl.c:5110:17: warning: implicit declaration of function 'RSA_set0_crt_params' [-Wimplicit-function-declaration]
 5110 |                 RSA_set0_crt_params(EVP_PKEY_get0_RSA(pkey), i, NULL, NULL);
      |                 ^~~~~~~~~~~~~~~~~~~
src/openssl.c:5125:17: warning: implicit declaration of function 'DSA_set0_pqg' [-Wimplicit-function-declaration]
 5125 |                 DSA_set0_pqg(EVP_PKEY_get0_DSA(pkey), i, NULL, NULL);
      |                 ^~~~~~~~~~~~
src/openssl.c:5140:17: warning: implicit declaration of function 'DSA_set0_key'; did you mean 'DES_set_key'? [-Wimplicit-function-declaration]
 5140 |                 DSA_set0_key(EVP_PKEY_get0_DSA(pkey), i, NULL);
      |                 ^~~~~~~~~~~~
      |                 DES_set_key
src/openssl.c:5150:17: warning: implicit declaration of function 'DH_set0_pqg' [-Wimplicit-function-declaration]
 5150 |                 DH_set0_pqg(EVP_PKEY_get0_DH(pkey), i, NULL, NULL);
      |                 ^~~~~~~~~~~
src/openssl.c:5160:17: warning: implicit declaration of function 'DH_set0_key'; did you mean 'DES_set_key'? [-Wimplicit-function-declaration]
 5160 |                 DH_set0_key(EVP_PKEY_get0_DH(pkey), i, NULL);
      |                 ^~~~~~~~~~~
      |                 DES_set_key
src/openssl.c: At top level:
src/openssl.c:5429:32: error: 'RSA_PKCS1_PADDING' undeclared here (not in a function)
 5429 |         { "RSA_PKCS1_PADDING", RSA_PKCS1_PADDING }, // PKCS#1 padding
      |                                ^~~~~~~~~~~~~~~~~
src/openssl.c:5433:29: error: 'RSA_NO_PADDING' undeclared here (not in a function)
 5433 |         { "RSA_NO_PADDING", RSA_NO_PADDING }, // no padding
      |                             ^~~~~~~~~~~~~~
src/openssl.c:5434:37: error: 'RSA_PKCS1_OAEP_PADDING' undeclared here (not in a function)
 5434 |         { "RSA_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING }, // OAEP padding (encrypt and decrypt only)
      |                                     ^~~~~~~~~~~~~~~~~~~~~~
src/openssl.c:5435:31: error: 'RSA_X931_PADDING' undeclared here (not in a function)
 5435 |         { "RSA_X931_PADDING", RSA_X931_PADDING }, // (signature operations only)
      |                               ^~~~~~~~~~~~~~~~
src/openssl.c: In function 'xc_new':
src/openssl.c:6472:33: warning: implicit declaration of function 'X509_get_notBefore'; did you mean 'X509_getm_notBefore'? [-Wimplicit-function-declaration]
 6472 |                 X509_gmtime_adj(X509_get_notBefore(*ud), 0);
      |                                 ^~~~~~~~~~~~~~~~~~
      |                                 X509_getm_notBefore
src/openssl.c:6472:33: warning: passing argument 1 of 'X509_gmtime_adj' makes pointer from integer without a cast [-Wint-conversion]
 6472 |                 X509_gmtime_adj(X509_get_notBefore(*ud), 0);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~
      |                                 |
      |                                 int
In file included from src/openssl.c:73:
/home/mangix/devstuff/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include/openssl/x509.h:491:39: note: expected 'ASN1_TIME *' {aka 'struct asn1_string_st *'} but argument is of type 'int'
  491 | ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj);
      |                            ~~~~~~~~~~~^
src/openssl.c:6473:33: warning: implicit declaration of function 'X509_get_notAfter'; did you mean 'X509_getm_notAfter'? [-Wimplicit-function-declaration]
 6473 |                 X509_gmtime_adj(X509_get_notAfter(*ud), 0);
      |                                 ^~~~~~~~~~~~~~~~~
      |                                 X509_getm_notAfter
src/openssl.c:6473:33: warning: passing argument 1 of 'X509_gmtime_adj' makes pointer from integer without a cast [-Wint-conversion]
 6473 |                 X509_gmtime_adj(X509_get_notAfter(*ud), 0);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~
      |                                 |
      |                                 int
/home/mangix/devstuff/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include/openssl/x509.h:491:39: note: expected 'ASN1_TIME *' {aka 'struct asn1_string_st *'} but argument is of type 'int'
  491 | ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj);
      |                            ~~~~~~~~~~~^
src/openssl.c: In function 'xc_getLifetime':
src/openssl.c:6740:19: warning: assignment to 'const ASN1_TIME *' {aka 'const struct asn1_string_st *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
 6740 |         if ((time = X509_get_notBefore(crt)))
      |                   ^
src/openssl.c:6743:19: warning: assignment to 'const ASN1_TIME *' {aka 'const struct asn1_string_st *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
 6743 |         if ((time = X509_get_notAfter(crt)))
      |                   ^
src/openssl.c: In function 'xc_setLifetime':
src/openssl.c:6775:36: warning: passing argument 1 of 'ASN1_TIME_set' makes pointer from integer without a cast [-Wint-conversion]
 6775 |                 if (!ASN1_TIME_set(X509_get_notBefore(crt), ut))
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~
      |                                    |
      |                                    int
In file included from src/openssl.c:72:
/home/mangix/devstuff/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include/openssl/asn1.h:626:37: note: expected 'ASN1_TIME *' {aka 'struct asn1_string_st *'} but argument is of type 'int'
  626 | ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
      |                          ~~~~~~~~~~~^
src/openssl.c:6787:36: warning: passing argument 1 of 'ASN1_TIME_set' makes pointer from integer without a cast [-Wint-conversion]
 6787 |                 if (!ASN1_TIME_set(X509_get_notAfter(crt), ut))
      |                                    ^~~~~~~~~~~~~~~~~~~~~~
      |                                    |
      |                                    int
/home/mangix/devstuff/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include/openssl/asn1.h:626:37: note: expected 'ASN1_TIME *' {aka 'struct asn1_string_st *'} but argument is of type 'int'
  626 | ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
      |                          ~~~~~~~~~~~^
src/openssl.c: In function 'sx_setEphemeralKey':
src/openssl.c:9610:22: warning: implicit declaration of function 'SSL_CTX_set_tmp_rsa'; did you mean 'SSL_CTX_set_tmp_dh'? [-Wimplicit-function-declaration]
 9610 |                 if (!SSL_CTX_set_tmp_rsa(ctx, tmp))
      |                      ^~~~~~~~~~~~~~~~~~~
      |                      SSL_CTX_set_tmp_dh