1 /* 2 * AES Block cipher 3 * (c) 2005-2010 Axiomatic Systems, LLC 4 */ 5 6 #ifndef _AP4_AES_BLOCK_CIPHER_H_ 7 #define _AP4_AES_BLOCK_CIPHER_H_ 8 9 /*---------------------------------------------------------------------- 10 | includes 11 +---------------------------------------------------------------------*/ 12 #include "Ap4Types.h" 13 #include "Ap4Config.h" 14 #include "Ap4Protection.h" 15 16 /*---------------------------------------------------------------------- 17 | class references 18 +---------------------------------------------------------------------*/ 19 struct aes_ctx; 20 21 /*---------------------------------------------------------------------- 22 | AES constants 23 +---------------------------------------------------------------------*/ 24 #define AP4_AES_BLOCK_SIZE 16 25 #define AP4_AES_KEY_LENGTH 16 26 27 /*---------------------------------------------------------------------- 28 | AP4_AesBlockCipher class 29 +---------------------------------------------------------------------*/ 30 class AP4_AesBlockCipher : public AP4_BlockCipher 31 { 32 public: 33 // constructor and destructor 34 static AP4_Result Create(const AP4_UI08* key, 35 CipherDirection direction, 36 CipherMode mode, 37 const void* mode_params, 38 AP4_AesBlockCipher*& cipher); 39 virtual ~AP4_AesBlockCipher(); 40 GetDirection()41 virtual CipherDirection GetDirection() { return m_Direction; } 42 43 protected: 44 // constructor AP4_AesBlockCipher(CipherDirection direction,CipherMode mode,aes_ctx * context)45 AP4_AesBlockCipher(CipherDirection direction, 46 CipherMode mode, 47 aes_ctx* context) : 48 m_Direction(direction), 49 m_Mode(mode), 50 m_Context(context) {} 51 52 // members 53 CipherDirection m_Direction; 54 CipherMode m_Mode; 55 aes_ctx* m_Context; 56 }; 57 58 #endif // _AP4_AES_BLOCK_CIPHER_H_ 59