futility: Create signatures using vboot 2.0 APIs

Refactor futility to use only vboot 2.0 APIs to create signatures.

BUG=chromium:611535
BRANCH=none
TEST=make runtests

Change-Id: I176e7f424fa556d34d8fe691df5681f1e43210ce
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/356128
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
This commit is contained in:
Randall Spangler
2016-06-17 10:48:16 -07:00
committed by chrome-bot
parent 31f04ada58
commit 814aaf09ce
27 changed files with 505 additions and 319 deletions

View File

@@ -8,10 +8,12 @@
#ifndef VBOOT_REFERENCE_HOST_KEY_H_
#define VBOOT_REFERENCE_HOST_KEY_H_
#include "2crypto.h"
#include "cryptolib.h"
#include "vboot_struct.h"
struct vb2_packed_key;
struct vb2_private_key;
typedef struct rsa_st RSA;
@@ -23,9 +25,11 @@ typedef struct VbPrivateKey {
/* Read a private key from a .pem file. Caller owns the returned pointer,
* and must free it with PrivateKeyFree(). */
* and must free() it. */
VbPrivateKey* PrivateKeyReadPem(const char* filename, uint64_t algorithm);
struct vb2_private_key *vb2_read_private_key_pem(
const char *filename,
enum vb2_crypto_algorithm algorithm);
/* Free a private key. */
void PrivateKeyFree(VbPrivateKey* key);
@@ -33,13 +37,12 @@ void PrivateKeyFree(VbPrivateKey* key);
/* Write a private key to a file in .vbprivk format. */
int PrivateKeyWrite(const char* filename, const VbPrivateKey* key);
/* Read a privake key from a .vbprivk file. Caller owns the returned
* pointer, and must free it with PrivateKeyFree().
/* Read a private key from a .vbprivk file. Caller owns the returned
* pointer, and must free() it.
*
* Returns NULL if error. */
VbPrivateKey* PrivateKeyRead(const char* filename);
struct vb2_private_key *vb2_read_private_key(const char *filename);
/* Allocate a new public key with space for a [key_size] byte key. */
VbPublicKey* PublicKeyAlloc(uint64_t key_size, uint64_t algorithm,