summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* vboot: replace sysincludes.h with 2sysincludes.hJoel Kitching2019-08-222-2/+2
| | | | | | | | | | | | | | | | | | | | | sysincludes.h and 2sysincludes.h are almost identical except for one extra header (ctype.h) in the vboot1 variant. Add this to 2sysincludes.h, and nuke sysincludes.h. Depends on: https://review.coreboot.org/c/coreboot/+/33525 BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Iaba21a9b8bb2ae0c081184019576663898317bd1 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1680325 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1659990 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Auto-Submit: Joel Kitching <kitching@chromium.org>
* vboot/secdata: move permissions and uid check to ReadSpaceKernelJoel Kitching2019-08-211-39/+59
| | | | | | | | | | | | | | | | | | Relocate permissions and uid check from RollbackKernelRead to ReadSpaceKernel. Restructure test code to set default values in ResetMocks. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I72c536042b89684c6db5099412344678e3d9d920 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1758146 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/secdata: remove legacy version checks on rollback spacesJoel Kitching2019-08-211-55/+40
| | | | | | | | | | | | | | | | | The code to deal with version < 2 rollback spaces has been around since 2013. Legacy devices will not be updating to this code, thus we can remove the legacy silent upgrade. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I8ce22c37418ddc56cb74cc792540b54b3ee7bbd7 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1727949 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* tests: Add array bounds checkstabilize-kernelnext-broadwell-12434.BJacob Garber2019-08-171-1/+2
| | | | | | | | | | | | | | | Ensure that mock_keypresses_count is in bounds before accessing the mock_keyflags array. BUG=none TEST=make clean && make runtests BRANCH=none Change-Id: Ifa8fce5438f2e2547c9e316038466244eee7bfa9 Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Found-by: Coverity CID 198899 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1752048 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: vb2_shared_data offsets should hang off parentstabilize-12428.BJoel Kitching2019-08-167-133/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | vb2_shared_data struct has many offsets to other objects in the workbuf. They are all prefixed with `workbuf_`, e.g.: uint32_t workbuf_data_key_offset; uint32_t workbuf_data_key_size; In order to adhere to a hierarchical structure on the workbuf, remove the workbuf_ prefix from these symbols to reflect the relationship between vb2_shared_data and its children more accurately. Create a helper function vb2_member_of to safely look up a child of a particular object in the workbuf by offset. Pointer arithmetic to find vb2_shared_data children is replaced with calls to this function. BUG=b:124141368, chromium:994060 TEST=make clean && make runtests BRANCH=none Change-Id: Ia82417a35d2067ee5e4f42fea0396e6325127223 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1753400 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1718264 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* tests: Fix off-by-one error in array bounds checkJacob Garber2019-08-161-1/+1
| | | | | | | | | | | | | | | | | | rptr points to an object with rsize number of bytes. If offset + size == rsize, then rptr + offset + size will point to one byte past the end of the object during the memcpy(). Exclude this case by adding it to the bounds check. We can also remove the offset > rsize check since it is subsumed in the other one. BUG=none TEST=make clean && make runtests BRANCH=none Change-Id: Iceda658f420babe61bd1d9807efc8333d2044ccc Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Found-by: Coverity CID 198905 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1752766 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: properly check failure from VbExGetLocalizationCountJoel Kitching2019-08-131-0/+5
| | | | | | | | | | | | | | | | | Check the return value and result of calling VbExGetLocalizationCount. If something is awry, fall back to using one language entry. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Ieeea54bfed303a98d16f15aceab47f1ffdd10d6d Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1729773 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/secdata: remove retries from rollback functionsJoel Kitching2019-08-131-159/+25
| | | | | | | | | | | | | | | | Assume that transport-layer communication to Cr50 is reliable. No need for retries on reads/writes, or verification after write. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: Ie57d1eeaa44c338bca289e371c516540aacf9437 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1729713 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: replace VBERROR_INVALID_PARAMETER with vboot2 equivalentJoel Kitching2019-08-131-2/+2
| | | | | | | | | | | | | | | | | Replace vboot1-style VBERROR_INVALID_PARAMETER with vboot2 equivalent VB2_ERROR_INVALID_PARAMETER. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I46227cd3a7d7ce84654a0093f9d64883c9563381 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1728116 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1728294 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: replace VBERROR_SIMULATED with VB2_ERROR_MOCKJoel Kitching2019-08-137-32/+32
| | | | | | | | | | | | | | | Replace vboot1-style VBERROR_SIMULATED with VB2_ERROR_MOCK. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I9f7a21b957097672883a428a5210c14a27852085 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1722917 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: replace VBERROR_UNKNOWN with VB2_ERROR_UNKNOWNJoel Kitching2019-08-135-13/+13
| | | | | | | | | | | | | | | | Replace vboot1-style VBERROR_UNKNOWN with VB2_ERROR_UNKNOWN. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: Icd2158e328142cff69ce94b5396ab021a1f7839c Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1728115 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1722916 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: replace VBERROR_SUCCESS with VB2_SUCCESSJoel Kitching2019-08-1312-94/+94
| | | | | | | | | | | | | | | | | Replace vboot1-style VBERROR_SUCCESS with VB2_SUCCESS (trivial change since both are equal values). BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I46e02471a031e9f36ec869d11d0b957d1c1b5769 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1728114 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1722915 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: update vboot2 functions to use new vb2_error_tJoel Kitching2019-08-1317-209/+166
| | | | | | | | | | | | | | | | | | To make explicit when vboot2 error codes should be returned, use the new vb2_error_t type on all functions which return VB2_ERROR_* constants. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: Idd3ee8afe8c78347783ce5fa829cb78f1e5719e2 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1728113, chromium:1728499 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1728292 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* image_signing: clean up oci container key referencesMike Frysinger2019-08-092-9/+0
| | | | | | | | | | | | | | | | We never released this feature and we've dropped the logic from newer releases. Purge the signing logic of references to the key. We still need to delete the key in case we're signing an older release branch. BUG=chromium:976916 TEST=signing image w/key deletes it, and signing image w/out key passes BRANCH=None Change-Id: I82b8a4dab5f68e01c54281afd4817eea3dd359ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1742692 Reviewed-by: LaMont Jones <lamontjones@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* vboot: rename VbError_t typedef to vb2_error_tJoel Kitching2019-08-0611-77/+79
| | | | | | | | | | | | | | | | | | | | | | As part of the conversion of error codes from vboot1 to vboot2, replace all instances of VbError_t with vb2_error_t. vboot2 currently uses the int type for return values, but we would like to implement the use of vb2_error_t instead, which is potentially clearer than simply using an int. Existing functions will be converted to use vb2_error_t in a subsequent CL. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: Iee90d9a1f46bcf5f088e981ba6ddbcf886ff0f18 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1728112 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1722914 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot/tpm: fix return type inconsistenciesJoel Kitching2019-08-061-2/+2
| | | | | | | | | | | | | | | | | | | TPM errors and vboot errors were getting mixed up. Note that this patch changes a function signature in the vboot1 API. Any callers of the function should be updated accordingly. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: Idf332ca9ac61b5771fccf9e2ce75e8689c0aace9 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1730374 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1729712 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: join vboot1 and vboot2 errors into same enumJoel Kitching2019-08-061-0/+1
| | | | | | | | | | | | | | | | | | | | It's extremely hard to accomplish anything with two different sets of error codes. Since the two error code sets don't overlap, merge them into the same enum (vb2_return_code). The next step is to get rid of VbError_t and have all functions consistently return vboot2-style int. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: Ie34ac2c30e5d73fe886628e3150cf63543d520af Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1728117, chromium:1735666 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1722913 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: deprecate VbExError functionJoel Kitching2019-07-242-2/+6
| | | | | | | | | | | | | | | | Convert uses of this function to call VB2_DEBUG and manually exit if necessary. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I9006b1a9c66645757d33310d96207233b88eaed5 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1710340 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove Boot Descriptor Block (BDB) library and utilitiesJoel Kitching2019-07-2412-1436/+0
| | | | | | | | | | | | | | | | Remove unused BDB code, previously created for a cancelled SoC project. BUG=b:124141368, chromium:986177 TEST=make clean && make runtests BRANCH=none Change-Id: I91faf97d9850f8afb816fa324ad9a4d9f3842888 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1710336 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove VbPublicKey structJoel Kitching2019-07-103-51/+16
| | | | | | | | | | | | | | | Update all references to vboot2-style struct vb2_packed_key. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I55a5f6bf315bdb4b83a998759d3732077283998e Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1675871 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: replace Min macro with VB2_MINstabilize-12331.BJoel Kitching2019-07-062-50/+51
| | | | | | | | | | | | | | | | Replace old vboot1-style Min macro with VB2_MIN, and relocate tests accordingly. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I73d630147eaf23f97dd750769fb1e911dae01848 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1675866 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove VerifyMemberInside functionstabilize-12301.BJoel Kitching2019-06-262-53/+24
| | | | | | | | | | | | | | | | | | Use vboot2-style vb2_verify_member_inside instead. Correct some strings in vboot2 tests to refer to new vboot2 functions instead. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Idb3bcf1657c9d955acc6f93983c7b0c7f06427e3 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1675870 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: remove vboot1 version of ARRAY_SIZE macroJoel Kitching2019-06-263-13/+16
| | | | | | | | | | | | | | | | Macro already exists in vboot2-style 2common.h. Relocate tests accordingly. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I6b96627a05e8c05ff49b8780fe4472890c2a2043 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1675869 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove OffsetOf functionJoel Kitching2019-06-262-12/+7
| | | | | | | | | | | | | | | Should use vboot2 equivalent instead: vb2_offset_of BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I64afc88477cbb615a661833f45761030c55fcdf6 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1675868 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: remove unused CombineUint16Pair functionJoel Kitching2019-06-261-8/+0
| | | | | | | | | | | | | BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Ifd7dcc1414248b025a8a4bc2942db11814bc8be5 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1675865 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* lib/ec_sync_all: Reboot EC to RO after successful AUX FW updateKarthikeyan Ramasubramanian2019-06-191-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | Currently some chips that require AUX FW update request EC reboot to RO after the FW update is applied successfully while some chips do not. It is safe to request EC reboot to RO whenever AUX FW update is applied successfully so that all the chips that require AUX FW update gets reset to a clean state. Update tests to handle the updated code flow and return code correctly. BUG=b:128820536,b:119046668 BRANCH=None TEST=Ensure that the device boots to ChromeOS. Force a TCPC FW update and ensure that after it is successfully applied EC reboots to RO. Cq-Depend: chromium:1625866 Change-Id: I72849620d90284e49cd1a9b31fc5eadede455c51 Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/1627302 Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Commit-Ready: Karthikeyan Ramasubramanian <kramasub@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: add vb2api_gbb_get_flags functionJoel Kitching2019-06-141-0/+9
| | | | | | | | | | | | | | BUG=b:124141368, chromium:954774 TEST=make clean && make runtests BRANCH=none Change-Id: I7b422e8a26621720a6b7efc5211629996a6aa385 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1659989 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org> Auto-Submit: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: correct VB2_SECDATAK_SIZE constant to 13Joel Kitching2019-06-132-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | This constant was incorrectly set to 14, whereas sizeof(vb2_secdatak) is 13. Update the constant its correct value, and add a test for each of secdata and secdatak to check the constant values. Previously, this constant was not used anywhere. The secdatak space is created and initialized in coreboot with a hard-coded (correct) size and initial value. So there should be no worry about devices out in the field with TPM secdatak size set to 14. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I0a6072aef2de401bd3cd40ac3b002f754da19560 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1655049 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org>
* vboot: expose vb2api_secdatak_check and vb2api_secdatak_createJoel Kitching2019-06-1310-19/+19
| | | | | | | | | | | | | | | | | | | | | | Previously vb2api_secdatak_check and vb2api_secdatak_create had headers in 2api.h, but no definitions. Merge identical internal/external functions: vb2api_secdata_create, vb2_secdata_create_crc vb2api_secdata_check, vb2_secdata_check_crc vb2api_secdatak_create, vb2_secdatak_create_crc vb2api_secdatak_check, vb2_secdatak_check_crc BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I64a14d65e5d856ca0f819ef3ded50b4719abc8b3 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1652874 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org>
* vboot: rewrite GBB functions and APIJoel Kitching2019-06-075-84/+401
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Old vboot1-style GBB accessor functions were awkwardly located within region-init.c. Rewrite GBB accessor functions for vboot2, and formally expose HWID retrieval function via vboot2 API. workbuf is used for key retrieval functions, while a buffer provided by the caller is used for HWID retrieval function. Reintroduce vboot_display_tests to `make runtests` test suite. Move GBB tests from vboot_display_tests to vb2_gbb_tests. Properly propagate vb2_workbuf objects within the function call stack (vb2_load_partition). BUG=b:124141368, chromium:954774 TEST=Build and flash to eve, check that Chrome OS boots TEST=Build with CL:1627469 applied, check HWID TEST=make clean && make runtests BRANCH=none Change-Id: I398d1329f0b092de35aac73d98dfd9aee6e4e7de Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1584488 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Jason Clinton <jclinton@chromium.org>
* vboot: don't unset VB2_NV_DISPLAY_REQUEST in EC syncJoel Kitching2019-06-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | VB2_NV_DISPLAY_REQUEST disabling code has been relocated to VbBootNormal. Remove from EC sync code. Remove the vb2_shared_data argument from check_reboot_for_display. Avoid calling ec_sync_check_aux_fw after phase 1 if already certain that a reboot is required. BUG=b:124141368, chromium:948592, chromium:967298 TEST=make clean && make runtests BRANCH=none Change-Id: Ia5472aceb0b2a415f24dd76d26179632009d07cb Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1634453 Commit-Queue: Jason Clinton <jclinton@chromium.org> Tested-by: Jason Clinton <jclinton@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: don't use VB2_NV_DISPLAY_REQUEST for diagnostic modeJoel Kitching2019-06-072-19/+3
| | | | | | | | | | | | | | | | | Display initialization code now directly checks VB2_NV_DIAG_REQUEST. There is no need for diagnostic mode flow to set VB2_NV_DISPLAY_REQUEST. BUG=b:124141368, chromium:948592, chromium:967298, b:133175864 TEST=make clean && make runtests BRANCH=none Change-Id: I9748bf03c11c5698c181c177634d73fb34fd2d59 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1634452 Commit-Queue: Jason Clinton <jclinton@chromium.org> Tested-by: Jason Clinton <jclinton@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: check display init when entering normal modeJoel Kitching2019-06-072-8/+17
| | | | | | | | | | | | | | | | | | In order to simplify code which uses VB2_NV_DISPLAY_REQUEST, centralize disabling this NVRAM flag to a function called at the start of VbBootNormal. Also disable VB2_NV_DIAG_REQUEST here, since display init is enabled for this request as well. BUG=b:124141368, chromium:948592, chromium:967298, b:133175864 TEST=make clean && make runtests BRANCH=none Change-Id: I8aa7c44671ada23c0500cd8a0c5d7f737298bb11 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1634451 Commit-Queue: Jason Clinton <jclinton@chromium.org> Tested-by: Jason Clinton <jclinton@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: move vb2_packed_key and several functions from lib20 to 2libJoel Kitching2019-06-072-88/+108
| | | | | | | | | | | | | | | | | | | * Move vb2_packed_key from vb2_struct.h to 2struct.h * Move vb2_verify_member_inside from lib20/common.c to 2common.c * Move vb2_packed_key_data and vb2_verify_packed_key_inside from lib20/packed_key.c to 2packed_key.c * Relocate tests accordingly BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I6a9338ffdb640aad071941c3768427e15cd2aa93 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1642773 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* tests/ec_sync_tests: Update the test to reflect new AUX FW protectionKarthikeyan Ramasubramanian2019-06-061-0/+5
| | | | | | | | | | | | | | | | | | All AUX FW remote bus tunnels are protected as part of VbootExEcVbootDone callback. So update the test to reflect that behavior. BUG=None BRANCH=None TEST=/mnt/host/source/chromite/bin/cros_run_unit_tests --board=octopus --packages=chromeos-base/vboot_reference Change-Id: I163518a57deb586fb12ea11ba74987ff1a4ad90b Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1641531 Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* vboot: do not use cparams for VBSDJoel Kitching2019-05-282-24/+14
| | | | | | | | | | | | | | | | | | | | | Pass VbSharedDataHeader struct directly as an argument for the functions VbVerifyMemoryBootImage and VbSelectAndLoadKernel, instead of retrieving from cparams. After any remaining references are removed from depthcharge, the VbCommonParams struct may be deprecated and removed. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I4dceb539516b62b5817987359705bb8e27ddb6f3 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1585505 Reviewed-on: https://chromium-review.googlesource.com/1584489 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: save GBB header in workbuf during firmware verificationJoel Kitching2019-05-2814-99/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since GBB header will be needed for subsequent GBB reads later on (in kernel verification stage), and since GBB header is relatively small (128 bytes), save the full GBB header onto workbuf during firmware verification stage, and store an offset pointer to it in vb2_shared_data. vb2_gbb_header object may be accessed via the vb2_get_gbb function. Additionally, update functions in firmware/lib/region-init.c to read GBB data from flash, rather than using cparams passed in by depthcharge, which is slated for deprecation. BUG=b:124141368, chromium:954774 TEST=make clean && make runtests BRANCH=none Change-Id: I6e6218231299ce3a5b383663bc3480b20f929840 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1585500 Reviewed-on: https://chromium-review.googlesource.com/1627430 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: standardize on vb2_context identifiers in testsJoel Kitching2019-05-1710-541/+541
| | | | | | | | | | | | | | | | | Use `ctx` for global vb2_context variable, and `c` for argument to functions. This avoids shadowing the `ctx` identifier, which was recently disallowed by enabling -Wshadow in CL:1598721. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I9db97fd4945694e6f54abc5b0c04ed5533789300 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1616872 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Youcheng Syu <youcheng@chromium.org>
* vboot: deprecate v1 GoogleBinaryBlockHeader structJoel Kitching2019-05-1710-40/+33
| | | | | | | | | | | | | | | | | Deprecate internal usage of GoogleBinaryBlockHeader struct in favour of vb2_gbb_header struct. Keep the v1 struct around until we remove references in other repos. BUG=b:124141368, chromium:954774 TEST=make clean && make runtests BRANCH=none Change-Id: I396d2e624bd5dcac9c461cc86e8175e8f7692d26 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1583826 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: hide 2common.h from external APIJoel Kitching2019-05-172-2/+2
| | | | | | | | | | | | | | | | | | 2common.h contains code which should be internal to vboot. Most notably of which is 2struct.h, which contains the vb2_shared_data data structure. BUG=b:124141368, chromium:956474 TEST=make clean && make runtests BRANCH=none Cq-Depend: chromium:1587981, chromium:1599567, chromium:1610164 Change-Id: I712f51915bb9b0b03dce558e2b843eb83662f434 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1583819 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: update display init to use vboot2 codeJoel Kitching2019-05-165-27/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per go/vboot2-oprom-cleanup, use vboot2 SD flag DISPLAY_AVAILABLE, instead of the old vboot1 flags OPROM_MATTERS and OPROM_LOADED. Remove instances of "OPROM" and update with correct nomenclature. Update code and tests for EC software sync and diagnostic menu to use vboot2 display init model. OPROM_MATTERS and OPROM_LOADED are now deprecated, and will be removed when no references remain in depthcharge and coreboot. Deprecate VBERROR_DISPLAY_INIT_MISMATCH (previously OPROM_MISMATCH) and return VBERROR_REBOOT_REQUIRED directly when needed. BUG=b:124141368, b:124192753, chromium:948529 TEST=Build image for eve, force EC update, check that the "critical update" screen shows TEST=make clean && make runtests BRANCH=none Change-Id: I889872f886230f8559d5cce09d0de194da3fcc38 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1605641 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* firmware: replace recovery mode flag with physical presenceMatt Delco2019-05-161-88/+335
| | | | | | | | | | | | | | | | | | | | | vboot can query the physical presence flag instead of the recovery mode flag. In general, the physical presence flag will map to the recovery mode button if a board has it, and otherwise will map to the physical presence button (usually the power button). Cq-Depend: chromium:1580454 BUG=b:129471321 BRANCH=None TEST=make runtests. Built firmware and slashed on sarien. Verified that displayed text references power button and that pressing power button initiates dev mode (vs. powering off the system). Change-Id: I22f29de192da67b8eece27cbdd5aa64e97717bfc Signed-off-by: Matt Delco <delco@google.com> Reviewed-on: https://chromium-review.googlesource.com/1580472 Commit-Ready: Matt Delco <delco@chromium.org> Tested-by: Matt Delco <delco@chromium.org> Reviewed-by: Matt Delco <delco@chromium.org>
* vboot: deprecate Alt OS codeJoel Kitching2019-05-141-2/+0
| | | | | | | | | | | | | | BUG=b:124141368, b:131663912 TEST=make clean && make runtests BRANCH=none Change-Id: I6aae5683b8306eede4388ff5ed6665e7769756dc Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1588026 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Makefile: Enable more warnings for host utilities / testsJulius Werner2019-05-1427-78/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a bunch of more warnings that are already enabled in coreboot and thus already enabled for firmware builds anyway (because coreboot just passes its CFLAGS through). Enabling it in the vboot Makefile means they also apply to host utilities and tests, which sounds desirable for consistency. Fix enough of the cruft and bad coding practices that accumulated over the years of not having warnings enabled to get it to build again (this includes making functions static, removing dead code, cleaning up prototypes, etc.). Also remove -fno-strict-aliasing from the x86 firmware build options, because it's not clear why it's there (coreboot isn't doing this, so presumably it's not needed). BRANCH=None BUG=None TEST=make runtests Change-Id: Ie4a42083c4770a4eca133b22725be9ba85b24184 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1598721 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
* Remove code for displaying screen from GBBDaisuke Nojiri2019-05-0716-398/+2
| | | | | | | | | | | | | | | | | | | This patch removes the code displaying vboot screens using bitmap and layout data stored in GBB. bmpblk_utility, and futility support for BmpBlock is also removed. BUG=chromium:622501,chrome-os-partner:54619,b:124141368 BRANCH=none CQ-DEPEND=CL:373123 TEST=Verified screens on eve && emerge-eve chromeos-bootimage && make runtests Change-Id: I1a8dd8ff0162965e81df121d5a87ea64310a0854 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/367882 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: update vb2_misc_tests to use VB2_WORKBUF_ALIGNJoel Kitching2019-05-071-3/+5
| | | | | | | | | | | | | | | | | | If VB2_WORKBUF_ALIGN was set to any value other than 16, this test would fail. The test should not be dependent upon a specific alignment, but rather account for this variable. BUG=None TEST=make clean && make runtests BRANCH=none Change-Id: Iaba095eba7a852bc2eb9711bf122a23c34cb66c3 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1588028 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* vboot: implement DISPLAY_INIT context and SD flagJoel Kitching2019-05-031-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of go/vboot2-cleanup-oprom, introduce new context flag DISPLAY_INIT. The equivalent shared data flag DISPLAY_AVAILABLE is also introduced for downstream vboot to read. The context flag serves the dual purpose of: (1) the vboot caller (coreboot) telling vboot that "display will be initialized regardless", for cases when a mainboard/SoC cannot disable its display initialization code (see coreboot Kconfig VBOOT_MUST_REQUEST_DISPLAY, previously VBOOT_OPROM_MATTERS). (2) vboot telling the vboot caller (coreboot) that "display initialization should occur" for cases when vboot needs display enabled on this boot. BUG=b:124141368, chromium:948529 TEST=make clean && make runtests BRANCH=none Change-Id: If18bedf99c0f6e366c12d043377edb7bcdb35fdf Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1564232 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: remove workbuf alloc and free codeJoel Kitching2019-04-172-4/+10
| | | | | | | | | | | | | | | | Workbuf should be allocated and free'd by vboot caller. BUG=b:124141368, chromium:951692 TEST=make clean && make runtests CQ-DEPEND=CL:1563872 BRANCH=none Change-Id: Ibaa70f62c660d46cc083a5e55a73b961eb813649 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1560716 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: add magic and version to vb2_shared_dataJoel Kitching2019-04-151-0/+36
| | | | | | | | | | | | | | | | | | | | In order for vb2_shared_data to cross application boundaries, it needs magic and version fields. These can be initialized in vb2_init_context, which is called implicitly via vb2api_fw_phase1 and vb2api_fail. On re-init, check fields for validity. BUG=b:124141368, b:124192753 TEST=make clean && make runtests BRANCH=none Change-Id: I90005833836f13f60813bdf82f0e4dbb8d9afecd Reviewed-on: https://chromium-review.googlesource.com/1521406 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* Enable launching diagnostics from OS broken screenstabilize-12088.BMathew King2019-04-131-6/+35
| | | | | | | | | | | | | | | | | If firmware diagnostics is enabled allow the user to lauch diagnostics from the OS broken screen. Currently diagnostics can only be launched from the recovery screen. BUG=b:130244249 TEST=Tested on arcada device make runmisctests BRANCH=none Change-Id: Ic6946338605599ea7411b5658acb2c6fc960a782 Signed-off-by: Mathew King <mathewk@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1564448 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Julius Werner <jwerner@chromium.org>