mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
Remove vestiges of RIJNDAEL_COUNTER_OPTIMIZATION
This commit is contained in:
parent
7d8edfcceb
commit
46d236c684
@ -55,7 +55,7 @@ struct aes_cnt_cipher {
|
|||||||
AES_KEY key;
|
AES_KEY key;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(WORDS_BIGENDIAN) || defined(USE_RIJNDAEL_COUNTER_OPTIMIZATION)
|
#if !defined(WORDS_BIGENDIAN)
|
||||||
#define USING_COUNTER_VARS
|
#define USING_COUNTER_VARS
|
||||||
/** These four values, together, implement a 128-bit counter, with
|
/** These four values, together, implement a 128-bit counter, with
|
||||||
* counter0 as the low-order word and counter3 as the high-order word. */
|
* counter0 as the low-order word and counter3 as the high-order word. */
|
||||||
@ -65,8 +65,6 @@ struct aes_cnt_cipher {
|
|||||||
uint32_t counter0;
|
uint32_t counter0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USE_RIJNDAEL_COUNTER_OPTIMIZATION
|
|
||||||
#define USING_COUNTER_BUFS
|
|
||||||
union {
|
union {
|
||||||
/** The counter, in big-endian order, as bytes. */
|
/** The counter, in big-endian order, as bytes. */
|
||||||
uint8_t buf[16];
|
uint8_t buf[16];
|
||||||
@ -75,7 +73,7 @@ struct aes_cnt_cipher {
|
|||||||
* so we just use these values instead. */
|
* so we just use these values instead. */
|
||||||
uint32_t buf32[4];
|
uint32_t buf32[4];
|
||||||
} ctr_buf;
|
} ctr_buf;
|
||||||
#endif
|
|
||||||
/** The encrypted value of ctr_buf. */
|
/** The encrypted value of ctr_buf. */
|
||||||
uint8_t buf[16];
|
uint8_t buf[16];
|
||||||
/** Our current stream position within buf. */
|
/** 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->counter2 = 0;
|
||||||
cipher->counter3 = 0;
|
cipher->counter3 = 0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USING_COUNTER_BUFS
|
|
||||||
memset(cipher->ctr_buf.buf, 0, sizeof(cipher->ctr_buf.buf));
|
memset(cipher->ctr_buf.buf, 0, sizeof(cipher->ctr_buf.buf));
|
||||||
#endif
|
|
||||||
|
|
||||||
cipher->pos = 0;
|
cipher->pos = 0;
|
||||||
_aes_fill_buf(cipher);
|
_aes_fill_buf(cipher);
|
||||||
@ -171,7 +168,7 @@ aes_free_cipher(aes_cnt_cipher_t *cipher)
|
|||||||
tor_free(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 \
|
#define UPDATE_CTR_BUF(c, n) STMT_BEGIN \
|
||||||
(c)->ctr_buf.buf32[3-(n)] = htonl((c)->counter ## n); \
|
(c)->ctr_buf.buf32[3-(n)] = htonl((c)->counter ## n); \
|
||||||
STMT_END
|
STMT_END
|
||||||
@ -273,9 +270,7 @@ aes_set_iv(aes_cnt_cipher_t *cipher, const char *iv)
|
|||||||
cipher->counter0 = ntohl(get_uint32(iv+12));
|
cipher->counter0 = ntohl(get_uint32(iv+12));
|
||||||
#endif
|
#endif
|
||||||
cipher->pos = 0;
|
cipher->pos = 0;
|
||||||
#ifndef USE_RIJNDAEL_COUNTER_OPTIMIZATION
|
|
||||||
memcpy(cipher->ctr_buf.buf, iv, 16);
|
memcpy(cipher->ctr_buf.buf, iv, 16);
|
||||||
#endif
|
|
||||||
|
|
||||||
_aes_fill_buf(cipher);
|
_aes_fill_buf(cipher);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user