diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-25 23:15:16 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-25 23:15:16 +0000 |
commit | 6ca35268fea102054277895f45425bc8a64992b8 (patch) | |
tree | f3332224e21f7c039053ac7ad96a391672779f99 /src/libutil/http.c | |
parent | 13d1587064ee25b8dab3e5d37db383a1d48bcc8d (diff) | |
download | rspamd-6ca35268fea102054277895f45425bc8a64992b8.tar.gz rspamd-6ca35268fea102054277895f45425bc8a64992b8.zip |
Start migrating to the new hash API.
Diffstat (limited to 'src/libutil/http.c')
-rw-r--r-- | src/libutil/http.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c index beb27cf9b..340951caf 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -28,7 +28,6 @@ #include "printf.h" #include "logger.h" #include "ref.h" -#include "blake2.h" #include "ottery.h" #include "keypair_private.h" #include "cryptobox.h" @@ -1301,7 +1300,7 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn, gboolean encrypted = FALSE; gchar *b32_key, *b32_id; guchar nonce[rspamd_cryptobox_MAX_NONCEBYTES], mac[rspamd_cryptobox_MAX_MACBYTES], - id[BLAKE2B_OUTBYTES]; + id[rspamd_cryptobox_HASHBYTES]; guchar *np = NULL, *mp = NULL, *meth_pos = NULL; struct rspamd_http_keypair *peer_key = NULL; @@ -2262,6 +2261,7 @@ rspamd_http_connection_make_key (gchar *key, gsize keylen) gchar *semicolon; gsize decoded_len; struct rspamd_http_keypair *kp; + guchar kh[rspamd_cryptobox_HASHBYTES]; semicolon = memchr (key, ':', keylen); @@ -2284,8 +2284,9 @@ rspamd_http_connection_make_key (gchar *key, gsize keylen) REF_INIT_RETAIN (kp, rspamd_http_keypair_dtor); memcpy (kp->sk, decoded_sk, rspamd_cryptobox_sk_bytes ()); memcpy (kp->pk, decoded_pk, rspamd_cryptobox_pk_bytes ()); - blake2b (kp->id, kp->pk, NULL, sizeof (kp->id), - rspamd_cryptobox_pk_bytes (), 0); + rspamd_cryptobox_hash (kh, kp->pk, rspamd_cryptobox_pk_bytes (), + NULL, 0); + memcpy (kp->id, kh, sizeof (kp->id)); return (gpointer) kp; } @@ -2300,13 +2301,15 @@ gpointer rspamd_http_connection_gen_key (void) { struct rspamd_http_keypair *kp; + guchar kh[rspamd_cryptobox_HASHBYTES]; kp = g_slice_alloc (sizeof (*kp)); REF_INIT_RETAIN (kp, rspamd_http_keypair_dtor); rspamd_cryptobox_keypair (kp->pk, kp->sk); - blake2b (kp->id, kp->pk, NULL, sizeof (kp->id), - rspamd_cryptobox_pk_bytes (), 0); + rspamd_cryptobox_hash (kh, kp->pk, rspamd_cryptobox_pk_bytes (), + NULL, 0); + memcpy (kp->id, kh, sizeof (kp->id)); return (gpointer)kp; } @@ -2419,6 +2422,7 @@ rspamd_http_connection_make_peer_key (const gchar *key) guchar *pk_decoded; gsize dec_len; struct rspamd_http_keypair *kp = NULL; + guchar kh[rspamd_cryptobox_HASHBYTES]; pk_decoded = rspamd_decode_base32 (key, strlen (key), &dec_len); @@ -2426,8 +2430,9 @@ rspamd_http_connection_make_peer_key (const gchar *key) kp = g_slice_alloc0 (sizeof (*kp)); REF_INIT_RETAIN (kp, rspamd_http_keypair_dtor); memcpy (kp->pk, pk_decoded, rspamd_cryptobox_pk_bytes ()); - blake2b (kp->id, kp->pk, NULL, sizeof (kp->id), - rspamd_cryptobox_pk_bytes (), 0); + rspamd_cryptobox_hash (kh, kp->pk, rspamd_cryptobox_pk_bytes (), + NULL, 0); + memcpy (kp->id, kh, sizeof (kp->id)); } g_free (pk_decoded); |