mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-13 14:11:34 -06:00
23.01
This commit is contained in:
@@ -9,8 +9,8 @@ specified in "A Password Based File Encryption Utility":
|
||||
- 2 bytes contain Password Verifier's Code
|
||||
*/
|
||||
|
||||
#ifndef __CRYPTO_WZ_AES_H
|
||||
#define __CRYPTO_WZ_AES_H
|
||||
#ifndef ZIP7_INC_CRYPTO_WZ_AES_H
|
||||
#define ZIP7_INC_CRYPTO_WZ_AES_H
|
||||
|
||||
#include "../../Common/MyBuffer.h"
|
||||
|
||||
@@ -65,8 +65,8 @@ struct CKeyInfo
|
||||
void Wipe()
|
||||
{
|
||||
Password.Wipe();
|
||||
MY_memset_0_ARRAY(Salt);
|
||||
MY_memset_0_ARRAY(PwdVerifComputed);
|
||||
Z7_memset_0_ARRAY(Salt);
|
||||
Z7_memset_0_ARRAY(PwdVerifComputed);
|
||||
}
|
||||
|
||||
~CKeyInfo() { Wipe(); }
|
||||
@@ -94,12 +94,18 @@ class CBaseCoder:
|
||||
public ICryptoSetPassword,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
Z7_COM_UNKNOWN_IMP_1(ICryptoSetPassword)
|
||||
Z7_COM7F_IMP(Init())
|
||||
public:
|
||||
Z7_IFACE_COM7_IMP(ICryptoSetPassword)
|
||||
protected:
|
||||
CKeyInfo _key;
|
||||
|
||||
// NSha1::CHmac _hmac;
|
||||
// NSha1::CHmac *Hmac() { return &_hmac; }
|
||||
CAlignedBuffer _hmacBuf;
|
||||
CAlignedBuffer1 _hmacBuf;
|
||||
UInt32 _hmacOverCalc;
|
||||
|
||||
NSha1::CHmac *Hmac() { return (NSha1::CHmac *)(void *)(Byte *)_hmacBuf; }
|
||||
|
||||
// CAesCtr2 _aes;
|
||||
@@ -108,18 +114,12 @@ protected:
|
||||
CBaseCoder():
|
||||
_hmacBuf(sizeof(NSha1::CHmac))
|
||||
{
|
||||
_aesCoderSpec = new CAesCoder(true, 32, true);
|
||||
_aesCoder = _aesCoderSpec;
|
||||
_aesCoderSpec = new CAesCtrCoder(32);
|
||||
_aesCoder = _aesCoderSpec;
|
||||
}
|
||||
|
||||
void Init2();
|
||||
public:
|
||||
MY_UNKNOWN_IMP1(ICryptoSetPassword)
|
||||
|
||||
STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
|
||||
|
||||
STDMETHOD(Init)();
|
||||
|
||||
unsigned GetHeaderSize() const { return _key.GetSaltSize() + kPwdVerifSize; }
|
||||
unsigned GetAddPackSize() const { return GetHeaderSize() + kMacSize; }
|
||||
|
||||
@@ -134,24 +134,23 @@ public:
|
||||
virtual ~CBaseCoder() {}
|
||||
};
|
||||
|
||||
class CEncoder:
|
||||
class CEncoder Z7_final:
|
||||
public CBaseCoder
|
||||
{
|
||||
Z7_COM7F_IMP2(UInt32, Filter(Byte *data, UInt32 size))
|
||||
public:
|
||||
STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
|
||||
HRESULT WriteHeader(ISequentialOutStream *outStream);
|
||||
HRESULT WriteFooter(ISequentialOutStream *outStream);
|
||||
};
|
||||
|
||||
class CDecoder:
|
||||
class CDecoder Z7_final:
|
||||
public CBaseCoder
|
||||
// public ICompressSetDecoderProperties2
|
||||
{
|
||||
Byte _pwdVerifFromArchive[kPwdVerifSize];
|
||||
Z7_COM7F_IMP2(UInt32, Filter(Byte *data, UInt32 size))
|
||||
public:
|
||||
// ICompressSetDecoderProperties2
|
||||
// STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
|
||||
STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
|
||||
// Z7_IFACE_COM7_IMP(ICompressSetDecoderProperties2)
|
||||
HRESULT ReadHeader(ISequentialInStream *inStream);
|
||||
bool Init_and_CheckPassword();
|
||||
HRESULT CheckMac(ISequentialInStream *inStream, bool &isOK);
|
||||
|
||||
Reference in New Issue
Block a user