diff options
author | nagendra modadugu <ngm@google.com> | 2016-07-14 03:42:54 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-21 13:13:30 -0700 |
commit | 63bd3feaabb95562c1051a718ac88305126c3ead (patch) | |
tree | 5f81f7dc0edc10a1079c11fa7948f2b8f115e07c | |
parent | 09cff6b9bfa45a14e758c1a8c431fc03a1976423 (diff) | |
download | chrome-ec-63bd3feaabb95562c1051a718ac88305126c3ead.tar.gz |
CR50: add a #define guard to enable use of non-asm bignum
Bignum test code that runs on host (e.g. x86) can't
make use of CR50 assembly; add a #define switch which
allows for host builds.
BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=build succeeds
Reviewed-on: https://chromium-review.googlesource.com/360247
Commit-Queue: Nagendra Modadugu <ngm@google.com>
Trybot-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
(cherry picked from commit 20158b1bc5a80812dde7b798296a8b6e5dcc8400)
(cherry picked from commit 4b34af801fd565fe8fc2b855307ba5a7074b3470)
Change-Id: Ia754fd47e958e8338cd4cee60405305e58b8aa88
Reviewed-on: https://chromium-review.googlesource.com/362114
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r-- | chip/g/dcrypto/bn.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/chip/g/dcrypto/bn.c b/chip/g/dcrypto/bn.c index bff4f5b996..ae76cb0858 100644 --- a/chip/g/dcrypto/bn.c +++ b/chip/g/dcrypto/bn.c @@ -340,6 +340,7 @@ void bn_mont_modexp(struct BIGNUM *output, const struct BIGNUM *input, struct BIGNUM acc; struct BIGNUM aR; +#ifndef CR50_NO_BN_ASM if (bn_bits(N) == 2048 || bn_bits(N) == 1024) { /* TODO(ngm): add hardware support for standard key sizes. */ bn_mont_modexp_asm(output, input, exp, N); @@ -349,6 +350,7 @@ void bn_mont_modexp(struct BIGNUM *output, const struct BIGNUM *input, bn_add(output, N); return; } +#endif bn_init(&RR, RR_buf, bn_size(N)); bn_init(&acc, acc_buf, bn_size(N)); |