diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-12 23:23:03 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-12 23:23:03 +0700 |
commit | 67288687b0c982e1718126d08dc60282adc5a78e (patch) | |
tree | a50313f6a126073058f6b733ff71d2b161f46d17 /crypto/src | |
parent | Refactoring in Pqc.Crypto.Bike (diff) | |
download | BouncyCastle.NET-ed25519-67288687b0c982e1718126d08dc60282adc5a78e.tar.xz |
Cmce perf. opts.
Diffstat (limited to 'crypto/src')
-rw-r--r-- | crypto/src/pqc/crypto/cmce/CmceEngine.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crypto/src/pqc/crypto/cmce/CmceEngine.cs b/crypto/src/pqc/crypto/cmce/CmceEngine.cs index 0d62b57ca..605770c3c 100644 --- a/crypto/src/pqc/crypto/cmce/CmceEngine.cs +++ b/crypto/src/pqc/crypto/cmce/CmceEngine.cs @@ -1475,6 +1475,19 @@ namespace Org.BouncyCastle.Pqc.Crypto.Cmce c += 8; } } +#else + { + byte maskByte = (byte)-mask; + int limit = (SYS_N / 8) - 4; + while (c <= limit) + { + mat_row[c + 0] ^= (byte)(mat_k[c + 0] & maskByte); + mat_row[c + 1] ^= (byte)(mat_k[c + 1] & maskByte); + mat_row[c + 2] ^= (byte)(mat_k[c + 2] & maskByte); + mat_row[c + 3] ^= (byte)(mat_k[c + 3] & maskByte); + c += 4; + } + } #endif { byte maskByte = (byte)-mask; @@ -1529,6 +1542,19 @@ namespace Org.BouncyCastle.Pqc.Crypto.Cmce c += 8; } } +#else + { + byte maskByte = (byte)-mask; + int limit = (SYS_N / 8) - 4; + while (c <= limit) + { + mat_k[c + 0] ^= (byte)(mat_row[c + 0] & maskByte); + mat_k[c + 1] ^= (byte)(mat_row[c + 1] & maskByte); + mat_k[c + 2] ^= (byte)(mat_row[c + 2] & maskByte); + mat_k[c + 3] ^= (byte)(mat_row[c + 3] & maskByte); + c += 4; + } + } #endif { byte maskByte = (byte)-mask; |