From 5e4236d226309a32842a6928878fd0e1cd5937e7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 23 Nov 2018 18:02:44 +0100 Subject: tls: in AES-CBC code, do not set key for every record - do it once function old new delta aes_setkey 16 212 +196 tls_handshake 1941 1977 +36 aes_encrypt_1 382 396 +14 xwrite_encrypted 605 604 -1 tls_xread_record 659 656 -3 aes_encrypt_one_block 65 59 -6 aes_cbc_encrypt 172 121 -51 aesgcm_setkey 58 - -58 aes_cbc_decrypt 958 881 -77 KeyExpansion 188 - -188 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 3/5 up/down: 246/-384) Total: -138 bytes Signed-off-by: Denys Vlasenko --- networking/tls_aes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'networking/tls_aes.h') diff --git a/networking/tls_aes.h b/networking/tls_aes.h index fc3881793..e9e3721f1 100644 --- a/networking/tls_aes.h +++ b/networking/tls_aes.h @@ -10,5 +10,5 @@ void aes_setkey(struct tls_aes *aes, const void *key, unsigned key_len) FAST_FUN void aes_encrypt_one_block(struct tls_aes *aes, const void *data, void *dst) FAST_FUNC; -void aes_cbc_encrypt(const void *key, int klen, void *iv, const void *data, size_t len, void *dst) FAST_FUNC; -void aes_cbc_decrypt(const void *key, int klen, void *iv, const void *data, size_t len, void *dst) FAST_FUNC; +void aes_cbc_encrypt(struct tls_aes *aes, void *iv, const void *data, size_t len, void *dst) FAST_FUNC; +void aes_cbc_decrypt(struct tls_aes *aes, void *iv, const void *data, size_t len, void *dst) FAST_FUNC; -- cgit v1.2.3