Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2016-07-02 21:24:30 +0300
committerDavid Benjamin <davidben@google.com>2016-07-07 02:11:11 +0300
commit56cbbe5b8d9d38732aebf19da22132eac6a9ce47 (patch)
tree8699a9ab99f4ef80f738ad2d891276dd9248ef8f /crypto
parent66a0e6e37d2841ae91af20aba3a3b85db07b6b62 (diff)
Use BN_set_bit in TestLShift1.
No need for the special case and such. Change-Id: If8fbc73eda0ccbaf3fd422e97c96fee6dc10b1ab Reviewed-on: https://boringssl-review.googlesource.com/8604 Reviewed-by: David Benjamin <davidben@google.com>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bn/bn_test.cc13
1 files changed, 2 insertions, 11 deletions
diff --git a/crypto/bn/bn_test.cc b/crypto/bn/bn_test.cc
index fe6e0b74..151164ee 100644
--- a/crypto/bn/bn_test.cc
+++ b/crypto/bn/bn_test.cc
@@ -422,17 +422,8 @@ static bool TestLShift1(FileTest *t, BN_CTX *ctx) {
}
// Set the LSB to 1 and test rshift1 again.
- if (BN_is_negative(lshift1.get())) {
- if (!BN_sub(lshift1.get(), lshift1.get(), BN_value_one())) {
- return false;
- }
- } else {
- if (!BN_add(lshift1.get(), lshift1.get(), BN_value_one())) {
- return false;
- }
- }
-
- if (!BN_div(ret.get(), nullptr /* rem */, lshift1.get(), two.get(), ctx) ||
+ if (!BN_set_bit(lshift1.get(), 0) ||
+ !BN_div(ret.get(), nullptr /* rem */, lshift1.get(), two.get(), ctx) ||
!ExpectBIGNUMsEqual(t, "(LShift1 | 1) / 2", a.get(), ret.get()) ||
!BN_rshift1(ret.get(), lshift1.get()) ||
!ExpectBIGNUMsEqual(t, "(LShift | 1) >> 1", a.get(), ret.get())) {