Wim Vervoorn has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Updated security document ......................................................................
Documentation/vendorcode/eltan: Updated security document
The security document has been updated to reflect the current state of the coreboot implementation.
More detail has been added and the change to the public vboot API is documented.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com --- M Documentation/vendorcode/eltan/security.md 1 file changed, 109 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/38591/1
diff --git a/Documentation/vendorcode/eltan/security.md b/Documentation/vendorcode/eltan/security.md index 04537df..79c0896 100644 --- a/Documentation/vendorcode/eltan/security.md +++ b/Documentation/vendorcode/eltan/security.md @@ -1,38 +1,125 @@ # Eltan Security
-## Security This code enables measured boot and verified boot support. -Verified boot is available in coreboot, but based on ChromeOS. This vendorcode -uses a small encryption library and leave much more space in flash for the -payload. +Verified boot is available in coreboot, but based on ChromeOS. This vendorcode security +solution is intended to be used for system without ChromeOS support. + +This solution allows implementing verified boot support for systems that do not contain a TPM.
## Hashing Library -The library suppports SHA-1, SHA-256 and SHA-512. The required routines of -`3rdparty/vboot/firmware/2lib` are used. +The API functions of `3rdparty/vboot/firmware` are used. + +The function `cb_sha_little_endian()` uses `vb2_digest_buffer()` to provide a little endian +digest.
## Measured boot -measured boot support will use TPM2 device if available. The items specified -in `mb_log_list[]` will be measured. +Measured boot support requires a TPM2 device. + +The items specified in `mb_log_list[]` and `*_verify_list[]` the will be measured. + +The `mb_log_list[]` should only contain items that are not contained in one of the verify_lists +below (except for the `bootblock_verify_list[]`). + +The list can contain the next items: `config`, `revision`, `cmos_layout.bin`. +`oemmanifest.bin` should be added when Verified boot is enabled.
## Verified boot -verified boot support will use TPM2 device if available. The items specified -in the next table will be verified: -* `bootblock_verify_list[]` -* `verify_item_t romstage_verify_list[]` -* `ram_stage_additional_list[]` -* `ramstage_verify_list[]` -* `payload_verify_list[]` -* `oprom_verify_list[]` +verified boot support will use the OEM manifest to verify the items. + +The verification process is controlled using the next verify lists: +* `bootblock_verify_list[]` (will not be measured, verified in bootblock) +* `romstage_verify_list[]` (verified in early romstage) +* `postcar_verify_list[]` (verified in just before postcar loading) +* `ramstage_verify_list[]` (verified in just before ramstage loading) +* `payload_verify_list[]` (verified in just before payload loading) +* `oprom_verify_list[]` (verified before option rom execution) + +The verify_list contains a `related_items` member. This can point to an additional +`verify_list` which will be verified before the specified item is verified. As an example the +`ramstage_verify_list[]` can point to the `ram_stage_additional_list[]` that contains the items +used by ramstage. + +In this example loading the ramstage will trigger verification of the items in the +`ram_stage_additional_list[]`. This list can contain items like the vbt file and the dsdt.asl +file used by the ramstage. + +## Creating private and public keys +Create private key in RSA2048 format: +`openssl genrsa -F4 -out <private_key_file> 2048` + +Create public key using private key: +`futility --vb1 create <private_key_file> <public_key_file_without_extension>` + +The public key will be included into coreboot and used for verified boot only.
## Enabling support - -* Measured boot can be enabled using **CONFIG_MBOOT** +To enable measured boot support: +* Enabled **CONFIG_VENDORCODE_ELTAN_MBOOT** * Create mb_log_list table with list of item to measure + +To enable verified boot support: +* Enable **CONFIG_VENDORCODE_ELTAN_VBOOT** * Create tables bootblock_verify_list[], verify_item_t romstage_verify_list[], - ram_stage_additional_list[], ramstage_verify_list[], payload_verify_list[], - oprom_verify_list[] -* Verified boot can be enabled using **CONFIG_VERIFIED_BOOT** -* Added Kconfig values for verbose console output + postcar_verify_list[], ramstage_verify_list[], payload_verify_list[], oprom_verify_list[] +* **CONFIG_VENDORCODE_ELTAN_VBOOT_KEY_FILE** must point to location of the public key created + with futility + +## Creating signed binary + +During build of coreboot binary an empty oemmanifest.bin is added to the binary. + +This binary must be replaced by a correct (signed) binary when +**CONFIG_VENDORCODE_ELTAN_VBOOT** is enabled + +The oemmanifest.bin contains the SHA-256 (or SHA-512) hashes of all the different parts +contained in verify_lists. + +When **CONFIG_VENDORCODE_ELTAN_VBOOT_SIGNED_MANIFEST** is enabled the manifest should be signed +and the signature should appended to the manifest. + +Please make sure the public key is in the RO part of the coreboot image. The OEM manifest +should be in the RW part of the coreboot image. + +### Hashing + +The oemmanifest.bin contains the hashes of different binaries parts of the binary e.g.: +bootblock, romstage, postcar, ramstage, fsp etc. + +The total number of items must match `CONFIG_VENDORCODE_ELTAN_OEM_MANIFEST_ITEMS`. + +For every part the SHA (SHA-256) must be calculated: +First extract the binary from the coreboot image using: +`cbfstool <coreboot_file_name> extract -n <cbfs_name> -f <item_binary_file_name>` +followed by: +`openssl dgst -sha256 -binary -out <hash_file_name> <item_binary_file_name>` + +Replace -sha256 with -sha512 when `CONFIG_VENDORCODE_ELTAN_VBOOT_USE_SHA512` is enabled. + +All the hashes must be combined to a hash binary. The hashes need to be placed in the same +order as defined by the `HASH_IDX_XXX` values. + +### Signing + +The oemmanifest, needs to be signed when `CONFIG_VENDORCODE_ELTAN_VBOOT_SIGNED_MANIFEST` is +enabled. + +This can be done with the next command: +`openssl dgst -sign <private_key_file_name> -sha256 -out <signature_binary> <hash_binary>` + +The oemmanifest.bin can be created by adding the signature_binary to the hash_binary: +`cat <hash_binary> <signature_binary' >hash_table.bin` + +When signing is disabled the hash binary can be copied to `hash_table.bin` + +## Create binary +The oemmanifest.bin must be replaced in the coreboot binary by the generated hash_table.bin. + +To replace the binary: +Remove using: +`cbfstool <coreboot_file_name> remove -n oemmanifest.bin` +Then add the new image using: +`cbfstool coreboot.bin add -f <hash_table_file_name> -n oemmanifest.bin -t raw ` +`-b <CONFIG_VENDORCODE_ELTAN_OEM_MANIFEST_LOC>`
## Debugging
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Updated security document ......................................................................
Patch Set 1:
(4 comments)
https://review.coreboot.org/c/coreboot/+/38591/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38591/1//COMMIT_MSG@7 PS1, Line 7: Updated Update
https://review.coreboot.org/c/coreboot/+/38591/1//COMMIT_MSG@9 PS1, Line 9: has been is
https://review.coreboot.org/c/coreboot/+/38591/1/Documentation/vendorcode/el... File Documentation/vendorcode/eltan/security.md:
https://review.coreboot.org/c/coreboot/+/38591/1/Documentation/vendorcode/el... PS1, Line 85: oemmanifest.bin Mark up with ``?
https://review.coreboot.org/c/coreboot/+/38591/1/Documentation/vendorcode/el... PS1, Line 109: oemmanifest.bin Ditto.
Hello Frans Hendriks, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38591
to look at the new patch set (#2).
Change subject: Documentation/vendorcode/eltan: Updated security document ......................................................................
Documentation/vendorcode/eltan: Updated security document
The security document has been updated to reflect the current state of the coreboot implementation.
More detail has been added and the change to the public vboot API is documented.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com --- M Documentation/vendorcode/eltan/security.md 1 file changed, 109 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/38591/2
Hello Frans Hendriks, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38591
to look at the new patch set (#3).
Change subject: Documentation/vendorcode/eltan: Updated security document ......................................................................
Documentation/vendorcode/eltan: Updated security document
Update the security document to reflect the current state of the coreboot implementation.
Added more detail and documented the change to the public vboot API.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com --- M Documentation/vendorcode/eltan/security.md 1 file changed, 109 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/38591/3
Wim Vervoorn has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Updated security document ......................................................................
Patch Set 3:
(4 comments)
https://review.coreboot.org/c/coreboot/+/38591/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38591/1//COMMIT_MSG@7 PS1, Line 7: Updated
Update
Done
https://review.coreboot.org/c/coreboot/+/38591/1//COMMIT_MSG@9 PS1, Line 9: has been
is
Done
https://review.coreboot.org/c/coreboot/+/38591/1/Documentation/vendorcode/el... File Documentation/vendorcode/eltan/security.md:
https://review.coreboot.org/c/coreboot/+/38591/1/Documentation/vendorcode/el... PS1, Line 85: oemmanifest.bin
Mark up with ``?
Done
https://review.coreboot.org/c/coreboot/+/38591/1/Documentation/vendorcode/el... PS1, Line 109: oemmanifest.bin
Ditto.
Done
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Updated security document ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38591/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38591/3//COMMIT_MSG@7 PS3, Line 7: Updated Update
Hello Frans Hendriks, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38591
to look at the new patch set (#4).
Change subject: Documentation/vendorcode/eltan: Updated security document ......................................................................
Documentation/vendorcode/eltan: Updated security document
Update the security document to reflect the current state of the coreboot implementation.
Added more detail and documented the change to the public vboot API.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com --- M Documentation/vendorcode/eltan/security.md 1 file changed, 106 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/38591/4
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Updated security document ......................................................................
Patch Set 4:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38591/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38591/4//COMMIT_MSG@7 PS4, Line 7: Updated Update
https://review.coreboot.org/c/coreboot/+/38591/4//COMMIT_MSG@12 PS4, Line 12: Added Add
Hello Frans Hendriks, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38591
to look at the new patch set (#5).
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Documentation/vendorcode/eltan: Update security document
Update the security document to reflect the current state of the coreboot implementation.
Add more detail and document the change to the public vboot API.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com --- M Documentation/vendorcode/eltan/security.md 1 file changed, 106 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/38591/5
Wim Vervoorn has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 5:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38591/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38591/4//COMMIT_MSG@7 PS4, Line 7: Updated
Update
Done
https://review.coreboot.org/c/coreboot/+/38591/4//COMMIT_MSG@12 PS4, Line 12: Added
Add
Done
Hello Frans Hendriks, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38591
to look at the new patch set (#6).
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Documentation/vendorcode/eltan: Update security document
Update the security document to reflect the current state of the coreboot implementation.
Add more detail and document the change to the public vboot API.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com --- M Documentation/vendorcode/eltan/security.md 1 file changed, 106 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/38591/6
Wim Vervoorn has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38591/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38591/3//COMMIT_MSG@7 PS3, Line 7: Updated
Update
Done
Hello Frans Hendriks, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38591
to look at the new patch set (#7).
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Documentation/vendorcode/eltan: Update security document
Update the security document to reflect the current state of the coreboot implementation.
Add more detail and document the change to the public vboot API.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com --- M Documentation/vendorcode/eltan/security.md 1 file changed, 98 insertions(+), 23 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/38591/7
Frans Hendriks has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 7:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38591/7/Documentation/vendorcode/el... File Documentation/vendorcode/eltan/security.md:
https://review.coreboot.org/c/coreboot/+/38591/7/Documentation/vendorcode/el... PS7, Line 34: The verify_list contains a `related_items` member. This can point to an additional `verify_list` space at EOL
https://review.coreboot.org/c/coreboot/+/38591/7/Documentation/vendorcode/el... PS7, Line 39: In this example loading the ramstage will trigger verification of the items in the Space at EOL
Wim Vervoorn has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 7:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38591/7/Documentation/vendorcode/el... File Documentation/vendorcode/eltan/security.md:
https://review.coreboot.org/c/coreboot/+/38591/7/Documentation/vendorcode/el... PS7, Line 34: The verify_list contains a `related_items` member. This can point to an additional `verify_list`
space at EOL
Done
https://review.coreboot.org/c/coreboot/+/38591/7/Documentation/vendorcode/el... PS7, Line 39: In this example loading the ramstage will trigger verification of the items in the
Space at EOL
Done
Frans Hendriks has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38591/7/Documentation/vendorcode/el... File Documentation/vendorcode/eltan/security.md:
https://review.coreboot.org/c/coreboot/+/38591/7/Documentation/vendorcode/el... PS7, Line 99: The signed manifest can be created by adding the signature_binary to the hash_binary: Suggest: 'adding the signature to the manifest'
Hello Frans Hendriks, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38591
to look at the new patch set (#8).
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Documentation/vendorcode/eltan: Update security document
Update the security document to reflect the current state of the coreboot implementation.
Add more detail and document the change to the public vboot API.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com --- M Documentation/vendorcode/eltan/security.md 1 file changed, 98 insertions(+), 23 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/38591/8
Wim Vervoorn has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38591/7/Documentation/vendorcode/el... File Documentation/vendorcode/eltan/security.md:
https://review.coreboot.org/c/coreboot/+/38591/7/Documentation/vendorcode/el... PS7, Line 99: The signed manifest can be created by adding the signature_binary to the hash_binary:
Suggest: 'adding the signature to the manifest'
Done
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 8: Code-Review+1
Hello Frans Hendriks, Paul Menzel, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38591
to look at the new patch set (#9).
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Documentation/vendorcode/eltan: Update security document
Update the security document to reflect the current state of the coreboot implementation.
Add more detail and document the change to the public vboot API.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com --- M Documentation/vendorcode/eltan/security.md 1 file changed, 98 insertions(+), 23 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/38591/9
Frans Hendriks has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 9: Code-Review+2
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 9:
(9 comments)
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... File Documentation/vendorcode/eltan/security.md:
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 15: the drop "the"?
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 20: next following
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 21: added to the list? or to CBFS?
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 24: v V
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 26: next following
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 34: The "A"?
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 35: specified item I understand the rest of the text that this means "list itself", or is it really for each item in a list?
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 59: point to location of the public key maybe "point to the public key file"?
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 96: next following
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 9:
forgot to say: many of my comments are just minor issues, so feel free to discard any comment you don't want to act on.
Hello Frans Hendriks, Paul Menzel, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38591
to look at the new patch set (#10).
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Documentation/vendorcode/eltan: Update security document
Update the security document to reflect the current state of the coreboot implementation.
Add more detail and document the change to the public vboot API.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com --- M Documentation/vendorcode/eltan/security.md 1 file changed, 96 insertions(+), 23 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/38591/10
Wim Vervoorn has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 10:
(9 comments)
Patch Set 9:
forgot to say: many of my comments are just minor issues, so feel free to discard any comment you don't want to act on.
Thanks for your remarks. I adressed the issues and created some clarifications that I hope will make it easier to understand.
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... File Documentation/vendorcode/eltan/security.md:
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 15: the
drop "the"?
Done
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 20: next
following
Done
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 21: added
to the list? or to CBFS?
Done
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 24: v
V
Done
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 26: next
following
Done
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 34: The
"A"?
Done
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 35: specified item
I understand the rest of the text that this means "list itself", or is it really for each item in a […]
Done
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 59: point to location of the public key
maybe "point to the public key file"?
Done
https://review.coreboot.org/c/coreboot/+/38591/9/Documentation/vendorcode/el... PS9, Line 96: next
following
Done
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 10: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Documentation/vendorcode/eltan: Update security document
Update the security document to reflect the current state of the coreboot implementation.
Add more detail and document the change to the public vboot API.
BUG=N/A TEST=build
Change-Id: I228d0faae0efde70039680a981fea9a436d2384f Signed-off-by: Wim Vervoorn wvervoorn@eltan.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/38591 Reviewed-by: Patrick Georgi pgeorgi@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M Documentation/vendorcode/eltan/security.md 1 file changed, 96 insertions(+), 23 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/Documentation/vendorcode/eltan/security.md b/Documentation/vendorcode/eltan/security.md index 04537df..9dd47c0 100644 --- a/Documentation/vendorcode/eltan/security.md +++ b/Documentation/vendorcode/eltan/security.md @@ -1,38 +1,111 @@ # Eltan Security
-## Security This code enables measured boot and verified boot support. -Verified boot is available in coreboot, but based on ChromeOS. This vendorcode -uses a small encryption library and leave much more space in flash for the -payload. +Verified boot is available in coreboot, but based on ChromeOS. This vendorcode security +solution is intended to be used for system without ChromeOS support. + +This solution allows implementing verified boot support for systems that do not contain a TPM.
## Hashing Library -The library suppports SHA-1, SHA-256 and SHA-512. The required routines of -`3rdparty/vboot/firmware/2lib` are used. +The API functions of `3rdparty/vboot/firmware` are used.
## Measured boot -measured boot support will use TPM2 device if available. The items specified -in `mb_log_list[]` will be measured. +Measured boot support requires a TPM2 device. + +The items specified in `mb_log_list[]` and `*_verify_list[]` will be measured. + +The `mb_log_list[]` should only contain items that are not contained in one of the verify_lists +below (except for the `bootblock_verify_list[]`). + +The list can contain the following items: `config`, `revision`, `cmos_layout.bin`. +`oemmanifest.bin` should be added to the list when Verified boot is enabled.
## Verified boot -verified boot support will use TPM2 device if available. The items specified -in the next table will be verified: -* `bootblock_verify_list[]` -* `verify_item_t romstage_verify_list[]` -* `ram_stage_additional_list[]` -* `ramstage_verify_list[]` -* `payload_verify_list[]` -* `oprom_verify_list[]` +Verified boot support will use the OEM manifest to verify the items. + +The verification process is controlled using the following verify lists: +* `bootblock_verify_list[]` (will not be measured, verified in bootblock) +* `romstage_verify_list[]` (verified in early romstage) +* `postcar_verify_list[]` (verified in just before postcar loading) +* `ramstage_verify_list[]` (verified in just before ramstage loading) +* `payload_verify_list[]` (verified in just before payload loading) +* `oprom_verify_list[]` (verified before option rom execution) + +A verify_list entry contains a `related_items` member. This can point to an additional `verify_list` +which will be verified before the specified item is verified. As an example the `grub` entry in +`payload_verify_list[]` can point to the `grub_additional_list[]` that contains the items used by +the grub payload and the `seabios` entry in `payload_verify_list[]` can point to the +`seabios_additional_list[]` that contains the items used by the seabios payload. By doing this the +entries that are verified (and measured) depend on the payload selected at runtime. + +## Creating private and public keys +Create private key in RSA2048 format: `openssl genrsa -F4 -out <private_key_file> 2048` + +Create public key using private key: +`futility --vb1 create <private_key_file> <public_key_file_without_extension>` + +The public key will be included into coreboot and used for verified boot only.
## Enabling support +To enable measured boot support: +* Enabled *VENDORCODE_ELTAN_MBOOT* +* Create `mb_log_list` table with list of items to measure
-* Measured boot can be enabled using **CONFIG_MBOOT** -* Create mb_log_list table with list of item to measure -* Create tables bootblock_verify_list[], verify_item_t romstage_verify_list[], - ram_stage_additional_list[], ramstage_verify_list[], payload_verify_list[], - oprom_verify_list[] -* Verified boot can be enabled using **CONFIG_VERIFIED_BOOT** -* Added Kconfig values for verbose console output +To enable verified boot support: +* Enable *VENDORCODE_ELTAN_VBOOT* +* Create the verify lists `*_verify_list[]` +* *VENDORCODE_ELTAN_VBOOT_KEY_FILE* must point to location of the public key file created with `futility` + +## Creating signed binary + +During build of coreboot binary an empty `oemmanifest.bin` is added to the binary. + +This binary must be replaced by a correct (signed) binary when *VENDORCODE_ELTAN_VBOOT* is enabled + +The `oemmanifest.bin` file contains the SHA-256 (or SHA-512) hashes of all the different parts +contained in verify_lists. + +When *VENDORCODE_ELTAN_VBOOT_SIGNED_MANIFEST* is enabled the manifest should be signed and the +signature should appended to the manifest. + +Please make sure the public key is in the RO part of the coreboot image. The `oemmanifest.bin` file +should be in the RW part of the coreboot image. + +### Hashing + +The `oemmanifest.bin` file contains the hashes of different binaries parts of the binary e.g.: +bootblock, romstage, postcar, ramstage, fsp etc. + +The total number of items must match `VENDORCODE_ELTAN_OEM_MANIFEST_ITEMS`. + +For every part the SHA (SHA-256) must be calculated. First extract the binary from the coreboot +image using: `cbfstool <coreboot_file_name> extract -n <cbfs_name> -f <item_binary_file_name>` +followed by: `openssl dgst -sha256 -binary -out <hash_file_name> <item_binary_file_name>` + +Replace -sha256 with -sha512 when `VENDORCODE_ELTAN_VBOOT_USE_SHA512` is enabled. + +All the hashes must be combined to a hash binary. The hashes need to be placed in the same order as +defined by the `HASH_IDX_XXX` values. + +### Signing + +The oemmanifest needs to be signed when `VENDORCODE_ELTAN_VBOOT_SIGNED_MANIFEST` is enabled. + +This can be done with the following command: +`openssl dgst -sign <private_key_file_name> -sha256 -out <signature_binary> <hash_binary>` + +The signed manifest can be created by adding the signature to the manifest: +`cat <hash_binary> <signature_binary> >hash_table.bin` + +## Create binary +The `oemmanifest.bin` file must be replaced in the coreboot binary by the generated +`hash_table.bin`. + +To replace the binary: Remove using: +`cbfstool <coreboot_file_name> remove -n oemmanifest.bin` +Then add the new image using: +`cbfstool coreboot.bin add -f <hash_table_file_name> -n oemmanifest.bin -t raw ` +`-b <CONFIG_VENDORCODE_ELTAN_OEM_MANIFEST_LOC>`
## Debugging
9elements QA has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38591 )
Change subject: Documentation/vendorcode/eltan: Update security document ......................................................................
Patch Set 11:
Automatic boot test returned (PASS/FAIL/TOTAL): 3/0/3 Emulation targets: EMULATION_QEMU_X86_Q35 using payload TianoCore : SUCCESS : https://lava.9esec.io/r/346 EMULATION_QEMU_X86_Q35 using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/345 EMULATION_QEMU_X86_I440FX using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/344
Please note: This test is under development and might not be accurate at all!