aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-24 20:51:45 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-24 20:51:45 +0100
commit12519216c16359ca5ca4cf735a9612985e1cb9e7 (patch)
tree429171d04ae94fa5b6007c58a64e842abb5adc3d
parentf40d6f8502561b84d71045378cab86cc4f462584 (diff)
downloadrspamd-12519216c16359ca5ca4cf735a9612985e1cb9e7.tar.gz
rspamd-12519216c16359ca5ca4cf735a9612985e1cb9e7.zip
[Fix] Fix types check and types usage in lua_cryptobox
-rw-r--r--src/libcryptobox/cryptobox.c6
-rw-r--r--src/libcryptobox/cryptobox.h8
-rw-r--r--src/lua/lua_cryptobox.c2
3 files changed, 9 insertions, 7 deletions
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c
index 10f9fd975..cb875c026 100644
--- a/src/libcryptobox/cryptobox.c
+++ b/src/libcryptobox/cryptobox.c
@@ -1435,7 +1435,7 @@ rspamd_cryptobox_mac_bytes (enum rspamd_cryptobox_mode mode)
}
void
-rspamd_cryptobox_hash_init (void *p, const guchar *key, gsize keylen)
+rspamd_cryptobox_hash_init (rspamd_cryptobox_hash_state_t *p, const guchar *key, gsize keylen)
{
crypto_generichash_blake2b_state *st = cryptobox_align_ptr (p,
_Alignof(crypto_generichash_blake2b_state));
@@ -1447,7 +1447,7 @@ rspamd_cryptobox_hash_init (void *p, const guchar *key, gsize keylen)
* Update hash with data portion
*/
void
-rspamd_cryptobox_hash_update (void *p, const guchar *data, gsize len)
+rspamd_cryptobox_hash_update (rspamd_cryptobox_hash_state_t *p, const guchar *data, gsize len)
{
crypto_generichash_blake2b_state *st = cryptobox_align_ptr (p,
_Alignof(crypto_generichash_blake2b_state));
@@ -1458,7 +1458,7 @@ rspamd_cryptobox_hash_update (void *p, const guchar *data, gsize len)
* Output hash to the buffer of rspamd_cryptobox_HASHBYTES length
*/
void
-rspamd_cryptobox_hash_final (void *p, guchar *out)
+rspamd_cryptobox_hash_final (rspamd_cryptobox_hash_state_t *p, guchar *out)
{
crypto_generichash_blake2b_state *st = cryptobox_align_ptr (p,
_Alignof(crypto_generichash_blake2b_state));
diff --git a/src/libcryptobox/cryptobox.h b/src/libcryptobox/cryptobox.h
index 61395d11f..aa93f8972 100644
--- a/src/libcryptobox/cryptobox.h
+++ b/src/libcryptobox/cryptobox.h
@@ -322,17 +322,19 @@ typedef crypto_generichash_blake2b_state rspamd_cryptobox_hash_state_t;
* with at least rspamd_cryptobox_HASHSTATEBYTES bytes length. If keylen == 0, then
* non-keyed hash is generated
*/
-void rspamd_cryptobox_hash_init (void *st, const guchar *key, gsize keylen);
+void rspamd_cryptobox_hash_init (rspamd_cryptobox_hash_state_t *st,
+ const guchar *key, gsize keylen);
/**
* Update hash with data portion
*/
-void rspamd_cryptobox_hash_update (void *st, const guchar *data, gsize len);
+void rspamd_cryptobox_hash_update (rspamd_cryptobox_hash_state_t *st,
+ const guchar *data, gsize len);
/**
* Output hash to the buffer of rspamd_cryptobox_HASHBYTES length
*/
-void rspamd_cryptobox_hash_final (void *st, guchar *out);
+void rspamd_cryptobox_hash_final (rspamd_cryptobox_hash_state_t *st, guchar *out);
/**
* One in all function
diff --git a/src/lua/lua_cryptobox.c b/src/lua/lua_cryptobox.c
index 7a7f4419b..788f2e1df 100644
--- a/src/lua/lua_cryptobox.c
+++ b/src/lua/lua_cryptobox.c
@@ -1235,7 +1235,7 @@ lua_cryptobox_hash_create_keyed (lua_State *L)
}
if (s) {
- rspamd_cryptobox_hash_update (h, s, len);
+ rspamd_cryptobox_hash_update (h->content.h, s, len);
}
ph = lua_newuserdata (L, sizeof (void *));