vb20: add vb2api_check_hash_get_digest() for retrieving hash result
authorAaron Durbin <adurbin@chromium.org>
Fri, 22 Jan 2016 21:06:05 +0000 (15:06 -0600)
committerchrome-bot <chrome-bot@chromium.org>
Tue, 26 Jan 2016 22:56:36 +0000 (14:56 -0800)
commit7cbd1ced18e6abf63e1017b2d02ad80391b47cd7
tree0709b17c9a84679bf50e216f96651de2f394a4d6
parent6502935d9f610f8d62acf2de2534e5e64ee50643
vb20: add vb2api_check_hash_get_digest() for retrieving hash result

For x86 systems, which resume through the boot reset vector, to
implement vboot verification of the memory init code one needs
check that the slot chosen on the resume path is the same as
the original boot path. That check is done by storing the
resulting hash of the slot. However, vb2api doesn't export
the resulting hash from vb2api_check_hash(). Thus, provide
a variant which saves the resulting digest in the supplied
buffer.

BUG=chrome-os-partner:46049
BRANCH=glados
TEST=Suspended and resumed on chell. Also, tested with an EC build
     which returns a bad hash to ensure that is properly caught.

Change-Id: Ic20be2024afedabc2d8bc767f1b794376348523c
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/323460
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
firmware/2lib/include/2api.h
firmware/2lib/include/2return_codes.h
firmware/lib20/api.c
tests/vb20_api_tests.c