summaryrefslogtreecommitdiff
path: root/sm4.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-11-24 18:21:27 -0500
committerJeffrey Walton <noloader@gmail.com>2017-11-24 18:21:27 -0500
commit2ac9e613358cd00a10ce0916a4488473292b76b1 (patch)
treec06f68dbbc5a0fa9c440c3d8f0b08948ad3bc9c4 /sm4.cpp
parent4f2d6f713f005e55fc435118c74ccc42acc5c3b4 (diff)
downloadcryptopp-git-2ac9e613358cd00a10ce0916a4488473292b76b1.tar.gz
Switch to rotlConstant and rotrConstant
Diffstat (limited to 'sm4.cpp')
-rw-r--r--sm4.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/sm4.cpp b/sm4.cpp
index 1a157c1d..1aa2a1ff 100644
--- a/sm4.cpp
+++ b/sm4.cpp
@@ -1,4 +1,8 @@
// sm4.cpp - written and placed in the public domain by Jeffrey Walton and Han Lulu
+//
+// We understand future ARMv8 enhancements are supposed
+// to include SM3 and SM4 related instructions so the function
+// is stubbed for an eventual SM4_Round_ARMV8.
#include "pch.h"
#include "config.h"
@@ -11,8 +15,7 @@ ANONYMOUS_NAMESPACE_BEGIN
using CryptoPP::byte;
using CryptoPP::word32;
-using CryptoPP::rotlFixed;
-using CryptoPP::rotrFixed;
+using CryptoPP::rotlConstant;
const byte S[256] =
{
@@ -54,13 +57,13 @@ inline word32 SM4_H(word32 x)
inline word32 SM4_G(word32 x)
{
const word32 t = SM4_H(x);
- return t ^ rotlFixed(t, 13) ^ rotlFixed(t, 23);
+ return t ^ rotlConstant<13>(t) ^ rotlConstant<23>(t);
}
inline word32 SM4_F(word32 x)
{
const word32 t = SM4_H(x);
- return t ^ rotlFixed(t, 2) ^ rotlFixed(t, 10) ^ rotlFixed(t, 18) ^ rotlFixed(t, 24);
+ return t ^ rotlConstant<2>(t) ^ rotlConstant<10>(t) ^ rotlConstant<18>(t) ^ rotlConstant<24>(t);
}
template <unsigned int R, bool FWD>