From 37385fcd836bcc086b56b8dc7089d5038c203f13 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 15 Sep 2012 06:01:11 +0200 Subject: 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. --- src/fastd.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/fastd.h') 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 || -- cgit v1.2.3