summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Sukhomlinov <sukhomlinov@google.com>2019-11-11 14:18:16 -0800
committerCommit Bot <commit-bot@chromium.org>2019-11-19 23:26:57 +0000
commita3b7c0cbf3906f60501fd07e09cd9b7583521088 (patch)
tree6c6c9cbd29848f04b37726b42624ee85a04e5a21
parent8190be1a6fef4203d743825d7afe74b5ec1fc083 (diff)
downloadchrome-ec-a3b7c0cbf3906f60501fd07e09cd9b7583521088.tar.gz
cr50: Add support for testing SHA-384, SHA-512 with CRYPTO_TEST=1
Added support for SHA-384 and SHA-512 testing by providing direct access to algorithms using TPM extension commands enbaled with CRYPTO_TEST=1. This is used by ACVP tests for completness of SHA2 coverage. ACVP tests to be added separately. BUG=none BRANCH=cr50 TEST=make BOARD=cr50 CRYPTO_TEST=1 -j Change-Id: I3152d5186a5488793f6487ec5d50acdec2813c77 Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1910525 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>
-rw-r--r--board/cr50/tpm2/hash.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/board/cr50/tpm2/hash.c b/board/cr50/tpm2/hash.c
index de4116052b..aba5d84a6f 100644
--- a/board/cr50/tpm2/hash.c
+++ b/board/cr50/tpm2/hash.c
@@ -302,8 +302,8 @@ static void hash_command_handler(void *cmd_body,
* field | size | note
* ===================================================================
* mode | 1 | 0 - start, 1 - cont., 2 - finish, 3 - single
- * hash_mode | 1 | 0 - sha1, 1 - sha256
- * handle | 1 | seassion handle, ignored in 'single' mode
+ * hash_mode | 1 | 0 - sha1, 1 - sha256, 2 - sha384, 3 - sha512
+ * 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
*/
@@ -321,7 +321,14 @@ static void hash_command_handler(void *cmd_body,
case 1:
alg = TPM_ALG_SHA256;
break;
-
+#ifdef SHA512_SUPPORT
+ case 2:
+ alg = TPM_ALG_SHA384;
+ break;
+ case 3:
+ alg = TPM_ALG_SHA512;
+ break;
+#endif
default:
return;
}