commit 1251921: [Fix] Fix types check and types usage in lua_cryptobox
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Aug 24 19:56:06 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-08-24 20:51:45 +0100
URL: https://github.com/rspamd/rspamd/commit/12519216c16359ca5ca4cf735a9612985e1cb9e7 (HEAD -> master)
[Fix] Fix types check and types usage in lua_cryptobox
---
src/libcryptobox/cryptobox.c | 6 +++---
src/libcryptobox/cryptobox.h | 8 +++++---
src/lua/lua_cryptobox.c | 2 +-
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 *));
More information about the Commits
mailing list