]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix types check and types usage in lua_cryptobox
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 24 Aug 2020 19:51:45 +0000 (20:51 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 24 Aug 2020 19:51:45 +0000 (20:51 +0100)
src/libcryptobox/cryptobox.c
src/libcryptobox/cryptobox.h
src/lua/lua_cryptobox.c

index 10f9fd975d1e66ce4831d00e635832e676e1ccd5..cb875c02685c5641d71f1b17ee1fabb76bf711b6 100644 (file)
@@ -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));
index 61395d11fb4791d9164eeacbe5517894cbb6704b..aa93f89729f564ed808af437594c9f23d7c9a4d1 100644 (file)
@@ -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
index 7a7f4419b7e3bc80de2a327b8868b1109bb80b2a..788f2e1df4906a75375cdc65cb370009f0eb997d 100644 (file)
@@ -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 *));