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

Unified Diff: host/lib/host_common.c

Issue 2729021: Clean up of key block functions (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: More key block cleanup 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 | « host/include/host_keyblock.h ('k') | host/lib/host_keyblock.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: host/lib/host_common.c
diff --git a/host/lib/host_common.c b/host/lib/host_common.c
index 03efd2a41996bccd0b112e4c1845fc37a4fbb2ca..3d0a23db2881e36bb1f292657ef7ea701ae15cf2 100644
--- a/host/lib/host_common.c
+++ b/host/lib/host_common.c
@@ -14,58 +14,6 @@
#include "vboot_common.h"
-VbKeyBlockHeader* CreateKeyBlock(const VbPublicKey* data_key,
- const VbPrivateKey* signing_key,
- uint64_t flags) {
-
- VbKeyBlockHeader* h;
- uint64_t signed_size = sizeof(VbKeyBlockHeader) + data_key->key_size;
- uint64_t block_size = (signed_size + SHA512_DIGEST_SIZE +
- siglen_map[signing_key->algorithm]);
- uint8_t* data_key_dest;
- uint8_t* block_sig_dest;
- uint8_t* block_chk_dest;
- VbSignature *sigtmp;
-
- /* Allocate key block */
- h = (VbKeyBlockHeader*)Malloc(block_size);
- if (!h)
- return NULL;
- data_key_dest = (uint8_t*)(h + 1);
- block_chk_dest = data_key_dest + data_key->key_size;
- block_sig_dest = block_chk_dest + SHA512_DIGEST_SIZE;
-
- Memcpy(h->magic, KEY_BLOCK_MAGIC, KEY_BLOCK_MAGIC_SIZE);
- h->header_version_major = KEY_BLOCK_HEADER_VERSION_MAJOR;
- h->header_version_minor = KEY_BLOCK_HEADER_VERSION_MINOR;
- h->key_block_size = block_size;
- h->key_block_flags = flags;
-
- /* Copy data key */
- PublicKeyInit(&h->data_key, data_key_dest, data_key->key_size);
- PublicKeyCopy(&h->data_key, data_key);
-
- /* Set up signature structs so we can calculate the signatures */
- SignatureInit(&h->key_block_checksum, block_chk_dest,
- SHA512_DIGEST_SIZE, signed_size);
- SignatureInit(&h->key_block_signature, block_sig_dest,
- siglen_map[signing_key->algorithm], signed_size);
-
- /* Calculate checksum */
- sigtmp = CalculateChecksum((uint8_t*)h, signed_size);
- SignatureCopy(&h->key_block_checksum, sigtmp);
- Free(sigtmp);
-
- /* Calculate signature */
- sigtmp = CalculateSignature((uint8_t*)h, signed_size, signing_key);
- SignatureCopy(&h->key_block_signature, sigtmp);
- Free(sigtmp);
-
- /* Return the header */
- return h;
-}
-
-
VbFirmwarePreambleHeader* CreateFirmwarePreamble(
uint64_t firmware_version,
const VbPublicKey* kernel_subkey,
« no previous file with comments | « host/include/host_keyblock.h ('k') | host/lib/host_keyblock.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698