mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
fix infinite recursive call in IsRandomAccess (reported by ASBai)
This commit is contained in:
parent
c8fe7e0718
commit
244f99c027
4
modes.h
4
modes.h
@ -140,7 +140,7 @@ inline void CopyOrZero(void *dest, const void *src, size_t s)
|
||||
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE OFB_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy>
|
||||
{
|
||||
public:
|
||||
bool IsRandomAccess() const {return false;}
|
||||
bool CipherIsRandomAccess() const {return false;}
|
||||
IV_Requirement IVRequirement() const {return UNIQUE_IV;}
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "OFB";}
|
||||
|
||||
@ -162,7 +162,7 @@ private:
|
||||
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CTR_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy>
|
||||
{
|
||||
public:
|
||||
bool IsRandomAccess() const {return true;}
|
||||
bool CipherIsRandomAccess() const {return true;}
|
||||
IV_Requirement IVRequirement() const {return UNIQUE_IV;}
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "CTR";}
|
||||
|
||||
|
2
panama.h
2
panama.h
@ -122,7 +122,7 @@ class PanamaCipherPolicy : public AdditiveCipherConcretePolicy<word32, 8>,
|
||||
protected:
|
||||
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
||||
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
||||
bool IsRandomAccess() const {return false;}
|
||||
bool CipherIsRandomAccess() const {return false;}
|
||||
void CipherResynchronize(byte *keystreamBuffer, const byte *iv);
|
||||
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64
|
||||
unsigned int GetAlignment() const;
|
||||
|
2
salsa.h
2
salsa.h
@ -19,7 +19,7 @@ protected:
|
||||
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
||||
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
||||
void CipherResynchronize(byte *keystreamBuffer, const byte *IV);
|
||||
bool IsRandomAccess() const {return true;}
|
||||
bool CipherIsRandomAccess() const {return true;}
|
||||
void SeekToIteration(lword iterationCount);
|
||||
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64
|
||||
unsigned int GetAlignment() const;
|
||||
|
2
seal.h
2
seal.h
@ -19,7 +19,7 @@ protected:
|
||||
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
||||
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
||||
void CipherResynchronize(byte *keystreamBuffer, const byte *IV);
|
||||
bool IsRandomAccess() const {return true;}
|
||||
bool CipherIsRandomAccess() const {return true;}
|
||||
void SeekToIteration(lword iterationCount);
|
||||
|
||||
private:
|
||||
|
@ -18,7 +18,7 @@ protected:
|
||||
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
||||
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
||||
void CipherResynchronize(byte *keystreamBuffer, const byte *iv);
|
||||
bool IsRandomAccess() const {return false;}
|
||||
bool CipherIsRandomAccess() const {return false;}
|
||||
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64
|
||||
unsigned int GetAlignment() const;
|
||||
unsigned int GetOptimalBlockSize() const;
|
||||
|
@ -75,8 +75,8 @@ struct CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AdditiveCipherAbstractPolicy
|
||||
virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) {assert(false);}
|
||||
virtual void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) =0;
|
||||
virtual void CipherResynchronize(byte *keystreamBuffer, const byte *iv) {throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");}
|
||||
virtual bool IsRandomAccess() const =0;
|
||||
virtual void SeekToIteration(lword iterationCount) {assert(!IsRandomAccess()); throw NotImplemented("StreamTransformation: this object doesn't support random access");}
|
||||
virtual bool CipherIsRandomAccess() const =0;
|
||||
virtual void SeekToIteration(lword iterationCount) {assert(!CipherIsRandomAccess()); throw NotImplemented("StreamTransformation: this object doesn't support random access");}
|
||||
};
|
||||
|
||||
template <typename WT, unsigned int W, unsigned int X = 1, class BASE = AdditiveCipherAbstractPolicy>
|
||||
@ -141,7 +141,7 @@ public:
|
||||
unsigned int OptimalDataAlignment() const {return this->GetPolicy().GetAlignment();}
|
||||
bool IsSelfInverting() const {return true;}
|
||||
bool IsForwardTransformation() const {return true;}
|
||||
bool IsRandomAccess() const {return this->GetPolicy().IsRandomAccess();}
|
||||
bool IsRandomAccess() const {return this->GetPolicy().CipherIsRandomAccess();}
|
||||
void Seek(lword position);
|
||||
|
||||
typedef typename BASE::PolicyInterface PolicyInterface;
|
||||
|
2
wake.h
2
wake.h
@ -44,7 +44,7 @@ protected:
|
||||
void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount);
|
||||
// OFB
|
||||
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
||||
bool IsRandomAccess() const {return false;}
|
||||
bool CipherIsRandomAccess() const {return false;}
|
||||
};
|
||||
|
||||
namespace Weak {
|
||||
|
Loading…
Reference in New Issue
Block a user