mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
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.
This commit is contained in:
+2
-1
@@ -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.");
|
||||
|
||||
Reference in New Issue
Block a user