summaryrefslogtreecommitdiff
path: root/speck.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-11-22 07:57:39 -0500
committerJeffrey Walton <noloader@gmail.com>2017-11-22 07:57:39 -0500
commit39697d92bfb4aed006e6ed29be7c5281a901ad06 (patch)
tree0afdc9eda81cc619ae6c0a04072a13d4b2adada0 /speck.h
parentc4479188159a9a9a89e793e2052d4ff2fb6a16f0 (diff)
downloadcryptopp-git-39697d92bfb4aed006e6ed29be7c5281a901ad06.tar.gz
Add SSSE3 intrinsics for SPECK-128 (GH #538)
Performance increased by about 100% on a 3.1 GHz Core i5 Skylake. Throughput went from about 7.3 cpb to about 3.5 cpb. Not bad for a software-based implementation of a block cipher
Diffstat (limited to 'speck.h')
-rw-r--r--speck.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/speck.h b/speck.h
index 7f4acc38..037dab92 100644
--- a/speck.h
+++ b/speck.h
@@ -45,12 +45,13 @@ template <class W>
struct SPECK_Base
{
virtual ~SPECK_Base() {}
- SPECK_Base() : m_kwords(0) {}
+ SPECK_Base() : m_kwords(0), m_rounds(0) {}
typedef SecBlock<W, AllocatorWithCleanup<W, true> > AlignedSecBlock;
mutable AlignedSecBlock m_wspace; // workspace
- AlignedSecBlock m_rkey; // round keys
+ AlignedSecBlock m_rkeys; // round keys
unsigned int m_kwords; // number of key words
+ unsigned int m_rounds; // number of rounds
};
//! \class SPECK64
@@ -141,6 +142,9 @@ public:
{
protected:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
+#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64
+ size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
+#endif
};
//! \brief Provides implementation for encryption transformation
@@ -151,6 +155,9 @@ public:
{
protected:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
+#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64
+ size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
+#endif
};
typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;