seckey.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. // seckey.h - originally written and placed in the public domain by Wei Dai
  2. /// \file seckey.h
  3. /// \brief Classes and functions for implementing secret key algorithms.
  4. #ifndef CRYPTOPP_SECKEY_H
  5. #define CRYPTOPP_SECKEY_H
  6. #include "config.h"
  7. #include "cryptlib.h"
  8. #include "misc.h"
  9. #include "simple.h"
  10. #include "stdcpp.h"
  11. #if CRYPTOPP_MSC_VERSION
  12. # pragma warning(push)
  13. # pragma warning(disable: 4189 4296)
  14. #endif
  15. // Issue 340
  16. #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
  17. # pragma GCC diagnostic push
  18. # pragma GCC diagnostic ignored "-Wconversion"
  19. # pragma GCC diagnostic ignored "-Wsign-conversion"
  20. #endif
  21. NAMESPACE_BEGIN(CryptoPP)
  22. /// \brief Inverts the cipher's direction
  23. /// \param dir the cipher's direction
  24. /// \return DECRYPTION if \ref CipherDir "dir" is ENCRYPTION, DECRYPTION otherwise
  25. inline CipherDir ReverseCipherDir(CipherDir dir)
  26. {
  27. return (dir == ENCRYPTION) ? DECRYPTION : ENCRYPTION;
  28. }
  29. /// \brief Inherited by algorithms with fixed block size
  30. /// \tparam N the blocksize of the algorithm
  31. template <unsigned int N>
  32. class FixedBlockSize
  33. {
  34. public:
  35. /// \brief The block size of the algorithm provided as a constant.
  36. CRYPTOPP_CONSTANT(BLOCKSIZE = N);
  37. };
  38. // ************** rounds ***************
  39. /// \brief Inherited by algorithms with fixed number of rounds
  40. /// \tparam R the number of rounds used by the algorithm
  41. template <unsigned int R>
  42. class FixedRounds
  43. {
  44. public:
  45. /// \brief The number of rounds for the algorithm provided as a constant.
  46. CRYPTOPP_CONSTANT(ROUNDS = R);
  47. };
  48. /// \brief Inherited by algorithms with variable number of rounds
  49. /// \tparam D Default number of rounds
  50. /// \tparam N Minimum number of rounds
  51. /// \tparam M Maximum number of rounds
  52. template <unsigned int D, unsigned int N=1, unsigned int M=INT_MAX> // use INT_MAX here because enums are treated as signed ints
  53. class VariableRounds
  54. {
  55. public:
  56. /// \brief The default number of rounds for the algorithm provided as a constant.
  57. CRYPTOPP_CONSTANT(DEFAULT_ROUNDS = D);
  58. /// \brief The minimum number of rounds for the algorithm provided as a constant.
  59. CRYPTOPP_CONSTANT(MIN_ROUNDS = N);
  60. /// \brief The maximum number of rounds for the algorithm provided as a constant.
  61. CRYPTOPP_CONSTANT(MAX_ROUNDS = M);
  62. /// \brief The default number of rounds for the algorithm based on key length
  63. /// provided by a static function.
  64. /// \param keylength the size of the key, in bytes
  65. /// \details keylength is unused in the default implementation.
  66. CRYPTOPP_STATIC_CONSTEXPR unsigned int StaticGetDefaultRounds(size_t keylength)
  67. {
  68. return CRYPTOPP_UNUSED(keylength), static_cast<unsigned int>(DEFAULT_ROUNDS);
  69. }
  70. protected:
  71. /// \brief Validates the number of rounds for an algorithm.
  72. /// \param rounds the candidate number of rounds
  73. /// \param alg an Algorithm object used if the number of rounds are invalid
  74. /// \throw InvalidRounds if the number of rounds are invalid
  75. /// \details ThrowIfInvalidRounds() validates the number of rounds and throws if invalid.
  76. inline void ThrowIfInvalidRounds(int rounds, const Algorithm *alg)
  77. {
  78. if (M == INT_MAX) // Coverity and result_independent_of_operands
  79. {
  80. if (rounds < MIN_ROUNDS)
  81. throw InvalidRounds(alg ? alg->AlgorithmName() : std::string("VariableRounds"), rounds);
  82. }
  83. else
  84. {
  85. if (rounds < MIN_ROUNDS || rounds > MAX_ROUNDS)
  86. throw InvalidRounds(alg ? alg->AlgorithmName() : std::string("VariableRounds"), rounds);
  87. }
  88. }
  89. /// \brief Validates the number of rounds for an algorithm
  90. /// \param param the candidate number of rounds
  91. /// \param alg an Algorithm object used if the number of rounds are invalid
  92. /// \return the number of rounds for the algorithm
  93. /// \throw InvalidRounds if the number of rounds are invalid
  94. /// \details GetRoundsAndThrowIfInvalid() validates the number of rounds and throws if invalid.
  95. inline unsigned int GetRoundsAndThrowIfInvalid(const NameValuePairs &param, const Algorithm *alg)
  96. {
  97. int rounds = param.GetIntValueWithDefault("Rounds", DEFAULT_ROUNDS);
  98. ThrowIfInvalidRounds(rounds, alg);
  99. return static_cast<unsigned int>(rounds);
  100. }
  101. };
  102. // ************** key length ***************
  103. /// \brief Inherited by keyed algorithms with fixed key length
  104. /// \tparam N Default key length, in bytes
  105. /// \tparam IV_REQ the \ref SimpleKeyingInterface::IV_Requirement "IV requirements"
  106. /// \tparam IV_L default IV length, in bytes
  107. /// \sa SimpleKeyingInterface
  108. template <unsigned int N, unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE, unsigned int IV_L = 0>
  109. class FixedKeyLength
  110. {
  111. public:
  112. /// \brief The default key length used by the algorithm provided as a constant
  113. /// \details KEYLENGTH is provided in bytes, not bits
  114. CRYPTOPP_CONSTANT(KEYLENGTH=N);
  115. /// \brief The minimum key length used by the algorithm provided as a constant
  116. /// \details MIN_KEYLENGTH is provided in bytes, not bits
  117. CRYPTOPP_CONSTANT(MIN_KEYLENGTH=N);
  118. /// \brief The maximum key length used by the algorithm provided as a constant
  119. /// \details MAX_KEYLENGTH is provided in bytes, not bits
  120. CRYPTOPP_CONSTANT(MAX_KEYLENGTH=N);
  121. /// \brief The default key length used by the algorithm provided as a constant
  122. /// \details DEFAULT_KEYLENGTH is provided in bytes, not bits
  123. CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=N);
  124. /// \brief The default IV requirements for the algorithm provided as a constant
  125. /// \details The default value is NOT_RESYNCHRONIZABLE. See IV_Requirement
  126. /// in cryptlib.h for allowed values.
  127. CRYPTOPP_CONSTANT(IV_REQUIREMENT = IV_REQ);
  128. /// \brief The default IV length used by the algorithm provided as a constant
  129. /// \details IV_LENGTH is provided in bytes, not bits. The default implementation uses 0.
  130. CRYPTOPP_CONSTANT(IV_LENGTH = IV_L);
  131. /// \brief The default key length for the algorithm provided by a static function.
  132. /// \param keylength the size of the key, in bytes
  133. /// \details The default implementation returns KEYLENGTH. keylength is unused
  134. /// in the default implementation.
  135. CRYPTOPP_STATIC_CONSTEXPR size_t CRYPTOPP_API StaticGetValidKeyLength(size_t keylength)
  136. {
  137. return CRYPTOPP_UNUSED(keylength), static_cast<size_t>(KEYLENGTH);
  138. }
  139. };
  140. /// \brief Inherited by keyed algorithms with variable key length
  141. /// \tparam D Default key length, in bytes
  142. /// \tparam N Minimum key length, in bytes
  143. /// \tparam M Maximum key length, in bytes
  144. /// \tparam Q Default key length multiple, in bytes. The default multiple is 1.
  145. /// \tparam IV_REQ the \ref SimpleKeyingInterface::IV_Requirement "IV requirements"
  146. /// \tparam IV_L default IV length, in bytes. The default length is 0.
  147. /// \sa SimpleKeyingInterface
  148. 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>
  149. class VariableKeyLength
  150. {
  151. // Make these private to avoid Doxygen documenting them in all derived classes
  152. CRYPTOPP_COMPILE_ASSERT(Q > 0);
  153. CRYPTOPP_COMPILE_ASSERT(N % Q == 0);
  154. CRYPTOPP_COMPILE_ASSERT(M % Q == 0);
  155. CRYPTOPP_COMPILE_ASSERT(N < M);
  156. CRYPTOPP_COMPILE_ASSERT(D >= N);
  157. CRYPTOPP_COMPILE_ASSERT(M >= D);
  158. public:
  159. /// \brief The minimum key length used by the algorithm provided as a constant
  160. /// \details MIN_KEYLENGTH is provided in bytes, not bits
  161. CRYPTOPP_CONSTANT(MIN_KEYLENGTH=N);
  162. /// \brief The maximum key length used by the algorithm provided as a constant
  163. /// \details MAX_KEYLENGTH is provided in bytes, not bits
  164. CRYPTOPP_CONSTANT(MAX_KEYLENGTH=M);
  165. /// \brief The default key length used by the algorithm provided as a constant
  166. /// \details DEFAULT_KEYLENGTH is provided in bytes, not bits
  167. CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=D);
  168. /// \brief The key length multiple used by the algorithm provided as a constant
  169. /// \details MAX_KEYLENGTH is provided in bytes, not bits
  170. CRYPTOPP_CONSTANT(KEYLENGTH_MULTIPLE=Q);
  171. /// \brief The default IV requirements for the algorithm provided as a constant
  172. /// \details The default value is NOT_RESYNCHRONIZABLE. See IV_Requirement
  173. /// in cryptlib.h for allowed values.
  174. CRYPTOPP_CONSTANT(IV_REQUIREMENT=IV_REQ);
  175. /// \brief The default initialization vector length for the algorithm provided as a constant
  176. /// \details IV_LENGTH is provided in bytes, not bits. The default implementation uses 0.
  177. CRYPTOPP_CONSTANT(IV_LENGTH=IV_L);
  178. /// \brief Provides a valid key length for the algorithm provided by a static function.
  179. /// \param keylength the size of the key, in bytes
  180. /// \details If keylength is less than MIN_KEYLENGTH, then the function returns
  181. /// MIN_KEYLENGTH. If keylength is greater than MAX_KEYLENGTH, then the function
  182. /// returns MAX_KEYLENGTH. If keylength is a multiple of KEYLENGTH_MULTIPLE,
  183. /// then keylength is returned. Otherwise, the function returns keylength rounded
  184. /// \a down to the next smaller multiple of KEYLENGTH_MULTIPLE.
  185. /// \details keylength is provided in bytes, not bits.
  186. CRYPTOPP_STATIC_CONSTEXPR size_t CRYPTOPP_API StaticGetValidKeyLength(size_t keylength)
  187. {
  188. return (keylength <= N) ? N :
  189. (keylength >= M) ? M :
  190. (keylength+Q-1) - (keylength+Q-1)%Q;
  191. }
  192. };
  193. /// \brief Provides key lengths based on another class's key length
  194. /// \tparam T another FixedKeyLength or VariableKeyLength class
  195. /// \tparam IV_REQ the \ref SimpleKeyingInterface::IV_Requirement "IV requirements"
  196. /// \tparam IV_L default IV length, in bytes
  197. /// \sa SimpleKeyingInterface
  198. template <class T, unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE, unsigned int IV_L = 0>
  199. class SameKeyLengthAs
  200. {
  201. public:
  202. /// \brief The minimum key length used by the algorithm provided as a constant
  203. /// \details MIN_KEYLENGTH is provided in bytes, not bits
  204. CRYPTOPP_CONSTANT(MIN_KEYLENGTH=T::MIN_KEYLENGTH);
  205. /// \brief The maximum key length used by the algorithm provided as a constant
  206. /// \details MIN_KEYLENGTH is provided in bytes, not bits
  207. CRYPTOPP_CONSTANT(MAX_KEYLENGTH=T::MAX_KEYLENGTH);
  208. /// \brief The default key length used by the algorithm provided as a constant
  209. /// \details MIN_KEYLENGTH is provided in bytes, not bits
  210. CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=T::DEFAULT_KEYLENGTH);
  211. /// \brief The default IV requirements for the algorithm provided as a constant
  212. /// \details The default value is NOT_RESYNCHRONIZABLE. See IV_Requirement
  213. /// in cryptlib.h for allowed values.
  214. CRYPTOPP_CONSTANT(IV_REQUIREMENT=IV_REQ);
  215. /// \brief The default initialization vector length for the algorithm provided as a constant
  216. /// \details IV_LENGTH is provided in bytes, not bits. The default implementation uses 0.
  217. CRYPTOPP_CONSTANT(IV_LENGTH=IV_L);
  218. /// \brief Provides a valid key length for the algorithm provided by a static function.
  219. /// \param keylength the size of the key, in bytes
  220. /// \details If keylength is less than MIN_KEYLENGTH, then the function returns
  221. /// MIN_KEYLENGTH. If keylength is greater than MAX_KEYLENGTH, then the function
  222. /// returns MAX_KEYLENGTH. If keylength is a multiple of KEYLENGTH_MULTIPLE,
  223. /// then keylength is returned. Otherwise, the function returns keylength rounded
  224. /// \a down to the next smaller multiple of KEYLENGTH_MULTIPLE.
  225. /// \details keylength is provided in bytes, not bits.
  226. CRYPTOPP_STATIC_CONSTEXPR size_t CRYPTOPP_API StaticGetValidKeyLength(size_t keylength)
  227. {return T::StaticGetValidKeyLength(keylength);}
  228. };
  229. // ************** implementation helper for SimpleKeyingInterface ***************
  230. /// \brief Provides a base implementation of SimpleKeyingInterface
  231. /// \tparam BASE a SimpleKeyingInterface derived class
  232. /// \tparam INFO a SimpleKeyingInterface derived class
  233. /// \details SimpleKeyingInterfaceImpl() provides a default implementation for ciphers providing a keying interface.
  234. /// Functions are virtual and not eligible for C++11 <tt>constexpr</tt>-ness.
  235. /// \sa Algorithm(), SimpleKeyingInterface()
  236. template <class BASE, class INFO = BASE>
  237. class CRYPTOPP_NO_VTABLE SimpleKeyingInterfaceImpl : public BASE
  238. {
  239. public:
  240. /// \brief The minimum key length used by the algorithm
  241. /// \return minimum key length used by the algorithm, in bytes
  242. size_t MinKeyLength() const
  243. {return INFO::MIN_KEYLENGTH;}
  244. /// \brief The maximum key length used by the algorithm
  245. /// \return maximum key length used by the algorithm, in bytes
  246. size_t MaxKeyLength() const
  247. {return static_cast<size_t>(INFO::MAX_KEYLENGTH);}
  248. /// \brief The default key length used by the algorithm
  249. /// \return default key length used by the algorithm, in bytes
  250. size_t DefaultKeyLength() const
  251. {return INFO::DEFAULT_KEYLENGTH;}
  252. /// \brief Provides a valid key length for the algorithm
  253. /// \param keylength the size of the key, in bytes
  254. /// \return the valid key length, in bytes
  255. /// \details keylength is provided in bytes, not bits. If keylength is less than MIN_KEYLENGTH,
  256. /// then the function returns MIN_KEYLENGTH. If keylength is greater than MAX_KEYLENGTH,
  257. /// then the function returns MAX_KEYLENGTH. if If keylength is a multiple of KEYLENGTH_MULTIPLE,
  258. /// then keylength is returned. Otherwise, the function returns a \a lower multiple of
  259. /// KEYLENGTH_MULTIPLE.
  260. size_t GetValidKeyLength(size_t keylength) const {return INFO::StaticGetValidKeyLength(keylength);}
  261. /// \brief The default IV requirements for the algorithm
  262. /// \details The default value is NOT_RESYNCHRONIZABLE. See IV_Requirement
  263. /// in cryptlib.h for allowed values.
  264. SimpleKeyingInterface::IV_Requirement IVRequirement() const
  265. {return static_cast<SimpleKeyingInterface::IV_Requirement>(INFO::IV_REQUIREMENT);}
  266. /// \brief The initialization vector length for the algorithm
  267. /// \details IVSize is provided in bytes, not bits. The default implementation uses
  268. /// IV_LENGTH, which is 0.
  269. unsigned int IVSize() const
  270. {return INFO::IV_LENGTH;}
  271. };
  272. /// \brief Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers
  273. /// \tparam INFO a SimpleKeyingInterface derived class
  274. /// \tparam BASE a SimpleKeyingInterface derived class
  275. /// \details BlockCipherImpl() provides a default implementation for block ciphers using AlgorithmImpl()
  276. /// and SimpleKeyingInterfaceImpl(). Functions are virtual and not eligible for C++11 <tt>constexpr</tt>-ness.
  277. /// \sa Algorithm(), SimpleKeyingInterface(), AlgorithmImpl(), SimpleKeyingInterfaceImpl()
  278. template <class INFO, class BASE = BlockCipher>
  279. class CRYPTOPP_NO_VTABLE BlockCipherImpl : public AlgorithmImpl<SimpleKeyingInterfaceImpl<TwoBases<BASE, INFO> > >
  280. {
  281. public:
  282. /// Provides the block size of the algorithm
  283. /// \return the block size of the algorithm, in bytes
  284. unsigned int BlockSize() const {return this->BLOCKSIZE;}
  285. };
  286. /// \brief Provides class member functions to key a block cipher
  287. /// \tparam DIR a CipherDir
  288. /// \tparam BASE a BlockCipherImpl derived class
  289. template <CipherDir DIR, class BASE>
  290. class BlockCipherFinal : public ClonableImpl<BlockCipherFinal<DIR, BASE>, BASE>
  291. {
  292. public:
  293. /// \brief Construct a default BlockCipherFinal
  294. /// \details The cipher is not keyed.
  295. BlockCipherFinal() {}
  296. /// \brief Construct a BlockCipherFinal
  297. /// \param key a byte array used to key the cipher
  298. /// \details key must be at least DEFAULT_KEYLENGTH in length. Internally, the function calls
  299. /// SimpleKeyingInterface::SetKey.
  300. BlockCipherFinal(const byte *key)
  301. {this->SetKey(key, this->DEFAULT_KEYLENGTH);}
  302. /// \brief Construct a BlockCipherFinal
  303. /// \param key a byte array used to key the cipher
  304. /// \param length the length of the byte array
  305. /// \details key must be at least DEFAULT_KEYLENGTH in length. Internally, the function calls
  306. /// SimpleKeyingInterface::SetKey.
  307. BlockCipherFinal(const byte *key, size_t length)
  308. {this->SetKey(key, length);}
  309. /// \brief Construct a BlockCipherFinal
  310. /// \param key a byte array used to key the cipher
  311. /// \param length the length of the byte array
  312. /// \param rounds the number of rounds
  313. /// \details key must be at least DEFAULT_KEYLENGTH in length. Internally, the function calls
  314. /// SimpleKeyingInterface::SetKeyWithRounds.
  315. BlockCipherFinal(const byte *key, size_t length, unsigned int rounds)
  316. {this->SetKeyWithRounds(key, length, rounds);}
  317. /// \brief Provides the direction of the cipher
  318. /// \return true if DIR is ENCRYPTION, false otherwise
  319. /// \sa GetCipherDirection(), IsPermutation()
  320. bool IsForwardTransformation() const {return DIR == ENCRYPTION;}
  321. };
  322. /// \brief Provides a base implementation of Algorithm and SimpleKeyingInterface for message authentication codes
  323. /// \tparam INFO a SimpleKeyingInterface derived class
  324. /// \tparam BASE a SimpleKeyingInterface derived class
  325. /// \details MessageAuthenticationCodeImpl() provides a default implementation for message authentication codes
  326. /// using AlgorithmImpl() and SimpleKeyingInterfaceImpl(). Functions are virtual and not subject to C++11
  327. /// <tt>constexpr</tt>.
  328. /// \sa Algorithm(), SimpleKeyingInterface(), AlgorithmImpl(), SimpleKeyingInterfaceImpl()
  329. template <class BASE, class INFO = BASE>
  330. class MessageAuthenticationCodeImpl : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
  331. {
  332. };
  333. /// \brief Provides class member functions to key a message authentication code
  334. /// \tparam BASE a BlockCipherImpl derived class
  335. /// \details A default implementation for MessageAuthenticationCode
  336. template <class BASE>
  337. class MessageAuthenticationCodeFinal : public ClonableImpl<MessageAuthenticationCodeFinal<BASE>, MessageAuthenticationCodeImpl<BASE> >
  338. {
  339. public:
  340. /// \brief Construct a default MessageAuthenticationCodeFinal
  341. /// \details The message authentication code is not keyed.
  342. MessageAuthenticationCodeFinal() {}
  343. /// \brief Construct a BlockCipherFinal
  344. /// \param key a byte array used to key the algorithm
  345. /// \details key must be at least DEFAULT_KEYLENGTH in length. Internally, the function calls
  346. /// SimpleKeyingInterface::SetKey.
  347. MessageAuthenticationCodeFinal(const byte *key)
  348. {this->SetKey(key, this->DEFAULT_KEYLENGTH);}
  349. /// \brief Construct a BlockCipherFinal
  350. /// \param key a byte array used to key the algorithm
  351. /// \param length the length of the byte array
  352. /// \details key must be at least DEFAULT_KEYLENGTH in length. Internally, the function calls
  353. /// SimpleKeyingInterface::SetKey.
  354. MessageAuthenticationCodeFinal(const byte *key, size_t length)
  355. {this->SetKey(key, length);}
  356. };
  357. // ************** documentation ***************
  358. /// \brief Provides Encryption and Decryption typedefs used by derived classes to
  359. /// implement a block cipher
  360. /// \details These objects usually should not be used directly. See CipherModeDocumentation
  361. /// instead. Each class derived from this one defines two types, Encryption and Decryption,
  362. /// both of which implement the BlockCipher interface.
  363. struct BlockCipherDocumentation
  364. {
  365. /// implements the BlockCipher interface
  366. typedef BlockCipher Encryption;
  367. /// implements the BlockCipher interface
  368. typedef BlockCipher Decryption;
  369. };
  370. /// \brief Provides Encryption and Decryption typedefs used by derived classes to
  371. /// implement a symmetric cipher
  372. /// \details Each class derived from this one defines two types, Encryption and Decryption,
  373. /// both of which implement the SymmetricCipher interface. Two types of classes derive
  374. /// from this class: stream ciphers and block cipher modes. Stream ciphers can be used
  375. /// alone, cipher mode classes need to be used with a block cipher. See CipherModeDocumentation
  376. /// for more for information about using cipher modes and block ciphers.
  377. struct SymmetricCipherDocumentation
  378. {
  379. /// implements the SymmetricCipher interface
  380. typedef SymmetricCipher Encryption;
  381. /// implements the SymmetricCipher interface
  382. typedef SymmetricCipher Decryption;
  383. };
  384. /// \brief Provides Encryption and Decryption typedefs used by derived classes to
  385. /// implement an authenticated encryption cipher
  386. /// \details Each class derived from this one defines two types, Encryption and Decryption,
  387. /// both of which implement the AuthenticatedSymmetricCipher interface.
  388. struct AuthenticatedSymmetricCipherDocumentation
  389. {
  390. /// implements the AuthenticatedSymmetricCipher interface
  391. typedef AuthenticatedSymmetricCipher Encryption;
  392. /// implements the AuthenticatedSymmetricCipher interface
  393. typedef AuthenticatedSymmetricCipher Decryption;
  394. };
  395. NAMESPACE_END
  396. #if CRYPTOPP_MSC_VERSION
  397. # pragma warning(pop)
  398. #endif
  399. // Issue 340
  400. #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
  401. # pragma GCC diagnostic pop
  402. #endif
  403. #endif