diff options
author | Baur Krykpayev <bkrykpayev@google.com> | 2019-07-04 23:40:19 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-11 05:33:57 +0000 |
commit | b11f71e7fff01d1edd2492a616a0b391c08e5688 (patch) | |
tree | efc14a8d1aa5b20819053ada8b5980d6b0f4f3cc /chip/g/dcrypto/internal.h | |
parent | 6863b3943c7eb72199374a2e0eb9fe5721ac2bd0 (diff) | |
download | chrome-ec-b11f71e7fff01d1edd2492a616a0b391c08e5688.tar.gz |
[DCRYPTO Hardening] Adding the ecdsa test that can be invoked through console.
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>
Diffstat (limited to 'chip/g/dcrypto/internal.h')
-rw-r--r-- | chip/g/dcrypto/internal.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/chip/g/dcrypto/internal.h b/chip/g/dcrypto/internal.h index 26bac1c73f..1811426f2a 100644 --- a/chip/g/dcrypto/internal.h +++ b/chip/g/dcrypto/internal.h @@ -165,7 +165,7 @@ int dcrypto_p256_ecdsa_sign(struct drbg_ctx *drbg, const p256_int *key, const p256_int *message, p256_int *r, p256_int *s) __attribute__((warn_unused_result)); int dcrypto_p256_base_point_mul(const p256_int *k, p256_int *x, p256_int *y) - __attribute__((warn_unused_result)); + __attribute__((warn_unused_result)); int dcrypto_p256_point_mul(const p256_int *k, const p256_int *in_x, const p256_int *in_y, p256_int *x, p256_int *y) @@ -177,6 +177,12 @@ int dcrypto_p256_ecdsa_verify(const p256_int *key_x, const p256_int *key_y, int dcrypto_p256_is_valid_point(const p256_int *x, const p256_int *y) __attribute__((warn_unused_result)); +/* Pick a p256 number between 1 < k < |p256| */ +int dcrypto_p256_pick(struct drbg_ctx *drbg, p256_int *output); + +/* Overwrite with random p256 value */ +void dcrypto_p256_rnd(p256_int *output); + /* * Accelerator runtime. * |