Skip to content

Commit 19c00d6

Browse files
committed
Fix OpenSSL compilation
1 parent b4ad3cf commit 19c00d6

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

ext/openssl/openssl.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6119,7 +6119,7 @@ static void php_openssl_load_cipher_mode(struct php_openssl_cipher_mode *mode, c
61196119
}
61206120
/* }}} */
61216121

6122-
static int php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_required_len,
6122+
static int php_openssl_validate_iv(const char **piv, size_t *piv_len, size_t iv_required_len,
61236123
zend_bool *free_iv, EVP_CIPHER_CTX *cipher_ctx, struct php_openssl_cipher_mode *mode) /* {{{ */
61246124
{
61256125
char *iv_new;
@@ -6173,9 +6173,9 @@ static int php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_requir
61736173

61746174
static int php_openssl_cipher_init(const EVP_CIPHER *cipher_type,
61756175
EVP_CIPHER_CTX *cipher_ctx, struct php_openssl_cipher_mode *mode,
6176-
char **ppassword, size_t *ppassword_len, zend_bool *free_password,
6177-
char **piv, size_t *piv_len, zend_bool *free_iv,
6178-
char *tag, int tag_len, zend_long options, int enc) /* {{{ */
6176+
const char **ppassword, size_t *ppassword_len, zend_bool *free_password,
6177+
const char **piv, size_t *piv_len, zend_bool *free_iv,
6178+
const char *tag, int tag_len, zend_long options, int enc) /* {{{ */
61796179
{
61806180
unsigned char *key;
61816181
int key_len, password_len;
@@ -6245,8 +6245,8 @@ static int php_openssl_cipher_init(const EVP_CIPHER *cipher_type,
62456245

62466246
static int php_openssl_cipher_update(const EVP_CIPHER *cipher_type,
62476247
EVP_CIPHER_CTX *cipher_ctx, struct php_openssl_cipher_mode *mode,
6248-
zend_string **poutbuf, int *poutlen, char *data, size_t data_len,
6249-
char *aad, size_t aad_len, int enc) /* {{{ */
6248+
zend_string **poutbuf, int *poutlen, const char *data, size_t data_len,
6249+
const char *aad, size_t aad_len, int enc) /* {{{ */
62506250
{
62516251
int i = 0;
62526252

@@ -6256,7 +6256,7 @@ static int php_openssl_cipher_update(const EVP_CIPHER *cipher_type,
62566256
return FAILURE;
62576257
}
62586258

6259-
if (mode->is_aead && !EVP_CipherUpdate(cipher_ctx, NULL, &i, (unsigned char *)aad, (int)aad_len)) {
6259+
if (mode->is_aead && !EVP_CipherUpdate(cipher_ctx, NULL, &i, (const unsigned char *) aad, (int) aad_len)) {
62606260
php_openssl_store_errors();
62616261
php_error_docref(NULL, E_WARNING, "Setting of additional application data failed");
62626262
return FAILURE;
@@ -6265,7 +6265,7 @@ static int php_openssl_cipher_update(const EVP_CIPHER *cipher_type,
62656265
*poutbuf = zend_string_alloc((int)data_len + EVP_CIPHER_block_size(cipher_type), 0);
62666266

62676267
if (!EVP_CipherUpdate(cipher_ctx, (unsigned char*)ZSTR_VAL(*poutbuf),
6268-
&i, (unsigned char *)data, (int)data_len)) {
6268+
&i, (const unsigned char *)data, (int)data_len)) {
62696269
/* we don't show warning when we fail but if we ever do, then it should look like this:
62706270
if (mode->is_single_run_aead && !enc) {
62716271
php_error_docref(NULL, E_WARNING, "Tag verifycation failed");
@@ -6368,10 +6368,10 @@ PHP_OPENSSL_API zend_string* php_openssl_encrypt(
63686368
}
63696369

63706370
if (free_password) {
6371-
efree(password);
6371+
efree((void *) password);
63726372
}
63736373
if (free_iv) {
6374-
efree(iv);
6374+
efree((void *) iv);
63756375
}
63766376
EVP_CIPHER_CTX_reset(cipher_ctx);
63776377
EVP_CIPHER_CTX_free(cipher_ctx);
@@ -6467,10 +6467,10 @@ PHP_OPENSSL_API zend_string* php_openssl_decrypt(
64676467
}
64686468

64696469
if (free_password) {
6470-
efree(password);
6470+
efree((void *) password);
64716471
}
64726472
if (free_iv) {
6473-
efree(iv);
6473+
efree((void *) iv);
64746474
}
64756475
if (base64_str) {
64766476
zend_string_release_ex(base64_str, 0);

0 commit comments

Comments
 (0)