summaryrefslogtreecommitdiff
path: root/src/sp_crypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp_crypt.c')
-rw-r--r--src/sp_crypt.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/sp_crypt.c b/src/sp_crypt.c
index ff8f65e..c1d9403 100644
--- a/src/sp_crypt.c
+++ b/src/sp_crypt.c
@@ -3,13 +3,10 @@
3void generate_key(unsigned char *key) { 3void generate_key(unsigned char *key) {
4 PHP_SHA256_CTX ctx; 4 PHP_SHA256_CTX ctx;
5 const char *user_agent = getenv("HTTP_USER_AGENT"); 5 const char *user_agent = getenv("HTTP_USER_AGENT");
6 const zend_string *env_var_zend = 6 const zend_string *env_var_zend = SPCFG(cookies_env_var);
7 SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var; 7 const zend_string *encryption_key_zend = SPCFG(encryption_key);
8 const zend_string *encryption_key_zend =
9 SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key;
10 const char *env_var = (env_var_zend ? getenv(ZSTR_VAL(env_var_zend)) : NULL); 8 const char *env_var = (env_var_zend ? getenv(ZSTR_VAL(env_var_zend)) : NULL);
11 const char *encryption_key = 9 const char *encryption_key = (encryption_key_zend ? ZSTR_VAL(encryption_key_zend) : NULL);
12 (encryption_key_zend ? ZSTR_VAL(encryption_key_zend) : NULL);
13 10
14 assert(32 == crypto_secretbox_KEYBYTES); // 32 is the size of a SHA256. 11 assert(32 == crypto_secretbox_KEYBYTES); // 32 is the size of a SHA256.
15 assert(encryption_key); // Encryption key can't be NULL 12 assert(encryption_key); // Encryption key can't be NULL