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

OpenSSL 3.x support #36

Open
dktapps opened this issue Apr 26, 2023 · 2 comments
Open

OpenSSL 3.x support #36

dktapps opened this issue Apr 26, 2023 · 2 comments

Comments

@dktapps
Copy link
Collaborator

dktapps commented Apr 26, 2023

@bukka I don't know a whole lot about OpenSSL API, would we require significant changes here to support 3.x?

@dktapps
Copy link
Collaborator Author

dktapps commented Apr 26, 2023

Looks like it automagically compiles, but there are a bunch of compiler warnings related to HMAC and CMAC:

/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c: In function ‘crypto_hash__free’:
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:235:3: warning: ‘HMAC_CTX_free’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  235 |   HMAC_CTX_free(PHP_CRYPTO_HMAC_CTX(PHPC_THIS));
      |   ^~~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:26,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/hmac.h:35:28: note: declared here
   35 | OSSL_DEPRECATEDIN_3_0 void HMAC_CTX_free(HMAC_CTX *ctx);
      |                            ^~~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:239:3: warning: ‘CMAC_CTX_free’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  239 |   CMAC_CTX_free(PHP_CRYPTO_CMAC_CTX(PHPC_THIS));
      |   ^~~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:28,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/cmac.h:34:28: note: declared here
   34 | OSSL_DEPRECATEDIN_3_0 void CMAC_CTX_free(CMAC_CTX *ctx);
      |                            ^~~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c: In function ‘crypto_hash__create_ex’:
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:261:3: warning: ‘HMAC_CTX_new’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  261 |   PHP_CRYPTO_HMAC_CTX(PHPC_THIS) = HMAC_CTX_new();
      |   ^~~~~~~~~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:26,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/hmac.h:33:33: note: declared here
   33 | OSSL_DEPRECATEDIN_3_0 HMAC_CTX *HMAC_CTX_new(void);
      |                                 ^~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:266:3: warning: ‘CMAC_CTX_new’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  266 |   PHP_CRYPTO_CMAC_CTX(PHPC_THIS) = CMAC_CTX_new();
      |   ^~~~~~~~~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:28,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/cmac.h:32:33: note: declared here
   32 | OSSL_DEPRECATEDIN_3_0 CMAC_CTX *CMAC_CTX_new(void);
      |                                 ^~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c: In function ‘crypto_hash__clone’:
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:304:3: warning: ‘EVP_MD_CTX_md’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  304 |   PHP_CRYPTO_HASH_ALG(PHPC_THAT) = EVP_MD_CTX_md(PHP_CRYPTO_HASH_CTX(PHPC_THIS));
      |   ^~~~~~~~~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto.h:45,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:20:
/home/user/php-build-scripts/bin/php7/include/openssl/evp.h:555:15: note: declared here
  555 | const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
      |               ^~~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:306:3: warning: ‘HMAC_CTX_copy’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  306 |   copy_success = HMAC_CTX_copy(
      |   ^~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:26,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/hmac.h:49:34: note: declared here
   49 | OSSL_DEPRECATEDIN_3_0 __owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);
      |                                  ^~~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:311:3: warning: ‘CMAC_CTX_copy’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  311 |   copy_success = CMAC_CTX_copy(
      |   ^~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:28,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/cmac.h:36:27: note: declared here
   36 | OSSL_DEPRECATEDIN_3_0 int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in);
      |                           ^~~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c: In function ‘php_crypto_hash_init’:
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:413:5: warning: ‘HMAC_Init_ex’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  413 |     PHP_CRYPTO_HMAC_DO(rc, HMAC_Init_ex)(
      |     ^~~~~~~~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:26,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/hmac.h:43:27: note: declared here
   43 | OSSL_DEPRECATEDIN_3_0 int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
      |                           ^~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:421:5: warning: ‘CMAC_Init’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  421 |     rc = CMAC_Init(PHP_CRYPTO_CMAC_CTX(PHPC_THIS),
      |     ^~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:28,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/cmac.h:37:27: note: declared here
   37 | OSSL_DEPRECATEDIN_3_0 int CMAC_Init(CMAC_CTX *ctx,
      |                           ^~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c: In function ‘php_crypto_hash_update’:
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:459:4: warning: ‘HMAC_Update’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  459 |    PHP_CRYPTO_HMAC_DO(rc, HMAC_Update)(
      |    ^~~~~~~~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:26,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/hmac.h:45:27: note: declared here
   45 | OSSL_DEPRECATEDIN_3_0 int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data,
      |                           ^~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:465:4: warning: ‘CMAC_Update’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  465 |    rc = CMAC_Update(PHP_CRYPTO_CMAC_CTX(PHPC_THIS), data, data_len);
      |    ^~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:28,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/cmac.h:40:27: note: declared here
   40 | OSSL_DEPRECATEDIN_3_0 int CMAC_Update(CMAC_CTX *ctx,
      |                           ^~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c: In function ‘php_crypto_hash_digest’:
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:509:4: warning: ‘HMAC_Final’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  509 |    PHP_CRYPTO_HMAC_DO(rc, HMAC_Final)(
      |    ^~~~~~~~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:26,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/hmac.h:47:27: note: declared here
   47 | OSSL_DEPRECATEDIN_3_0 int HMAC_Final(HMAC_CTX *ctx, unsigned char *md,
      |                           ^~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:514:4: warning: ‘CMAC_Final’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  514 |    rc = CMAC_Final(PHP_CRYPTO_CMAC_CTX(PHPC_THIS), hash_value, &hash_len_size);
      |    ^~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto_hash.h:28,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_hash.c:21:
/home/user/php-build-scripts/bin/php7/include/openssl/cmac.h:42:27: note: declared here
   42 | OSSL_DEPRECATEDIN_3_0 int CMAC_Final(CMAC_CTX *ctx,
      |                           ^~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_kdf.c: In function ‘crypto_kdf__clone’:
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_kdf.c:219:12: warning: unused variable ‘copy_success’ [-Wunused-variable]
  219 |  zend_bool copy_success;
      |            ^~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_kdf.c: In function ‘zim_Crypto__PBKDF2_derive’:
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_kdf.c:494:62: warning: pointer targets in passing argument 3 of ‘PKCS5_PBKDF2_HMAC’ differ in signedness [-Wpointer-sign]
  494 |  if (!PKCS5_PBKDF2_HMAC(password, password_len_int, PHPC_THIS->salt, PHPC_THIS->salt_len,
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto.h:45,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_kdf.c:20:
/home/user/php-build-scripts/bin/php7/include/openssl/evp.h:1488:44: note: expected ‘const unsigned char *’ but argument is of type ‘char *’
 1488 |                       const unsigned char *salt, int saltlen, int iter,
      |                       ~~~~~~~~~~~~~~~~~~~~~^~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/Zend/zend.h:32,
                 from /home/user/php-build-scripts/install_data/subdir/php/main/php.h:31,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_kdf.c:19:
/home/user/php-build-scripts/install_data/subdir/php/Zend/zend_string.h:66:31: warning: pointer targets in passing argument 8 of ‘PKCS5_PBKDF2_HMAC’ differ in signedness [-Wpointer-sign]
   66 | #define ZSTR_VAL(zstr)  (zstr)->val
      |                         ~~~~~~^~~~~
      |                               |
      |                               char *
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/phpc/phpc.h:870:47: note: in expansion of macro ‘ZSTR_VAL’
  870 | #define PHPC_STR_VAL                          ZSTR_VAL
      |                                               ^~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_kdf.c:496:24: note: in expansion of macro ‘PHPC_STR_VAL’
  496 |    PHPC_THIS->key_len, PHPC_STR_VAL(key))) {
      |                        ^~~~~~~~~~~~
In file included from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/php_crypto.h:45,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_kdf.c:20:
/home/user/php-build-scripts/bin/php7/include/openssl/evp.h:1489:72: note: expected ‘unsigned char *’ but argument is of type ‘char *’
 1489 |                       const EVP_MD *digest, int keylen, unsigned char *out);
      |                                                         ~~~~~~~~~~~~~~~^~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_kdf.c:480:24: warning: unused variable ‘hash_len’ [-Wunused-variable]
  480 |  int password_len_int, hash_len;
      |                        ^~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_stream.c:170:1: warning: ‘inline’ is not at beginning of declaration [-Wold-style-declaration]
  170 | static void inline php_crypto_stream_create_meta_field(
      | ^~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_stream.c:347:2: warning: initialization of ‘ssize_t (*)(php_stream *, const char *, size_t)’ {aka ‘long int (*)(struct _php_stream *, const char *, long unsigned int)’} from incompatible pointer type ‘size_t (*)(php_stream *, const char *, size_t)’ {aka ‘long unsigned int (*)(struct _php_stream *, const char *, long unsigned int)’} [-Wincompatible-pointer-types]
  347 |  php_crypto_stream_write, php_crypto_stream_read,
      |  ^~~~~~~~~~~~~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_stream.c:347:2: note: (near initialization for ‘php_crypto_stream_ops.write’)
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_stream.c:347:27: warning: initialization of ‘ssize_t (*)(php_stream *, char *, size_t)’ {aka ‘long int (*)(struct _php_stream *, char *, long unsigned int)’} from incompatible pointer type ‘size_t (*)(php_stream *, char *, size_t)’ {aka ‘long unsigned int (*)(struct _php_stream *, char *, long unsigned int)’} [-Wincompatible-pointer-types]
  347 |  php_crypto_stream_write, php_crypto_stream_read,
      |                           ^~~~~~~~~~~~~~~~~~~~~~
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_stream.c:347:27: note: (near initialization for ‘php_crypto_stream_ops.read’)
/home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_stream.c:617:1: warning: missing initializer for field ‘stream_metadata’ of ‘php_stream_wrapper_ops’ {aka ‘struct _php_stream_wrapper_ops’} [-Wmissing-field-initializers]
  617 | };
      | ^
In file included from /home/user/php-build-scripts/install_data/subdir/php/main/php.h:417,
                 from /home/user/php-build-scripts/install_data/subdir/php/ext/crypto/crypto_stream.c:19:
/home/user/php-build-scripts/install_data/subdir/php/main/php_streams.h:156:8: note: ‘stream_metadata’ declared here
  156 |  int (*stream_metadata)(php_stream_wrapper *wrapper, const char *url, int options, void *value, php_stream_context *context);
      |        ^~~~~~~~~~~~~~~

@bukka
Copy link
Owner

bukka commented May 5, 2023

Yeah it should be converted to EVP MAC eventually. There is hopefully still plenty of time to do that as it will stop working in OpenSSL 4.0.

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

No branches or pull requests

2 participants