summaryrefslogtreecommitdiff
path: root/seckey.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2015-12-13 23:53:50 -0500
committerJeffrey Walton <noloader@gmail.com>2015-12-13 23:53:50 -0500
commitd9502a6ea93d7d5a5de6a0c8c28d807efeb1559b (patch)
tree488173a182613a9a21f71e3197dbdd9cd6882e44 /seckey.h
parent5a28b8e184f54e71a4148601f7da78d67a7e9590 (diff)
downloadcryptopp-git-d9502a6ea93d7d5a5de6a0c8c28d807efeb1559b.tar.gz
Updated documentation
Diffstat (limited to 'seckey.h')
-rw-r--r--seckey.h98
1 files changed, 53 insertions, 45 deletions
diff --git a/seckey.h b/seckey.h
index 90d7aa25..3df2a34b 100644
--- a/seckey.h
+++ b/seckey.h
@@ -28,31 +28,31 @@ inline CipherDir ReverseCipherDir(CipherDir dir)
}
//! \class FixedBlockSize
-//! \brief Inherited by block ciphers with fixed block size
-//! \tparam N the blocksize of the cipher
+//! \brief Inherited by algorithms with fixed block size
+//! \tparam N the blocksize of the algorithm
template <unsigned int N>
class FixedBlockSize
{
public:
- //! \brief The block size of the cipher provided as a constant.
+ //! \brief The block size of the algorithm provided as a constant.
CRYPTOPP_CONSTANT(BLOCKSIZE = N)
};
// ************** rounds ***************
//! \class FixedRounds
-//! \brief Inherited by ciphers with fixed number of rounds
-//! \tparam R the number of rounds used by the cipher
+//! \brief Inherited by algorithms with fixed number of rounds
+//! \tparam R the number of rounds used by the algorithm
template <unsigned int R>
class FixedRounds
{
public:
- //! \brief The number of rounds for the cipher provided as a constant.
+ //! \brief The number of rounds for the algorithm provided as a constant.
CRYPTOPP_CONSTANT(ROUNDS = R)
};
//! \class VariableRounds
-//! \brief Inherited by ciphers with variable number of rounds
+//! \brief Inherited by algorithms with variable number of rounds
//! \tparam D Default number of rounds
//! \tparam N Minimum number of rounds
//! \tparam D Maximum number of rounds
@@ -60,13 +60,13 @@ template <unsigned int D, unsigned int N=1, unsigned int M=INT_MAX> // use INT_
class VariableRounds
{
public:
- //! \brief The default number of rounds for the cipher provided as a constant.
+ //! \brief The default number of rounds for the algorithm provided as a constant.
CRYPTOPP_CONSTANT(DEFAULT_ROUNDS = D)
- //! \brief The minimum number of rounds for the cipher provided as a constant.
+ //! \brief The minimum number of rounds for the algorithm provided as a constant.
CRYPTOPP_CONSTANT(MIN_ROUNDS = N)
- //! \brief The maximum number of rounds for the cipher provided as a constant.
+ //! \brief The maximum number of rounds for the algorithm provided as a constant.
CRYPTOPP_CONSTANT(MAX_ROUNDS = M)
- //! \brief The default number of rounds for the cipher based on key length
+ //! \brief The default number of rounds for the algorithm based on key length
//! provided by a static function.
//! \param keylength the size of the key, in bytes
//! \details keylength is unused in the default implementation.
@@ -74,7 +74,7 @@ public:
{CRYPTOPP_UNUSED(keylength); return DEFAULT_ROUNDS;}
protected:
- //! \brief Validates the number of rounds for a cipher.
+ //! \brief Validates the number of rounds for an algorithm.
//! \param rounds the canddiate number of rounds
//! \param alg an Algorithm object used if the number of rounds are invalid
//! \throws InvalidRounds if the number of rounds are invalid
@@ -89,10 +89,10 @@ protected:
#endif
}
- //! \brief Validates the number of rounds for a cipher
+ //! \brief Validates the number of rounds for an algorithm
//! \param param the canddiate number of rounds
//! \param alg an Algorithm object used if the number of rounds are invalid
- //! \returns the number of rounds for the cipher
+ //! \returns the number of rounds for the algorithm
//! \throws InvalidRounds if the number of rounds are invalid
inline unsigned int GetRoundsAndThrowIfInvalid(const NameValuePairs &param, const Algorithm *alg)
{
@@ -109,30 +109,31 @@ protected:
//! \tparam N Default key length, in bytes
//! \tparam IV_REQ The IV requirements. See IV_Requirement in cryptlib.h for allowed values
//! \tparam IV_L Default IV length, in bytes
+//! \sa SimpleKeyingInterface
template <unsigned int N, unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE, unsigned int IV_L = 0>
class FixedKeyLength
{
public:
- //! \brief The default key length used by the cipher provided as a constant
+ //! \brief The default key length used by the algorithm provided as a constant
//! \details KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(KEYLENGTH=N)
- //! \brief The minimum key length used by the cipher provided as a constant
+ //! \brief The minimum key length used by the algorithm provided as a constant
//! \details MIN_KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(MIN_KEYLENGTH=N)
- //! \brief The maximum key length used by the cipher provided as a constant
+ //! \brief The maximum key length used by the algorithm provided as a constant
//! \details MAX_KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(MAX_KEYLENGTH=N)
- //! \brief The default key length used by the cipher provided as a constant
+ //! \brief The default key length used by the algorithm provided as a constant
//! \details DEFAULT_KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=N)
- //! \brief The default IV requirements for the cipher provided as a constant
+ //! \brief The default IV requirements for the algorithm provided as a constant
//! \details The default value is NOT_RESYNCHRONIZABLE. See IV_Requirement
//! in cryptlib.h for allowed values.
CRYPTOPP_CONSTANT(IV_REQUIREMENT = IV_REQ)
- //! \brief The default IV length used by the cipher provided as a constant
+ //! \brief The default IV length used by the algorithm provided as a constant
//! \details IV_LENGTH is provided in bytes, not bits. The default implementation uses 0.
CRYPTOPP_CONSTANT(IV_LENGTH = IV_L)
- //! \brief The default key length for the cipher provided by a static function.
+ //! \brief The default key length for the algorithm provided by a static function.
//! \param keylength the size of the key, in bytes
//! \details The default implementation returns KEYLENGTH. keylength is unused
//! in the default implementation.
@@ -148,6 +149,7 @@ public:
//! \tparam M Default key length multiple, in bytes. The default multiple is 1.
//! \tparam IV_REQ The IV requirements. See IV_Requirement in cryptlib.h for allowed values
//! \tparam IV_L Default IV length, in bytes. The default length is 0.
+//! \sa SimpleKeyingInterface
template <unsigned int D, unsigned int N, unsigned int M, unsigned int Q = 1, unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE, unsigned int IV_L = 0>
class VariableKeyLength
{
@@ -160,26 +162,26 @@ class VariableKeyLength
CRYPTOPP_COMPILE_ASSERT(M >= D);
public:
- //! \brief The minimum key length used by the cipher provided as a constant
+ //! \brief The minimum key length used by the algorithm provided as a constant
//! \details MIN_KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(MIN_KEYLENGTH=N)
- //! \brief The maximum key length used by the cipher provided as a constant
+ //! \brief The maximum key length used by the algorithm provided as a constant
//! \details MAX_KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(MAX_KEYLENGTH=M)
- //! \brief The default key length used by the cipher provided as a constant
+ //! \brief The default key length used by the algorithm provided as a constant
//! \details DEFAULT_KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=D)
- //! \brief The key length multiple used by the cipher provided as a constant
+ //! \brief The key length multiple used by the algorithm provided as a constant
//! \details MAX_KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(KEYLENGTH_MULTIPLE=Q)
- //! \brief The default IV requirements for the cipher provided as a constant
+ //! \brief The default IV requirements for the algorithm provided as a constant
//! \details The default value is NOT_RESYNCHRONIZABLE. See IV_Requirement
//! in cryptlib.h for allowed values.
CRYPTOPP_CONSTANT(IV_REQUIREMENT=IV_REQ)
- //! \brief The default initialization vector length for the cipher provided as a constant
+ //! \brief The default initialization vector length for the algorithm provided as a constant
//! \details IV_LENGTH is provided in bytes, not bits. The default implementation uses 0.
CRYPTOPP_CONSTANT(IV_LENGTH=IV_L)
- //! \brief Provides a valid key length for the cipher provided by a static function.
+ //! \brief Provides a valid key length for the algorithm provided by a static function.
//! \param keylength the size of the key, in bytes
//! \details If keylength is less than MIN_KEYLENGTH, then the function returns
//! MIN_KEYLENGTH. If keylength is greater than MAX_KEYLENGTH, then the function
@@ -209,27 +211,28 @@ public:
//! \tparam T another FixedKeyLength or VariableKeyLength class
//! \tparam IV_REQ The IV requirements. See IV_Requirement in cryptlib.h for allowed values
//! \tparam IV_L Default IV length, in bytes
+//! \sa SimpleKeyingInterface
template <class T, unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE, unsigned int IV_L = 0>
class SameKeyLengthAs
{
public:
- //! \brief The minimum key length used by the cipher provided as a constant
+ //! \brief The minimum key length used by the algorithm provided as a constant
//! \details MIN_KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(MIN_KEYLENGTH=T::MIN_KEYLENGTH)
- //! \brief The maximum key length used by the cipher provided as a constant
+ //! \brief The maximum key length used by the algorithm provided as a constant
//! \details MIN_KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(MAX_KEYLENGTH=T::MAX_KEYLENGTH)
- //! \brief The default key length used by the cipher provided as a constant
+ //! \brief The default key length used by the algorithm provided as a constant
//! \details MIN_KEYLENGTH is provided in bytes, not bits
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=T::DEFAULT_KEYLENGTH)
- //! \brief The default IV requirements for the cipher provided as a constant
+ //! \brief The default IV requirements for the algorithm provided as a constant
//! \details The default value is NOT_RESYNCHRONIZABLE. See IV_Requirement
//! in cryptlib.h for allowed values.
CRYPTOPP_CONSTANT(IV_REQUIREMENT=IV_REQ)
- //! \brief The default initialization vector length for the cipher provided as a constant
+ //! \brief The default initialization vector length for the algorithm provided as a constant
//! \details IV_LENGTH is provided in bytes, not bits. The default implementation uses 0.
CRYPTOPP_CONSTANT(IV_LENGTH=IV_L)
- //! \brief Provides a valid key length for the cipher provided by a static function.
+ //! \brief Provides a valid key length for the algorithm provided by a static function.
//! \param keylength the size of the key, in bytes
//! \details If keylength is less than MIN_KEYLENGTH, then the function returns
//! MIN_KEYLENGTH. If keylength is greater than MAX_KEYLENGTH, then the function
@@ -241,30 +244,35 @@ public:
{return T::StaticGetValidKeyLength(keylength);}
};
-// ************** implementation helper for SimpleKeyed ***************
+// ************** implementation helper for SimpleKeyingInterface ***************
//! \class SimpleKeyingInterfaceImpl
//! \brief Provides class member functions to access SimpleKeyingInterface constants
//! \tparam BASE a SimpleKeyingInterface derived class
//! \tparam INFO a SimpleKeyingInterface derived class
+//! \sa SimpleKeyingInterface
template <class BASE, class INFO = BASE>
class CRYPTOPP_NO_VTABLE SimpleKeyingInterfaceImpl : public BASE
{
public:
- //! \brief The minimum key length used by the cipher
+ //! \brief The minimum key length used by the algorithm
+ //! \returns minimum key length used by the algorithm, in bytes
size_t MinKeyLength() const
{return INFO::MIN_KEYLENGTH;}
- //! \brief The maximum key length used by the cipher
+ //! \brief The maximum key length used by the algorithm
+ //! \returns maximum key length used by the algorithm, in bytes
size_t MaxKeyLength() const
{return (size_t)INFO::MAX_KEYLENGTH;}
- //! \brief The default key length used by the cipher
+ //! \brief The default key length used by the algorithm
+ //! \returns default key length used by the algorithm, in bytes
size_t DefaultKeyLength() const
{return INFO::DEFAULT_KEYLENGTH;}
- //! \brief Provides a valid key length for the cipher
+ //! \brief Provides a valid key length for the algorithm
//! \param keylength the size of the key, in bytes
+ //! \returns the valid key lenght, in bytes
//! \details keylength is provided in bytes, not bits. If keylength is less than MIN_KEYLENGTH,
//! then the function returns MIN_KEYLENGTH. If keylength is greater than MAX_KEYLENGTH,
//! then the function returns MAX_KEYLENGTH. if If keylength is a multiple of KEYLENGTH_MULTIPLE,
@@ -272,13 +280,13 @@ public:
//! KEYLENGTH_MULTIPLE.
size_t GetValidKeyLength(size_t keylength) const {return INFO::StaticGetValidKeyLength(keylength);}
- //! \brief The default IV requirements for the cipher
+ //! \brief The default IV requirements for the algorithm
//! \details The default value is NOT_RESYNCHRONIZABLE. See IV_Requirement
//! in cryptlib.h for allowed values.
SimpleKeyingInterface::IV_Requirement IVRequirement() const
{return (SimpleKeyingInterface::IV_Requirement)INFO::IV_REQUIREMENT;}
- //! \brief The default initialization vector length for the cipher
+ //! \brief The default initialization vector length for the algorithm
//! \details IVSize is provided in bytes, not bits. The default implementation uses IV_LENGTH, which is 0.
unsigned int IVSize() const
{return INFO::IV_LENGTH;}
@@ -292,8 +300,8 @@ template <class INFO, class BASE = BlockCipher>
class CRYPTOPP_NO_VTABLE BlockCipherImpl : public AlgorithmImpl<SimpleKeyingInterfaceImpl<TwoBases<BASE, INFO> > >
{
public:
- //! Provides the block size of the cipher
- //! \returns the block size of the cipher, in bytes
+ //! Provides the block size of the algorithm
+ //! \returns the block size of the algorithm, in bytes
unsigned int BlockSize() const {return this->BLOCKSIZE;}
};
@@ -360,13 +368,13 @@ public:
//! \details The message authentication code is not keyed.
MessageAuthenticationCodeFinal() {}
//! \brief Construct a BlockCipherFinal
- //! \param key a byte array used to key the cipher
+ //! \param key a byte array used to key the algorithm
//! \details key must be at least DEFAULT_KEYLENGTH in length. Internally, the function calls
//! SimpleKeyingInterface::SetKey.
MessageAuthenticationCodeFinal(const byte *key)
{this->SetKey(key, this->DEFAULT_KEYLENGTH);}
//! \brief Construct a BlockCipherFinal
- //! \param key a byte array used to key the cipher
+ //! \param key a byte array used to key the algorithm
//! \param length the length of the byte array
//! \details key must be at least DEFAULT_KEYLENGTH in length. Internally, the function calls
//! SimpleKeyingInterface::SetKey.