summaryrefslogtreecommitdiff
path: root/speck.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-11-20 08:33:33 -0500
committerJeffrey Walton <noloader@gmail.com>2017-11-20 08:33:33 -0500
commit4b3560baef8e8d7406e41eba0d25c17290993609 (patch)
tree063afe93e6082708c6a326b5aa6d1bf5125edf24 /speck.h
parent93fb412215d9ac99400f1850735ac84d74825f38 (diff)
downloadcryptopp-git-4b3560baef8e8d7406e41eba0d25c17290993609.tar.gz
Update documentation
Whitespace check-in
Diffstat (limited to 'speck.h')
-rw-r--r--speck.h89
1 files changed, 55 insertions, 34 deletions
diff --git a/speck.h b/speck.h
index 81917ed5..b4092689 100644
--- a/speck.h
+++ b/speck.h
@@ -21,6 +21,9 @@ NAMESPACE_BEGIN(CryptoPP)
//! \class SPECK_Info
//! \brief SPECK block cipher information
//! \tparam BS 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 BS, unsigned int D, unsigned int N, unsigned int M>
struct SPECK_Info : public FixedBlockSize<BS>, VariableKeyLength<D, N, M>
@@ -35,23 +38,25 @@ struct SPECK_Info : public FixedBlockSize<BS>, VariableKeyLength<D, N, M>
//! \class SPECK_Base
//! \brief SPECK block cipher base class
//! \tparam BS block size of the cipher, in bytes
-//! \details User code should use SPECK128, SPECK512, SPECK1024
-//! \sa SPECK32, SPECK48, SPECK64, SPECK96, SPECK128, <a href="http://www.cryptopp.com/wiki/SPECK">SPECK</a>
+//! \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() {}
+
typedef SecBlock<W, AllocatorWithCleanup<W, true> > AlignedSecBlock;
mutable AlignedSecBlock m_wspace; // workspace
AlignedSecBlock m_rkey; // round keys
- unsigned int m_kwords; // number of key words
+ unsigned int m_kwords; // number of key words
};
//! \class SPECK64
//! \brief SPECK 64-bit block cipher
//! \details SPECK64 provides 64-bit block size. The valid key sizes are 98-bit and 128-bit.
//! \note Crypto++ provides a byte oriented implementation
-//! \sa SPECK32, SPECK64, and SPECK128, <a href="http://www.cryptopp.com/wiki/SPECK">SPECK</a>
+//! \sa SPECK64, SPECK128, <a href="http://www.cryptopp.com/wiki/SPECK">SPECK</a>
//! \since Crypto++ 6.0
class CRYPTOPP_NO_VTABLE SPECK64 : public SPECK_Info<8, 12, 12, 16>, public BlockCipherDocumentation
{
@@ -61,26 +66,34 @@ public:
//! \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() + "(" + IntToString(m_kwords*sizeof(word32)*8) + ")";
- }
+ public:
+ std::string AlgorithmName() const {
+ return StaticAlgorithmName() + "(" + IntToString(m_kwords*sizeof(word32)*8) + ")";
+ }
protected:
void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs &params);
};
- class CRYPTOPP_NO_VTABLE Enc : public Base
- {
- protected:
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
- };
+ //! \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;
+ };
- class CRYPTOPP_NO_VTABLE Dec : public Base
- {
- protected:
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
- };
+ //! \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;
+ };
typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
@@ -90,7 +103,7 @@ public:
//! \brief SPECK 128-bit block cipher
//! \details SPECK128 provides 128-bit block size. The valid key sizes are 128-bit, 192-bit and 256-bit.
//! \note Crypto++ provides a byte oriented implementation
-//! \sa SPECK32, SPECK64, and SPECK128, <a href="http://www.cryptopp.com/wiki/SPECK">SPECK</a>
+//! \sa SPECK64, SPECK128, <a href="http://www.cryptopp.com/wiki/SPECK">SPECK</a>
//! \since Crypto++ 6.0
class CRYPTOPP_NO_VTABLE SPECK128 : public SPECK_Info<16, 16, 16, 32>, public BlockCipherDocumentation
{
@@ -100,26 +113,34 @@ public:
//! \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() + "(" + IntToString(sizeof(word64)*8) + ")";
- }
+ public:
+ std::string AlgorithmName() const {
+ return StaticAlgorithmName() + "(" + IntToString(sizeof(word64)*8) + ")";
+ }
protected:
void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs &params);
};
- class CRYPTOPP_NO_VTABLE Enc : public Base
- {
- protected:
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
- };
-
- class CRYPTOPP_NO_VTABLE Dec : public Base
- {
- protected:
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
- };
+ //! \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;
+ };
+
+ //! \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;
+ };
typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;