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

Unified Diff: vboot_firmware/lib/vboot_common.c

Issue 2848006: Refactor LoadFrmware() to avoid global variables, which don't work when running out of ROM (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: Undo change to vboot_struct Created 10 years, 6 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
« no previous file with comments | « vboot_firmware/lib/load_firmware_fw.c ('k') | vboot_firmware/lib/vboot_firmware.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vboot_firmware/lib/vboot_common.c
diff --git a/vboot_firmware/lib/vboot_common.c b/vboot_firmware/lib/vboot_common.c
index 1256b676d3e67d12b08352ea1c82d5c488a43619..f76eed45abc0655a93c77099e171773f6365ef0e 100644
--- a/vboot_firmware/lib/vboot_common.c
+++ b/vboot_firmware/lib/vboot_common.c
@@ -85,6 +85,26 @@ int VerifySignatureInside(const void* parent, uint64_t parent_size,
}
+void PublicKeyInit(VbPublicKey* key, uint8_t* key_data, uint64_t key_size) {
+ key->key_offset = OffsetOf(key, key_data);
+ key->key_size = key_size;
+ key->algorithm = kNumAlgorithms; /* Key not present yet */
+ key->key_version = 0;
+}
+
+
+int PublicKeyCopy(VbPublicKey* dest, const VbPublicKey* src) {
+ if (dest->key_size < src->key_size)
+ return 1;
+
+ dest->key_size = src->key_size;
+ dest->algorithm = src->algorithm;
+ dest->key_version = src->key_version;
+ Memcpy(GetPublicKeyData(dest), GetPublicKeyDataC(src), src->key_size);
+ return 0;
+}
+
+
RSAPublicKey* PublicKeyToRSA(const VbPublicKey* key) {
RSAPublicKey *rsa;
« no previous file with comments | « vboot_firmware/lib/load_firmware_fw.c ('k') | vboot_firmware/lib/vboot_firmware.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698