diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-28 22:25:43 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-28 22:25:43 +0000 |
commit | aa110b0b4b6173cd58366eeeea338b6dcf668475 (patch) | |
tree | dde247be74121e8931f2487922ad41140c64c041 /src/libutil/http.c | |
parent | 175d7c8cc6ad393d1d19c237ceb4d23003e059ff (diff) | |
download | rspamd-aa110b0b4b6173cd58366eeeea338b6dcf668475.tar.gz rspamd-aa110b0b4b6173cd58366eeeea338b6dcf668475.zip |
Add keypair generation routine.
Diffstat (limited to 'src/libutil/http.c')
-rw-r--r-- | src/libutil/http.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c index 81771987d..23db6b3a3 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -1612,6 +1612,20 @@ rspamd_http_connection_make_key (gchar *key, gsize keylen) return FALSE; } +gpointer +rspamd_http_connection_gen_key (void) +{ + struct rspamd_http_keypair *kp; + + kp = g_slice_alloc (sizeof (*kp)); + REF_INIT_RETAIN (kp, rspamd_http_keypair_dtor); + + crypto_box_keypair (kp->pk, kp->sk); + blake2b (kp->id, kp->pk, NULL, sizeof (kp->id), sizeof (kp->pk), 0); + + return (gpointer)kp; +} + void rspamd_http_connection_set_key (struct rspamd_http_connection *conn, gpointer key) |