diff options
author | Jeffrey Walton <noloader@gmail.com> | 2018-02-14 04:06:16 -0500 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2018-02-14 04:06:16 -0500 |
commit | 15b14cc6189084e4b4ef1930087a56bddd5a8aee (patch) | |
tree | ef1165d484ed0ed3083a323e0fed651d472171eb /speck.h | |
parent | 541caa3978278efcbca006094d9136473ca5ffe8 (diff) | |
download | cryptopp-git-15b14cc6189084e4b4ef1930087a56bddd5a8aee.tar.gz |
Remove Simon and Speck ciphers (GH #585)
We recently learned our Simon and Speck implementation was wrong. The removal will stop harm until we can loop back and fix the issue.
The issue is, the paper, the test vectors and the ref-impl do not align. Each produces slightly different result. We followed the test vectors but they turned out to be wrong for the ciphers.
We have one kernel test vector but we don't have a working implementation to observe it to fix our implementation. Ugh...
Diffstat (limited to 'speck.h')
-rw-r--r-- | speck.h | 179 |
1 files changed, 0 insertions, 179 deletions
diff --git a/speck.h b/speck.h deleted file mode 100644 index 88f87d3b..00000000 --- a/speck.h +++ /dev/null @@ -1,179 +0,0 @@ -// speck.h - written and placed in the public domain by Jeffrey Walton
-
-/// \file speck.h
-/// \brief Classes for the Speck block cipher
-/// \details Speck is a block cipher designed by Ray Beaulieu, Douglas Shors, Jason Smith,
-/// Stefan Treatman-Clark, Bryan Weeks and Louis Wingers.
-/// \sa <A HREF="http://eprint.iacr.org/2013/404">The SIMON and SPECK Families of
-/// Lightweight Block Ciphers</A> and <A HREF="http://iadgov.github.io/simon-speck/">
-/// The Simon and Speck GitHub</A>
-/// \since Crypto++ 6.0
-
-#ifndef CRYPTOPP_SPECK_H
-#define CRYPTOPP_SPECK_H
-
-#include "config.h"
-#include "seckey.h"
-#include "secblock.h"
-
-#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64
-# define CRYPTOPP_SPECK64_ADVANCED_PROCESS_BLOCKS 1
-#endif
-
-#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64
-# define CRYPTOPP_SPECK128_ADVANCED_PROCESS_BLOCKS 1
-#endif
-
-NAMESPACE_BEGIN(CryptoPP)
-
-/// \brief SPECK block cipher information
-/// \tparam L block size of the cipher, in bytes
-/// \tparam D default key length, in bytes
-/// \tparam N minimum key length, in bytes
-/// \tparam M maximum key length, in bytes
-/// \since Crypto++ 6.0
-template <unsigned int L, unsigned int D, unsigned int N, unsigned int M>
-struct SPECK_Info : public FixedBlockSize<L>, VariableKeyLength<D, N, M>
-{
- static const std::string StaticAlgorithmName()
- {
- // Format is Cipher-Blocksize(Keylength)
- return "SPECK-" + IntToString(L*8);
- }
-};
-
-/// \brief SPECK block cipher base class
-/// \tparam W the word type
-/// \details User code should use SPECK64 or SPECK128
-/// \sa SPECK64, SPECK128, <a href="http://www.cryptopp.com/wiki/SPECK">SPECK</a>
-/// \since Crypto++ 6.0
-template <class W>
-struct SPECK_Base
-{
- virtual ~SPECK_Base() {}
- SPECK_Base() : m_kwords(0), m_rounds(0) {}
-
- typedef SecBlock<W, AllocatorWithCleanup<W, true> > AlignedSecBlock;
- mutable AlignedSecBlock m_wspace; // workspace
- AlignedSecBlock m_rkeys; // round keys
- unsigned int m_kwords; // number of key words
- unsigned int m_rounds; // number of rounds
-};
-
-/// \brief SPECK 64-bit block cipher
-/// \details Speck is a block cipher designed by Ray Beaulieu, Douglas Shors, Jason Smith,
-/// Stefan Treatman-Clark, Bryan Weeks and Louis Wingers.
-/// \details SPECK64 provides 64-bit block size. The valid key sizes are 96-bit and 128-bit.
-/// \sa SPECK64, SPECK128, <A HREF="http://eprint.iacr.org/2013/404">The SIMON and SPECK
-/// Families of Lightweight Block Ciphers</A>, <A HREF="http://iadgov.github.io/simon-speck/">
-/// The Simon and Speck GitHub</A>, <a href="http://www.cryptopp.com/wiki/SPECK">SPECK</a> on the
-/// Crypto++ wiki
-/// \since Crypto++ 6.0
-class CRYPTOPP_NO_VTABLE SPECK64 : public SPECK_Info<8, 12, 12, 16>, public BlockCipherDocumentation
-{
-public:
- /// \brief SPECK block cipher transformation functions
- /// \details Provides implementation common to encryption and decryption
- /// \since Crypto++ 6.0
- class CRYPTOPP_NO_VTABLE Base : protected SPECK_Base<word32>, public BlockCipherImpl<SPECK_Info<8, 12, 12, 16> >
- {
- public:
- std::string AlgorithmName() const {
- return StaticAlgorithmName() + (m_kwords == 0 ? "" :
- "(" + IntToString(m_kwords*sizeof(word32)*8) + ")");
- }
-
- protected:
- void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs ¶ms);
- };
-
- /// \brief Provides implementation for encryption transformation
- /// \details Enc provides implementation for encryption transformation. All key
- /// sizes are supported.
- /// \since Crypto++ 6.0
- class CRYPTOPP_NO_VTABLE Enc : public Base
- {
- protected:
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
-#if CRYPTOPP_SPECK64_ADVANCED_PROCESS_BLOCKS
- size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
-#endif
- };
-
- /// \brief Provides implementation for encryption transformation
- /// \details Dec provides implementation for decryption transformation. All key
- /// sizes are supported.
- /// \since Crypto++ 6.0
- class CRYPTOPP_NO_VTABLE Dec : public Base
- {
- protected:
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
-#if CRYPTOPP_SPECK64_ADVANCED_PROCESS_BLOCKS
- size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
-#endif
- };
-
- typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
- typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
-};
-
-/// \brief SPECK 128-bit block cipher
-/// \details Speck is a block cipher designed by Ray Beaulieu, Douglas Shors, Jason Smith,
-/// Stefan Treatman-Clark, Bryan Weeks and Louis Wingers.
-/// \details SPECK128 provides 128-bit block size. The valid key sizes are 128-bit, 192-bit and 256-bit.
-/// \sa SPECK64, SPECK128, <A HREF="http://eprint.iacr.org/2013/404">The SIMON and SPECK
-/// Families of Lightweight Block Ciphers</A>, <A HREF="http://iadgov.github.io/simon-speck/">
-/// The Simon and Speck GitHub</A>, <a href="http://www.cryptopp.com/wiki/SPECK">SPECK</a> on the
-/// Crypto++ wiki
-/// \since Crypto++ 6.0
-class CRYPTOPP_NO_VTABLE SPECK128 : public SPECK_Info<16, 16, 16, 32>, public BlockCipherDocumentation
-{
-public:
- /// \brief SPECK block cipher transformation functions
- /// \details Provides implementation common to encryption and decryption
- /// \since Crypto++ 6.0
- class CRYPTOPP_NO_VTABLE Base : protected SPECK_Base<word64>, public BlockCipherImpl<SPECK_Info<16, 16, 16, 32> >
- {
- public:
- std::string AlgorithmName() const {
- return StaticAlgorithmName() + (m_kwords == 0 ? "" :
- "(" + IntToString(m_kwords*sizeof(word64)*8) + ")");
- }
-
- protected:
- void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs ¶ms);
- };
-
- /// \brief Provides implementation for encryption transformation
- /// \details Enc provides implementation for encryption transformation. All key
- /// sizes are supported.
- /// \since Crypto++ 6.0
- class CRYPTOPP_NO_VTABLE Enc : public Base
- {
- protected:
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
-#if CRYPTOPP_SPECK128_ADVANCED_PROCESS_BLOCKS
- size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
-#endif
- };
-
- /// \brief Provides implementation for encryption transformation
- /// \details Dec provides implementation for decryption transformation. All key
- /// sizes are supported.
- /// \since Crypto++ 6.0
- class CRYPTOPP_NO_VTABLE Dec : public Base
- {
- protected:
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
-#if CRYPTOPP_SPECK128_ADVANCED_PROCESS_BLOCKS
- size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
-#endif
- };
-
- typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
- typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
-};
-
-NAMESPACE_END
-
-#endif // CRYPTOPP_SPECK_H
|