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

Side by Side Diff: src/platform/vboot_reference/common/utility_stub.c

Issue 553023: RSA signature verification and SHA-1/256/512 reference implementation for verified boot. (Closed)
Patch Set: Fixes. Created 10 years, 10 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
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 * Stub implementations of utility functions which call their linux-specific
6 * equivalents.
7 */
8
9 #include "utility.h"
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14
15 void* Malloc(size_t size) {
16 void* p = malloc(size);
17 if (!p) {
18 /* Fatal Error. We must abort. */
19 abort();
20 }
21 return p;
22 }
23
24 void Free(void* ptr) {
25 free(ptr);
26 }
27
28 void* Memcpy(void* dest, const void* src, size_t n) {
29 return memcpy(dest, src, n);
30 }
31
32 int SafeMemcmp(const void* s1, const void* s2, size_t n) {
33 int match = 1;
34 const unsigned char* us1 = s1;
35 const unsigned char* us2 = s2;
36 while (n--) {
37 if (*us1++ != *us2++)
38 match = 0;
39 else
40 match = 1;
41 }
42
43 return match;
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698