allow DLL to be built with VC++ .NET
parent
5b2008101c
commit
55a22f2adf
12
basecode.h
12
basecode.h
|
|
@ -11,11 +11,11 @@ class CRYPTOPP_DLL BaseN_Encoder : public Unflushable<Filter>
|
|||
{
|
||||
public:
|
||||
BaseN_Encoder(BufferedTransformation *attachment=NULL)
|
||||
: Unflushable<Filter>(attachment) {}
|
||||
{Detach(attachment);}
|
||||
|
||||
BaseN_Encoder(const byte *alphabet, int log2base, BufferedTransformation *attachment=NULL, int padding=-1)
|
||||
: Unflushable<Filter>(attachment)
|
||||
{
|
||||
Detach(attachment);
|
||||
IsolatedInitialize(MakeParameters(Name::EncodingLookupArray(), alphabet)
|
||||
(Name::Log2Base(), log2base)
|
||||
(Name::Pad(), padding != -1)
|
||||
|
|
@ -36,11 +36,11 @@ class CRYPTOPP_DLL BaseN_Decoder : public Unflushable<Filter>
|
|||
{
|
||||
public:
|
||||
BaseN_Decoder(BufferedTransformation *attachment=NULL)
|
||||
: Unflushable<Filter>(attachment) {}
|
||||
{Detach(attachment);}
|
||||
|
||||
BaseN_Decoder(const int *lookup, int log2base, BufferedTransformation *attachment=NULL)
|
||||
: Unflushable<Filter>(attachment)
|
||||
{
|
||||
Detach(attachment);
|
||||
IsolatedInitialize(MakeParameters(Name::DecodingLookupArray(), lookup)(Name::Log2Base(), log2base));
|
||||
}
|
||||
|
||||
|
|
@ -60,11 +60,11 @@ class CRYPTOPP_DLL Grouper : public Bufferless<Filter>
|
|||
{
|
||||
public:
|
||||
Grouper(BufferedTransformation *attachment=NULL)
|
||||
: Bufferless<Filter>(attachment) {}
|
||||
{Detach(attachment);}
|
||||
|
||||
Grouper(int groupSize, const std::string &separator, const std::string &terminator, BufferedTransformation *attachment=NULL)
|
||||
: Bufferless<Filter>(attachment)
|
||||
{
|
||||
Detach(attachment);
|
||||
IsolatedInitialize(MakeParameters(Name::GroupSize(), groupSize)
|
||||
(Name::Separator(), ConstByteArrayParameter(separator))
|
||||
(Name::Terminator(), ConstByteArrayParameter(terminator)));
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 advapi32.lib /nologo /base:"0x42900000" /dll /map /debug /machine:I386 /out:"DLL_Release/cryptopp.dll" /opt:ref /export:CryptoPP_Malloc=malloc /export:CryptoPP_Free=free
|
||||
# ADD LINK32 advapi32.lib /nologo /base:"0x42900000" /dll /map /debug /machine:I386 /out:"DLL_Release/cryptopp.dll" /opt:ref
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
# Begin Custom Build
|
||||
OutDir=.\DLL_Release
|
||||
|
|
|
|||
10
cryptest.dsp
10
cryptest.dsp
|
|
@ -45,7 +45,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm200 /c
|
||||
# ADD CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "CRYPTOPP_IMPORTS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm400 /c
|
||||
# ADD CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O1 /Ob2 /D "NDEBUG" /D "CRYPTOPP_IMPORTS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm400 /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -75,7 +75,7 @@ PreLink_Cmds=echo This configuration requires cryptopp.dll. echo You can build i
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm200 /c
|
||||
# ADD CPP /nologo /G5 /Gz /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "CRYPTOPP_IMPORTS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm400 /c
|
||||
# ADD CPP /nologo /G5 /Gz /MTd /W3 /GX /Zi /Od /D "_DEBUG" /D "CRYPTOPP_IMPORTS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm400 /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -111,7 +111,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /map /debug /machine:I386 /OPT:NOWIN98 /OPT:REF /OPT:ICF
|
||||
# ADD LINK32 advapi32.lib Ws2_32.lib /nologo /subsystem:console /map /debug /machine:I386 /OPT:NOWIN98 /OPT:REF /OPT:ICF
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "cryptest - Win32 Debug"
|
||||
|
|
@ -128,7 +128,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /Zm400 /c
|
||||
# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /Zm400 /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -136,7 +136,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /OPT:NOWIN98
|
||||
# ADD LINK32 advapi32.lib Ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /OPT:NOWIN98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
|
|
|||
158
cryptlib.cpp
158
cryptlib.cpp
|
|
@ -520,89 +520,93 @@ void GeneratableCryptoMaterial::GenerateRandomWithKeySize(RandomNumberGenerator
|
|||
GenerateRandom(rng, MakeParameters("KeySize", (int)keySize));
|
||||
}
|
||||
|
||||
class PK_DefaultEncryptionFilter : public Unflushable<Filter>
|
||||
{
|
||||
public:
|
||||
PK_DefaultEncryptionFilter(RandomNumberGenerator &rng, const PK_Encryptor &encryptor, BufferedTransformation *attachment, const NameValuePairs ¶meters)
|
||||
: m_rng(rng), m_encryptor(encryptor), m_parameters(parameters)
|
||||
{
|
||||
Detach(attachment);
|
||||
}
|
||||
|
||||
unsigned int Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking)
|
||||
{
|
||||
FILTER_BEGIN;
|
||||
m_plaintextQueue.Put(inString, length);
|
||||
|
||||
if (messageEnd)
|
||||
{
|
||||
{
|
||||
unsigned int plaintextLength = m_plaintextQueue.CurrentSize();
|
||||
unsigned int ciphertextLength = m_encryptor.CiphertextLength(plaintextLength);
|
||||
|
||||
SecByteBlock plaintext(plaintextLength);
|
||||
m_plaintextQueue.Get(plaintext, plaintextLength);
|
||||
m_ciphertext.resize(ciphertextLength);
|
||||
m_encryptor.Encrypt(m_rng, plaintext, plaintextLength, m_ciphertext, m_parameters);
|
||||
}
|
||||
|
||||
FILTER_OUTPUT(1, m_ciphertext, m_ciphertext.size(), messageEnd);
|
||||
}
|
||||
FILTER_END_NO_MESSAGE_END;
|
||||
}
|
||||
|
||||
RandomNumberGenerator &m_rng;
|
||||
const PK_Encryptor &m_encryptor;
|
||||
const NameValuePairs &m_parameters;
|
||||
ByteQueue m_plaintextQueue;
|
||||
SecByteBlock m_ciphertext;
|
||||
};
|
||||
|
||||
BufferedTransformation * PK_Encryptor::CreateEncryptionFilter(RandomNumberGenerator &rng, BufferedTransformation *attachment, const NameValuePairs ¶meters) const
|
||||
{
|
||||
struct EncryptionFilter : public Unflushable<Filter>
|
||||
{
|
||||
EncryptionFilter(RandomNumberGenerator &rng, const PK_Encryptor &encryptor, BufferedTransformation *attachment, const NameValuePairs ¶meters)
|
||||
: Unflushable<Filter>(attachment), m_rng(rng), m_encryptor(encryptor), m_parameters(parameters)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking)
|
||||
{
|
||||
FILTER_BEGIN;
|
||||
m_plaintextQueue.Put(inString, length);
|
||||
|
||||
if (messageEnd)
|
||||
{
|
||||
{
|
||||
unsigned int plaintextLength = m_plaintextQueue.CurrentSize();
|
||||
unsigned int ciphertextLength = m_encryptor.CiphertextLength(plaintextLength);
|
||||
|
||||
SecByteBlock plaintext(plaintextLength);
|
||||
m_plaintextQueue.Get(plaintext, plaintextLength);
|
||||
m_ciphertext.resize(ciphertextLength);
|
||||
m_encryptor.Encrypt(m_rng, plaintext, plaintextLength, m_ciphertext, m_parameters);
|
||||
}
|
||||
|
||||
FILTER_OUTPUT(1, m_ciphertext, m_ciphertext.size(), messageEnd);
|
||||
}
|
||||
FILTER_END_NO_MESSAGE_END;
|
||||
}
|
||||
|
||||
RandomNumberGenerator &m_rng;
|
||||
const PK_Encryptor &m_encryptor;
|
||||
const NameValuePairs &m_parameters;
|
||||
ByteQueue m_plaintextQueue;
|
||||
SecByteBlock m_ciphertext;
|
||||
};
|
||||
|
||||
return new EncryptionFilter(rng, *this, attachment, parameters);
|
||||
return new PK_DefaultEncryptionFilter(rng, *this, attachment, parameters);
|
||||
}
|
||||
|
||||
class PK_DefaultDecryptionFilter : public Unflushable<Filter>
|
||||
{
|
||||
public:
|
||||
PK_DefaultDecryptionFilter(RandomNumberGenerator &rng, const PK_Decryptor &decryptor, BufferedTransformation *attachment, const NameValuePairs ¶meters)
|
||||
: m_rng(rng), m_decryptor(decryptor), m_parameters(parameters)
|
||||
{
|
||||
Detach(attachment);
|
||||
}
|
||||
|
||||
unsigned int Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking)
|
||||
{
|
||||
FILTER_BEGIN;
|
||||
m_ciphertextQueue.Put(inString, length);
|
||||
|
||||
if (messageEnd)
|
||||
{
|
||||
{
|
||||
unsigned int ciphertextLength = m_ciphertextQueue.CurrentSize();
|
||||
unsigned int maxPlaintextLength = m_decryptor.MaxPlaintextLength(ciphertextLength);
|
||||
|
||||
SecByteBlock ciphertext(ciphertextLength);
|
||||
m_ciphertextQueue.Get(ciphertext, ciphertextLength);
|
||||
m_plaintext.resize(maxPlaintextLength);
|
||||
m_result = m_decryptor.Decrypt(m_rng, ciphertext, ciphertextLength, m_plaintext, m_parameters);
|
||||
if (!m_result.isValidCoding)
|
||||
throw InvalidCiphertext(m_decryptor.AlgorithmName() + ": invalid ciphertext");
|
||||
}
|
||||
|
||||
FILTER_OUTPUT(1, m_plaintext, m_result.messageLength, messageEnd);
|
||||
}
|
||||
FILTER_END_NO_MESSAGE_END;
|
||||
}
|
||||
|
||||
RandomNumberGenerator &m_rng;
|
||||
const PK_Decryptor &m_decryptor;
|
||||
const NameValuePairs &m_parameters;
|
||||
ByteQueue m_ciphertextQueue;
|
||||
SecByteBlock m_plaintext;
|
||||
DecodingResult m_result;
|
||||
};
|
||||
|
||||
BufferedTransformation * PK_Decryptor::CreateDecryptionFilter(RandomNumberGenerator &rng, BufferedTransformation *attachment, const NameValuePairs ¶meters) const
|
||||
{
|
||||
struct DecryptionFilter : public Unflushable<Filter>
|
||||
{
|
||||
DecryptionFilter(RandomNumberGenerator &rng, const PK_Decryptor &decryptor, BufferedTransformation *attachment, const NameValuePairs ¶meters)
|
||||
: Unflushable<Filter>(attachment), m_rng(rng), m_decryptor(decryptor), m_parameters(parameters)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking)
|
||||
{
|
||||
FILTER_BEGIN;
|
||||
m_ciphertextQueue.Put(inString, length);
|
||||
|
||||
if (messageEnd)
|
||||
{
|
||||
{
|
||||
unsigned int ciphertextLength = m_ciphertextQueue.CurrentSize();
|
||||
unsigned int maxPlaintextLength = m_decryptor.MaxPlaintextLength(ciphertextLength);
|
||||
|
||||
SecByteBlock ciphertext(ciphertextLength);
|
||||
m_ciphertextQueue.Get(ciphertext, ciphertextLength);
|
||||
m_plaintext.resize(maxPlaintextLength);
|
||||
m_result = m_decryptor.Decrypt(m_rng, ciphertext, ciphertextLength, m_plaintext, m_parameters);
|
||||
if (!m_result.isValidCoding)
|
||||
throw InvalidCiphertext(m_decryptor.AlgorithmName() + ": invalid ciphertext");
|
||||
}
|
||||
|
||||
FILTER_OUTPUT(1, m_plaintext, m_result.messageLength, messageEnd);
|
||||
}
|
||||
FILTER_END_NO_MESSAGE_END;
|
||||
}
|
||||
|
||||
RandomNumberGenerator &m_rng;
|
||||
const PK_Decryptor &m_decryptor;
|
||||
const NameValuePairs &m_parameters;
|
||||
ByteQueue m_ciphertextQueue;
|
||||
SecByteBlock m_plaintext;
|
||||
DecodingResult m_result;
|
||||
};
|
||||
|
||||
return new DecryptionFilter(rng, *this, attachment, parameters);
|
||||
return new PK_DefaultDecryptionFilter(rng, *this, attachment, parameters);
|
||||
}
|
||||
|
||||
unsigned int PK_Signer::Sign(RandomNumberGenerator &rng, PK_MessageAccumulator *messageAccumulator, byte *signature) const
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Intermediate_Dir "FIPS_140_Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /c
|
||||
# ADD CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /Fd"FIPS_140_Release/cryptopp" /FD /c
|
||||
# ADD CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O1 /Ob2 /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /Fd"FIPS_140_Release/cryptopp" /FD /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -66,7 +66,7 @@ LIB32=link.exe -lib
|
|||
# PROP Intermediate_Dir "FIPS_140_Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /c
|
||||
# ADD CPP /nologo /G5 /Gz /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /Fd"FIPS_140_Debug/cryptopp" /FD /c
|
||||
# ADD CPP /nologo /G5 /Gz /MTd /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /Fd"FIPS_140_Debug/cryptopp" /FD /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -112,7 +112,7 @@ LIB32=link.exe -lib
|
|||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /Yu"pch.h" /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /Yu"pch.h" /FD /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409
|
||||
BSC32=bscmake.exe
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ void FIPS140_SampleApplication()
|
|||
{
|
||||
if (!FIPS_140_2_ComplianceEnabled())
|
||||
{
|
||||
cerr << "FIPS-140-2 compliance was turned off at compile time.\n";
|
||||
cerr << "FIPS 140-2 compliance was turned off at compile time.\n";
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "CRYPTOPP_DLL_ONLY" /YX /FD /c
|
||||
# ADD CPP /nologo /Gz /MT /W3 /GX /Zi /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "CRYPTOPP_DLL_ONLY" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -66,7 +66,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "CRYPTOPP_DLL_ONLY" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "CRYPTOPP_DLL_ONLY" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public:
|
|||
const EllipticCurve& GetCurve() const {return m_groupPrecomputation.GetCurve();}
|
||||
|
||||
bool operator==(const ThisClass &rhs) const
|
||||
{return DL_GroupParametersImpl<EcPrecomputation<EC> >::operator==(rhs);}
|
||||
{return m_groupPrecomputation.GetCurve() == rhs.m_groupPrecomputation.GetCurve() && m_gpc.GetBase(m_groupPrecomputation) == rhs.m_gpc.GetBase(rhs.m_groupPrecomputation);}
|
||||
|
||||
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
|
||||
const Point& GetBasePoint() const {return GetSubgroupGenerator();}
|
||||
|
|
|
|||
12
filters.cpp
12
filters.cpp
|
|
@ -40,14 +40,12 @@ const BufferedTransformation *Filter::AttachedTransformation() const
|
|||
void Filter::Detach(BufferedTransformation *newOut)
|
||||
{
|
||||
m_attachment.reset(newOut);
|
||||
NotifyAttachmentChange();
|
||||
}
|
||||
|
||||
void Filter::Insert(Filter *filter)
|
||||
{
|
||||
filter->m_attachment.reset(m_attachment.release());
|
||||
m_attachment.reset(filter);
|
||||
NotifyAttachmentChange();
|
||||
}
|
||||
|
||||
unsigned int Filter::CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end, const std::string &channel, bool blocking) const
|
||||
|
|
@ -896,14 +894,20 @@ unsigned int StringStore::CopyRangeTo2(BufferedTransformation &target, unsigned
|
|||
return blockedBytes;
|
||||
}
|
||||
|
||||
void RandomNumberStore::StoreInitialize(const NameValuePairs ¶meters)
|
||||
{
|
||||
parameters.GetRequiredParameter("RandomNumberStore", "RandomNumberGeneratorPointer", m_rng);
|
||||
parameters.GetRequiredIntParameter("RandomNumberStore", "RandomNumberStoreSize", m_length);
|
||||
}
|
||||
|
||||
unsigned int RandomNumberStore::TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel, bool blocking)
|
||||
{
|
||||
if (!blocking)
|
||||
throw NotImplemented("RandomNumberStore: nonblocking transfer is not implemented by this object");
|
||||
|
||||
unsigned long transferMax = transferBytes;
|
||||
for (transferBytes = 0; transferBytes<transferMax && m_count < m_length; ++transferBytes, ++m_count)
|
||||
target.ChannelPut(channel, m_rng.GenerateByte());
|
||||
for (transferBytes = 0; transferBytes<transferMax && m_count < (unsigned long)m_length; ++transferBytes, ++m_count)
|
||||
target.ChannelPut(channel, m_rng->GenerateByte());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
31
filters.h
31
filters.h
|
|
@ -14,7 +14,7 @@ NAMESPACE_BEGIN(CryptoPP)
|
|||
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Filter : public BufferedTransformation, public NotCopyable
|
||||
{
|
||||
public:
|
||||
Filter(BufferedTransformation *attachment);
|
||||
Filter(BufferedTransformation *attachment = NULL);
|
||||
|
||||
bool Attachable() {return true;}
|
||||
BufferedTransformation *AttachedTransformation();
|
||||
|
|
@ -29,7 +29,6 @@ public:
|
|||
bool MessageSeriesEnd(int propagation=-1, bool blocking=true);
|
||||
|
||||
protected:
|
||||
virtual void NotifyAttachmentChange() {}
|
||||
virtual BufferedTransformation * NewDefaultAttachment() const;
|
||||
void Insert(Filter *nextFilter); // insert filter after this one
|
||||
|
||||
|
|
@ -84,7 +83,7 @@ class CRYPTOPP_DLL MeterFilter : public Bufferless<Filter>
|
|||
{
|
||||
public:
|
||||
MeterFilter(BufferedTransformation *attachment=NULL, bool transparent=true)
|
||||
: Bufferless<Filter>(attachment), m_transparent(transparent) {ResetMeter();}
|
||||
: m_transparent(transparent) {Detach(attachment); ResetMeter();}
|
||||
|
||||
void SetTransparent(bool transparent) {m_transparent = transparent;}
|
||||
void ResetMeter() {m_currentMessageBytes = m_totalBytes = m_currentSeriesMessages = m_totalMessages = m_totalMessageSeries = 0;}
|
||||
|
|
@ -269,7 +268,7 @@ class CRYPTOPP_DLL HashFilter : public Bufferless<Filter>, private FilterPutSpac
|
|||
{
|
||||
public:
|
||||
HashFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, bool putMessage=false)
|
||||
: Bufferless<Filter>(attachment), m_hashModule(hm), m_putMessage(putMessage) {}
|
||||
: m_hashModule(hm), m_putMessage(putMessage) {Detach(attachment);}
|
||||
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||
unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
|
||||
|
|
@ -321,7 +320,7 @@ class CRYPTOPP_DLL SignerFilter : public Unflushable<Filter>
|
|||
{
|
||||
public:
|
||||
SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *attachment = NULL, bool putMessage=false)
|
||||
: Unflushable<Filter>(attachment), m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewSignatureAccumulator(rng)), m_putMessage(putMessage) {}
|
||||
: m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewSignatureAccumulator(rng)), m_putMessage(putMessage) {Detach(attachment);}
|
||||
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||
unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
|
||||
|
|
@ -597,8 +596,11 @@ private:
|
|||
class CRYPTOPP_DLL RandomNumberStore : public Store
|
||||
{
|
||||
public:
|
||||
RandomNumberStore()
|
||||
: m_rng(NULL), m_length(0), m_count(0) {}
|
||||
|
||||
RandomNumberStore(RandomNumberGenerator &rng, unsigned long length)
|
||||
: m_rng(rng), m_length(length), m_count(0) {}
|
||||
: m_rng(&rng), m_length(length), m_count(0) {}
|
||||
|
||||
bool AnyRetrievable() const {return MaxRetrievable() != 0;}
|
||||
unsigned long MaxRetrievable() const {return m_length-m_count;}
|
||||
|
|
@ -610,10 +612,10 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void StoreInitialize(const NameValuePairs ¶meters) {m_count = 0;}
|
||||
void StoreInitialize(const NameValuePairs ¶meters);
|
||||
|
||||
RandomNumberGenerator &m_rng;
|
||||
const unsigned long m_length;
|
||||
RandomNumberGenerator *m_rng;
|
||||
int m_length;
|
||||
unsigned long m_count;
|
||||
};
|
||||
|
||||
|
|
@ -635,8 +637,8 @@ private:
|
|||
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Source : public InputRejecting<Filter>
|
||||
{
|
||||
public:
|
||||
Source(BufferedTransformation *attachment)
|
||||
: InputRejecting<Filter>(attachment) {}
|
||||
Source(BufferedTransformation *attachment = NULL)
|
||||
{Detach(attachment);}
|
||||
|
||||
unsigned long Pump(unsigned long pumpMax=ULONG_MAX)
|
||||
{Pump2(pumpMax); return pumpMax;}
|
||||
|
|
@ -665,8 +667,6 @@ class SourceTemplate : public Source
|
|||
public:
|
||||
SourceTemplate<T>(BufferedTransformation *attachment)
|
||||
: Source(attachment) {}
|
||||
SourceTemplate<T>(BufferedTransformation *attachment, T store)
|
||||
: Source(attachment), m_store(store) {}
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters)
|
||||
{m_store.IsolatedInitialize(parameters);}
|
||||
unsigned int Pump2(unsigned long &byteCount, bool blocking=true)
|
||||
|
|
@ -704,8 +704,9 @@ public:
|
|||
class CRYPTOPP_DLL RandomNumberSource : public SourceTemplate<RandomNumberStore>
|
||||
{
|
||||
public:
|
||||
RandomNumberSource(RandomNumberGenerator &rng, unsigned int length, bool pumpAll, BufferedTransformation *attachment = NULL)
|
||||
: SourceTemplate<RandomNumberStore>(attachment, RandomNumberStore(rng, length)) {if (pumpAll) PumpAll();}
|
||||
RandomNumberSource(RandomNumberGenerator &rng, int length, bool pumpAll, BufferedTransformation *attachment = NULL)
|
||||
: SourceTemplate<RandomNumberStore>(attachment)
|
||||
{SourceInitialize(pumpAll, MakeParameters("RandomNumberGeneratorPointer", &rng)("RandomNumberStoreSize", length));}
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
|
|
|||
18
ida.h
18
ida.h
|
|
@ -14,7 +14,7 @@ class RawIDA : public AutoSignaling<Unflushable<Multichannel<Filter> > >
|
|||
{
|
||||
public:
|
||||
RawIDA(BufferedTransformation *attachment=NULL)
|
||||
: AutoSignaling<Unflushable<Multichannel<Filter> > >(attachment) {}
|
||||
{Detach(attachment);}
|
||||
|
||||
unsigned int GetThreshold() const {return m_threshold;}
|
||||
void AddOutputChannel(word32 channelId);
|
||||
|
|
@ -57,8 +57,11 @@ class SecretSharing : public CustomFlushPropagation<Filter>
|
|||
{
|
||||
public:
|
||||
SecretSharing(RandomNumberGenerator &rng, int threshold, int nShares, BufferedTransformation *attachment=NULL, bool addPadding=true)
|
||||
: CustomFlushPropagation<Filter>(attachment), m_rng(rng), m_ida(new OutputProxy(*this, true))
|
||||
{IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("NumberOfShares", nShares)("AddPadding", addPadding));}
|
||||
: m_rng(rng), m_ida(new OutputProxy(*this, true))
|
||||
{
|
||||
Detach(attachment);
|
||||
IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("NumberOfShares", nShares)("AddPadding", addPadding));
|
||||
}
|
||||
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters=g_nullNameValuePairs);
|
||||
unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
|
||||
|
|
@ -92,8 +95,11 @@ class InformationDispersal : public CustomFlushPropagation<Filter>
|
|||
{
|
||||
public:
|
||||
InformationDispersal(int threshold, int nShares, BufferedTransformation *attachment=NULL, bool addPadding=true)
|
||||
: CustomFlushPropagation<Filter>(attachment), m_ida(new OutputProxy(*this, true))
|
||||
{IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("NumberOfShares", nShares)("AddPadding", addPadding));}
|
||||
: m_ida(new OutputProxy(*this, true))
|
||||
{
|
||||
Detach(attachment);
|
||||
IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("NumberOfShares", nShares)("AddPadding", addPadding));
|
||||
}
|
||||
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters=g_nullNameValuePairs);
|
||||
unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
|
||||
|
|
@ -127,7 +133,7 @@ class PaddingRemover : public Unflushable<Filter>
|
|||
{
|
||||
public:
|
||||
PaddingRemover(BufferedTransformation *attachment=NULL)
|
||||
: Unflushable<Filter>(attachment), m_possiblePadding(false) {}
|
||||
: m_possiblePadding(false) {Detach(attachment);}
|
||||
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters) {m_possiblePadding = false;}
|
||||
unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
|
||||
|
|
|
|||
5
mqueue.h
5
mqueue.h
|
|
@ -69,8 +69,9 @@ public:
|
|||
|
||||
/*! if throwIfNotEqual is false, this filter will output a '\0' byte when it detects a mismatch, '\1' otherwise */
|
||||
EqualityComparisonFilter(BufferedTransformation *attachment=NULL, bool throwIfNotEqual=true, const std::string &firstChannel="0", const std::string &secondChannel="1")
|
||||
: Unflushable<Multichannel<Filter> >(attachment), m_throwIfNotEqual(throwIfNotEqual), m_mismatchDetected(false)
|
||||
, m_firstChannel(firstChannel), m_secondChannel(secondChannel) {}
|
||||
: m_throwIfNotEqual(throwIfNotEqual), m_mismatchDetected(false)
|
||||
, m_firstChannel(firstChannel), m_secondChannel(secondChannel)
|
||||
{Detach(attachment);}
|
||||
|
||||
unsigned int ChannelPut2(const std::string &channel, const byte *begin, unsigned int length, int messageEnd, bool blocking);
|
||||
bool ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1, bool blocking=true);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class CRYPTOPP_NO_VTABLE NonblockingSource : public AutoSignaling<Source>
|
|||
{
|
||||
public:
|
||||
NonblockingSource(BufferedTransformation *attachment)
|
||||
: AutoSignaling<Source>(attachment), m_messageEndSent(false) {}
|
||||
: m_messageEndSent(false) {Detach(attachment);}
|
||||
|
||||
//! \name NONBLOCKING SOURCE
|
||||
//@{
|
||||
|
|
|
|||
3
pubkey.h
3
pubkey.h
|
|
@ -639,9 +639,6 @@ public:
|
|||
const DL_FixedBasePrecomputation<Element> & GetBasePrecomputation() const {return m_gpc;}
|
||||
DL_FixedBasePrecomputation<Element> & AccessBasePrecomputation() {return m_gpc;}
|
||||
|
||||
bool operator==(const DL_GroupParametersImpl<GROUP_PRECOMP, BASE_PRECOMP, BASE> &rhs) const
|
||||
{return m_groupPrecomputation.GetCurve() == rhs.m_groupPrecomputation.GetCurve() && m_gpc.GetBase(m_groupPrecomputation) == rhs.m_gpc.GetBase(rhs.m_groupPrecomputation);}
|
||||
|
||||
protected:
|
||||
GROUP_PRECOMP m_groupPrecomputation;
|
||||
BASE_PRECOMP m_gpc;
|
||||
|
|
|
|||
18
simple.h
18
simple.h
|
|
@ -56,8 +56,6 @@ template <class T>
|
|||
class CRYPTOPP_NO_VTABLE Bufferless : public T
|
||||
{
|
||||
public:
|
||||
Bufferless() {}
|
||||
Bufferless(BufferedTransformation *q) : T(q) {}
|
||||
bool IsolatedFlush(bool hardFlush, bool blocking) {return false;}
|
||||
};
|
||||
|
||||
|
|
@ -65,8 +63,6 @@ template <class T>
|
|||
class CRYPTOPP_NO_VTABLE Unflushable : public T
|
||||
{
|
||||
public:
|
||||
Unflushable() {}
|
||||
Unflushable(BufferedTransformation *q) : T(q) {}
|
||||
bool Flush(bool completeFlush, int propagation=-1, bool blocking=true)
|
||||
{return ChannelFlush(NULL_CHANNEL, completeFlush, propagation, blocking);}
|
||||
bool IsolatedFlush(bool hardFlush, bool blocking)
|
||||
|
|
@ -90,10 +86,6 @@ template <class T>
|
|||
class CRYPTOPP_NO_VTABLE InputRejecting : public T
|
||||
{
|
||||
public:
|
||||
InputRejecting() {}
|
||||
InputRejecting(BufferedTransformation *q) : T(q) {}
|
||||
|
||||
protected:
|
||||
struct InputRejected : public NotImplemented
|
||||
{InputRejected() : NotImplemented("BufferedTransformation: this object doesn't allow input") {}};
|
||||
|
||||
|
|
@ -112,9 +104,6 @@ template <class T>
|
|||
class CRYPTOPP_NO_VTABLE CustomFlushPropagation : public T
|
||||
{
|
||||
public:
|
||||
CustomFlushPropagation() {}
|
||||
CustomFlushPropagation(BufferedTransformation *q) : T(q) {}
|
||||
|
||||
virtual bool Flush(bool hardFlush, int propagation=-1, bool blocking=true) =0;
|
||||
|
||||
private:
|
||||
|
|
@ -125,9 +114,6 @@ template <class T>
|
|||
class CRYPTOPP_NO_VTABLE CustomSignalPropagation : public CustomFlushPropagation<T>
|
||||
{
|
||||
public:
|
||||
CustomSignalPropagation() {}
|
||||
CustomSignalPropagation(BufferedTransformation *q) : CustomFlushPropagation<T>(q) {}
|
||||
|
||||
virtual void Initialize(const NameValuePairs ¶meters=g_nullNameValuePairs, int propagation=-1) =0;
|
||||
|
||||
private:
|
||||
|
|
@ -138,9 +124,6 @@ template <class T>
|
|||
class CRYPTOPP_NO_VTABLE Multichannel : public CustomFlushPropagation<T>
|
||||
{
|
||||
public:
|
||||
Multichannel() {}
|
||||
Multichannel(BufferedTransformation *q) : CustomFlushPropagation<T>(q) {}
|
||||
|
||||
bool Flush(bool hardFlush, int propagation=-1, bool blocking=true)
|
||||
{return ChannelFlush(NULL_CHANNEL, hardFlush, propagation, blocking);}
|
||||
bool MessageSeriesEnd(int propagation=-1, bool blocking=true)
|
||||
|
|
@ -171,7 +154,6 @@ class CRYPTOPP_NO_VTABLE AutoSignaling : public T
|
|||
{
|
||||
public:
|
||||
AutoSignaling(int propagation=-1) : m_autoSignalPropagation(propagation) {}
|
||||
AutoSignaling(BufferedTransformation *q, int propagation=-1) : T(q), m_autoSignalPropagation(propagation) {}
|
||||
|
||||
void SetAutoSignalPropagation(int propagation)
|
||||
{m_autoSignalPropagation = propagation;}
|
||||
|
|
|
|||
|
|
@ -209,9 +209,10 @@ bool HuffmanDecoder::Decode(LowFirstBitReader &reader, value_t &value) const
|
|||
// *************************************************************
|
||||
|
||||
Inflator::Inflator(BufferedTransformation *attachment, bool repeat, int propagation)
|
||||
: AutoSignaling<Filter>(attachment, propagation)
|
||||
: AutoSignaling<Filter>(propagation)
|
||||
, m_state(PRE_STREAM), m_repeat(repeat), m_reader(m_inQueue)
|
||||
{
|
||||
Detach(attachment);
|
||||
}
|
||||
|
||||
void Inflator::IsolatedInitialize(const NameValuePairs ¶meters)
|
||||
|
|
|
|||
Loading…
Reference in New Issue