diff --git a/firmware/stub/utility_stub.c b/firmware/stub/utility_stub.c index 1445008ce1..3e17f77347 100644 --- a/firmware/stub/utility_stub.c +++ b/firmware/stub/utility_stub.c @@ -60,14 +60,18 @@ void* Memset(void* d, const uint8_t c, uint64_t n) { return dest; } + int SafeMemcmp(const void* s1, const void* s2, size_t n) { - int match = 0; + int result = 0; + if (0 == n) + return 1; + const unsigned char* us1 = s1; const unsigned char* us2 = s2; - while (n--) { - if (*us1++ != *us2++) - match = 1; - } + /* Code snippet without data-dependent branch due to + * Nate Lawson (nate@root.org) of Root Labs. */ + while (n--) + result |= *us1++ ^ *us2++; - return match; + return result != 0; } diff --git a/firmware/version.c b/firmware/version.c index d6fde5dac3..f3aaaa27fd 100644 --- a/firmware/version.c +++ b/firmware/version.c @@ -1 +1 @@ -char* VbootVersion = "VBOOv=43853f81"; +char* VbootVersion = "VBOOv=de3135df";