summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
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/fastd.h
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/fastd.h')
-rw-r--r--src/fastd.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 12702e7..e1c531b 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -91,6 +91,8 @@ struct _fastd_method {
size_t (*max_packet_size)(fastd_context *ctx);
size_t (*min_encrypt_head_space)(fastd_context *ctx);
size_t (*min_decrypt_head_space)(fastd_context *ctx);
+ size_t (*min_encrypt_tail_space)(fastd_context *ctx);
+ size_t (*min_decrypt_tail_space)(fastd_context *ctx);
fastd_method_session_state* (*session_init)(fastd_context *ctx, uint8_t *secret, size_t length, bool initiator);
bool (*session_is_valid)(fastd_context *ctx, fastd_method_session_state *session);
@@ -349,7 +351,7 @@ static inline void fastd_string_stack_free(fastd_string_stack *str) {
}
}
-#define ALIGN8(l) (((l+7)/8)*8)
+#define ALIGN(l, a) (((l+a-1)/a)*a)
static inline bool timespec_after(const struct timespec *tp1, const struct timespec *tp2) {
return (tp1->tv_sec > tp2->tv_sec ||