aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-04-08 13:32:53 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-04-08 13:32:53 +0100
commit4cc70328cf728643450ad25eb4c8718942a19e1d (patch)
treed724a566b7e4dbcbecf6118194f05f854389976e /src/libstat
parentf33dfad9746ac11d187fc2b1d6330106c8d59d17 (diff)
downloadrspamd-4cc70328cf728643450ad25eb4c8718942a19e1d.tar.gz
rspamd-4cc70328cf728643450ad25eb4c8718942a19e1d.zip
Use new siphash implementation.
Diffstat (limited to 'src/libstat')
-rw-r--r--src/libstat/tokenizers/osb.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libstat/tokenizers/osb.c b/src/libstat/tokenizers/osb.c
index dc6808753..517b465fd 100644
--- a/src/libstat/tokenizers/osb.c
+++ b/src/libstat/tokenizers/osb.c
@@ -30,7 +30,7 @@
#include "stat_internal.h"
#include "libstemmer.h"
#include "xxhash.h"
-#include "siphash.h"
+#include "cryptobox.h"
/* Size for features pipe */
#define DEFAULT_FEATURE_WINDOW_SIZE 5
@@ -63,7 +63,7 @@ struct rspamd_osb_tokenizer_config {
gshort window_size;
enum rspamd_osb_hash_type ht;
guint64 seed;
- struct sipkey sk;
+ rspamd_sipkey_t sk;
};
/*
@@ -125,12 +125,12 @@ rspamd_tokenizer_osb_config_from_ucl (rspamd_mempool_t * pool,
if (elt != NULL && ucl_object_type (elt) == UCL_STRING) {
key = rspamd_decode_base32 (ucl_object_tostring (elt),
0, &keylen);
- if (keylen < 16) {
+ if (keylen < sizeof (rspamd_sipkey_t)) {
msg_warn ("siphash key is too short: %s", keylen);
g_free (key);
}
else {
- sip_tokey (&cf->sk, key);
+ memcpy (cf->sk, key, sizeof (cf->sk));
g_free (key);
}
}
@@ -251,7 +251,8 @@ rspamd_tokenizer_osb (struct rspamd_tokenizer_config *cf,
cur = XXH64 (token->begin, token->len, osb_cf->seed);
}
else {
- cur = siphash24 (token->begin, token->len, &osb_cf->sk);
+ rspamd_cryptobox_siphash ((guchar *)&cur, token->begin,
+ token->len, osb_cf->sk);
}
}