From 6bb8bcbbaa479c8475754fcc86e204061b92c64a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 29 Sep 2015 17:29:24 +0100 Subject: Add encryption to fuzzy storage. --- src/fuzzy_storage.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/fuzzy_storage.h') diff --git a/src/fuzzy_storage.h b/src/fuzzy_storage.h index 57d7b5cc7..2e97f8190 100644 --- a/src/fuzzy_storage.h +++ b/src/fuzzy_storage.h @@ -4,6 +4,7 @@ #include "config.h" #include "rspamd.h" #include "shingles.h" +#include "cryptobox.h" #define RSPAMD_FUZZY_VERSION 3 @@ -34,4 +35,32 @@ RSPAMD_PACKED(rspamd_fuzzy_reply) { float prob; }; +RSPAMD_PACKED(rspamd_fuzzy_encrypted_req_hdr) { + guchar magic[4]; + guchar reserved[8]; + guchar pubkey[rspamd_cryptobox_PKBYTES]; + guchar nonce[rspamd_cryptobox_NONCEBYTES]; + guchar mac[rspamd_cryptobox_MACBYTES]; +}; + +RSPAMD_PACKED(rspamd_fuzzy_encrypted_cmd) { + struct rspamd_fuzzy_encrypted_req_hdr hdr; + struct rspamd_fuzzy_cmd cmd; +}; + +RSPAMD_PACKED(rspamd_fuzzy_encrypted_shingle_cmd) { + struct rspamd_fuzzy_encrypted_req_hdr hdr; + struct rspamd_fuzzy_shingle_cmd cmd; +}; + +RSPAMD_PACKED(rspamd_fuzzy_encrypted_rep_hdr) { + guchar nonce[rspamd_cryptobox_NONCEBYTES]; + guchar mac[rspamd_cryptobox_MACBYTES]; +}; + +RSPAMD_PACKED(rspamd_fuzzy_encrypted_reply) { + struct rspamd_fuzzy_encrypted_rep_hdr hdr; + struct rspamd_fuzzy_reply rep; +}; + #endif -- cgit v1.2.3