summaryrefslogtreecommitdiff
path: root/test/tpm_test/hash_test.py
Commit message (Collapse)AuthorAgeFilesLines
* Cr50: In hash crypto test, return valid hash for empty input.Gurleen Grewal2019-10-171-0/+2
| | | | | | | | | | | | | | | | | | | | FIPS ACVP tests require that on an empty input, the result is the hash of the empty string. In the current implementation, an empty result is returned. Change the implementation so it matches FIPS expectations. Also added two test cases in hash crypto test to check the corner case of the empty input. BUG=None BRANCH=cr50 TEST=test/tpm_test/tpmtest.py Change-Id: I9f5c3f71e4b10cbce2ea204eeb52e57ef26ad0e7 Signed-off-by: Gurleen Grewal <gurleengrewal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1866444 Reviewed-by: Andrey Pronin <apronin@chromium.org> Tested-by: Gurleen Grewal <gurleengrewal@google.com>
* Unify #! use in python scriptsStefan Reinauer2019-10-011-1/+1
| | | | | | | | | | | | | | | | | | Right now we have several different versions of #! in our python scripts. Unify them all and specify that we are using python2. Signed-off-by: Stefan Reinauer <reinauer@chromium.org> BUG=none BRANCH=none TEST=make buildall Change-Id: Iab33a3f5d4b827451a55542bcee8837b00da7867 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1817948 Commit-Queue: Stefan Reinauer <reinauer@chromium.org> Tested-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* tpmtest: make the test work againVadim Bendebury2017-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TPM test directory has bitrotted and does not compile any more, leave alone pass tests. This patch updates the tests to match changed EC codebase: test/tpm_test/Makefile - look for include files in more directories test/tpm_test/bn_test.c - add implementation of always_memset() which for the EC tree now comes from a different tree and provide a plug for watchdog_reload() which is no used by dcrypto code (which in fact is not a good idea, but an issue for another day). test/tpm_test/hash_test.py - update to match new format of return messages test/tpm_test/upgrade_test.py - update to match the new format of return messages and limit the test to installing just 2K worth of data BRANCH=cr50 BUG=none TEST=./test/tpmtest/tpmtest.py now passes Change-Id: Ibcd7fcfba06cd83023e35a2ac4f37ec896492ad4 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/665322 Reviewed-by: Nagendra Modadugu <ngm@google.com> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* cr50: test: consolidate test exceptionsVadim Bendebury2016-02-111-8/+4
| | | | | | | | | | | | | | | | | | | | | | There is no point in defining tpm test exception classes per test type, one common class is enough, especially if the source module of the exception is reported. BRANCH=none BUG=none TEST=tried running the test without the USB FTDI cable plugged in, got the following error message: $ ./test/tpm_test/tpmtest.py Starting MPSSE at 800 kHz Error in tpmtest.py:54: Failed to connect $ Change-Id: I5642aa70c8a581099887b58e3a436d7f8d7608a1 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/327300 Reviewed-by: Nagendra Modadugu <ngm@google.com>
* Fix bug in software sha256_hash()nagendra modadugu2016-01-281-0/+2
| | | | | | | | | | | | | | | | | The implementation for sha256_hash() copied and incorrect number of bytes to the output. This change provides a fix and a test. TEST=added test case BRANCH=none BUG=chrome-os-partner:43025,chrome-os-partner:47524 Change-Id: I74e98c6f5005a14dd5c0ca19ea7540622dd6c7d7 Signed-off-by: nagendra modadugu <ngm@google.com> Reviewed-on: https://chromium-review.googlesource.com/324391 Commit-Ready: Nagendra Modadugu <ngm@google.com> Tested-by: Nagendra Modadugu <ngm@google.com> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Refactor crypto subcommands into their own python module.nagendra modadugu2015-12-171-3/+2
| | | | | | | | | | | | | BRANCH=none TEST=tpmtest.py passes BUG=chrome-os-partner:43025,chrome-os-partner:47524 Signed-off-by: nagendra modadugu <ngm@google.com> Change-Id: I48f426176f17c57c723104d19c963b228f16d985 Reviewed-on: https://chromium-review.googlesource.com/318915 Commit-Ready: Nagendra Modadugu <ngm@google.com> Tested-by: Nagendra Modadugu <ngm@google.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: test: add hash testing host side implementationVadim Bendebury2015-12-031-0/+118
The new module generates hash test extension subcommands, driven by the 'test_inputs' table. Each table entry is a tuple, including the test name and the data to be hashed. The test name determines the hash type (sha1 or sha256) and the test mode (single or spread over several messages). The last element of the name is the context number (ignored in single message mode). The hash extended command payload looks as follows: field | size | note =================================================================== hash_cmd | 1 | 0 - start, 1 - cont., 2 - finish, 4 - single hash_mode | 1 | 0 - sha1, 1 - sha256 handle | 1 | session handle, ignored in 'single' mode text_len | 2 | size of the text to process, big endian text | text_len | text to hash BRANCH=none BUG=chrome-os-partner:43025 TEST=currently failing, a couple of hash code tweaks needed, see upcoming patches. Change-Id: Ie992bf01cae3c5278110357b482370b2fc11c70f Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/314693 Reviewed-by: Randall Spangler <rspangler@chromium.org>