summaryrefslogtreecommitdiffstats
path: root/src/method_xsalsa20_poly1305.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-09-15 06:01:11 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-09-15 06:01:11 +0200
commit37385fcd836bcc086b56b8dc7089d5038c203f13 (patch)
treee4baf6ea1c24ebb8fbc93f02526acb56d186c606 /src/method_xsalsa20_poly1305.c
parent430a8557d4421f41fbf834909f7598cfc64e3311 (diff)
downloadfastd-37385fcd836bcc086b56b8dc7089d5038c203f13.tar
fastd-37385fcd836bcc086b56b8dc7089d5038c203f13.zip
Rework some parts of the AES128-GCM method
These changes improve the performance of the AES128-GCM method by ~10% on my Intel CPU when compiled with -O2. Furthermore, the AES and the GHASH parts are separated now, allowing to switch to other implementations of the algorithms more easily.
Diffstat (limited to 'src/method_xsalsa20_poly1305.c')
-rw-r--r--src/method_xsalsa20_poly1305.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/method_xsalsa20_poly1305.c b/src/method_xsalsa20_poly1305.c
index c7fb040..23f4c5d 100644
--- a/src/method_xsalsa20_poly1305.c
+++ b/src/method_xsalsa20_poly1305.c
@@ -86,6 +86,10 @@ static size_t method_min_decrypt_head_space(fastd_context *ctx) {
return (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES - NONCEBYTES);
}
+static size_t method_min_tail_space(fastd_context *ctx) {
+ return 0;
+}
+
static fastd_method_session_state* method_session_init(fastd_context *ctx, uint8_t *secret, size_t length, bool initiator) {
int i;
@@ -220,6 +224,8 @@ const fastd_method fastd_method_xsalsa20_poly1305 = {
.max_packet_size = method_max_packet_size,
.min_encrypt_head_space = method_min_encrypt_head_space,
.min_decrypt_head_space = method_min_decrypt_head_space,
+ .min_encrypt_tail_space = method_min_tail_space,
+ .min_decrypt_tail_space = method_min_tail_space,
.session_init = method_session_init,
.session_is_valid = method_session_is_valid,