Commit Graph

691 Commits

Author SHA1 Message Date
Shelley Chen
19a41188cd poppy: reinstating fw ctrl functions
Putting ctrl+D, ctrl+U, ctrl+L shortcuts
back in from the fw screens.

BUG=b:35585623
BRANCH=None
TEST=reboot and try ctrl+D, etc. in fw screen to
     make sure that they have desired effects.

Change-Id: I5ca555658eddabeeea6a2f64794e6839f35d75f7
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/443349
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-03-02 09:33:57 -08:00
Shelley Chen
e6198e7fc0 vboot_ui_menu: getting rid of explicit function print
Since we're now using VB2_DEBUG, no need to explicitly
print out __func__ anymore.

BUG=b:35585623
BRANCH=None
TEST=reboot and make sure still see serial output in
     AP console.

Change-Id: Ica524d4e50c61681e466815ffb93d33ceee215aa
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/443348
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-03-02 09:33:56 -08:00
Shelley Chen
ea97468d8a poppy: replacing dev warn & rec screens with base
Using new base screen only and leaving center
blank for displaying the detachable menu items.

BUG=b:35585623
BRANCH=None
TEST=reboot and make sure icons don't show up
     in FW screens.

Change-Id: I705dac43441f386ebceb58533fa0e336541fcd3c
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/442692
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-03-02 09:33:56 -08:00
Shelley Chen
b6ce9d095e poppy: defining base screen enum item
BUG=b:35585623
BRANCH=None
TEST=None

Change-Id: I2bb7f3f3cb8fd37f8a7c2253e1ea0cb322d01c9c
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/442691
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-03-01 18:42:22 -08:00
Shelley Chen
04b42e9612 poppy: Highlight menu selection
Reverse foreground/background colors for
highlighted selection.

BUG=chrome-os-partner:61275
BRANCH=None
TEST=reboot and make sure selection is highlighted
CQ-DEPEND=CL:442747

Change-Id: Iaf33cf6140a3ce774a67e3ac7d381d5e05feeddb
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/442690
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-02-27 12:03:18 -08:00
Shelley Chen
5c4c4678e7 poppy: add highlight param to VbExDisplayText()
BUG=chrome-os-partner:61275
BRANCH=None
TEST=None
CQ-DEPEND=CL:442747,CL:442690

Change-Id: I0730b64a1f8bf1f4aeca1be5ee87724d61818b23
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/442689
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-02-27 12:03:18 -08:00
Nicolas Boichat
83bd850f3f vboot_reference: Add support for 2048-bit exponent 3 keys
This also adds the required tests (keys, testcases).

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

Change-Id: I5e148f8792ea325f813d76089271f3c4bcc2935d
Reviewed-on: https://chromium-review.googlesource.com/438951
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-02-18 00:39:28 -08:00
Nicolas Boichat
8c53e881f8 host_key2: Add VB2_SIG_ALG_COUNT to count the number of valid signatures
More reliable than simply assuming that VB2_SIG_RSA8192 is the last
signature.

BRANCH=none
BUG=chromium:684354
TEST=rm tests/testkeys/key_*; make genkeys -j
TEST=make runtests -j

Change-Id: I755b3afb50313fcdf292fb3cd5b0dfe09f8593e3
Reviewed-on: https://chromium-review.googlesource.com/438948
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-02-15 10:47:29 -08:00
Randall Spangler
c7282f6bdc rollback_index: Add disable-ccd-unlock FWMP flag
This flag will be used by cr50 to disable case-closed debugging
unlock.  Here, we're just defining the flag.

BUG=chrome-os-partner:62205
BRANCH=reef
TEST=build_packages --board=reef chromeos_firmware

Change-Id: If86e112948e1c95a767808b2f92dd8fe35abf46c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/440846
Reviewed-by: Shelley Chen <shchen@chromium.org>
2017-02-14 14:50:40 -08:00
Shelley Chen
00dee97036 poppy: initializing next_menu_idx to current_menu_idx
Get rid of uninitialized variable warning.

BUG=chrome-os-partner:61275
BRANCH=None
TEST=make cgpt WERROR= STATIC=1

Change-Id: I31faa557406c6a90cfdea8571620675c81c0c0ec
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/440432
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2017-02-11 19:53:40 -08:00
Shelley Chen
791267a561 poppy: Converting all // comments to /* */
Also, ensuring comments start with capital letter.

BUG=chrome-os-partner:61275
BRANCH=None
TEST=None.  No functionality change.

Change-Id: I961236e2b6d95cf0281cd4e3313f465bf12ead9f
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/434250
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-30 16:48:36 -08:00
Shelley Chen
56ca279c58 poppy: Moving menu placement higher
Prevent scrolling off for low res displays

BUG=chrome-os-partner:61275
BRANCH=None
TEST=reboot snappy and make sure menu doesn't cause
     screen to scroll.

Change-Id: Ic5641c7c43ab3872dcb321df2629e228e86ddbb6
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/434249
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-30 16:48:36 -08:00
Shelley Chen
469d36aff5 poppy: Check NULL menu_array params in vb2_get_current_menu_size()
BUG=chrome-os-partner:61275
BRANCH=None
TEST=None

Change-Id: I1d88e552a4c9184061207a8e14e32dfb1a39745a
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/434248
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-30 16:48:35 -08:00
Shelley Chen
8496157c62 poppy: Adding kernel-doc comments
BUG=chrome-os-partner:61275
BRANCH=None
TEST=None.  No functionality change.

Change-Id: I00bb1924e22f398e1b614789dd0cd068ce51cc5d
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/434247
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-30 16:48:35 -08:00
Shelley Chen
53f8202a2a firmware: Using power button for selection
BUG=chrome-os-partner:61275
BRANCH=None
TEST=reboot and try to make selections in detachable
     UI with power button.

Change-Id: I0a3178eb3fa2c8c1ed77d96fdefa948eaea508e5
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/427220
2017-01-24 17:18:00 -08:00
Shelley Chen
666bd54416 firmware: Prevent wraparound when scrolling through menus
BUG=chrome-os-partner:61275
BRANCH=None
TEST=reboot and scroll to ends of menus to make sure that
     they don't wraparound.

Change-Id: I9ba83b23939140d23fe54858b9a10f873091ff72
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/426410
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-24 10:21:27 -08:00
Shelley Chen
0d82853f3b firmware: set fw screen default selection
BUG=chrome-os-partner:61275
BRANCH=None
TEST=reboot and scroll through menus to make sure
     defaults to power off in all menus.

Change-Id: I21e6c24c43a46e9e79001857c1dec9869a07d61a
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/426409
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-24 10:21:27 -08:00
Shelley Chen
4de0c43b1c firmware: Adding vol up/down ascii definitions
BUG=chrome-os-partner:61275
BRANCH=None
TEST=test vol up/down keys and see if menu changes.

Change-Id: I2213639d530f954f12040b14bf2e5cdeb5c03218
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/426408
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-24 01:31:04 -08:00
Randall Spangler
a609478d1a 2lib: add VB2_DEBUG_RAW() to print without function name
Currently, VB2_DEBUG() will print the function name as a prefix to the
debug output.  Add VB2_DEBUG_RAW() to print without that, so that it's
possible to print little bits of debug output.  Use this in ec_sync to
hex dump the hashes.

And then clean up all of the debug calls which explicitly did things like:
    VB2_DEBUG("%s: foo", __func__);
to just:
    VB2_DEBUG("foo");
so they don't double-print the function name

BUG=chromium:683391
BRANCH=none
TEST=build_packages --board=reef chromeos-firmware &&
     DEBUG=1 make -j runtests
CQ-DEPEND=CL:430978,CL:431111

Change-Id: I0c35519d2e670d55d65d01eaa60d61f3e3edf419
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/431171
Reviewed-by: Julius Werner <jwerner@chromium.org>
2017-01-20 22:40:31 -08:00
Shelley Chen
1a03740bb0 firmware: calling menu ui when using detachables
BUG=chrome-os-partner:61275
BRANCH=None
TEST=compile depthcharge with
     inflags=VB_SALK_INFLAGS_ENABLE_DETACHABLE_UI and run.

Change-Id: I4c2351feef51bbf88fefd37986de6f853cd1942e
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424091
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-18 22:51:49 -08:00
Shelley Chen
1ceb361d60 firmware: fixing menu artifacts during printing
BUG=chrome-os-partner:61275
BRANCH=None
TEST=reboot and switch menus and make sure everything
     is printing out properly.

Change-Id: I1269d3dc762a66dde0203673b7b400aba92afa75
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424356
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-18 19:17:56 -08:00
Shelley Chen
9f1d423890 firmware: adding support for language menu
BUG=chrome-os-partner:61275
BRANCH=None
TEST=reboot and try selecting language menu.

Change-Id: I3ec208578aec0ccaa92e17e4589ebeae250dae4f
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424355
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-18 19:17:55 -08:00
Shelley Chen
755bf33ad1 firmware: Add recovery menu support for detachables
Adding in basic menu support (using arrow keys) for
detachables.  This is specifically for the recovery menu.

BUG=chrome-os-partner:61275
BRANCH=None
TEST=reboot into recovery and try booting into developer mode.

Change-Id: I9596cde62f2748928b4b796bde0a0226dc981235
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424354
2017-01-18 19:17:53 -08:00
Shelley Chen
71c6c033f9 firmware: Add developer menu support for detachables
Adding in basic menu support (using arrow keys)
for detachables, which do not have keyboards.  Thus,
we can only do menu scrolling rather than the old
ctrl+D/U/L way.  This is specifically for the developer
warning menu.

BUG=chrome-os-partner:61275
BRANCH=None
TEST=reboot system and try scrolling through menu

Change-Id: I39f56f5ca2fedd47df53ab246ec357d07c9c4af0
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424353
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-18 19:17:52 -08:00
Randall Spangler
e02a19a6c2 vboot: fix compiling with DEBUG=1
If FOR_TEST is defined, 2common.h defines VB2_DEBUG() to be printf();
it should include stdio.h as well.

The HOSTLIB extern linktest links against the vboot1 stub functions,
but not the vboot2 stub functions, so it couldn't find vb2ex_printf().

BUG=chromium:682058
BRANCH=none
TEST=DEBUG=1 make runtests; DEBUG=1 emerge-reef vboot_reference depthcharge

Change-Id: Ibf981a70ca4087ce3d86b02d76e03063b2cfc9e5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/429310
Commit-Ready: Shelley Chen <shchen@chromium.org>
Reviewed-by: Shelley Chen <shchen@chromium.org>
2017-01-18 19:17:50 -08:00
Shelley Chen
3409e60633 firmware: Adding VbExDisplayText function
Enables easy printing of text to display.
Will be used for detachable UI.

BUG=chrome-os-partner:61275
BRANCH=None
TEST=Tested from new vboot_ui_menu.c file
CQ-DEPEND=CL:424357

Change-Id: I668dd57eaafa02fb31f6ac479bcd03a613323f14
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424090
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-13 21:48:34 -08:00
Randall Spangler
21015898b3 firmware: replace VBDEBUG(()) macro with VB2_DEBUG()
The original VBDEBUG macro used doubly-nested parens to work with
MSVC, which didn't support varargs in macros.  We now only use more
modern compilers, so replace it with the VB2_DEBUG macro and get rid
of the ugly and fragile double parens.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; build_packages --board=reef chromeos-firmware

Change-Id: Ifc0cb0733b14daaa1fde095fab7da4215a538c77
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/425133
Reviewed-by: Shelley Chen <shchen@chromium.org>
2017-01-12 15:56:27 -08:00
Randall Spangler
df4eb2bb7b firmware: Split out kernel UI
This moves the UI loops out of vboot_api_kernel.c into vboot_ui.c, so
that it'll be easier to support different UIs for different form factors.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; build_packages --board=reef chromeos-firmware; boot reef

Change-Id: I451b15f65aceb427ffdd94b19f44e91ebc10a860
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/414289
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Shelley Chen <shchen@chromium.org>
2017-01-12 15:56:26 -08:00
Randall Spangler
ad7a75531e firmware: Remove LoadKernelParams from APIs
This cleans up the vboot functions which handle display so they don't
need to pass it around.  Eventually, it'll be absorbed by vb2_context.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; build_packages --board=reef chromeos-firmware; boot reef

Change-Id: I58169dfd37abe657f9b9aa339cc72ffa398329e0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/414288
Reviewed-by: Shelley Chen <shchen@chromium.org>
2017-01-12 15:56:24 -08:00
ChromeOS Developer
284bf5549a firmware: Refactor and clean up ec_sync
Previously, the EC software sync process called VbDisplayScreen() from
several function calls deep.  Refactor software sync so that the UI
decisions are at a higher level (in ec_sync_all.c) and isolated from
the low-level EC software sync functionality (in ec_sync.c).

This is one in a series of changes which are more clearly separating
out the UI, to make it easier to support multiple UI across a range of
devices.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; build_packages --board=reef chromeos-firmware; boot reef

Change-Id: I40597abeb5b0cc8f5d8fc2098e4acbed4bf59bf6
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/411921
Reviewed-by: Shelley Chen <shchen@chromium.org>
2017-01-12 15:56:22 -08:00
Randall Spangler
e4136dcaa0 vboot: Pass vb2 context and use vboot2 NV routines
Passing the vb2 context around allows using more of the vb2 functions in
future changes, and prepares for a future where we directly use the
context as it was set up in firmware verification.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge

Change-Id: I8efa606dbdec5d195b66eb899e76fdc84337ad36
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404997
Reviewed-by: Shelley Chen <shchen@chromium.org>
2016-12-22 12:09:26 -08:00
Randall Spangler
b57d9505c0 vboot: Clean up headers
Minor tidying; no functional changes.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge

Change-Id: I44c816de67025b83c9e46db54fb5427c684bbfef
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404921
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2016-12-21 19:42:27 -08:00
Randall Spangler
2603675460 vboot: Split ec software sync to its own file
This was previously done inside vboot_api_kernel.  But it has nothing to
do with kernel verification; that's just the only place where we could
easily put it given that vboot (currently) owns the firmware UI.

No outwardly-visible functionality changes.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge

Change-Id: I8a434eb4449a5a86b129ecac61ad81d0ad55549c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404920
2016-12-20 21:56:56 -08:00
Mike Frysinger
8df7ed1453 expand the BDB acronym in a few key places
For people not readily familiar with the BDB acronym, expand it in
a few README files and usage strings.

BUG=None
TEST=looked at help output
BRANCH=None

Change-Id: I2523e1a289815dd0eaea093c086bc75093579808
Reviewed-on: https://chromium-review.googlesource.com/414244
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-12-14 22:57:46 -08:00
Andrey Pronin
4ad42032f4 tpm2_lite: use null password authorization for ReadLock
Most of the indexes used in practice, have AUTHREAD set with null
password authentication. The only index, for which READ_STCLEAR is
set and TlclReadLock() is called is the one used by mount-encrypted.
It has AUTHREAD with empty password and should be lockable after
platform hierarchy is disabled. So, use null password authorization
instead of platform authorization in TlclReadLock().

BUG=chrome-os-partner:54708
BRANCH=none
TEST=Start with OOBE, corporate enroll, reboot, verify that the system
     doesn't go back to OOBE. Check mount-encrypted.log on start: it
     should contain "Read-locking NVRAM area succeeded".

Change-Id: Iaac78ba4dd048edac992adfab6fb94b69b2e989a
Reviewed-on: https://chromium-review.googlesource.com/410780
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-15 17:42:26 -08:00
Randall Spangler
eedd429358 vboot: Remove LoadKernel() LBA size/count checks
Now that LoadKernel() uses a stream API for its partition data, it
doesn't care about those fields.  They're blindly passed to
cgptlib_internal, which does similar checks in CheckParameters() and
CheckHeader().  So, don't duplicate the checks.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge

Change-Id: I72375496e5df7b7c17df25d358f2555fe41fe520
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407053
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-11-15 11:25:41 -08:00
Randall Spangler
f182401b97 vboot: Split partition and vblock verification from LoadKernel()
LoadKernel() was a big function which did everything from looping over
partitions on a drive to loading the data within them to calling the
low-level verification functions on that data.  Split it apart into more
manageable chunks.  This also reduces indentation of the inner parts of
the code, whic increases readability.

No outwardly-visible functionality changes.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge

Change-Id: Iea79e70163f5d9f1a9d0d897e4a9bacc925a742d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404919
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-11-14 16:42:19 -08:00
Vadim Bendebury
11dd2f2130 tpm2: do not lock kernel space when locking physical presence
There is no direct concept of physical presence in TPM2, the platform
hierarchy could be used to manage access to various NVRAM spaces
instead. The kernel NVRAM space does not have to be explicitly locked,
disabling platform hierarchy is enough to prevent writes into this
space.

BRANCH=none
BUG=chrome-os-partner:59651
TEST=verified that the system boots fine in both normal and recovery
     modes; using tpmc confirmed that the kernel space is readable in
     both and writeable only in recovery mode.

Change-Id: I3cd8344ad897d061f6b07424f1589a7b547a161f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/410127
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2016-11-11 17:20:11 -08:00
Andrey Pronin
1afcfc1366 tpm2_lite: implement TlclGetPermissions
Implement TlclGetPermissions, which sends a TPM2_NV_ReadPublic command
and returns the attributes of the NV Index (TPM2 Spec, Part 3, Section 31.6).

BUG=chrome-os-partner:58873
BUG=chrome-os-partner:55210
BRANCH=none
TEST=Run "tpmc def" with various permissions to define new indexes,
     verify that "tpmc getp" returns matching permissions for them.

Change-Id: I2ad7163332ae8793cd717875645f19baef513b26
Reviewed-on: https://chromium-review.googlesource.com/409618
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-11 10:05:28 -08:00
Vadim Bendebury
d28b4e1444 tpm2_lite: do not ignore errors reported by TPM
Some tpm command wrappers ignore TPM return code, they should not
report success in case TPM operation failed.

BRANCH=none
BUG=chrome-os-partner:55668
TEST=verified that tpmc on reef does not silently ignore tpm write
     errors any more.

Change-Id: Id8955e3757948a3fd0972f88b569fb8828be7715
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/406516
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-11-10 12:25:34 -08:00
Andrey Pronin
6a2f9c5a58 tpm_lite_stub: clean up debug printouts in VbExTpmSendReceive
1) Callers of VbExTpmSendReceive often use the same buffer for
   TPM command and response. So, debug-print the command before
   sending to avoid it being overwritten with the response before
   printing.
2) VbExTpmSendReceive only prints execution time in debug mode.
   Execute gettimeofday() only when debug mode is enabled.
3) Avoid printing "DEBUG: " prefix before every byte in the
   command/response.

BUG=none
BRANCH=none
TEST=emerge-$BOARD vboot_reference with and without DEBUG=1,
     run tpmc commands, check the output.

Change-Id: I1bfe9a21e1a78227996eb7310a3584a9e5b73a87
Reviewed-on: https://chromium-review.googlesource.com/409613
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-10 12:25:29 -08:00
Andrey Pronin
055788beb8 tpm2_lite: implement TlclDefineSpace
Implement TlclDefineSpace, which sends a TPM2_NV_DefineSpace command
to define the attributes of an NV Index and cause the TPM to reserve
space to hold the data associated with the NV Index (TPM2 Spec, Part 2,
Section 31.3.1).

Also, update TlclWrite and TlclWriteLock calls to use the platform
authorization only for NV Indexes in TPM and Platform ranges, and
use empty password authorization otherwise. This allows (1) working with
the Off-Disk Early-Access Key Storage used by mount-encrypted through
Tlcl API; and (2) testing Tlcl NV define/write/write-lock operations
with platform hierarchy disabled.

BUG=chrome-os-partner:55210
BUG=chrome-os-partner:59361
BRANCH=none
TEST=After clearing the TPM owner run "tpmc def 0x800001 0x3 0x0" to
     create a TPM index of size 3, which can be read and written to
     with empty password. Verify that "tpmc write 0x800001 12 34 56"
     succeeds and "tpmc read 0x800001 0x3" prints "12 34 56" as NVRAM
     space contents.

Change-Id: I185cf8380ef1579d0e9e4d8cead5a30ceda3ead9
Reviewed-on: https://chromium-review.googlesource.com/405792
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@google.com>
2016-11-09 18:39:47 -08:00
Furquan Shaikh
adfafba793 Add new recovery reason for rec hash space lock failure in RO firmware
BUG=chrome-os-partner:59355
BRANCH=None
TEST=make -j runtests

Change-Id: Ife661afea83f65ba262e50e9743a64628972d39e
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/408568
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-09 02:17:13 -08:00
Furquan Shaikh
34d58e7760 rollback_index: Add new index for recovery hash space
BUG=chrome-os-partner:59355
BRANCH=None
TEST=make runtests

Change-Id: Ia86922f2c1940c8b46eb938f208fb4afe4ebc175
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/408656
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-09 02:17:11 -08:00
Furquan Shaikh
95b2d6ca2b recovery: Add new recovery reason to train memory and reboot
This new recovery reason will instruct the calling firmware in
vboot_select_and_load_kernel to reboot the device (under the assumption
that training of memory has already been performed by the firmware). On
seeing the return code VBERROR_REBOOT_REQUESTED, calling firmware should
perform a reboot.

BUG=chrome-os-partner:59352
BRANCH=None
TEST=make -j runtests successful

Change-Id: I110a735e612665cb2378bd71ca01a111edaf58e3
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407656
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-08 02:52:45 -08:00
Randall Spangler
6e3931d1f6 vboot: Add vb2_unpack_key_buffer
Previously, vb2_unpack_key() actually unpacked a key buffer.  Callers
that had a vb2_packed_key had to typecast it back to a uint8_t buffer to
unpack it.  Rename vb2_unpack_key() to vb2_unpack_key_buffer(), and make
vb2_unpack_key() unpack a vb2_packed_key.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge;
     emerge-samus and boot it

Change-Id: I9ee38a819c59cc58a72ead78cf5ddf3d0f301ae7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400906
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-11-06 02:34:03 +00:00
Randall Spangler
559a110f33 vboot: use malloc and free directly
Originally, vboot1 code used VbExMalloc() and VbExFree() since it needed
to talk to EFI firmware that didn't have standard malloc() and free().
Now, coreboot and depthcharge implement them as wrappers around those
standard calls.  vboot2 code already calls them directly, so let vboot1
code do that too.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge

Change-Id: I49ad0e32e38d278dc3589bfaf494bcf0e4b0a4bd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400905
2016-11-06 02:33:50 +00:00
Randall Spangler
47eeaa6e4a vboot: remove unused stateful_util
Now that the vboot1 cryptolib code is gone, nothing uses stateful_util.
Remove it and its unit tests.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge

Change-Id: I75b6014be00c5266545db10e87c1d9485fd1444b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400904
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-11-06 02:33:37 +00:00
Randall Spangler
13c0776aab vboot: Remove the remainder of vb1 cryptolib
At this point, all that's left are a few constants in the cryptolib
header files, and they're only used by host-side code.  So move them to
a host-side header file and get rid of cryptolib.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge

Change-Id: I2235f0e84e13fef313afe54e749b73744b157884
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400903
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-11-06 02:33:19 +00:00
Randall Spangler
46a382d613 vboot: Remove vboot1 cryptolib padding source
The old vboot1 cryptolib hard-coded many of its padding arrays in a
padding.c file.  Use the equivalent vboot2 apis instead.

This change is almost exclusively on the host and test side; the only
firmware impact is on a single line of debug output.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge

Change-Id: If689ffd92f0255847bea2424950da4547b2c0df3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400902
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-11-06 02:33:02 +00:00