aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-05-16 08:47:32 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-05-16 08:47:32 +0000
commit2a084874993294b27969da8f69560b045ea5894a (patch)
tree15279a2c6ba60e0e4d5707210ef750ed035dde72
parent3fff4aa25076af8a67dd802f0f32e84956827f14 (diff)
parent543cbfb4dc08186ed8da5bb86c4c99c703ef745a (diff)
downloadtpm2-oreo-dr2-release.tar.gz
Change-Id: I7a1938a3139f26aa8276b7e60350effb80b58b90
-rw-r--r--MemoryLib.c6
-rw-r--r--fuzz/Dockerfile8
-rw-r--r--fuzz/README6
3 files changed, 14 insertions, 6 deletions
diff --git a/MemoryLib.c b/MemoryLib.c
index 7beac63..178848e 100644
--- a/MemoryLib.c
+++ b/MemoryLib.c
@@ -75,15 +75,15 @@ MemoryEqual(
UINT32 size // IN: size of bytes being compared
)
{
- BOOL equal = TRUE;
+ BOOL diff = FALSE;
const BYTE *b1, *b2;
b1 = (BYTE *)buffer1;
b2 = (BYTE *)buffer2;
// Compare all bytes so that there is no leakage of information
// due to timing differences.
for(; size > 0; size--)
- equal = (*b1++ == *b2++) && equal;
- return equal;
+ diff |= *b1++ ^ *b2++;
+ return !diff;
}
//
//
diff --git a/fuzz/Dockerfile b/fuzz/Dockerfile
index 69e2878..db3e560 100644
--- a/fuzz/Dockerfile
+++ b/fuzz/Dockerfile
@@ -1,11 +1,13 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Defines a docker image that can build fuzzers.
#
-FROM ossfuzz/base-libfuzzer
-RUN apt-get install -y make libssl-dev binutils libgcc-5-dev
+FROM gcr.io/oss-fuzz-base/base-builder
+RUN apt-get update && apt-get install -y make libssl-dev binutils libgcc-5-dev
COPY . /src/tpm2/
COPY fuzz/build.sh /src/
+
+WORKDIR tpm2
diff --git a/fuzz/README b/fuzz/README
index 4c0cc04..90fd5f6 100644
--- a/fuzz/README
+++ b/fuzz/README
@@ -32,6 +32,12 @@ To reproduce a crash under gdb:
$ docker run -ti --rm -v $(pwd):/src/tpm2 -v /tmp/fuzzers:/out \
ossfuzz/tpm2
+ or
+
+ $ docker run -ti --rm -v $(pwd):/src/tpm2 -v /tmp/fuzzers:/out \
+ -e FUZZING_ENGINE=libfuzzer \
+ -e SANITIZER=<address/memory/undefined> \
+ ossfuzz/tpm2
Get a shell in the container