[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Remove vestiges of RIJNDAEL_COUNTER_OPTIMIZATION
commit 46d236c68428a0fd0f008ec2a34ae08f1640b9b7
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue Nov 8 22:57:15 2011 -0500
Remove vestiges of RIJNDAEL_COUNTER_OPTIMIZATION
---
src/common/aes.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/common/aes.c b/src/common/aes.c
index c7e0aff..9c03b80 100644
--- a/src/common/aes.c
+++ b/src/common/aes.c
@@ -55,7 +55,7 @@ struct aes_cnt_cipher {
AES_KEY key;
#endif
-#if !defined(WORDS_BIGENDIAN) || defined(USE_RIJNDAEL_COUNTER_OPTIMIZATION)
+#if !defined(WORDS_BIGENDIAN)
#define USING_COUNTER_VARS
/** These four values, together, implement a 128-bit counter, with
* counter0 as the low-order word and counter3 as the high-order word. */
@@ -65,8 +65,6 @@ struct aes_cnt_cipher {
uint32_t counter0;
#endif
-#ifndef USE_RIJNDAEL_COUNTER_OPTIMIZATION
-#define USING_COUNTER_BUFS
union {
/** The counter, in big-endian order, as bytes. */
uint8_t buf[16];
@@ -75,7 +73,7 @@ struct aes_cnt_cipher {
* so we just use these values instead. */
uint32_t buf32[4];
} ctr_buf;
-#endif
+
/** The encrypted value of ctr_buf. */
uint8_t buf[16];
/** Our current stream position within buf. */
@@ -149,9 +147,8 @@ aes_set_key(aes_cnt_cipher_t *cipher, const char *key, int key_bits)
cipher->counter2 = 0;
cipher->counter3 = 0;
#endif
-#ifdef USING_COUNTER_BUFS
+
memset(cipher->ctr_buf.buf, 0, sizeof(cipher->ctr_buf.buf));
-#endif
cipher->pos = 0;
_aes_fill_buf(cipher);
@@ -171,7 +168,7 @@ aes_free_cipher(aes_cnt_cipher_t *cipher)
tor_free(cipher);
}
-#if defined(USING_COUNTER_VARS) && defined(USING_COUNTER_BUFS)
+#if defined(USING_COUNTER_VARS)
#define UPDATE_CTR_BUF(c, n) STMT_BEGIN \
(c)->ctr_buf.buf32[3-(n)] = htonl((c)->counter ## n); \
STMT_END
@@ -273,9 +270,7 @@ aes_set_iv(aes_cnt_cipher_t *cipher, const char *iv)
cipher->counter0 = ntohl(get_uint32(iv+12));
#endif
cipher->pos = 0;
-#ifndef USE_RIJNDAEL_COUNTER_OPTIMIZATION
memcpy(cipher->ctr_buf.buf, iv, 16);
-#endif
_aes_fill_buf(cipher);
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits