Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:53

0001 // aria.h - written and placed in the public domain by Jeffrey Walton

0002 
0003 /// \file aria.h

0004 /// \brief Classes for the ARIA block cipher

0005 /// \details The Crypto++ ARIA implementation is based on the 32-bit implementation by Aaram Yun

0006 ///   from the National Security Research Institute, KOREA. Aaram Yun's implementation is based on

0007 ///   the 8-bit implementation by Jin Hong. The source files are available in ARIA.zip from the Korea

0008 ///   Internet & Security Agency website.

0009 /// \sa <A HREF="http://tools.ietf.org/html/rfc5794">RFC 5794, A Description of the ARIA Encryption Algorithm</A>,

0010 ///   <A HREF="http://seed.kisa.or.kr/iwt/ko/bbs/EgovReferenceList.do?bbsId=BBSMSTR_000000000002">Korea

0011 ///   Internet & Security Agency homepage</A>

0012 
0013 #ifndef CRYPTOPP_ARIA_H
0014 #define CRYPTOPP_ARIA_H
0015 
0016 #include "config.h"
0017 #include "seckey.h"
0018 #include "secblock.h"
0019 
0020 NAMESPACE_BEGIN(CryptoPP)
0021 
0022 /// \brief ARIA block cipher information

0023 /// \since Crypto++ 6.0

0024 struct ARIA_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
0025 {
0026     CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "ARIA";}
0027 };
0028 
0029 /// \brief ARIA block cipher

0030 /// \details The Crypto++ ARIA implementation is based on the 32-bit implementation by Aaram Yun

0031 ///   from the National Security Research Institute, KOREA. Aaram Yun's implementation is based on

0032 ///   the 8-bit implementation by Jin Hong. The source files are available in ARIA.zip from the Korea

0033 ///   Internet & Security Agency website.

0034 /// \sa <A HREF="http://tools.ietf.org/html/rfc5794">RFC 5794, A Description of the ARIA Encryption Algorithm</A>,

0035 ///   <A HREF="http://seed.kisa.or.kr/iwt/ko/bbs/EgovReferenceList.do?bbsId=BBSMSTR_000000000002">Korea

0036 ///   Internet & Security Agency homepage</A>

0037 /// \sa <a href="http://www.cryptopp.com/wiki/ARIA">ARIA</a>

0038 /// \since Crypto++ 6.0

0039 class ARIA : public ARIA_Info, public BlockCipherDocumentation
0040 {
0041 public:
0042     class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<ARIA_Info>
0043     {
0044     public:
0045         Base() : m_rounds(0) {}
0046 
0047     protected:
0048         void UncheckedSetKey(const byte *key, unsigned int keylen, const NameValuePairs &params);
0049         void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0050 
0051     private:
0052         // Reference implementation allocates a table of 17 round keys.

0053         typedef SecBlock<byte, AllocatorWithCleanup<byte, true> >     AlignedByteBlock;
0054         typedef SecBlock<word32, AllocatorWithCleanup<word32, true> > AlignedWordBlock;
0055 
0056         AlignedWordBlock  m_rk;  // round keys

0057         AlignedWordBlock  m_w;   // w0, w1, w2, w3, t and u

0058         unsigned int m_rounds;
0059     };
0060 
0061 public:
0062     typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
0063     typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
0064 };
0065 
0066 typedef ARIA::Encryption ARIAEncryption;
0067 typedef ARIA::Decryption ARIADecryption;
0068 
0069 NAMESPACE_END
0070 
0071 #endif