From 67288687b0c982e1718126d08dc60282adc5a78e Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sat, 12 Nov 2022 23:23:03 +0700 Subject: Cmce perf. opts. --- crypto/src/pqc/crypto/cmce/CmceEngine.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'crypto') 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; -- cgit 1.4.1