diff options
author | Jack Lloyd <[email protected]> | 2018-04-18 11:41:46 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-04-18 11:41:46 -0400 |
commit | 3716327e26a9298cf4d09ed7703074ed4e4d5a37 (patch) | |
tree | f97a16faef10e7ca2aefada5010eb8cb5f9c4ddb /src/lib/math | |
parent | 7e4e69629d61307c0366a3fc7aae675b3a947ca3 (diff) |
Add early exit for P-192 reduce
Diffstat (limited to 'src/lib/math')
-rw-r--r-- | src/lib/math/numbertheory/nistp_redc.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/math/numbertheory/nistp_redc.cpp b/src/lib/math/numbertheory/nistp_redc.cpp index 9ceb7c167..33e77562e 100644 --- a/src/lib/math/numbertheory/nistp_redc.cpp +++ b/src/lib/math/numbertheory/nistp_redc.cpp @@ -198,6 +198,11 @@ void redc_p192(BigInt& x, secure_vector<word>& ws) #endif }; + if(S == 0 && x.word_at(p192_limbs-1) < p192_mults[0][p192_limbs-1]) + { + return; + } + word borrow = bigint_sub2(x.mutable_data(), x.size(), p192_mults[S], p192_limbs); BOTAN_ASSERT(borrow == 0 || borrow == 1, "Expected borrow during P-192 reduction"); |