Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: firmware/lib/utility.c

Issue 3173035: Make sure that our version of certain utility function implementations gets used in the firmware. (Closed) Base URL: http://src.chromium.org/git/vboot_reference.git
Patch Set: . Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « firmware/lib/stateful_util.c ('k') | firmware/stub/utility_stub.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 *
5 * Utility functions that need to be built as part of the firmware.
6 */
7
8 #include "utility.h"
9
10 void* Memset(void* d, const uint8_t c, uint64_t n) {
11 uint8_t* dest = d; /* the only way to keep both cl and gcc happy */
12 while (n--) {
13 *dest++ = c;
14 }
15 return dest;
16 }
17
18 int SafeMemcmp(const void* s1, const void* s2, size_t n) {
19 int result = 0;
20 if (0 == n)
21 return 1;
22
23 const unsigned char* us1 = s1;
24 const unsigned char* us2 = s2;
25 /* Code snippet without data-dependent branch due to
26 * Nate Lawson (nate@root.org) of Root Labs. */
27 while (n--)
28 result |= *us1++ ^ *us2++;
29
30 return result != 0;
31 }
OLDNEW
« no previous file with comments | « firmware/lib/stateful_util.c ('k') | firmware/stub/utility_stub.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698