summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagendra modadugu <ngm@google.com>2016-07-14 03:42:54 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2016-07-14 20:08:28 +0000
commit20158b1bc5a80812dde7b798296a8b6e5dcc8400 (patch)
treeb546a3977ac1c8bcbba3bca0f3c1a4458a7452a6
parentc4c66e5424b25fbb60d0590ce05ee3d91a7e7801 (diff)
downloadchrome-ec-20158b1bc5a80812dde7b798296a8b6e5dcc8400.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. BUG=chrome-os-partner:43025,chrome-os-partner:47524 TEST=build succeeds Change-Id: Ia754fd47e958e8338cd4cee60405305e58b8aa88 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>
-rw-r--r--chip/g/dcrypto/bn.c2
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));