Files
OpenCellular/firmware/lib/utility.c
Stefan Reinauer 66264b5d97 Move Memset from vboot_reference to vbexport/u-boot
All memory operations (except the "safe ones") live in the firmware
so the fast operations can be used. Except Memset. This CL changes that
problem.

This CL needs https://gerrit.chromium.org/gerrit/#change,10992 and a
similar change in H2C.

BUG=chrome-os-partner:6313
TEST=run coreboot/u-boot on Stumpy

Change-Id: Ic961ebbb45470c8fc1316490b902759dcf221deb
Reviewed-on: https://gerrit.chromium.org/gerrit/10993
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-11-02 12:59:54 -07:00

26 lines
643 B
C

/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Utility functions that need to be built as part of the firmware.
*/
#include "sysincludes.h"
#include "utility.h"
int SafeMemcmp(const void* s1, const void* s2, size_t n) {
const unsigned char* us1 = s1;
const unsigned char* us2 = s2;
int result = 0;
if (0 == n)
return 0;
/* Code snippet without data-dependent branch due to
* Nate Lawson (nate@root.org) of Root Labs. */
while (n--)
result |= *us1++ ^ *us2++;
return result != 0;
}