diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-06 17:26:30 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-06 17:42:59 +0100 |
commit | 785bf880861c1f0d7f4537f9f1b75a709c54c2a6 (patch) | |
tree | f2a4152b0368941fc9d00b0f79d2df1bff6ea552 /src/libcryptobox/cryptobox.h | |
parent | 0d594071ebf5c4c2d4db63c4e44240203a1045b8 (diff) | |
download | rspamd-785bf880861c1f0d7f4537f9f1b75a709c54c2a6.tar.gz rspamd-785bf880861c1f0d7f4537f9f1b75a709c54c2a6.zip |
Implement preliminary version of vectorized encryption.
Diffstat (limited to 'src/libcryptobox/cryptobox.h')
-rw-r--r-- | src/libcryptobox/cryptobox.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/libcryptobox/cryptobox.h b/src/libcryptobox/cryptobox.h index 57fb0d3ab..9fb0cb113 100644 --- a/src/libcryptobox/cryptobox.h +++ b/src/libcryptobox/cryptobox.h @@ -25,6 +25,11 @@ #include "config.h" +struct rspamd_cryptobox_segment { + guchar *data; + gsize len; +}; + #define rspamd_cryptobox_NONCEBYTES 24 #define rspamd_cryptobox_PKBYTES 32 #define rspamd_cryptobox_SKBYTES 32 @@ -52,6 +57,17 @@ void rspamd_cryptobox_init (void); void rspamd_cryptobox_keypair (rspamd_pk_t pk, rspamd_sk_t sk); /** + * Encrypt data inplace adding signature to sig afterwards + * @param data input buffer + * @param pk remote pubkey + * @param sk local secret key + * @param sig output signature + */ +void rspamd_cryptobox_encrypt_inplace (guchar *data, gsize len, + const rspamd_nonce_t nonce, + const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_sig_t sig); + +/** * Encrypt segments of data inplace adding signature to sig afterwards * @param segments segments of data * @param cnt count of segments @@ -59,7 +75,8 @@ void rspamd_cryptobox_keypair (rspamd_pk_t pk, rspamd_sk_t sk); * @param sk local secret key * @param sig output signature */ -void rspamd_cryptobox_encrypt_inplace (guchar *data, gsize len, +void rspamd_cryptobox_encryptv_inplace (struct rspamd_cryptobox_segment *segments, + gsize cnt, const rspamd_nonce_t nonce, const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_sig_t sig); @@ -89,6 +106,19 @@ void rspamd_cryptobox_encrypt_nm_inplace (guchar *data, gsize len, const rspamd_nonce_t nonce, const rspamd_nm_t nm, rspamd_sig_t sig); +/** + * Encrypt segments of data inplace adding signature to sig afterwards + * @param segments segments of data + * @param cnt count of segments + * @param pk remote pubkey + * @param sk local secret key + * @param sig output signature + */ +void rspamd_cryptobox_encryptv_nm_inplace (struct rspamd_cryptobox_segment *segments, + gsize cnt, + const rspamd_nonce_t nonce, + const rspamd_nm_t nm, rspamd_sig_t sig); + /** * Decrypt and verify data chunk inplace |