Use proper types in sodium_crypto_stream_xchacha20_xor_ic()

Most importantly, `ic` needs to be of type `zend_long`, not `zend_long*`.

Closes GH-8302.
This commit is contained in:
Christoph M. Becker 2022-04-05 14:56:49 +02:00
parent 2fe35cf807
commit d03a94a0a6
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6

View file

@ -1585,7 +1585,7 @@ PHP_FUNCTION(sodium_crypto_stream_xchacha20_xor_ic)
unsigned char *key;
unsigned char *msg;
unsigned char *nonce;
zend_long *ic;
zend_long ic;
size_t ciphertext_len;
size_t key_len;
@ -1612,7 +1612,7 @@ PHP_FUNCTION(sodium_crypto_stream_xchacha20_xor_ic)
ciphertext = zend_string_checked_alloc((size_t) ciphertext_len, 0);
if (crypto_stream_xchacha20_xor_ic((unsigned char *) ZSTR_VAL(ciphertext), msg,
(unsigned long long) msg_len, nonce,
(unsigned long long) ic, key) != 0) {
(uint64_t) ic, key) != 0) {
zend_string_free(ciphertext);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
RETURN_THROWS();