summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* rsa_test: use whatever primality test existsstabilize-quickfix-13597.30.B-cr50_stabstabilize-ambassador-13597.79.B-cr50_stabstabilize-13605.B-cr50_stabstabilize-13597.97.B-cr50_stabstabilize-13597.95.B-cr50_stabstabilize-13597.94.B-cr50_stabstabilize-13597.90.B-cr50_stabstabilize-13597.85.B-cr50_stabstabilize-13597.84.B-cr50_stabstabilize-13597.71.B-cr50_stabstabilize-13597.70.B-cr50_stabstabilize-13597.69.B-cr50_stabstabilize-13597.68.B-cr50_stabstabilize-13597.67.B-cr50_stabstabilize-13597.66.B-cr50_stabstabilize-13597.105.B-cr50_stabstabilize-13597.103.B-cr50_stabstabilize-13591.B-cr50_stabrelease-R88-13597.B-cr50_stabMary Ruthven2020-11-031-1/+5
| | | | | | | | | | | | | | | | Python may use different rsa versions inside and outside of the chroot. miller_rabin_primality_testing may or may not exist. For tpmtest randomized_primality_testing and miller_rabin_primality_testing are interchangeable. Use whatever primality test rma.prime has. BUG=b:172081851 TEST=make tpmtest ; run inside and outside of the chroot Change-Id: Iabd9755f0a264070ff321bde045a87f7397f7062 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2511432 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prepare to release 0.{5,6}.8Mary Ruthven2020-10-302-2/+2
| | | | | | | | | | BUG=b:172066114 TEST=none Change-Id: I553a06c52da3468358357fa08596e01238ed86b3 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2510463 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Revert "cr50: debounce successive TPM reset pulses"Mary Ruthven2020-10-291-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4805196e894a73a2a1285f1cd622d160ad248f77. Reason for revert: We aren't planning on landing this in the branch. Reduce the difference between TOT and the branch by reverting this. BUG=b:164130916 TEST=run ccd open with TOT image Original change's description: > cr50: debounce successive TPM reset pulses > > Some platforms generate more than one pulse when resetting, many Intel > SOCs generate two pulses, some other chips could go even higher. > > TPM reset on Cr50 is processed asynchronously, repetitive pulses > result in multiple reset processing cycles.In case pulses are coming > too soon one after another this could cause some race conditions. > > Let's ignore repetitive reset pulses unless there has been an attempt > by the host to read a register (which is usually the very first action > of the AP when booting up). > > BRANCH=cr50, cr50-mp > BUG=none > TEST=observed that only one reset is happening on an Octopus device, > while there are two pulses present on the PLT_RST_L line. > > Verified proper reboot multiple times in a row. > > Change-Id: Ie1b124d41be0388bd8e12d0084827782de62cfa0 > Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1755059 > Reviewed-by: Mary Ruthven <mruthven@chromium.org> Bug: none Change-Id: Ifbe8afea87c522c94cf9ab73cca8a1489ec3956b Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2485927
* tpm_test: fix python3 includestabilize-rust-13562.B-cr50_stabMary Ruthven2020-10-271-3/+3
| | | | | | | | | | BUG=b:171727921 TEST=make Change-Id: I401c35eec2c4c7fe783a348cbc42f0687868acec Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2499922 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* u2f: Switch FIPS call back to DCRYPTO for 5.7/6.7stabilize-rust-13555.B-cr50_stabstabilize-rust-13514.B-cr50_stabstabilize-13532.B-cr50_stabstabilize-13525.B-cr50_stabstabilize-13505.85.B-cr50_stabstabilize-13505.73.B-cr50_stabstabilize-13505.65.B-cr50_stabstabilize-13505.63.B-cr50_stabstabilize-13505.111.B-cr50_stabstabilize-13505.100.B-cr50_stabstabilize-13505.1.B-cr50_stabstabilize-13482.B-cr50_stabrelease-R87-13505.B-cr50_stabYicheng Li2020-09-181-8/+12
| | | | | | | | | | | | | | | | | There is a fips_rand_bytes() call in u2f. Since 5.7/6.7 will be released without FIPS support (and the plan is to move u2f to FIPS later), change that call back to DCRYPTO_ladder_random. This does not affect the canonical (non-versioned) u2f. This only affects the generation of versioned KHs for WebAuthn purposes. BUG=none TEST=make -j BOARD=cr50 Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: I78142efd1b3a8339cce44adc4d3f8e26151b30ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2419178 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* cr50: prepare to release 0.{5,6}.7Mary Ruthven2020-09-172-2/+2
| | | | | | | | | | BUG=b:168502792 TEST=none Change-Id: I4151120813f37c2427747ade01fb8a43dae9518a Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2416951 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* util: modify getversion to use proper timestamps.Vadim Bendebury2020-09-141-9/+18
| | | | | | | | | | | | | | | | | | | | | | The getversion.sh utility even when compiling the version string based on the state of several git trees always uses the ec tree for timestamps, be it the latest modified file if the tree is 'dirty' or the last commit time if the tree is clean. It should be using the latest time from all of the trees included in the build. BUG=none TEST=verified operation for Cr50 with both main and secondary trees clean and dirty Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I72dc1d49ec997c789697b15f7d79fa9f4a8f8adc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2393101 Reviewed-by: Craig Hesling <hesling@chromium.org> (cherry picked from commit 5ab4bd06261abf1204638c8ef877a9adb041d6e8) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2410700 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* u2f: Remove legacy KH supportYicheng Li2020-08-263-121/+5
| | | | | | | | | | | | | | | U2f key handles generated before January 2019 do not mix in user secrets. These legacy key handles should no longer be in use since it's been > 10 releases. Another change will remove this concept on u2fd side. BUG=b:165018526 TEST=build cr50 Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: I57a6a77e512591f14ef8c818ec6027a6ae21189d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2358425 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Reland "u2f: Append hmac of auth time secret to versioned KH"stabilize-quickfix-13421.74.B-cr50_stabstabilize-quickfix-13421.100.B-cr50_stabstabilize-13421.99.B-cr50_stabstabilize-13421.96.B-cr50_stabstabilize-13421.89.B-cr50_stabstabilize-13421.80.B-cr50_stabstabilize-13421.73.B-cr50_stabstabilize-13421.53.B-cr50_stabstabilize-13421.42.B-cr50_stabstabilize-13421.103.B-cr50_stabstabilize-13421.102.B-cr50_stabrelease-R86-13421.B-cr50_stabfirmware-zork-13421.B-cr50_stabYicheng Li2020-08-184-35/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of d2627d12bb21308f49a72cadaf47a0a86730a960 with one modification: The versioned key handle header (the old "key handle" concept) is now used in the derivation of authorization_hmac. This is to tie the key handle to the authorization secret. Original change's description: > u2f: Append hmac of auth time secret to versioned KH > > When generating versioned KHs, u2fd should send a public derivative > (sha256) of the user's auth time secret to cr50. Cr50 derives an > hmac of it and appends this authorization_hmac to the KH. > > When signing versioned KHs, u2fd may supply the unhashed auth time > secret. Cr50 will check the authorization_hmac if no power button press. > If the reconstructed hmac matches authorization_hmac, power button press > is waived. > > Currently for v1, we will just prepare the authorization_hmac but not > enforce it. This is because fingerprint and PIN are unable to unlock > the same secret. > > While we waive power button press for v1, we can enforce > authorization_hmac whenever auth-time secrets is ready. > > BUG=b:144861739 > TEST=- Use a known 32-byte "auth-time secret" > - Compute the sha256 of the auth-time secret (this is public) > - u2f_generate with the computed "authTimeSecretHash" > - Add code to u2f_sign command handler such that cr50 computes > the sha256 of the supplied auth-time secret at u2f_sign time > and require power button press if the hmac doesn't match. > - u2f_sign with the true auth-time secret -> observe in logging > that hmac matches, and no power button press required. > - u2f_sign with a wrong auth-time secret -> observe in logging > that hmac doesn't match, and power button press is required > for signing. > > Cq-Depend: chromium:2321731 > Change-Id: Ib9ae913667f8178ac7a4790f861d7dada972c4a0 > Signed-off-by: Yicheng Li <yichengli@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317047 > Reviewed-by: Andrey Pronin <apronin@chromium.org> > Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> BUG=b:144861739 TEST=See original CL's TEST above Cq-Depend: chromium:2327865 Change-Id: Ia1b0b4a585ec604398cfa730354ae1a91e7bc00b Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2355177 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* fips: move FIPS power-up test completion to PMU_PWRDN_SCRATCH22Vadim Sukhomlinov2020-08-063-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | Status of completion of power-up tests was in long life register which survives reboots and even firmware upgrades, which is not an intended behavior. Moving status to PWRDN register makes it reset on graceful reboots and firmware upgrades, but avoid running tests on wake from deep sleep. This switch also enables use of multiple bits to indicate status of tests, which makes it more fault tolerant. BUG=b:138577491 TEST=make BOARD=cr50, then deassert DIOM3 to trigger deep sleep FIPS power-on tests shouldn't run on wake. Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I098940e45afd5b5b9447b2780ff69372a922c03f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2330976 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* fips: prevent turning FIPS on (yet)Vadim Sukhomlinov2020-07-301-3/+13
| | | | | | | | | | | | | | | | | | | | | | Since FIPS-compliant U2F code is not yet ready, make sure that new devices won't switch to FIPS-approved by default when there are no U2F keys. This CL puts the logic that checks if the U2F seed exists and turns FIPS mode on when it doesn't under compile-time switch, and for now turns this switch off. As a result, FIPS mode is always off. BUG=b:138577491 TEST=make BOARD=cr50, then check FIPS mode in CCD Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I33b559c3f348f34115263fd3fedc8b7a2fbeab31 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2328113 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "u2f: Append hmac of auth time secret to versioned KH"Archie Pusaka2020-07-304-103/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit d2627d12bb21308f49a72cadaf47a0a86730a960. Reason for revert: Causing crbug.com/1111182 Original change's description: > u2f: Append hmac of auth time secret to versioned KH > > When generating versioned KHs, u2fd should send a public derivative > (sha256) of the user's auth time secret to cr50. Cr50 derives an > hmac of it and appends this authorization_hmac to the KH. > > When signing versioned KHs, u2fd may supply the unhashed auth time > secret. Cr50 will check the authorization_hmac if no power button press. > If the reconstructed hmac matches authorization_hmac, power button press > is waived. > > Currently for v1, we will just prepare the authorization_hmac but not > enforce it. This is because fingerprint and PIN are unable to unlock > the same secret. > > While we waive power button press for v1, we can enforce > authorization_hmac whenever auth-time secrets is ready. > > BUG=b:144861739 > TEST=- Use a known 32-byte "auth-time secret" > - Compute the sha256 of the auth-time secret (this is public) > - u2f_generate with the computed "authTimeSecretHash" > - Add code to u2f_sign command handler such that cr50 computes > the sha256 of the supplied auth-time secret at u2f_sign time > and require power button press if the hmac doesn't match. > - u2f_sign with the true auth-time secret -> observe in logging > that hmac matches, and no power button press required. > - u2f_sign with a wrong auth-time secret -> observe in logging > that hmac doesn't match, and power button press is required > for signing. > > Cq-Depend: chromium:2321731 > Change-Id: Ib9ae913667f8178ac7a4790f861d7dada972c4a0 > Signed-off-by: Yicheng Li <yichengli@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317047 > Reviewed-by: Andrey Pronin <apronin@chromium.org> > Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Bug: b:144861739 Cq-Depend: chromium:2327779 Exempt-From-Owner-Approval: Causing crbug.com/1111182 Change-Id: I8c8a594d148b92556b20a2753aa1007cf2c1676b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2327358 Tested-by: Archie Pusaka <apusaka@chromium.org> Reviewed-by: Yicheng Li <yichengli@chromium.org> Reviewed-by: Archie Pusaka <apusaka@chromium.org> Commit-Queue: Archie Pusaka <apusaka@chromium.org>
* u2f: Append hmac of auth time secret to versioned KHYicheng Li2020-07-294-34/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When generating versioned KHs, u2fd should send a public derivative (sha256) of the user's auth time secret to cr50. Cr50 derives an hmac of it and appends this authorization_hmac to the KH. When signing versioned KHs, u2fd may supply the unhashed auth time secret. Cr50 will check the authorization_hmac if no power button press. If the reconstructed hmac matches authorization_hmac, power button press is waived. Currently for v1, we will just prepare the authorization_hmac but not enforce it. This is because fingerprint and PIN are unable to unlock the same secret. While we waive power button press for v1, we can enforce authorization_hmac whenever auth-time secrets is ready. BUG=b:144861739 TEST=- Use a known 32-byte "auth-time secret" - Compute the sha256 of the auth-time secret (this is public) - u2f_generate with the computed "authTimeSecretHash" - Add code to u2f_sign command handler such that cr50 computes the sha256 of the supplied auth-time secret at u2f_sign time and require power button press if the hmac doesn't match. - u2f_sign with the true auth-time secret -> observe in logging that hmac matches, and no power button press required. - u2f_sign with a wrong auth-time secret -> observe in logging that hmac doesn't match, and power button press is required for signing. Cq-Depend: chromium:2321731 Change-Id: Ib9ae913667f8178ac7a4790f861d7dada972c4a0 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317047 Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* fips: move FIPS error injection under CR50_DEVVadim Sukhomlinov2020-07-291-7/+8
| | | | | | | | | | | | | | | | | | | Prevent access to FIPS CCD commands which can inject errors due to unclear security impact. Instead, made them available only in CR50_DEV builts. Same with vendor commands - moved them from CRYPTO_TEST to under CR50_DEV. BUG=b:138577491 TEST=help fips, fips sha/trng - ignored Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: Ic86db02f2c9c5abbea8f3f23ee56a5f5f570e177 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2321344 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* g build.mk: fix awk program bugVadim Bendebury2020-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | The recent modification of chip/g/build.mk introduced a bug where an awk script error is reported if the board name does not contain an underscore. It went unnoticed because it does not prevent make from reporting success and most boards do not care about the results of running of this awk script. This patch fixes the problem. BUG=none TEST=ran make for cr50 and hslt_d2c, observed proper modification of the manifest, verified that no script errors are reported any more. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I0981411ec7bc17e4473d4b33125f76b75983d974 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317059 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* signer: modify manifest tag field to include board nameVadim Bendebury2020-07-231-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | Personalization infrastructure expects the image header tag filed to be set to the board name in ASCII. This patch modifies the chip g makefile to paste the board name into the manifest, the signer copies the value into the image header. BUG=b:161498484 TEST=verified that the manifest is updated as expected: $ diff util/signer/ec_RW-manifest-dev.json /tmp/h1.signer.F2Pu6d 33c33 < "tag": "00000000000000000000000000000000000000000000000000000000", --- > "tag": "68736c74206432630000000000000000000000000000000000000000", and observed the personalizer test harness to retrieve the expected board name from the running image. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I9ecf009e21c2ab77b03c9de1ebb176197923e6e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2310850 Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* private-cr5X: add relevant git trees sha values to the version stringVadim Bendebury2020-07-231-9/+19
| | | | | | | | | | | | | | | Version strings of the boards built from the private directories should include git status information from all git trees used to build the images. BUG=none TEST=tried running 'BOARD=xyz ./util/getversion.sh' and verified that the expected git trees are added to the version string. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I5414a1de07171d37277ba508551a79ba84776ac6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2310777 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* cr50: prepare to release 0.{5,6}.6Mary Ruthven2020-07-222-2/+2
| | | | | | | | | | BUG=b:161755898 TEST=none Change-Id: Ic1e719addea733a3b8d198a771e0f038f9adf854 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2310592 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* usb_spi: add support for custom SYS_RST and EC_RST setupMary Ruthven2020-07-222-23/+63
| | | | | | | | | | | | | | | | | | | | | Don't touch the SYS_RST_L or EC_RST_L signals when flashing the AP if flashrom is run with custom_rst=True. BUG=b:154885210 TEST=manual on bob ecrst on flashrom -p raiden_debug_spi:target=EC -r ec.bin ecrst on flashrom -p raiden_debug_spi:target=AP,custom_rst=True -r ap.bin check ecrst is still on flashrom -p raiden_debug_spi:target=AP -r ap.bin Change-Id: Ia1ab8c853c25ced994e053c9e19a18d0d0f1cb45 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2301239 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* usb_spi: add spi_hash_ to new_device and new_gang_modeMary Ruthven2020-07-211-10/+10
| | | | | | | | | | | | | new_device and new_gang_mode are both only used for spi_hash SPI enable/disable. Rename them, so that's clear. BUG=none TEST=make buildall -j Change-Id: I67a4f7865e8a5ff21c79b4462a0f2c1d0f85f76d Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2300698 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* u2f: Correct versioned key handle offset errorYicheng Li2020-07-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | To reuse u2f_origin_user_keypair(), u2f_sign extracts the key handle bytes from versioned and non-versioned requests according to the format. In the versioned path the code incorrectly uses the non-versioned struct to extract the key handle bytes, which would result in wrong private key and thus non-verifiable signature in WebAuthn on version 1 key handles. Both the bug and the fix do not affect the non-versioned path. BUG=b:144861739 TEST=Added debug statements to verify that u2f_generate and u2f_sign arrive at the same private key. With the previous buggy code they get different private key. Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: If79daeff98b01d050fcdc8dd69c809c184e6abb3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2303278 Reviewed-by: Andrey Pronin <apronin@chromium.org> Commit-Queue: Andrey Pronin <apronin@chromium.org>
* tpm_nvmem_ops.c: fix read_tpm_nvmem_size() to work with hidden objectsstabilize-13360.B-cr50_stabVadim Sukhomlinov2020-07-141-11/+4
| | | | | | | | | | | | | | | | | | | | | | | In https://crrev.com/c/2258534 fix read_tpm_nvmem_size() was introduced, however it failed to properly return size of hidden objects, and code worked because it was masked by prior check of size for nvmem variable with getvar(), and these variables were always set together. This fix relies on https://crrev.com/c/2280405 for tpm2 to add proper service function. BUG=None TEST=manual, tested in upcoming change in cr50/board/u2f.c Cq-Depend: chromium:2280405 Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I38cfbf97e5cc99907c05887345017db92c5abc72 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2285432 Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* [DCRYPTO Hardening] Adding the ecdsa test that can be invoked through console.Baur Krykpayev2020-07-113-10/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test's main goal is to be used against future changes in the dcrypto engine. All it does is comparing signature received from the ecdsa sign function to the golden results. Signed-off-by: mschilder@google.com BUG=b:137659935 TEST=something of a test itself and is run by calling the command through the console connection via host. The test sequence is following: - call the dcrypto_ecdsa_sign function on the known input. - call the dcrypto_ecdsa_verisign on the same input (this function is added in the following CLs in the chain). - compare both results to the golden value. Test passes if both results match to the golden value. To run the test compile the CR50: make -j BOARD=cr50 CRYPTO_TEST=1 in the console run: dcrypto_ecdsa Change-Id: I07437f6a69ba79bdcce8c92976a374733b17d339 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2269337 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Andrey Pronin <apronin@chromium.org>
* cr50: Remove dummy U2F_ADPU vendor command.Louis Collard2020-07-101-56/+0
| | | | | | | | | | | | | | | | | | This was added to support u2fd on M77, and can be removed iff the version of cr50 this change is included in will not be expected to work with M77. BUG=b:158268336 TEST=build Signed-off-by: Louis Collard <louiscollard@chromium.org> Change-Id: I6bbbae44a86c1a70fef4c8e1da1c1116f9909aa8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2275504 Reviewed-by: Yicheng Li <yichengli@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Yicheng Li <yichengli@chromium.org> Tested-by: Yicheng Li <yichengli@chromium.org>
* ccd_howtos: add test_that commandMary Ruthven2020-07-101-1/+9
| | | | | | | | | | | | | | | | Add a test_that command to show how we run tests locally. BUG=none TEST=none Change-Id: I04d1a5d96c03b1cdceff6677e64893498837ea88 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2092202 Reviewed-by: Shelley Chen <shchen@chromium.org> (cherry picked from commit 4bdb7d9889371ca8ae74599cead640a254ed7b0d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278525 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
* ccd_howtos: add ccd faft setupMary Ruthven2020-07-101-2/+167
| | | | | | | | | | | | | | | BUG=none TEST=none Change-Id: Ibe22f9131dc34ce4185379d8db166de42a3d1e24 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1873853 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> (cherry picked from commit e4967bcc38227275d6788f1504e7a679c865357d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278524 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* docs/case_closed_debugging_cr50: RefactorTom Hughes2020-07-101-625/+562
| | | | | | | | | | | | | | | Refactor the CCD documentation so it's easier for non-experts to understand. BUG=none TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I89ba8fd5906119c4acfe1a555db5b7872dd949a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2137929 (cherry picked from commit 2ba6907508ecfc223c047db686fe459c9596f026) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278523 Tested-by: Vadim Bendebury <vbendeb@chromium.org>
* docs/case_closed_debugging_cr50.md: Unify shell prompt formattingTom Hughes2020-07-101-140/+211
| | | | | | | | | | | | | | | | | | | | | | | Use the standard used across the documentation for specifying different shell prompts: (chroot) $ (dut) $ cr50 > This makes it clear where the command should be run. BUG=none TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I0383e00825b5d9b500464ac1979555ca5afd8296 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2136870 Commit-Queue: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> (cherry picked from commit 8f13313b8b0b8787e01f5604cc6b812155c2a6ac) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278522 Tested-by: Vadim Bendebury <vbendeb@chromium.org>
* docs/case_closed_debugging_cr50.md: Run mdformatTom Hughes2020-07-101-133/+126
| | | | | | | | | | | | | | | | | | | | No content changes. Command used: mdformat --compatibility -w docs/case_closed_debugging_cr50.md BUG=none TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ieb84866ad610122da08873087f79a6d45ea17ab3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2137633 Reviewed-by: Justin TerAvest <teravest@chromium.org> Commit-Queue: Justin TerAvest <teravest@chromium.org> (cherry picked from commit 14c35054e52bba725a3b34e64f50cf3446f4f1d5) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278361 Tested-by: Vadim Bendebury <vbendeb@chromium.org>
* docs: Add cr50 rescue mode detailsJustin TerAvest2020-07-101-0/+127
| | | | | | | | | | | | | | | | | | | | | This adapts the "UART rescue mode" text from go/cr50-devel to open-source documentation in the EC codebase. This information has been necessary for partners to update cr50 on their own internal boards, where other update methods may not be viable. BUG=None TEST=worked with partner to reflash cr50 with attached instructions Change-Id: I6cf5defd38432e0ceda3cc809d43d94fa14797b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1974501 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Justin TerAvest <teravest@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org> (cherry picked from commit bccc832b7dbc056f464d549dd5f347277670d1b3) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278360 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* ccd: add information about AP flash programming speed up.Vadim Bendebury2020-07-101-0/+78
| | | | | | | | | | | | | | | | | | | | When programming AP flash for the very first time it is sufficient to program just a few sections. This makes it possible for the device to boot Chrome OS, at which point the rest of the AP flash can be programmed much faster. BUG=none TEST=verified proper rendering using gerrit Change-Id: I444b857302e67c6d7c54c026b9205d0ec734e24a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1981085 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 85326c1662f8db3cdc9ed801986f65127ccca123) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278359 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* docs: Update CCD docsTom Hughes2020-07-101-56/+73
| | | | | | | | | | | | BUG=none TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I7da8856cb0d39befead6418e53e709569adae613 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2134806 (cherry picked from commit 263b54489f08557690791fe7f0aaed634ddc6a2e) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278358 Tested-by: Vadim Bendebury <vbendeb@chromium.org>
* docs: Run mdformat on case_closed_debugging.mdTom Hughes2020-07-101-97/+107
| | | | | | | | | | | | | BUG=none TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Id55665d87e80a472af61f0ccb7ecb8bc097ebb3c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2134646 Reviewed-by: Furquan Shaikh <furquan@chromium.org> (cherry picked from commit 697b49ae69ae35e1df9188e2c6f4df07b0cdc2cc) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278357 Tested-by: Vadim Bendebury <vbendeb@chromium.org>
* system: make sure CR50_DEV images will not update info mapVadim Bendebury2020-07-071-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | Despite all make tricks, sometimes switching between make invocations with CR50_DEV defined and not defined, the code which updates the IFNO1 RW rollback space runs even when CR50_DEV was defined at compile time and the image header rollback space is set to all zeros. This causes complete clearing of the INFO1 RW rollback space, which in turn prevents from running images built without CR50_DEV=1. Let's add a check to see if the currently running image has the entire rollback space in the header erased, and not proceed with the INFO1 space update in this case. BUG=b:160013710 TEST=verified that images built both with CR50_DEV defined and not defined run properly. - removed '#ifndef CR50_DEV' block around lines 610..719 and built and ran the image, observed the "Skipped updating INFO1 RW" map message. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I63a54ba2a82cd250d1e4018768b7a55c406b69c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2271016 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* u2f: Add support for versioned key handlesYicheng Li2020-07-034-69/+246
| | | | | | | | | | | | | | | | | | | | | | | | Support generating and signing versioned key handles in addition to non-versioned ones. BUG=b:144861739 TEST=used webauthntool to verify that KH generated by old cr50 firmware can be signed with this firmware TEST=used webauthntool to verify that non-versioned KH generated by this firmware can be signed by old cr50 firmware (This and the first TEST proves that non-versioned path is the same as old firmware.) TEST=used webauthntool to verify that non-versioned KH generated by this firmware can be signed by this firmware TEST=used webauthntool to verify that versioned KH generated by this firmware can be signed by this firmware TEST=test_that --board=nami <IP> firmware_Cr50U2fCommands Cq-Depend: chromium:2280394 Change-Id: Idf413a1a3e6c35a3e7e651faaa91fe2894b805db Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2202949 Reviewed-by: Louis Collard <louiscollard@chromium.org>
* fips: introduce FIPS & policy power-up known-answer testsVadim Sukhomlinov2020-07-029-20/+979
| | | | | | | | | | | | | | | | | | | | | Add invocation of power-up known-answer tests (KATs) on power-on and after failures, while avoiding power-up tests on wake from sleep. Added console & vendor commands to report FIPS status, run tests, simulate errors. BUG=b:138577539 TEST=manual; check console fips on, fips test, fips sha, fips trng will add tpmtest for vendor command Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I58790d0637fda683c4b6187ba091edf08757f8ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2262055 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* cr50_vboot_doc: improve picture renederingVadim Bendebury2020-06-291-15/+22
| | | | | | | | | | | | | | | | | | This patch addresses gerrit markdown rendering deficiency where the target image is not properly rendered gerrit by the gerrit server. The images were duplicated on Google Drive, such that the smaller in the page version of the image is still loaded from the local tree, but the target image comes from Drive, which allows to see full size images when required. BUG=none TEST=verified proper rendering of the full size images Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: Ief2f18bd9b3805b391b19b8ebb8828d9e5ca05b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2274302 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* tpm_nvmem_ops.c: add function to get size of nvmem hidden objectstabilize-quickfix-13310.91.B-cr50_stabstabilize-quickfix-13310.76.B-cr50_stabstabilize-quickfix-13310.73.B-cr50_stabstabilize-13310.99.B-cr50_stabstabilize-13310.94.B-cr50_stabstabilize-13310.83.B-cr50_stabstabilize-13310.74.B-cr50_stabstabilize-13310.72.B-cr50_stabrelease-R85-13310.B-cr50_stabVadim Sukhomlinov2020-06-262-0/+23
| | | | | | | | | | | | | | | | | | Added service function read_tpm_nvmem_size() to return size of hidden nvmem object, which is needed in FIPS framework code, but can't be implemented locally due to conflicting headers between TPM2 library and Cryptoc library, and util.h BUG=none TEST=make BOARD=cr50; meaningul test will be added in upcoming CLs Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: Iab9520170cfdcd754f1fe2e79143f75766284921 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2258534 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Cr50: vboot troubleshooting docVadim Bendebury2020-06-265-0/+223
| | | | | | | | | | | | | | A document describing how AP and H1 interact during the boot up process, and typical failures causing the Chrome OS device falling into recovery mode. BUG=none TEST=none Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: Ib71ffbc9c7dadd5f42923c0bfac038ae7f0ca8e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2261318 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* common.h: consolidate stdbool.h and stddef.hVadim Sukhomlinov2020-06-257-9/+3
| | | | | | | | | | | | | | | | | | | Many source files over time started to respect 'bool' and 'size_t' types for better code readability. However, these types are defined in stdbool.h and stddef.h headers, so each time they were used there was a need to include them. util.h included both, and one option was to use it, but it conflicts with TPM2 library on definition MAX/MIN BUG=none TEST=make buildall -j Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: Ia0aca578e901c60aeafee5278471c228194d36bf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2258540 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* ecc: fix padding for ECDSA sign and verify, add more test vectorsVadim Sukhomlinov2020-06-252-36/+101
| | | | | | | | | | | | | | | | | | | https://crrev.com/c/2222386 added support for short EC keys to some functions. Extending this support to sign and verify. Added test vectors for regression testing in tpmtest.py BUG=b:157528390 TEST=tpmtest.py Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I3db2c9eee9da995d45d534a2732130948548ead8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2265605 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* NVMEM: selective erase of TPM objectsVadim Bendebury2020-06-252-8/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds another NVMEM API, which allows to erase stored TPM objects selectively. The list of indices of the objects to be erases is supplied in a zero terminated array. The existing nvmem_erase_tpm_data() has been modified to erase only selected objects, if the list of objects is supplied by the caller. BUG=b:138578447 TEST=Using tpm_manager_client created a bogus NVMEM object, modified Cr50 code to provide a CLI command which would invoke the new NVMEM API function to delete the new object. Invoked 'dump_nvmem' command before and after deleting the bogus object. Observed the NVMEM contents compacted and the bogus object deleted. Rebooted the device, observed proper Chrome OS start up maintaining the existing user account. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I3e299c8004141fa01ff20c290131b6526575c42e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2253324 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Commit-Queue: Andrey Pronin <apronin@chromium.org>
* fips_rand: FIPS-compliant way to generate randomsVadim Sukhomlinov2020-06-246-3/+583
| | | | | | | | | | | | | | | | | | Add proper TRNG health tests and CR50-wide DRBG with reseeding BUG=b:138578157 TEST=tpmtest.py -t1 fails after cr50 reboot. rand_perf in console (kick-off FIPS TRNG test) and then tpmtest.py -t1 and tpmtest.py -t2 should succeed. Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I94c2dbd7a00dedcf1a0f318539a3c73c0c8076ef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2251381 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* cr50: do not trigger unnecessary legacy NVMEM partition checksVadim Bendebury2020-06-221-1/+1
| | | | | | | | | | | | | | | | The logic of deciding if the alternative RW image is newer than a certain version needs to be updated to accommodate moving to higher prod and prepvt major version numbers. BUG=none TEST=the 'nvmem_find_partition: No Legacy Partitions found.' message is not printed during startup any more when updating from 6.3 to 6.4. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I59e18712b3365446c29f569bf0b50f95ab67df95 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250658 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* trng: adjust TRNG timeout to reduce TRNG resetsVadim Sukhomlinov2020-06-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Time it takes for TRNG to come-up with 32-bit of randomness varies, and once TRNG started to use 1-bit alphabet, it's average increased. We handle this timeout by resetting TRNG and writing record in the flash log. With current setting of EMPTY_COUNT set to 400 it's almost never happens under normal use, and is harmless, but adds unnecessary records in the log under heavy use like TRNG health tests. Adjusting EMPTY_COUNT to higher value reduce probability of TRNG reset when value is just delayed, but TRNG is not stalled yet. BUG=b:138578157 TEST=tpmtest -t0 Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: Ic0152da05934a70dd16b3e4178361bfcefbdda26 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2252481 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: William Wesson <wesson@google.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* ec.tasklist: increase stack for console task for development modeVadim Sukhomlinov2020-06-181-1/+9
| | | | | | | | | | | | | | | | | | | | | Due to changes in internal structures, stack consumption for SHA2, HMAC, HMAC_DRBG grew up, and when combined with stack growth due to changes in cprintf cause crash for some development console commands. This patch increase console stack for CR50_DEV and CRYPTO_TEST modes. BUG=none TEST=manual, build with CR50_DEV or CRYPTO_TEST, run taskinfo Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I7170c65e4b8092d165c478f505a435f834744ed9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2251382 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* cr50: use NIST-compliant configuration of TRNGVadim Sukhomlinov2020-06-175-113/+324
| | | | | | | | | | | | | | | | | | | | | | | | | | | | According to NIST SP 800-90B only vetted conditioning mechanism should be used for post-processing raw entropy. See SP 800-90B, 3.1.5.1 Using Vetted Conditioning Components. Use of non-vetted algorithms is governed in 3.1.5.2, but assumes conservative coefficient 0.85 for entropy estimate, which increase number of requests to TRNG to get desirable entropy. More details on entropy estimate tests are in associated bug. Entropy measurements using NIST assessment tool didn't report noticeable change in entropy estimate. However, more changes are needed to use DRBG instead of raw TRNG for all purposes. TRNG changes reviewed also at https://crrev.com/c/1926384 BUG=b:138577834 TEST=test/tpm_test/nist_entropy.sh Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I5a578b90b8b7a77fae6a218eec48e87e7644ab44 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2240519 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* cr50/board: add board-local FIPS settingVadim Sukhomlinov2020-06-163-0/+82
| | | | | | | | | | | | | | | | | | | | | | | Implement board-local configuraration of FIPS 140-2/3 policy as complementary to FWMP policy. This is intended mostly for lab testing and dogfooding, when FWMP policy is not feasible. board_fips_enforced() returns status of FIPS from FWMP and NVRAM and caches state to avoid expensive operations later. BUG=b:138577491 TEST=manual, make buildall -j Actual test command to be added in upcoming CLs Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I8fa651e56e6e76a87bbc4dd911e7a8c0546e7e0f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247112 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* console: add service functions to enable/disable console outputVadim Sukhomlinov2020-06-162-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | FIPS 140-2 certification requires that security related output from module should be disabled until completion of known-answer tests. However, it's tricky to justify what output is security related, as most of output data can be used to track current execution stage which may be helpful for attacker. So, its safer to disable any output for a short time once internal testing is done. Provide console_disable_output() and console_enable_output() functions which are supposed to be used by board initialization code driving FIPS mode initialization. BUG=b:138577539 TEST=manual; make buildall -j Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I42902acef7a5e99142ce2b6517ae511f63206e93 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247103 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* flash_log: add error code for FIPS known-answer and continuous testsVadim Sukhomlinov2020-06-161-4/+7
| | | | | | | | | | | | | | | | Add FE_LOG_FIPS_FAILURE event type BUG=b:138577539 TEST=manual Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I11be32598ddbbb327175a656c21abcb8388246d0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247106 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>