summaryrefslogtreecommitdiff
path: root/futility/cmd_create.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2016-06-23 13:45:59 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-02 01:28:37 -0700
commitf7559e4b4652134b1e15de3ce31ee50a3de00f69 (patch)
tree63c14345dbe8323ad25a428c936a1c51f6ae7fcc /futility/cmd_create.c
parentdf2bd9b1e74687dfc82a7bacc0b9a3c6162c0504 (diff)
downloadvboot-f7559e4b4652134b1e15de3ce31ee50a3de00f69.tar.gz
futility: Use vboot 2.0 APIs for public keys
This replaces calls to the old vboot 1 APIs with their vboot 2.0 equivalents. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: Ieb1a127577c6428c47ac088c3aaa0d0dad6275a8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356541 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'futility/cmd_create.c')
-rw-r--r--futility/cmd_create.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/futility/cmd_create.c b/futility/cmd_create.c
index 748ce2f7..c8219511 100644
--- a/futility/cmd_create.c
+++ b/futility/cmd_create.c
@@ -15,6 +15,7 @@
#include "2rsa.h"
#include "2sha.h"
#include "util_misc.h"
+#include "vb2_common.h"
#include "vb21_common.h"
#include "host_key.h"
@@ -81,7 +82,7 @@ static void print_help(int argc, char *argv[])
static int vb1_make_keypair()
{
struct vb2_private_key *privkey = NULL;
- VbPublicKey *pubkey = 0;
+ struct vb2_packed_key *pubkey = NULL;
struct rsa_st *rsa_key = NULL;
uint8_t *keyb_data = 0;
uint32_t keyb_size;
@@ -136,14 +137,14 @@ static int vb1_make_keypair()
goto done;
}
- pubkey = PublicKeyAlloc(keyb_size, vb1_algorithm, opt_version);
+ pubkey = vb2_alloc_packed_key(keyb_size, vb1_algorithm, opt_version);
if (!pubkey)
goto done;
- memcpy(GetPublicKeyData(pubkey), keyb_data, keyb_size);
+ memcpy((uint8_t *)vb2_packed_key_data(pubkey), keyb_data, keyb_size);
/* Write it out */
strcpy(outext, ".vbpubk");
- if (0 != PublicKeyWrite(outfile, pubkey)) {
+ if (VB2_SUCCESS != vb2_write_packed_key(outfile, pubkey)) {
fprintf(stderr, "unable to write public key\n");
goto done;
}
@@ -214,7 +215,8 @@ static int vb2_make_keypair()
privkey->sig_alg = sig_alg;
privkey->hash_alg = opt_hash_alg;
if (opt_desc && vb2_private_key_set_desc(privkey, opt_desc)) {
- fprintf(stderr, "Unable to set the private key description\n");
+ fprintf(stderr,
+ "Unable to set the private key description\n");
goto done;
}
}