Crypto++ 8.4 Free C++ class library of cryptographic schemes

aria.h
Go to the documentation of this file.
1 // aria.h - written and placed in the public domain by Jeffrey Walton
2
3 /// \file aria.h
4 /// \brief Classes for the ARIA block cipher
5 /// \details The Crypto++ ARIA implementation is based on the 32-bit implementation by Aaram Yun
6 /// from the National Security Research Institute, KOREA. Aaram Yun's implementation is based on
7 /// the 8-bit implementation by Jin Hong. The source files are available in ARIA.zip from the Korea
8 /// Internet & Security Agency website.
9 /// \sa <A HREF="http://tools.ietf.org/html/rfc5794">RFC 5794, A Description of the ARIA Encryption Algorithm</A>,
10 /// <A HREF="http://seed.kisa.or.kr/iwt/ko/bbs/EgovReferenceList.do?bbsId=BBSMSTR_000000000002">Korea
11 /// Internet & Security Agency homepage</A>
12
13 #ifndef CRYPTOPP_ARIA_H
14 #define CRYPTOPP_ARIA_H
15
16 #include "config.h"
17 #include "seckey.h"
18 #include "secblock.h"
19
20 NAMESPACE_BEGIN(CryptoPP)
21
22 /// \brief ARIA block cipher information
23 /// \since Crypto++ 6.0
24 struct ARIA_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
25 {
26 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "ARIA";}
27 };
28
29 /// \brief ARIA block cipher
30 /// \details The Crypto++ ARIA implementation is based on the 32-bit implementation by Aaram Yun
31 /// from the National Security Research Institute, KOREA. Aaram Yun's implementation is based on
32 /// the 8-bit implementation by Jin Hong. The source files are available in ARIA.zip from the Korea
33 /// Internet & Security Agency website.
34 /// \sa <A HREF="http://tools.ietf.org/html/rfc5794">RFC 5794, A Description of the ARIA Encryption Algorithm</A>,
35 /// <A HREF="http://seed.kisa.or.kr/iwt/ko/bbs/EgovReferenceList.do?bbsId=BBSMSTR_000000000002">Korea
36 /// Internet & Security Agency homepage</A>
37 /// \sa <a href="http://www.cryptopp.com/wiki/ARIA">ARIA</a>
38 /// \since Crypto++ 6.0
39 class ARIA : public ARIA_Info, public BlockCipherDocumentation
40 {
41 public:
42 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<ARIA_Info>
43 {
44 public:
45 Base() : m_rounds(0) {}
46
47 protected:
48 void UncheckedSetKey(const byte *key, unsigned int keylen, const NameValuePairs &params);
49 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
50
51 private:
52 // Reference implementation allocates a table of 17 round keys.
53 typedef SecBlock<byte, AllocatorWithCleanup<byte, true> > AlignedByteBlock;
54 typedef SecBlock<word32, AllocatorWithCleanup<word32, true> > AlignedWordBlock;
55
56 AlignedByteBlock m_rk; // round keys
57 AlignedWordBlock m_w; // w0, w1, w2, w3, t and u
58 unsigned int m_rounds;
59 };
60
61 public:
62 typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
63 typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
64 };
65
66 typedef ARIA::Encryption ARIAEncryption;
67 typedef ARIA::Decryption ARIADecryption;
68
69 NAMESPACE_END
70
71 #endif
ARIA_Info
ARIA block cipher information.
Definition: aria.h:24
secblock.h
Classes and functions for secure memory allocations.
FixedBlockSize
Inherited by algorithms with fixed block size.
Definition: seckey.h:40
BlockCipherImpl
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:305
ARIA
ARIA block cipher.
Definition: aria.h:39
BlockCipherDocumentation
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher.
Definition: seckey.h:398
seckey.h
Classes and functions for implementing secret key algorithms.
BlockCipherFinal
Provides class member functions to key a block cipher.
Definition: seckey.h:317
ARIA::Base
Definition: aria.h:42
CryptoPP
Crypto++ library namespace.
config.h
Library configuration file.
SecBlock
Secure memory block with allocator and cleanup.
Definition: secblock.h:727
NameValuePairs
Interface for retrieving values given their names.
Definition: cryptlib.h:321
VariableKeyLength
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:165