aboutsummaryrefslogtreecommitdiff
path: root/src/common/aes.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-12-13 17:34:05 -0500
committerNick Mathewson <nickm@torproject.org>2012-12-13 17:34:05 -0500
commitb1ff8daeb521d1645bc35ffd7191599b7169c2bb (patch)
tree60c365a6cb8f67cb2abbf92cc7e504a282974713 /src/common/aes.c
parent579808d4cdc62346fffa364900d0d76cfa28b3e1 (diff)
downloadtor-b1ff8daeb521d1645bc35ffd7191599b7169c2bb.tar.gz
tor-b1ff8daeb521d1645bc35ffd7191599b7169c2bb.zip
Nuke uses of memcmp outside of unit tests
We want to be saying fast_mem{cmp,eq,neq} when we're doing a comparison that's allowed to exit early, or tor_mem{cmp,eq,neq} when we need a data-invariant timing. Direct use of memcmp tends to imply that we haven't thought about the issue.
Diffstat (limited to 'src/common/aes.c')
-rw-r--r--src/common/aes.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/aes.c b/src/common/aes.c
index 2d64b85944..d8865d7116 100644
--- a/src/common/aes.c
+++ b/src/common/aes.c
@@ -41,6 +41,7 @@
#include "aes.h"
#include "util.h"
#include "torlog.h"
+#include "di_ops.h"
#ifdef ANDROID
/* Android's OpenSSL seems to have removed all of its Engine support. */
@@ -257,7 +258,7 @@ evaluate_ctr_for_aes(void)
for (i=0; i<16; ++i)
AES_ctr128_encrypt(&zero[i], &output[i], 1, &key, ivec, ivec_tmp, &pos);
- if (memcmp(output, encrypt_zero, 16)) {
+ if (fast_memneq(output, encrypt_zero, 16)) {
/* Counter mode is buggy */
log_notice(LD_CRYPTO, "This OpenSSL has a buggy version of counter mode; "
"not using it.");