diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-18 23:29:42 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-18 23:29:42 +0100 |
commit | 2c87c3c20472f1217c33bfa33bc5ecec2daff6a3 (patch) | |
tree | 18b19c1acbd30690ad99f6d07ffbba66dfdd9105 /src/libcryptobox | |
parent | b7efc8479526b5f1f10e1df9659f393adfac08c7 (diff) | |
download | rspamd-2c87c3c20472f1217c33bfa33bc5ecec2daff6a3.tar.gz rspamd-2c87c3c20472f1217c33bfa33bc5ecec2daff6a3.zip |
Enable openssl AES tests
Diffstat (limited to 'src/libcryptobox')
-rw-r--r-- | src/libcryptobox/cryptobox.c | 10 | ||||
-rw-r--r-- | src/libcryptobox/cryptobox.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c index dc4f3e5e9..e424dac1f 100644 --- a/src/libcryptobox/cryptobox.c +++ b/src/libcryptobox/cryptobox.c @@ -314,6 +314,7 @@ rspamd_cryptobox_encrypt_init (void *enc_ctx, const rspamd_nonce_t nonce, EVP_CIPHER_CTX *s; s = cryptobox_align_ptr (enc_ctx, CRYPTOBOX_ALIGNMENT); + memset (s, 0, sizeof (*s)); g_assert (EVP_EncryptInit_ex (s, EVP_aes_256_gcm (), NULL, NULL, NULL) == 1); g_assert (EVP_CIPHER_CTX_ctrl (s, EVP_CTRL_GCM_SET_IVLEN, 24, NULL) == 1); g_assert (EVP_EncryptInit_ex (s, NULL, NULL, nm, nonce) == 1); @@ -477,6 +478,7 @@ rspamd_cryptobox_decrypt_init (void *enc_ctx, const rspamd_nonce_t nonce, EVP_CIPHER_CTX *s; s = cryptobox_align_ptr (enc_ctx, CRYPTOBOX_ALIGNMENT); + memset (s, 0, sizeof (*s)); g_assert (EVP_DecryptInit_ex(s, EVP_aes_256_gcm (), NULL, NULL, NULL) == 1); g_assert (EVP_CIPHER_CTX_ctrl (s, EVP_CTRL_GCM_SET_IVLEN, 24, NULL) == 1); g_assert (EVP_DecryptInit_ex (s, NULL, NULL, nm, nonce) == 1); @@ -639,7 +641,7 @@ rspamd_cryptobox_cleanup (void *enc_ctx, void *auth_ctx) #else EVP_CIPHER_CTX *s = enc_ctx; - EVP_CIPHER_CTX_free (s); + EVP_CIPHER_CTX_cleanup (s); #endif } } @@ -923,12 +925,12 @@ rspamd_cryptobox_pbkdf (const char *pass, gsize pass_len, return TRUE; } -void +gboolean rspamd_cryptobox_openssl_mode (gboolean enable) { #ifdef HAVE_USABLE_OPENSSL use_openssl = enable; -#else - g_assert (0); #endif + + return use_openssl; } diff --git a/src/libcryptobox/cryptobox.h b/src/libcryptobox/cryptobox.h index 3305fccc1..aed90079c 100644 --- a/src/libcryptobox/cryptobox.h +++ b/src/libcryptobox/cryptobox.h @@ -178,6 +178,6 @@ gboolean rspamd_cryptobox_pbkdf(const char *pass, gsize pass_len, * Enable openssl mode in rspamd_cryptobox * @param enable if TRUE then crypto code will use openssl, chacha20/poly1305 otherwize */ -void rspamd_cryptobox_openssl_mode (gboolean enable); +gboolean rspamd_cryptobox_openssl_mode (gboolean enable); #endif /* CRYPTOBOX_H_ */ |