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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
Index: src/platform/vboot_reference/common/utility_stub.c
diff --git a/src/platform/vboot_reference/common/utility_stub.c b/src/platform/vboot_reference/common/utility_stub.c
new file mode 100644
index 0000000000000000000000000000000000000000..14a5910fbad8911e2a375e07fd6925a049983159
--- /dev/null
+++ b/src/platform/vboot_reference/common/utility_stub.c
@@ -0,0 +1,44 @@
+/* Copyright (c) 2010 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.
+ *
+ * Stub implementations of utility functions which call their linux-specific
+ * equivalents.
+ */
+
+#include "utility.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+void* Malloc(size_t size) {
+ void* p = malloc(size);
+ if (!p) {
+ /* Fatal Error. We must abort. */
+ abort();
+ }
+ return p;
+}
+
+void Free(void* ptr) {
+ free(ptr);
+}
+
+void* Memcpy(void* dest, const void* src, size_t n) {
+ return memcpy(dest, src, n);
+}
+
+int SafeMemcmp(const void* s1, const void* s2, size_t n) {
+ int match = 1;
+ const unsigned char* us1 = s1;
+ const unsigned char* us2 = s2;
+ while (n--) {
+ if (*us1++ != *us2++)
+ match = 0;
+ else
+ match = 1;
+ }
+
+ return match;
+}

Powered by Google App Engine
This is Rietveld 408576698