Commit Graph

7 Commits

Author SHA1 Message Date
Randall Spangler
ca72512866 vboot: Disambiguate vb2.1 structs and functions
Futility needs to link against both vboot1/vboot2.0 and vboot2.1
functions.  This was easy in the past because it did (vboot1 +
vboot2.1) and there's no overlap.

In replacing vboot1 function calls and structs with vboot2.0, now there
are symbol collisions between vboot2.0 and vboot2.1.  For example, both
of them use a struct called vb2_signature, but the structs are defined
differently.  Functions which operate on those structs also overload.

Rename the vb2.1 structs to start with vb21_ instead of vb2_.  Do the
same for vb2.1 functions which operate on vb2.1 data.

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

Change-Id: I24defd87cbd9ef64239faf1a8e98ab2372d27539
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347458
Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
2016-07-26 17:31:54 -07:00
Anatol Pomazau
57e881dedc futility: Initialize stack variables
This suppresses following 'maybe-uninitialized' gcc 4.9.2 errors:

    CC            futility/futility.o
futility/futility.c: In function ‘do_help’:
futility/futility.c:262:2: error: ‘vstr’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  printf("The following %scommands are built-in:\n\n", vstr);
  ^
cc1: all warnings being treated as errors
host/lib21/host_misc.c: In function ‘vb2_str_to_id’:
host/lib21/host_misc.c:154:14: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   id->raw[i] = val;
              ^
cc1: all warnings being treated as errors

BUG=none
BRANCH=none
TEST=compile, run unit tests

Change-Id: I6b9d19f2d6e9deb2010dd22602d2a3310f4db335
Signed-off-by: Anatol Pomazau <anatol@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/265370
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Anatol Pomazau <anatol@google.com>
Tested-by: Anatol Pomazau <anatol@google.com>
2015-04-13 18:44:24 +00:00
Bill Richardson
36bc59140c vb21: Rename struct vb2_guid to struct vb2_id
Since the ID structure isn't a true GUID anymore, let's call it
something else.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: I96f511bd5587a94d2cc20764e26d7ef0096de04c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/256182
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-03-10 23:46:07 +00:00
Bill Richardson
0f21441e78 vb21: Replace the key GUID with a sha1sum instead
We want a quick and human-friendly way to match keys with
signatures, so we decided to give each key a unique GUID and
carry that ID around when signing things.

But then we realized that we could autogenerate a unique
identifier from the .pem file itself, which is even better
because then we can match our binary keypair structs with the
openssl file used to generate them.

This change replaces the GUID id with a sha1sum calculated from
the public key's "keyb" blob.

BUG=none
BRANCH=none
TEST=make runtests

Also:

  futility show tests/testkeys/key_rsa4096.pem
  futility create tests/testkeys/key_rsa4096.pem foo
  futility show foo.vbp*

Note that the GUID is the same for all files.

Change-Id: Ie44e46c83433718b1ff0163c1e7c51ec331b99f9
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/256181
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-03-10 23:46:03 +00:00
Bill Richardson
4e4c19602e futility: Add create command to make keypairs from RSA files
This command reads a single .pem file and emits the public and
private keys generated from it. It can produce both the old-style
vboot 1.0 keys (.vbpubk and .vbprivk), or the new vboot 2.1
format keys (.vbpubk2 and .vbprik2). The default is the new
format, but you can give futility the --vb1 arg to force the old
format.

A test is included.

BUG=chromium:231547
BRANCH=ToT
TEST=make runtests

Change-Id: I4713dc5bf34151052870f88ba52ddccf9d4dab50
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/246766
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-03-10 20:44:43 +00:00
Randall Spangler
108d991c67 vboot2: Move knowledge of vboot 2.1 data structures inside lib21/
Code which compiles against fwlib2 no longer knows or cares about the
new data structures.  This should shrink fwlib2 a bit.  This is part 3
of 4 changes which split vboot 2.0 struct handling (old vboot1
structs) from vboot 2.1 struct handling (new style structs).

No functional changes; just shuffling around code.

BUG=chromium:423882
BRANCH=none
TEST=make runtests && VBOOT2=1 make runtests (works with/withoug VBOOT2 flag)
     And compile firmware for veyron_pinky.

Change-Id: Ibccd7d1974e07f38b90c19c924ef3b1ffcb77d62
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/233020
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2014-12-04 04:02:13 +00:00
Randall Spangler
a5b69b02e0 vboot2: Move files which use new vboot 2.1 structs to their own directories
This is part 1 of a series of 4 changes which rearrange the vboot2
files and unit tests so that we can more cleanly switch over from
old-style structs to new-style structs.

No functional changes, just shuffling around code.

BUG=chromium:423882
BRANCH=none
TEST=make runtests && VBOOT2=1 make runtests (works with/withoug VBOOT2 flag)
     And build firmware for veyron_pinky.

Change-Id: I170d737bf151a6bafe61cde23b3d2f7a3fae43ce
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/232978
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2014-12-04 04:01:41 +00:00