"Fossies" - the Fresh Open Source Software Archive

Member "p7zip_16.02/CPP/7zip/Crypto/MyAes.h" (18 May 2016, 1176 Bytes) of package /linux/misc/p7zip_16.02_src_all.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "MyAes.h": 15.14.1_src_all_vs_16.02_src_all.

    1 // Crypto/MyAes.h
    2 
    3 #ifndef __CRYPTO_MY_AES_H
    4 #define __CRYPTO_MY_AES_H
    5 
    6 #include "../../../C/Aes.h"
    7 
    8 #include "../../Common/MyCom.h"
    9 
   10 #include "../ICoder.h"
   11 
   12 namespace NCrypto {
   13 
   14 class CAesCbcCoder:
   15   public ICompressFilter,
   16   public ICryptoProperties,
   17   public ICompressSetCoderProperties,
   18   public CMyUnknownImp
   19 {
   20   AES_CODE_FUNC _codeFunc;
   21   unsigned _offset;
   22   unsigned _keySize;
   23   bool _keyIsSet;
   24   bool _encodeMode;
   25   UInt32 _aes[AES_NUM_IVMRK_WORDS + 3];
   26   Byte _iv[AES_BLOCK_SIZE];
   27 
   28   bool SetFunctions(UInt32 algo);
   29 
   30 public:
   31   CAesCbcCoder(bool encodeMode, unsigned keySize);
   32   
   33   MY_UNKNOWN_IMP3(ICompressFilter, ICryptoProperties, ICompressSetCoderProperties)
   34   
   35   INTERFACE_ICompressFilter(;)
   36   
   37   STDMETHOD(SetKey)(const Byte *data, UInt32 size);
   38   STDMETHOD(SetInitVector)(const Byte *data, UInt32 size);
   39   
   40   STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
   41 };
   42 
   43 struct CAesCbcEncoder: public CAesCbcCoder
   44 {
   45   CAesCbcEncoder(unsigned keySize = 0): CAesCbcCoder(true, keySize) {}
   46 };
   47 
   48 struct CAesCbcDecoder: public CAesCbcCoder
   49 {
   50   CAesCbcDecoder(unsigned keySize = 0): CAesCbcCoder(false, keySize) {}
   51 };
   52 
   53 }
   54 
   55 #endif