diff --git a/3way.h b/3way.h index 72f9984d..16affa6c 100644 --- a/3way.h +++ b/3way.h @@ -13,16 +13,15 @@ NAMESPACE_BEGIN(CryptoPP) //! \class ThreeWay_Info -//! \brief The cipher's key, iv, block size and name information. +//! \brief ThreeWay block cipher information struct ThreeWay_Info : public FixedBlockSize<12>, public FixedKeyLength<12>, public VariableRounds<11> { static const char *StaticAlgorithmName() {return "3-Way";} }; -// 3-Way - //! \class ThreeWay -//! \brief Provides 3-Way encryption and decryption +//! \brief ThreeWay block cipher +//! \sa 3-Way class ThreeWay : public ThreeWay_Info, public BlockCipherDocumentation { //! \class Base diff --git a/aes.h b/aes.h index 5588531b..217738bd 100644 --- a/aes.h +++ b/aes.h @@ -10,7 +10,9 @@ NAMESPACE_BEGIN(CryptoPP) -//! AES winner, announced on 10/2/2000 +//! \class AES +//! \brief AES block cipher (Rijndael) +//! \sa AES winner, announced on 10/2/2000 DOCUMENTED_TYPEDEF(Rijndael, AES); typedef RijndaelEncryption AESEncryption; diff --git a/blowfish.h b/blowfish.h index 98336b45..41497a66 100644 --- a/blowfish.h +++ b/blowfish.h @@ -12,7 +12,7 @@ NAMESPACE_BEGIN(CryptoPP) //! \class Blowfish_Info -//! \brief The cipher's key, iv, block size and name information. +//! \brief Blowfish block cipher information struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 4, 56>, public FixedRounds<16> { static const char *StaticAlgorithmName() {return "Blowfish";} @@ -20,8 +20,8 @@ struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 4, // Blowfish -//! \class Blowfish -//! \brief Provides Blowfish encryption and decryption +//! \class Blowfish_Info +//! \brief Blowfish block cipher class Blowfish : public Blowfish_Info, public BlockCipherDocumentation { //! \class Base diff --git a/camellia.h b/camellia.h index 91e765e5..ff0622ac 100644 --- a/camellia.h +++ b/camellia.h @@ -12,13 +12,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class Camellia_Info +//! \brief Camellia block cipher information struct Camellia_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8> { static const char *StaticAlgorithmName() {return "Camellia";} }; -/// Camellia +//! \class Camellia_Info +//! \brief Camellia block cipher +//! \sa Camellia class Camellia : public Camellia_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl diff --git a/cast.h b/cast.h index d464bbf7..05c0c50c 100644 --- a/cast.h +++ b/cast.h @@ -17,13 +17,16 @@ protected: static const word32 S[8][256]; }; -//! algorithm info +//! \class CAST128_Info +//! \brief CAST128 block cipher information struct CAST128_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 5, 16> { static const char *StaticAlgorithmName() {return "CAST-128";} }; -/// CAST-128 +//! \class CAST128 +//! \brief CAST128 block cipher +//! \sa CAST-128 class CAST128 : public CAST128_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl @@ -53,13 +56,16 @@ public: typedef BlockCipherFinal Decryption; }; -//! algorithm info +//! \class CAST256_Info +//! \brief CAST256 block cipher information struct CAST256_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32> { static const char *StaticAlgorithmName() {return "CAST-256";} }; -//! CAST-256 +//! \class CAST256 +//! \brief CAST256 block cipher +//! \sa CAST-256 class CAST256 : public CAST256_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl diff --git a/cryptlib.h b/cryptlib.h index 555b0401..f7cd3337 100644 --- a/cryptlib.h +++ b/cryptlib.h @@ -493,7 +493,8 @@ public: }; //! \class SimpleKeyingInterface -//! Interface for algorithms that take byte strings as keys +//! \brief Interface for algorithms that take byte strings as keys +//! \sa FixedKeyLength(), VariableKeyLength(), SameKeyLengthAs(), SimpleKeyingInterfaceImpl() class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE SimpleKeyingInterface { public: @@ -507,11 +508,14 @@ public: virtual size_t DefaultKeyLength() const =0; //! \brief + //! \param n the desired keylength //! \returns the smallest valid key length in bytes that is greater than or equal to min(n, GetMaxKeyLength()) virtual size_t GetValidKeyLength(size_t n) const =0; //! \brief Returns whether keylength is a valid key length - //! \details Internally the function calls GetValidKeyLength() + //! \param keylength the requested keylength + //! \returns true if keylength is valid, false otherwise + //! \details Internally the function calls GetValidKeyLength() virtual bool IsValidKeyLength(size_t keylength) const {return keylength == GetValidKeyLength(keylength);} @@ -527,8 +531,8 @@ public: //! \param length the size of the key, in bytes //! \param rounds the number of rounds to apply the transformation function, //! if applicable - //! \details SetKeyWithRounds calls SetKey with an NameValuePairs - //! object that just specifies rounds. rounds is an integer parameter, + //! \details SetKeyWithRounds() calls SetKey() with a NameValuePairs + //! object that only specifies rounds. rounds is an integer parameter, //! and -1 means use the default number of rounds. void SetKeyWithRounds(const byte *key, size_t length, int rounds); @@ -537,27 +541,32 @@ public: //! \param length the size of the key, in bytes //! \param iv the intiialization vector to use when keying the object //! \param ivLength the size of the iv, in bytes - //! \details SetKeyWithIV calls SetKey with an NameValuePairs object - //! that just specifies iv. iv is a byte buffer with size ivLength. + //! \details SetKeyWithIV() calls SetKey() with a NameValuePairs + //! that only specifies IV. The IV is a byte buffer with size ivLength. + //! ivLength is an integer parameter, and -1 means use IVSize(). void SetKeyWithIV(const byte *key, size_t length, const byte *iv, size_t ivLength); //! \brief Sets or reset the key of this object //! \param key the key to use when keying the object //! \param length the size of the key, in bytes //! \param iv the intiialization vector to use when keying the object - //! \details SetKeyWithIV calls SetKey with an NameValuePairs object - //! that just specifies iv. iv is a byte buffer, and it must have - //! a size IVSize. + //! \details SetKeyWithIV() calls SetKey() with a NameValuePairs() object + //! that only specifies iv. iv is a byte buffer, and it must have + //! a size IVSize(). void SetKeyWithIV(const byte *key, size_t length, const byte *iv) {SetKeyWithIV(key, length, iv, IVSize());} - //! \brief Provides IV requirements as an enumerated value. + //! \brief Secure IVs requirements as enumerated values. + //! \details Provides secure IV requirements as a monotomically increasing enumerated values. Requirements can be + //! compared using less than (<) and greater than (>). For example, UNIQUE_IV < RANDOM_IV + //! and UNPREDICTABLE_RANDOM_IV > RANDOM_IV. + //! \sa IsResynchronizable(), CanUseRandomIVs(), CanUsePredictableIVs(), CanUseStructuredIVs() enum IV_Requirement { //! \brief The IV must be unique UNIQUE_IV = 0, - //! \brief The IV must be random + //! \brief The IV must be random and possibly predictable RANDOM_IV, - //! \brief The IV must be unpredictable + //! \brief The IV must be random and unpredictable UNPREDICTABLE_RANDOM_IV, //! \brief The IV is set by the object INTERNALLY_GENERATED_IV, @@ -565,42 +574,69 @@ public: NOT_RESYNCHRONIZABLE }; - //! returns the minimal requirement for secure IVs + //! \brief Minimal requirement for secure IVs + //! \returns the secure IV requirement of the algorithm virtual IV_Requirement IVRequirement() const =0; - //! returns whether the object can be resynchronized (i.e. supports initialization vectors) - /*! If this function returns true, and no IV is passed to SetKey() and CanUseStructuredIVs()==true, an IV of all 0's will be assumed. */ + //! \brief Determines if the object can be resynchronized + //! \returns true if the object can be resynchronized (i.e. supports initialization vectors), false otherwise + //! \note If this function returns true, and no IV is passed to SetKey() and CanUseStructuredIVs()==true, + //! an IV of all 0's will be assumed. bool IsResynchronizable() const {return IVRequirement() < NOT_RESYNCHRONIZABLE;} - //! returns whether the object can use random IVs (in addition to ones returned by GetNextIV) + + //! \brief Determines if the object can use random IVs + //! \returns true if the object can use random IVs (in addition to ones returned by GetNextIV), false otherwise bool CanUseRandomIVs() const {return IVRequirement() <= UNPREDICTABLE_RANDOM_IV;} - //! returns whether the object can use random but possibly predictable IVs (in addition to ones returned by GetNextIV) + + //! \brief Determines if the object can use random but possibly predictable IVs + //! \returns true if the object can use random but possibly predictable IVs (in addition to ones returned by + //! GetNextIV), false otherwise bool CanUsePredictableIVs() const {return IVRequirement() <= RANDOM_IV;} - //! returns whether the object can use structured IVs, for example a counter (in addition to ones returned by GetNextIV) + + //! \brief Determines if the object can use structured IVs + //! returns whether the object can use structured IVs, for example a counter (in addition to ones returned by + //! GetNextIV), false otherwise bool CanUseStructuredIVs() const {return IVRequirement() <= UNIQUE_IV;} //! \brief Returns length of the IV accepted by this object + //! \returns the size of an IV, in bytes + //! \throws NotImplemented() if the object does not support resynchronization //! \details The default implementation throws NotImplemented virtual unsigned int IVSize() const {throw NotImplemented(GetAlgorithm().AlgorithmName() + ": this object doesn't support resynchronization");} - //! returns default length of IVs accepted by this object + + //! \brief Provides the default size of an IV + //! \returns default length of IVs accepted by this object, in bytes unsigned int DefaultIVLength() const {return IVSize();} - //! returns minimal length of IVs accepted by this object + + //! \brief Provides the minimum size of an IV + //! \returns minimal length of IVs accepted by this object, in bytes + //! \throws NotImplemented() if the object does not support resynchronization virtual unsigned int MinIVLength() const {return IVSize();} - //! returns maximal length of IVs accepted by this object + + //! \brief Provides the maximum size of an IV + //! \returns maximal length of IVs accepted by this object, in bytes + //! \throws NotImplemented() if the object does not support resynchronization virtual unsigned int MaxIVLength() const {return IVSize();} - //! resynchronize with an IV. ivLength=-1 means use IVSize() + + //! \brief Resynchronize with an IV + //! \param iv the initialization vector + //! \param ivLength the size of the initialization vector, in bytes + //! \details Resynchronize() resynchronizes with an IV provided by the caller. ivLength=-1 means use IVSize(). + //! \throws NotImplemented() if the object does not support resynchronization virtual void Resynchronize(const byte *iv, int ivLength=-1) { CRYPTOPP_UNUSED(iv); CRYPTOPP_UNUSED(ivLength); throw NotImplemented(GetAlgorithm().AlgorithmName() + ": this object doesn't support resynchronization"); } - //! \brief Gets a secure IV for the next message + //! \brief Retrieves a secure IV for the next message //! \param rng a RandomNumberGenerator to produce keying material //! \param iv a block of bytes to receive the IV + //! \details The IV must be at least IVSize() in length. //! \details This method should be called after you finish encrypting one message and are ready - //! to start the next one. After calling it, you must call SetKey() or Resynchronize() - //! before using this object again. - //! \details key must be at least IVSize() in length. + //! to start the next one. After calling it, you must call SetKey() or Resynchronize(). + //! before using this object again. + //! \details Internally, the base class implementation calls RandomNumberGenerator's GenerateBlock() //! \note This method is not implemented on decryption objects. virtual void GetNextIV(RandomNumberGenerator &rng, byte *iv); @@ -638,7 +674,7 @@ protected: void ThrowIfInvalidIV(const byte *iv); //! \brief Validates the IV length - //! \param length the size of the IV, in bytes + //! \param length the size of an IV, in bytes //! \throws InvalidArgument if the number of rounds are invalid size_t ThrowIfInvalidIVLength(int length); @@ -956,7 +992,7 @@ public: //! \param digest a pointer to the buffer to receive the hash //! \param digestSize the size of the truncated digest, in bytes //! \details TruncatedFinal() call Final() and then copies digestSize bytes to digest - //! \details TruncatedFinal() restarts the hash for the next nmessage. + //! \details TruncatedFinal() restarts the hash for the next message. virtual void TruncatedFinal(byte *digest, size_t digestSize) =0; //! \brief Updates the hash with additional input and computes the hash of the current message @@ -1002,7 +1038,10 @@ public: #endif protected: - //! \brief Exception thrown when the truncated digest size is greater than DigestSize() + //! \brief Validates a truncated digest size + //! \param size the requested digest size + //! \throws InvalidArgument if the algorithm's digest size cannot be truncated to the requested size + //! \details Throws an exception when the truncated digest size is greater than DigestSize() void ThrowIfInvalidTruncatedSize(size_t size) const; }; @@ -2035,37 +2074,41 @@ public: }; //! \brief Interface for public keys - class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PublicKey : virtual public CryptoMaterial { }; //! \brief Interface for private keys - class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PrivateKey : public GeneratableCryptoMaterial { }; //! \brief Interface for crypto prameters - class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CryptoParameters : public GeneratableCryptoMaterial { }; //! \brief Interface for asymmetric algorithms - class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AsymmetricAlgorithm : public Algorithm { public: - //! returns a reference to the crypto material used by this object + //! \brief Retrieves a reference to CryptoMaterial + //! \returns a reference to the crypto material used by this object virtual CryptoMaterial & AccessMaterial() =0; - //! returns a const reference to the crypto material used by this object + + //! \brief Retrieves a reference to CryptoMaterial + //! \returns a const reference to the crypto material used by this object virtual const CryptoMaterial & GetMaterial() const =0; - //! for backwards compatibility, calls AccessMaterial().Load(bt) + //! \brief Loads this object from a BufferedTransformation + //! \param bt a BufferedTransformation object + //! \deprecated for backwards compatibility, calls AccessMaterial().Load(bt) void BERDecode(BufferedTransformation &bt) {AccessMaterial().Load(bt);} - //! for backwards compatibility, calls GetMaterial().Save(bt) + + //! \brief Saves this object to a BufferedTransformation + //! \param bt a BufferedTransformation object + //! \deprecated for backwards compatibility, calls GetMaterial().Save(bt) void DEREncode(BufferedTransformation &bt) const {GetMaterial().Save(bt);} @@ -2075,16 +2118,18 @@ public: }; //! \brief Interface for asymmetric algorithms using public keys - class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PublicKeyAlgorithm : public AsymmetricAlgorithm { public: // VC60 workaround: no co-variant return type - CryptoMaterial & AccessMaterial() {return AccessPublicKey();} - const CryptoMaterial & GetMaterial() const {return GetPublicKey();} + CryptoMaterial & AccessMaterial() + {return AccessPublicKey();} + const CryptoMaterial & GetMaterial() const + {return GetPublicKey();} virtual PublicKey & AccessPublicKey() =0; - virtual const PublicKey & GetPublicKey() const {return const_cast(this)->AccessPublicKey();} + virtual const PublicKey & GetPublicKey() const + {return const_cast(this)->AccessPublicKey();} #ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~PublicKeyAlgorithm() {} @@ -2092,7 +2137,6 @@ public: }; //! \brief Interface for asymmetric algorithms using private keys - class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PrivateKeyAlgorithm : public AsymmetricAlgorithm { public: @@ -2108,7 +2152,6 @@ public: }; //! \brief Interface for key agreement algorithms - class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE KeyAgreementAlgorithm : public AsymmetricAlgorithm { public: @@ -2124,33 +2167,41 @@ public: }; //! \brief Interface for public-key encryptors and decryptors - -/*! This class provides an interface common to encryptors and decryptors - for querying their plaintext and ciphertext lengths. -*/ +//! \details This class provides an interface common to encryptors and decryptors +//! for querying their plaintext and ciphertext lengths. class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_CryptoSystem { public: virtual ~PK_CryptoSystem() {} - //! maximum length of plaintext for a given ciphertext length - /*! \note This function returns 0 if ciphertextLength is not valid (too long or too short). */ + //! \brief Provides the maximum length of plaintext for a given ciphertext length + //! \returns the maximum size of the plaintext, in bytes + //! \details This function returns 0 if ciphertextLength is not valid (too long or too short). virtual size_t MaxPlaintextLength(size_t ciphertextLength) const =0; - //! calculate length of ciphertext given length of plaintext - /*! \note This function returns 0 if plaintextLength is not valid (too long). */ + //! \brief Calculate the length of ciphertext given length of plaintext + //! \returns the maximum size of the ciphertext, in bytes + //! \details This function returns 0 if plaintextLength is not valid (too long). virtual size_t CiphertextLength(size_t plaintextLength) const =0; - //! this object supports the use of the parameter with the given name - /*! some possible parameter names: EncodingParameters, KeyDerivationParameters */ + //! \brief Determines whether this object supports the use of a named parameter + //! \param name the name of the parameter + //! \returns true if the parameter name is supported, false otherwise + //! \details Some possible parameter names: EncodingParameters(), KeyDerivationParameters() + //! and others Parameters listed in argnames.h virtual bool ParameterSupported(const char *name) const =0; - //! return fixed ciphertext length, if one exists, otherwise return 0 - /*! \note "Fixed" here means length of ciphertext does not depend on length of plaintext. - It usually does depend on the key length. */ + //! \brief Provides the fixed ciphertext length, if one exists + //! \returns the fixed ciphertext length if one exists, otherwise 0 + //! \details "Fixed" here means length of ciphertext does not depend on length of plaintext. + //! In this case, it usually does depend on the key length. virtual size_t FixedCiphertextLength() const {return 0;} - //! return maximum plaintext length given the fixed ciphertext length, if one exists, otherwise return 0 + //! \brief Provides the maximum plaintext length given a fixed ciphertext length + //! \return maximum plaintext length given the fixed ciphertext length, if one exists, + //! otherwise return 0. + //! \details FixedMaxPlaintextLength(0 returns the maximum plaintext length given the fixed ciphertext + //! length, if one exists, otherwise return 0. virtual size_t FixedMaxPlaintextLength() const {return 0;} #ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY diff --git a/gost.h b/gost.h index 6ef844e4..12dbb344 100644 --- a/gost.h +++ b/gost.h @@ -11,13 +11,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class GOST_Info +//! \brief GOST block cipher information struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32> { static const char *StaticAlgorithmName() {return "GOST";} }; -/// GOST +//! \class GOST +//! \brief GOST block cipher +//! \sa GOST class GOST : public GOST_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl diff --git a/idea.h b/idea.h index 897de889..a2b50673 100644 --- a/idea.h +++ b/idea.h @@ -11,13 +11,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class IDEA_Info +//! \brief IDEA block cipher information struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<8> { static const char *StaticAlgorithmName() {return "IDEA";} }; -/// IDEA +//! \class IDEA +//! \brief IDEA block cipher +//! \sa IDEA class IDEA : public IDEA_Info, public BlockCipherDocumentation { public: // made public for internal purposes diff --git a/lubyrack.h b/lubyrack.h index 1c9c62da..ad301bd6 100644 --- a/lubyrack.h +++ b/lubyrack.h @@ -16,14 +16,16 @@ template struct DigestSizeDoubleWorkaround // VC60 workaround CRYPTOPP_CONSTANT(RESULT = 2*T::DIGESTSIZE) }; -//! algorithm info +//! \class LR_Info +//! \brief Luby-Rackoff block cipher information template struct LR_Info : public VariableKeyLength<16, 0, 2*(INT_MAX/2), 2>, public FixedBlockSize::RESULT> { static std::string StaticAlgorithmName() {return std::string("LR/")+T::StaticAlgorithmName();} }; -//! Luby-Rackoff +//! \class LR +//! \brief Luby-Rackoff block cipher template class LR : public LR_Info, public BlockCipherDocumentation { diff --git a/mars.h b/mars.h index c4c7fd93..3a59c1e8 100644 --- a/mars.h +++ b/mars.h @@ -11,13 +11,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class MARS_Info +//! \brief MARS block cipher information struct MARS_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 56, 4> { static const char *StaticAlgorithmName() {return "MARS";} }; -/// MARS +//! \class MARS +//! \brief MARS block cipher +//! \sa MARS class MARS : public MARS_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl diff --git a/rc2.h b/rc2.h index 96ed6d4d..b917abfb 100644 --- a/rc2.h +++ b/rc2.h @@ -13,7 +13,7 @@ NAMESPACE_BEGIN(CryptoPP) //! \class RC2_Info -//! \brief The RC2 cipher's key, iv, block size and name information. +//! \brief RC2 block cipher information struct RC2_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 128> { CRYPTOPP_CONSTANT(DEFAULT_EFFECTIVE_KEYLENGTH = 1024) @@ -22,7 +22,7 @@ struct RC2_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 128> }; //! \class RC2 -//! \brief The RC2 stream cipher +//! \brief RC2 block cipher //! \sa RC2 on the Crypto Lounge. class RC2 : public RC2_Info, public BlockCipherDocumentation { diff --git a/rc5.h b/rc5.h index 9f125dd0..b1012737 100644 --- a/rc5.h +++ b/rc5.h @@ -11,14 +11,17 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class RC5_Info +//! \brief RC5 block cipher information struct RC5_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 0, 255>, public VariableRounds<16> { static const char *StaticAlgorithmName() {return "RC5";} typedef word32 RC5_WORD; }; -/// RC5 +//! \class RC5 +//! \brief RC5 block cipher +//! \sa RC5 class RC5 : public RC5_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl diff --git a/rc6.h b/rc6.h index 37eba319..13b7bfa9 100644 --- a/rc6.h +++ b/rc6.h @@ -11,14 +11,17 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class RC6_Info +//! \brief RC6 block cipher information struct RC6_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 255>, public VariableRounds<20> { static const char *StaticAlgorithmName() {return "RC6";} typedef word32 RC6_WORD; }; -/// RC6 +//! \class RC6 +//! \brief RC6 block cipher +//! \sa RC6 class RC6 : public RC6_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl diff --git a/safer.h b/safer.h index a828c629..3828d8e3 100644 --- a/safer.h +++ b/safer.h @@ -11,7 +11,8 @@ NAMESPACE_BEGIN(CryptoPP) -/// base class, do not use directly +//! \class SAFER +//! \brief SAFER base class class SAFER { public: @@ -49,13 +50,16 @@ protected: bool Strengthened() const {return STR;} }; -//! _ +//! \class SAFER_K_Info +//! \brief SAFER-K block cipher information struct SAFER_K_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 8, 16, 8>, public VariableRounds<10, 1, 13> { static const char *StaticAlgorithmName() {return "SAFER-K";} }; -/// SAFER-K +//! \class SAFER_K +//! \brief SAFER-K block cipher +//! \sa SAFER-K class SAFER_K : public SAFER_K_Info, public SAFER, public BlockCipherDocumentation { public: @@ -63,13 +67,16 @@ public: typedef BlockCipherFinal > Decryption; }; -//! _ +//! \class SAFER_SK_Info +//! \brief SAFER-SK block cipher information struct SAFER_SK_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 8, 16, 8>, public VariableRounds<10, 1, 13> { static const char *StaticAlgorithmName() {return "SAFER-SK";} }; -/// SAFER-SK +//! \class SAFER_SK +//! \brief SAFER-SK block cipher +//! \sa SAFER-SK class SAFER_SK : public SAFER_SK_Info, public SAFER, public BlockCipherDocumentation { public: 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 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 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 // 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 ¶m, 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 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 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 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 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 CRYPTOPP_NO_VTABLE BlockCipherImpl : public AlgorithmImpl > > { 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. diff --git a/seed.h b/seed.h index a7fba346..f62f6626 100644 --- a/seed.h +++ b/seed.h @@ -11,13 +11,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class SEED_Info +//! \brief SEED block cipher information struct SEED_Info : public FixedBlockSize<16>, public FixedKeyLength<16>, public FixedRounds<16> { static const char *StaticAlgorithmName() {return "SEED";} }; -/// SEED +//! \class SEED +//! \brief SEED block cipher +//! \sa SEED class SEED : public SEED_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl diff --git a/serpent.h b/serpent.h index 7c48cf76..64fd0e5c 100644 --- a/serpent.h +++ b/serpent.h @@ -11,13 +11,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class Serpent_Info +//! \brief Serpent block cipher information struct Serpent_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 32>, public FixedRounds<32> { static const char *StaticAlgorithmName() {return "Serpent";} }; -/// Serpent +//! \class Serpent +//! \brief Serpent block cipher +/// \sa Serpent class Serpent : public Serpent_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl diff --git a/shacal2.h b/shacal2.h index 70532102..d635ced9 100644 --- a/shacal2.h +++ b/shacal2.h @@ -11,13 +11,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class SHACAL2_Info +//! \brief SHACAL2 block cipher information struct SHACAL2_Info : public FixedBlockSize<32>, public VariableKeyLength<16, 16, 64> { static const char *StaticAlgorithmName() {return "SHACAL-2";} }; -/// SHACAL-2 +//! \class SHACAL2 +//! \brief SHACAL2 block cipher +//! \sa SHACAL-2 class SHACAL2 : public SHACAL2_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl diff --git a/shark.h b/shark.h index 41663fa1..8d1b6e71 100644 --- a/shark.h +++ b/shark.h @@ -12,12 +12,15 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class SHARK_Info +//! \brief SHARK block cipher information struct SHARK_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 16>, public VariableRounds<6, 2> { static const char *StaticAlgorithmName() {return "SHARK-E";} }; +//! \class SHARK +//! \brief SHARK block cipher /// SHARK-E class SHARK : public SHARK_Info, public BlockCipherDocumentation { diff --git a/skipjack.h b/skipjack.h index 2b2fbfe7..1e214c26 100644 --- a/skipjack.h +++ b/skipjack.h @@ -11,13 +11,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class SKIPJACK_Info +//! \brief SKIPJACK block cipher information struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10> { CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "SKIPJACK";} }; -/// SKIPJACK +//! \class SKIPJACK +//! \brief SKIPJACK block cipher information +//! \sa SKIPJACK class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation { class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl diff --git a/square.h b/square.h index 2565f1cf..cf058a3d 100644 --- a/square.h +++ b/square.h @@ -11,13 +11,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class Square_Info +//! \brief Square block cipher information struct Square_Info : public FixedBlockSize<16>, public FixedKeyLength<16>, FixedRounds<8> { static const char *StaticAlgorithmName() {return "Square";} }; -/// Square +//! \class Square +//! \brief Square block cipher +//! \sa Square class Square : public Square_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl diff --git a/tea.h b/tea.h index 39923924..6c933b7e 100644 --- a/tea.h +++ b/tea.h @@ -12,13 +12,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class TEA_Info +//! \brief TEA block cipher information struct TEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<32> { static const char *StaticAlgorithmName() {return "TEA";} }; -/// TEA +//! \class TEA +//! \brief TEA block cipher +//! \sa TEA class TEA : public TEA_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl @@ -51,13 +54,16 @@ public: typedef TEA::Encryption TEAEncryption; typedef TEA::Decryption TEADecryption; -//! _ +//! \class XTEA_Info +//! \brief XTEA block cipher information struct XTEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<32> { static const char *StaticAlgorithmName() {return "XTEA";} }; -/// XTEA +//! \class XTEA +//! \brief XTEA block cipher +//! \sa XTEA class XTEA : public XTEA_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl @@ -87,14 +93,17 @@ public: typedef BlockCipherFinal Decryption; }; -//! _ +//! \class BTEA_Info +//! \brief BTEA block cipher information struct BTEA_Info : public FixedKeyLength<16> { static const char *StaticAlgorithmName() {return "BTEA";} }; -//! corrected Block TEA (as described in "xxtea"). -/*! This class hasn't been tested yet. */ +//! \class BTEA +//! \brief BTEA block cipher +//! \details Corrected Block TEA as described in "xxtea". This class hasn't been tested yet. +//! \sa Corrected Block TEA. class BTEA : public BTEA_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public AlgorithmImpl, BTEA_Info>, public BTEA_Info diff --git a/twofish.h b/twofish.h index f93395d7..5ebc2440 100644 --- a/twofish.h +++ b/twofish.h @@ -11,13 +11,16 @@ NAMESPACE_BEGIN(CryptoPP) -//! _ +//! \class Twofish_Info +//! \brief Twofish block cipher information struct Twofish_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 32>, FixedRounds<16> { static const char *StaticAlgorithmName() {return "Twofish";} }; -/// Twofish +//! \class Twofish +//! \brief Twofish block cipher +//~ \sa Twofish class Twofish : public Twofish_Info, public BlockCipherDocumentation { class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl