diff options
author | Randall Spangler <rspangler@chromium.org> | 2010-06-15 18:45:09 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2010-06-15 18:45:09 -0700 |
commit | a55e5ca76c5054c02dcc0628be0950c07b49d38c (patch) | |
tree | 322a873fbf83ea81cf4e73dc7afe177cd70f9271 /host | |
parent | e3b4ac96bc8b47bc9e5f01177d8cf20066cff4a8 (diff) | |
download | vboot-a55e5ca76c5054c02dcc0628be0950c07b49d38c.tar.gz |
Refactor LoadFirmware() to avoid global variables, which don't work when running out of ROM
Review URL: http://codereview.chromium.org/2848006
Diffstat (limited to 'host')
-rw-r--r-- | host/include/host_key.h | 10 | ||||
-rw-r--r-- | host/lib/host_key.c | 23 | ||||
-rw-r--r-- | host/linktest/main.c | 2 |
3 files changed, 0 insertions, 35 deletions
diff --git a/host/include/host_key.h b/host/include/host_key.h index 6d964a0f..efdf79db 100644 --- a/host/include/host_key.h +++ b/host/include/host_key.h @@ -33,21 +33,11 @@ VbPrivateKey* PrivateKeyRead(const char* filename, uint64_t algorithm); void PrivateKeyFree(VbPrivateKey* key); -/* Initialize a public key to refer to [key_data]. */ -void PublicKeyInit(VbPublicKey* key, uint8_t* key_data, uint64_t key_size); - - /* Allocate a new public key with space for a [key_size] byte key. */ VbPublicKey* PublicKeyAlloc(uint64_t key_size, uint64_t algorithm, uint64_t version); -/* Copy a public key from [src] to [dest]. - * - * Returns 0 if success, non-zero if error. */ -int PublicKeyCopy(VbPublicKey* dest, const VbPublicKey* src); - - /* Read a public key from a .vbpubk file. Caller owns the returned * pointer, and must free it with Free(). * diff --git a/host/lib/host_key.c b/host/lib/host_key.c index c5f49d31..da350fd4 100644 --- a/host/lib/host_key.c +++ b/host/lib/host_key.c @@ -72,14 +72,6 @@ void PrivateKeyFree(VbPrivateKey* key) { } -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; -} - - /* Allocate a new public key with space for a [key_size] byte key. */ VbPublicKey* PublicKeyAlloc(uint64_t key_size, uint64_t algorithm, uint64_t version) { @@ -95,21 +87,6 @@ VbPublicKey* PublicKeyAlloc(uint64_t key_size, uint64_t algorithm, } -/* Copy a public key from [src] to [dest]. - * - * Returns zero if success, non-zero if error. */ -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; -} - - VbPublicKey* PublicKeyReadKeyb(const char* filename, uint64_t algorithm, uint64_t version) { VbPublicKey* key; diff --git a/host/linktest/main.c b/host/linktest/main.c index b8db1211..5fb7dd3d 100644 --- a/host/linktest/main.c +++ b/host/linktest/main.c @@ -7,9 +7,7 @@ int main(void) /* host_key.h */ PrivateKeyRead(0, 0); PrivateKeyFree(0); - PublicKeyInit(0, 0, 0); PublicKeyAlloc(0, 0, 0); - PublicKeyCopy(0, 0); PublicKeyRead(0); PublicKeyReadKeyb(0, 0, 0); PublicKeyWrite(0, 0); |