diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2019-07-29 22:15:23 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2019-07-29 22:15:23 +0700 |
commit | 3fc5f0e61be2f9f6169d88b143e8c196d5e63b5e (patch) | |
tree | 47c418aa136b57c261f462d211544b8230727567 /crypto/src | |
parent | fixed typo (diff) | |
download | BouncyCastle.NET-ed25519-3fc5f0e61be2f9f6169d88b143e8c196d5e63b5e.tar.xz |
Fix field reduction for custom secp128r1 curve
- see https://github.com/bcgit/bc-java/issues/566
Diffstat (limited to 'crypto/src')
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecP128R1Field.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP128R1Field.cs b/crypto/src/math/ec/custom/sec/SecP128R1Field.cs index d1ac009b3..cf91c7e5d 100644 --- a/crypto/src/math/ec/custom/sec/SecP128R1Field.cs +++ b/crypto/src/math/ec/custom/sec/SecP128R1Field.cs @@ -134,6 +134,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec x = (uint)c; } + + if (z[3] >= P3 && Nat128.Gte(z, P)) + { + AddPInvTo(z); + } } public static void Square(uint[] x, uint[] z) |