diff options
| author | jvoisin | 2026-04-24 12:17:05 +0200 |
|---|---|---|
| committer | jvoisin | 2026-04-24 12:17:05 +0200 |
| commit | 5f53903197021fcc8332a7f44c29fbea8d2c2060 (patch) | |
| tree | 9db9a6df3c124346bb3214d4cd180ec04fbac815 /src | |
| parent | 138e97baf135fb0ae765d8899f564d6b10211830 (diff) | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_crypt.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sp_crypt.c b/src/sp_crypt.c index 9d4e6bb..3b65616 100644 --- a/src/sp_crypt.c +++ b/src/sp_crypt.c | |||
| @@ -32,6 +32,7 @@ void generate_key(unsigned char *key) { | |||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | PHP_SHA256Final((unsigned char *)key, &ctx); | 34 | PHP_SHA256Final((unsigned char *)key, &ctx); |
| 35 | ZEND_SECURE_ZERO(&ctx, sizeof(ctx)); | ||
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | // This function return 0 upon success , non-zero otherwise | 38 | // This function return 0 upon success , non-zero otherwise |
| @@ -120,6 +121,7 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { | |||
| 120 | ret = ZEND_HASH_APPLY_KEEP; | 121 | ret = ZEND_HASH_APPLY_KEEP; |
| 121 | 122 | ||
| 122 | out: | 123 | out: |
| 124 | ZEND_SECURE_ZERO(key, sizeof(key)); | ||
| 123 | zend_string_efree(debase64); | 125 | zend_string_efree(debase64); |
| 124 | efree(decrypted); | 126 | efree(decrypted); |
| 125 | efree(backup); | 127 | efree(backup); |
| @@ -169,6 +171,8 @@ zend_string *encrypt_zval(zend_string *data) { | |||
| 169 | z = php_base64_encode(encrypted_data, emsg_and_nonce_len); | 171 | z = php_base64_encode(encrypted_data, emsg_and_nonce_len); |
| 170 | } | 172 | } |
| 171 | 173 | ||
| 174 | ZEND_SECURE_ZERO(key, sizeof(key)); | ||
| 175 | ZEND_SECURE_ZERO(nonce, sizeof(nonce)); | ||
| 172 | efree(data_to_encrypt); | 176 | efree(data_to_encrypt); |
| 173 | efree(encrypted_data); | 177 | efree(encrypted_data); |
| 174 | 178 | ||
