Removed MAINTAIN_BACKWARDS_COMPATIBILITY_562 (Issue 70)

pull/347/head
Jeffrey Walton 2016-12-03 00:32:07 -05:00
parent 6eb2792bc2
commit 40230dd3bf
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
44 changed files with 248 additions and 1724 deletions

View File

@ -19,9 +19,6 @@ namespace
{ {
const word32 START_E = 0x0b0b; // round constant of first encryption round const word32 START_E = 0x0b0b; // round constant of first encryption round
const word32 START_D = 0xb1b1; // round constant of first decryption round const word32 START_D = 0xb1b1; // round constant of first decryption round
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
const word32 RC_MODULUS = 0x11011;
#endif
} }
static inline word32 reverseBits(word32 a) static inline word32 reverseBits(word32 a)

View File

@ -48,7 +48,6 @@ channels.h
cmac.cpp cmac.cpp
cmac.h cmac.h
config.h config.h
config.compat
cpu.cpp cpu.cpp
cpu.h cpu.h
crc.cpp crc.cpp

View File

@ -676,7 +676,7 @@ dlltest.exe: cryptopp.dll $(DLLTESTOBJS)
$(CXX) -o $@ $(strip $(CXXFLAGS)) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS) $(CXX) -o $@ $(strip $(CXXFLAGS)) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS)
# This recipe prepares the distro files # This recipe prepares the distro files
TEXT_FILES := *.h *.cpp adhoc.cpp.proto License.txt Readme.txt Install.txt Filelist.txt CMakeLists.txt config.compat Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj *.filters cryptopp.rc TestVectors/*.txt TestData/*.dat TestScripts/*.sh TestScripts/*.pl TestScripts/*.cmd TEXT_FILES := *.h *.cpp adhoc.cpp.proto License.txt Readme.txt Install.txt Filelist.txt CMakeLists.txt Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj *.filters cryptopp.rc TestVectors/*.txt TestData/*.dat TestScripts/*.sh TestScripts/*.pl TestScripts/*.cmd
EXEC_FILES := GNUmakefile GNUmakefile-cross TestData/ TestVectors/ TestScripts/ EXEC_FILES := GNUmakefile GNUmakefile-cross TestData/ TestVectors/ TestScripts/
ifeq ($(wildcard Filelist.txt),Filelist.txt) ifeq ($(wildcard Filelist.txt),Filelist.txt)
@ -686,10 +686,10 @@ endif
.PHONY: trim .PHONY: trim
trim: trim:
ifneq ($(IS_DARWIN),0) ifneq ($(IS_DARWIN),0)
sed -i '' -e's/[[:space:]]*$$//' *.compat *.sh *.h *.cpp *.sln *.vcxproj GNUmakefile GNUmakefile-cross sed -i '' -e's/[[:space:]]*$$//' *.sh *.h *.cpp *.sln *.vcxproj GNUmakefile GNUmakefile-cross
make convert make convert
else else
sed -i -e's/[[:space:]]*$$//' *.compat *.sh *.h *.cpp *.sln *.vcxproj GNUmakefile GNUmakefile-cross sed -i -e's/[[:space:]]*$$//' *.sh *.h *.cpp *.sln *.vcxproj GNUmakefile GNUmakefile-cross
make convert make convert
endif endif

View File

@ -30,12 +30,6 @@
# rather than all of them. Its useful at places like the GCC Compile Farm, where being nice is policy. # rather than all of them. Its useful at places like the GCC Compile Farm, where being nice is policy.
# ./cryptest.sh nice # ./cryptest.sh nice
# You can test using original config.h with the following. 'orig', 'original' and 'config.h' are synonyms:
# ./cryptest.sh original
# You can test 5.6.2 compatibility using config.compat with the following. 'compat', 'compatibility' and 'config.compat' are synonyms:
# ./cryptest.sh compatibility
############################################ ############################################
# Set to suite your taste # Set to suite your taste
@ -177,9 +171,6 @@ do
WANT_NICE=1 WANT_NICE=1
elif [[ ($("$EGREP" -ix "orig" <<< "$ARG") || $("$EGREP" -ix "original" <<< "$ARG") || $("$EGREP" -ix "config.h" <<< "$ARG")) ]]; then elif [[ ($("$EGREP" -ix "orig" <<< "$ARG") || $("$EGREP" -ix "original" <<< "$ARG") || $("$EGREP" -ix "config.h" <<< "$ARG")) ]]; then
git checkout config.h > /dev/null 2>&1 git checkout config.h > /dev/null 2>&1
elif [[ ($("$EGREP" -ix "compat" <<< "$ARG") || $("$EGREP" -ix "compatibility" <<< "$ARG") || $("$EGREP" -ix "config.compat" <<< "$ARG")) ]]; then
git checkout config.compatibility > /dev/null 2>&1
cp config.compatibility config.h
else else
echo "Unknown option $ARG" echo "Unknown option $ARG"
fi fi
@ -2675,63 +2666,6 @@ if [[ "$HAVE_X32" -ne "0" ]]; then
fi fi
fi fi
############################################
# Backwards compatibility
if true; then
############################################
# Debug build
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Debug, MAINTAIN_BACKWARDS_COMPATIBILITY" | tee -a "$TEST_RESULTS"
echo
"$MAKE" clean > /dev/null 2>&1
rm -f adhoc.cpp > /dev/null 2>&1
CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ${PLATFORM_CXXFLAGS[@]} $USER_CXXFLAGS ${DEPRECATED_CXXFLAGS[@]}"
CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
else
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
fi
fi
############################################
# Release build
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Release, MAINTAIN_BACKWARDS_COMPATIBILITY" | tee -a "$TEST_RESULTS"
echo
"$MAKE" clean > /dev/null 2>&1
rm -f adhoc.cpp > /dev/null 2>&1
CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ${PLATFORM_CXXFLAGS[@]} $USER_CXXFLAGS ${DEPRECATED_CXXFLAGS[@]}"
CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
fi
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
fi
fi
############################################ ############################################
# init_priority # init_priority
if true; then if true; then

19
asn.h
View File

@ -165,6 +165,8 @@ CRYPTOPP_DLL void CRYPTOPP_API DERReencode(BufferedTransformation &bt, BufferedT
class CRYPTOPP_DLL OID class CRYPTOPP_DLL OID
{ {
public: public:
virtual ~OID() {}
//! \brief Construct an OID //! \brief Construct an OID
OID() {} OID() {}
//! \brief Construct an OID //! \brief Construct an OID
@ -211,6 +213,8 @@ class EncodedObjectFilter : public Filter
public: public:
enum Flag {PUT_OBJECTS=1, PUT_MESSANGE_END_AFTER_EACH_OBJECT=2, PUT_MESSANGE_END_AFTER_ALL_OBJECTS=4, PUT_MESSANGE_SERIES_END_AFTER_ALL_OBJECTS=8}; enum Flag {PUT_OBJECTS=1, PUT_MESSANGE_END_AFTER_EACH_OBJECT=2, PUT_MESSANGE_END_AFTER_ALL_OBJECTS=4, PUT_MESSANGE_SERIES_END_AFTER_ALL_OBJECTS=8};
virtual ~EncodedObjectFilter() {}
//! \brief Construct an EncodedObjectFilter //! \brief Construct an EncodedObjectFilter
//! \param attachment a BufferedTrasformation to attach to this object //! \param attachment a BufferedTrasformation to attach to this object
//! \param nObjects //! \param nObjects
@ -241,9 +245,10 @@ private:
class CRYPTOPP_DLL BERGeneralDecoder : public Store class CRYPTOPP_DLL BERGeneralDecoder : public Store
{ {
public: public:
virtual ~BERGeneralDecoder();
explicit BERGeneralDecoder(BufferedTransformation &inQueue, byte asnTag); explicit BERGeneralDecoder(BufferedTransformation &inQueue, byte asnTag);
explicit BERGeneralDecoder(BERGeneralDecoder &inQueue, byte asnTag); explicit BERGeneralDecoder(BERGeneralDecoder &inQueue, byte asnTag);
~BERGeneralDecoder();
bool IsDefiniteLength() const {return m_definiteLength;} bool IsDefiniteLength() const {return m_definiteLength;}
lword RemainingLength() const {CRYPTOPP_ASSERT(m_definiteLength); return m_length;} lword RemainingLength() const {CRYPTOPP_ASSERT(m_definiteLength); return m_length;}
@ -278,14 +283,10 @@ private:
class CRYPTOPP_DLL DERGeneralEncoder : public ByteQueue class CRYPTOPP_DLL DERGeneralEncoder : public ByteQueue
{ {
public: public:
#if defined(CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562) virtual ~DERGeneralEncoder();
explicit DERGeneralEncoder(BufferedTransformation &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED); explicit DERGeneralEncoder(BufferedTransformation &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED);
explicit DERGeneralEncoder(DERGeneralEncoder &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED); explicit DERGeneralEncoder(DERGeneralEncoder &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED);
#else
explicit DERGeneralEncoder(BufferedTransformation &outQueue, byte asnTag /*= SEQUENCE | CONSTRUCTED*/);
explicit DERGeneralEncoder(DERGeneralEncoder &outQueue, byte asnTag /*= SEQUENCE | CONSTRUCTED*/);
#endif
~DERGeneralEncoder();
// call this to denote end of sequence // call this to denote end of sequence
void MessageEnd(); void MessageEnd();
@ -390,6 +391,8 @@ public:
class CRYPTOPP_DLL X509PublicKey : public ASN1CryptoMaterial<PublicKey> class CRYPTOPP_DLL X509PublicKey : public ASN1CryptoMaterial<PublicKey>
{ {
public: public:
virtual ~X509PublicKey() {}
void BERDecode(BufferedTransformation &bt); void BERDecode(BufferedTransformation &bt);
void DEREncode(BufferedTransformation &bt) const; void DEREncode(BufferedTransformation &bt) const;
@ -411,6 +414,8 @@ public:
class CRYPTOPP_DLL PKCS8PrivateKey : public ASN1CryptoMaterial<PrivateKey> class CRYPTOPP_DLL PKCS8PrivateKey : public ASN1CryptoMaterial<PrivateKey>
{ {
public: public:
virtual ~PKCS8PrivateKey() {}
void BERDecode(BufferedTransformation &bt); void BERDecode(BufferedTransformation &bt);
void DEREncode(BufferedTransformation &bt) const; void DEREncode(BufferedTransformation &bt) const;

View File

@ -18,6 +18,8 @@ class PublicBlumBlumShub : public RandomNumberGenerator,
public StreamTransformation public StreamTransformation
{ {
public: public:
virtual ~PublicBlumBlumShub() {}
PublicBlumBlumShub(const Integer &n, const Integer &seed); PublicBlumBlumShub(const Integer &n, const Integer &seed);
unsigned int GenerateBit(); unsigned int GenerateBit();
@ -28,10 +30,6 @@ public:
bool IsSelfInverting() const {return true;} bool IsSelfInverting() const {return true;}
bool IsForwardTransformation() const {return true;} bool IsForwardTransformation() const {return true;}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~PublicBlumBlumShub() {}
#endif
protected: protected:
ModularArithmetic modn; ModularArithmetic modn;
Integer current; Integer current;
@ -42,6 +40,8 @@ protected:
class BlumBlumShub : public PublicBlumBlumShub class BlumBlumShub : public PublicBlumBlumShub
{ {
public: public:
virtual ~BlumBlumShub() {}
// Make sure p and q are both primes congruent to 3 mod 4 and at least 512 bits long, // Make sure p and q are both primes congruent to 3 mod 4 and at least 512 bits long,
// seed is the secret key and should be about as big as p*q // seed is the secret key and should be about as big as p*q
BlumBlumShub(const Integer &p, const Integer &q, const Integer &seed); BlumBlumShub(const Integer &p, const Integer &q, const Integer &seed);
@ -49,10 +49,6 @@ public:
bool IsRandomAccess() const {return true;} bool IsRandomAccess() const {return true;}
void Seek(lword index); void Seek(lword index);
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~BlumBlumShub() {}
#endif
protected: protected:
const Integer p, q; const Integer p, q;
const Integer x0; const Integer x0;

View File

@ -1,950 +0,0 @@
// config.h - written and placed in the public domain by Wei Dai
//! \file config.h
//! \brief Library configuration file
#ifndef CRYPTOPP_CONFIG_H
#define CRYPTOPP_CONFIG_H
// ***************** Important Settings ********************
// define this if running on a big-endian CPU
#if !defined(IS_LITTLE_ENDIAN) && (defined(__BIG_ENDIAN__) || (defined(__s390__) || defined(__s390x__) || defined(__zarch__)) || (defined(__m68k__) || defined(__MC68K__)) || defined(__sparc) || defined(__sparc__) || defined(__hppa__) || defined(__MIPSEB__) || defined(__ARMEB__) || (defined(__MWERKS__) && !defined(__INTEL__)))
# define IS_BIG_ENDIAN
#endif
// define this if running on a little-endian CPU
// big endian will be assumed if IS_LITTLE_ENDIAN is not defined
#ifndef IS_BIG_ENDIAN
# define IS_LITTLE_ENDIAN
#endif
// Sanity checks. Some processors have more than big-, little- and bi-endian modes. PDP mode, where order results in "4312", should
// raise red flags immediately. Additionally, mis-classified machines, like (previosuly) S/390, should raise red flags immediately.
#if defined(IS_BIG_ENDIAN) && defined(__GNUC__) && defined(__BYTE_ORDER__) && (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__)
# error "IS_BIG_ENDIAN is set, but __BYTE_ORDER__ does not equal __ORDER_BIG_ENDIAN__"
#endif
#if defined(IS_LITTLE_ENDIAN) && defined(__GNUC__) && defined(__BYTE_ORDER__) && (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__)
# error "IS_LITTLE_ENDIAN is set, but __BYTE_ORDER__ does not equal __ORDER_LITTLE_ENDIAN__"
#endif
// Define this if you want to disable all OS-dependent features,
// such as sockets and OS-provided random number generators
// #define NO_OS_DEPENDENCE
// Define this to use features provided by Microsoft's CryptoAPI.
// Currently the only feature used is Windows random number generation.
// This macro will be ignored if NO_OS_DEPENDENCE is defined.
// #define USE_MS_CRYPTOAPI
// Define this to use features provided by Microsoft's CryptoNG API.
// CryptoNG API is available in Vista and above and its cross platform,
// including desktop apps and store apps. Currently the only feature
// used is Windows random number generation.
// This macro will be ignored if NO_OS_DEPENDENCE is defined.
// #define USE_MS_CNGAPI
// If the user did not make a choice, then select CryptoNG if either
// Visual Studio 2015 is available, or Windows 10 or above is available.
#if !defined(USE_MS_CRYPTOAPI) && !defined(USE_MS_CNGAPI)
# if (_MSC_VER >= 1900) || ((WINVER >= 0x0A00 /*_WIN32_WINNT_WIN10*/) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/))
# define USE_MS_CNGAPI
# else
# define USE_MS_CRYPTOAPI
# endif
#endif
// Define this to ensure C/C++ standard compliance and respect for GCC aliasing rules and other alignment fodder. If you
// experience a break with GCC at -O3, you should try this first. Guard it in case its set on the command line (and it differs).
#ifndef CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
// # define CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
#endif
// ***************** Less Important Settings ***************
// Library version
#define CRYPTOPP_VERSION 570
// Define this if you want to set a prefix for TestData/ and TestVectors/
// Be mindful of the trailing slash since its simple concatenation.
// g++ ... -DCRYPTOPP_DATA_DIR='"/tmp/cryptopp_test/share/"'
#ifndef CRYPTOPP_DATA_DIR
# define CRYPTOPP_DATA_DIR ""
#endif
// define this to retain (as much as possible) old deprecated function and class names
// #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
// Define this to retain (as much as possible) ABI and binary compatibility with Crypto++ 5.6.2.
// Also see https://cryptopp.com/wiki/Config.h#Avoid_MAINTAIN_BACKWARDS_COMPATIBILITY
#define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
// Define this if you want or need the library's memcpy_s and memmove_s.
// See http://github.com/weidai11/cryptopp/issues/28.
// #if !defined(CRYPTOPP_WANT_SECURE_LIB)
// # define CRYPTOPP_WANT_SECURE_LIB
// #endif
// File system code to write to GZIP archive.
#if !defined(GZIP_OS_CODE)
# define GZIP_OS_CODE 0
#endif
// Try this if your CPU has 256K internal cache or a slow multiply instruction
// and you want a (possibly) faster IDEA implementation using log tables
// #define IDEA_LARGECACHE
// Define this if, for the linear congruential RNG, you want to use
// the original constants as specified in S.K. Park and K.W. Miller's
// CACM paper.
// #define LCRNG_ORIGINAL_NUMBERS
// Define this if you want Integer's operator<< to honor std::showbase (and
// std::noshowbase). If defined, Integer will use a suffix of 'b', 'o', 'h'
// or '.' (the last for decimal) when std::showbase is in effect. If
// std::noshowbase is set, then the suffix is not added to the Integer. If
// not defined, existing behavior is preserved and Integer will use a suffix
// of 'b', 'o', 'h' or '.' (the last for decimal).
// #define CRYPTOPP_USE_STD_SHOWBASE
// choose which style of sockets to wrap (mostly useful for MinGW which has both)
#if !defined(NO_BERKELEY_STYLE_SOCKETS) && !defined(PREFER_BERKELEY_STYLE_SOCKETS)
# define PREFER_BERKELEY_STYLE_SOCKETS
#endif
// #if !defined(NO_WINDOWS_STYLE_SOCKETS) && !defined(PREFER_WINDOWS_STYLE_SOCKETS)
// # define PREFER_WINDOWS_STYLE_SOCKETS
// #endif
// set the name of Rijndael cipher, was "Rijndael" before version 5.3
#define CRYPTOPP_RIJNDAEL_NAME "AES"
// CRYPTOPP_DEBUG enables the library's CRYPTOPP_ASSERT. CRYPTOPP_ASSERT
// raises a SIGTRAP (Unix) or calls DebugBreak() (Windows). CRYPTOPP_ASSERT
// is only in effect when CRYPTOPP_DEBUG, DEBUG or _DEBUG is defined. Unlike
// Posix assert, CRYPTOPP_ASSERT is not affected by NDEBUG (or failure to
// define it).
// Also see http://github.com/weidai11/cryptopp/issues/277, CVE-2016-7420
#if (defined(DEBUG) || defined(_DEBUG)) && !defined(CRYPTOPP_DEBUG)
# define CRYPTOPP_DEBUG 1
#endif
// ***************** Initialization and Constructor priorities ********************
// MacPorts/GCC and Solaris/GCC does not provide constructor(priority). Apple/GCC and Fink/GCC do provide it.
// See http://cryptopp.com/wiki/Static_Initialization_Order_Fiasco
// CRYPTOPP_INIT_PRIORITY attempts to manage initialization of C++ static objects.
// Under GCC, the library uses init_priority attribute in the range
// [CRYPTOPP_INIT_PRIORITY, CRYPTOPP_INIT_PRIORITY+100]. Under Windows,
// CRYPTOPP_INIT_PRIORITY enlists "#pragma init_seg(lib)".
#ifndef CRYPTOPP_INIT_PRIORITY
// # define CRYPTOPP_INIT_PRIORITY 250
#endif
// CRYPTOPP_USER_PRIORITY is for other libraries and user code that is using Crypto++
// and managing C++ static object creation. It is guaranteed not to conflict with
// values used by (or would be used by) the Crypto++ library.
#if defined(CRYPTOPP_INIT_PRIORITY) && (CRYPTOPP_INIT_PRIORITY > 0)
# define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY + 101)
#else
# define CRYPTOPP_USER_PRIORITY 350
#endif
// __attribute__(init_priority(250)) is supported
#if (__GNUC__ && (CRYPTOPP_INIT_PRIORITY > 0) && ((CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (_INTEL_COMPILER >= 300)) && !(MACPORTS_GCC_COMPILER > 0) && !defined(__sun__))
# define HAVE_GCC_CONSTRUCTOR1 1
#endif
// __attribute__(init_priority()) is supported
#if (__GNUC__ && (CRYPTOPP_INIT_PRIORITY > 0) && !HAVE_GCC_CONSTRUCTOR1 && !(MACPORTS_GCC_COMPILER > 0) && !defined(__sun__))
# define HAVE_GCC_CONSTRUCTOR0 1
#endif
#if (_MSC_VER && (CRYPTOPP_INIT_PRIORITY > 0))
# define HAVE_MSC_INIT_PRIORITY 1
#endif
// ***************** Important Settings Again ********************
// But the defaults should be ok.
// namespace support is now required
#ifdef NO_NAMESPACE
# error namespace support is now required
#endif
// Define this to workaround a Microsoft CryptoAPI bug where
// each call to CryptAcquireContext causes a 100 KB memory leak.
// Defining this will cause Crypto++ to make only one call to CryptAcquireContext.
#define WORKAROUND_MS_BUG_Q258000
#ifdef CRYPTOPP_DOXYGEN_PROCESSING
// Document the namespce exists. Put it here before CryptoPP is undefined below.
//! \namespace CryptoPP
//! \brief Crypto++ library namespace
//! \details Nearly all classes are located in the CryptoPP namespace. Within
//! the namespace, there are two additional namespaces.
//! <ul>
//! <li>Name - namespace for names used with \p NameValuePairs and documented in argnames.h
//! <li>Weak - namespace for weak and wounded algorithms, like ARC4, MD5 and Pananma
//! </ul>
namespace CryptoPP { }
// Bring in the symbols fund in the weak namespace; and fold Weak1 into Weak
# define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
# define Weak1 Weak
// Avoid putting "CryptoPP::" in front of everything in Doxygen output
# define CryptoPP
# define NAMESPACE_BEGIN(x)
# define NAMESPACE_END
// Get Doxygen to generate better documentation for these typedefs
# define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
// Make "protected" "private" so the functions and members are not documented
# define protected private
#else
# define NAMESPACE_BEGIN(x) namespace x {
# define NAMESPACE_END }
# define DOCUMENTED_TYPEDEF(x, y) typedef x y;
#endif
#define ANONYMOUS_NAMESPACE_BEGIN namespace {
#define ANONYMOUS_NAMESPACE_END }
#define USING_NAMESPACE(x) using namespace x;
#define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
#define DOCUMENTED_NAMESPACE_END }
// What is the type of the third parameter to bind?
// For Unix, the new standard is ::socklen_t (typically unsigned int), and the old standard is int.
// Unfortunately there is no way to tell whether or not socklen_t is defined.
// To work around this, TYPE_OF_SOCKLEN_T is a macro so that you can change it from the makefile.
#ifndef TYPE_OF_SOCKLEN_T
# if defined(_WIN32) || defined(__CYGWIN__)
# define TYPE_OF_SOCKLEN_T int
# else
# define TYPE_OF_SOCKLEN_T ::socklen_t
# endif
#endif
#if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS)
# define __USE_W32_SOCKETS
#endif
typedef unsigned char byte; // put in global namespace to avoid ambiguity with other byte typedefs
NAMESPACE_BEGIN(CryptoPP)
typedef unsigned short word16;
typedef unsigned int word32;
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 word64;
#define W64LIT(x) x##ui64
#elif (_LP64 || __LP64__) && ((__arm64__ || __aarch64__) || !defined(CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562))
typedef unsigned long word64;
#define W64LIT(x) x##UL
#else
typedef unsigned long long word64;
#define W64LIT(x) x##ULL
#endif
// define large word type, used for file offsets and such
typedef word64 lword;
const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
// Clang pretends to be VC++, too.
// See http://github.com/weidai11/cryptopp/issues/147
#if defined(_MSC_VER) && defined(__clang__)
# error: "Unsupported configuration"
#endif
#ifdef __GNUC__
#define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
// Apple and LLVM's Clang. Apple Clang version 7.0 roughly equals LLVM Clang version 3.7
#if defined(__clang__ ) && !defined(__apple_build_version__)
#define CRYPTOPP_LLVM_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
#define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1
#elif defined(__clang__ ) && defined(__apple_build_version__)
#define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
#define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1
#endif
#ifdef _MSC_VER
#define CRYPTOPP_MSC_VERSION (_MSC_VER)
#endif
// Need GCC 4.6/Clang 1.7/Apple Clang 2.0 or above due to "GCC diagnostic {push|pop}"
#if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_LLVM_CLANG_VERSION >= 10700) || (CRYPTOPP_APPLE_CLANG_VERSION >= 20000)
#define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1
#endif
// Clang due to "Inline assembly operands don't work with .intel_syntax", http://llvm.org/bugs/show_bug.cgi?id=24232
// TODO: supply the upper version when LLVM fixes it. We set it to 20.0 for compilation purposes.
#if (defined(CRYPTOPP_LLVM_CLANG_VERSION) && CRYPTOPP_LLVM_CLANG_VERSION <= 200000) || (defined(CRYPTOPP_APPLE_CLANG_VERSION) && CRYPTOPP_APPLE_CLANG_VERSION <= 200000) || defined(CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER)
#define CRYPTOPP_DISABLE_INTEL_ASM 1
#endif
// define hword, word, and dword. these are used for multiprecision integer arithmetic
// Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
#if (defined(_MSC_VER) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) && (defined(_M_X64) || defined(_M_IA64))) || (defined(__DECCXX) && defined(__alpha__)) || (defined(__INTEL_COMPILER) && defined(__x86_64__)) || (defined(__SUNPRO_CC) && defined(__x86_64__))
typedef word32 hword;
typedef word64 word;
#else
#define CRYPTOPP_NATIVE_DWORD_AVAILABLE 1
#if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400
// GCC 4.0.1 on MacOS X is missing __umodti3 and __udivti3
// mode(TI) division broken on amd64 with GCC earlier than GCC 3.4
typedef word32 hword;
typedef word64 word;
typedef __uint128_t dword;
typedef __uint128_t word128;
#define CRYPTOPP_WORD128_AVAILABLE 1
#else
// if we're here, it means we're on a 64-bit CPU but we don't have a way to obtain 128-bit multiplication results
typedef word16 hword;
typedef word32 word;
typedef word64 dword;
#endif
#else
// being here means the native register size is probably 32 bits or less
#define CRYPTOPP_BOOL_SLOW_WORD64 1
typedef word16 hword;
typedef word32 word;
typedef word64 dword;
#endif
#endif
#ifndef CRYPTOPP_BOOL_SLOW_WORD64
#define CRYPTOPP_BOOL_SLOW_WORD64 0
#endif
const unsigned int WORD_SIZE = sizeof(word);
const unsigned int WORD_BITS = WORD_SIZE * 8;
NAMESPACE_END
#ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
// This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
// Also see http://stackoverflow.com/questions/794632/programmatically-get-the-cache-line-size.
#if defined(_M_X64) || defined(__x86_64__) || (__arm64__) || (__aarch64__)
#define CRYPTOPP_L1_CACHE_LINE_SIZE 64
#else
// L1 cache line size is 32 on Pentium III and earlier
#define CRYPTOPP_L1_CACHE_LINE_SIZE 32
#endif
#endif
#if defined(_MSC_VER)
#if _MSC_VER == 1200
#include <malloc.h>
#endif
#if _MSC_VER > 1200 || defined(_mm_free)
#define CRYPTOPP_MSVC6PP_OR_LATER // VC 6 processor pack or later
#else
#define CRYPTOPP_MSVC6_NO_PP // VC 6 without processor pack
#endif
#endif
#ifndef CRYPTOPP_ALIGN_DATA
#if defined(CRYPTOPP_MSVC6PP_OR_LATER)
#define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
#elif defined(__GNUC__)
#define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
#else
#define CRYPTOPP_ALIGN_DATA(x)
#endif
#endif
#ifndef CRYPTOPP_SECTION_ALIGN16
#if defined(__GNUC__) && !defined(__APPLE__)
// the alignment attribute doesn't seem to work without this section attribute when -fdata-sections is turned on
#define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
#else
#define CRYPTOPP_SECTION_ALIGN16
#endif
#endif
// The section attribute attempts to initialize CPU flags to avoid Valgrind findings above -O1
#if ((defined(__MACH__) && defined(__APPLE__)) && ((CRYPTOPP_LLVM_CLANG_VERSION >= 30600) || (CRYPTOPP_APPLE_CLANG_VERSION >= 70100) || (CRYPTOPP_GCC_VERSION >= 40300)))
#define CRYPTOPP_SECTION_INIT __attribute__((section ("__DATA,__data")))
#elif (defined(__ELF__) && (CRYPTOPP_GCC_VERSION >= 40300))
#define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
#else
#define CRYPTOPP_SECTION_INIT
#endif
#if defined(_MSC_VER) || defined(__fastcall)
#define CRYPTOPP_FASTCALL __fastcall
#else
#define CRYPTOPP_FASTCALL
#endif
// VC60 workaround: it doesn't allow typename in some places
#if defined(_MSC_VER) && (_MSC_VER < 1300)
#define CPP_TYPENAME
#else
#define CPP_TYPENAME typename
#endif
// VC60 workaround: can't cast unsigned __int64 to float or double
#if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER)
#define CRYPTOPP_VC6_INT64 (__int64)
#else
#define CRYPTOPP_VC6_INT64
#endif
#ifdef _MSC_VER
#define CRYPTOPP_NO_VTABLE __declspec(novtable)
#else
#define CRYPTOPP_NO_VTABLE
#endif
#ifdef _MSC_VER
// 4127: conditional expression is constant
// 4231: nonstandard extension used : 'extern' before template explicit instantiation
// 4250: dominance
// 4251: member needs to have dll-interface
// 4275: base needs to have dll-interface
// 4505: unreferenced local function
// 4512: assignment operator not generated
// 4660: explicitly instantiating a class that's already implicitly instantiated
// 4661: no suitable definition provided for explicit template instantiation request
// 4786: identifer was truncated in debug information
// 4355: 'this' : used in base member initializer list
// 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
# pragma warning(disable: 4127 4231 4250 4251 4275 4505 4512 4660 4661 4786 4355 4910)
// Security related, possible defects
// http://blogs.msdn.com/b/vcblog/archive/2010/12/14/off-by-default-compiler-warnings-in-visual-c.aspx
# pragma warning(once: 4191 4242 4263 4264 4266 4302 4826 4905 4906 4928)
#endif
#ifdef __BORLANDC__
// 8037: non-const function called for const object. needed to work around BCB2006 bug
# pragma warn -8037
#endif
// [GCC Bug 53431] "C++ preprocessor ignores #pragma GCC diagnostic". Clang honors it.
#if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
# pragma GCC diagnostic ignored "-Wunused-function"
#endif
// You may need to force include a C++ header on Android when using STLPort to ensure
// _STLPORT_VERSION is defined: CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -include iosfwd"
// TODO: Figure out C++17 and lack of std::uncaught_exception
#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || (defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x450) || defined(_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)))
#define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
#endif
#ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
#define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
#endif
#ifdef CRYPTOPP_DISABLE_X86ASM // for backwards compatibility: this macro had both meanings
#define CRYPTOPP_DISABLE_ASM
#define CRYPTOPP_DISABLE_SSE2
#endif
// Apple's Clang prior to 5.0 cannot handle SSE2 (and Apple does not use LLVM Clang numbering...)
#if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 50000)
# define CRYPTOPP_DISABLE_ASM
#endif
// Sun Studio 12 provides GCC inline assembly, http://blogs.oracle.com/x86be/entry/gcc_style_asm_inlining_support
// We can enable SSE2 for Sun Studio in the makefile with -D__SSE2__, but users may not compile with it.
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(__SSE2__) && defined(__x86_64__) && (__SUNPRO_CC >= 0x5100)
# define __SSE2__ 1
#endif
#if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
// C++Builder 2010 does not allow "call label" where label is defined within inline assembly
#define CRYPTOPP_X86_ASM_AVAILABLE
#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__))
#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
#endif
#if !defined(CRYPTOPP_DISABLE_SSE3) && (_MSC_VER >= 1500 || (defined(__SSE3__) && defined(__SSSE3__)))
#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
#endif
#endif
#if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64)
#define CRYPTOPP_X64_MASM_AVAILABLE
#endif
#if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__)
#define CRYPTOPP_X64_ASM_AVAILABLE
#endif
#if !defined(CRYPTOPP_DISABLE_ASM) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) && !defined(_M_ARM)
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
#endif
// Intrinsics availible in GCC 4.3 (http://gcc.gnu.org/gcc-4.3/changes.html) and
// MSVC 2008 (http://msdn.microsoft.com/en-us/library/bb892950%28v=vs.90%29.aspx)
// SunCC could generate SSE4 at 12.1, but the intrinsics are missing until 12.4.
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSE4) && !defined(_M_ARM) && ((_MSC_VER >= 1500) || (defined(__SSE4_1__) && defined(__SSE4_2__)))
#define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 0
#endif
// Don't disgorge AES-NI from CLMUL. There will be two to four subtle breaks
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_AESNI) && !defined(_M_ARM) && (_MSC_FULL_VER >= 150030729 || __INTEL_COMPILER >= 1110 || (defined(__AES__) && defined(__PCLMUL__)))
#define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 0
#endif
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SHA) && !defined(_M_ARM) && ((_MSC_VER >= 1900) || defined(__SHA__))
#define CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE 0
#endif
// Requires ARMv7 and ACLE 1.0. Testing shows ARMv7 is really ARMv7a under most toolchains.
#if !defined(CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
# if defined(__ARM_NEON__) || defined(__ARM_NEON) || defined(_M_ARM)
# define CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE 1
# endif
#endif
// Requires ARMv8 and ACLE 2.0. For GCC, requires 4.8 and above.
// Microsoft plans to support ARM-64, but its not clear how to detect it.
// TODO: Add MSC_VER and ARM-64 platform define when available
#if !defined(CRYPTOPP_BOOL_ARM_CRC32_INTRINSICS_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
# if defined(__ARM_FEATURE_CRC32) || defined(_M_ARM64)
# define CRYPTOPP_BOOL_ARM_CRC32_INTRINSICS_AVAILABLE 1
# endif
#endif
// Requires ARMv8 and ACLE 2.0. For GCC, requires 4.8 and above.
// Microsoft plans to support ARM-64, but its not clear how to detect it.
// TODO: Add MSC_VER and ARM-64 platform define when available
#if !defined(CRYPTOPP_BOOL_ARM_CRYPTO_INTRINSICS_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
# if defined(__ARM_FEATURE_CRYPTO) || defined(_M_ARM64)
# define CRYPTOPP_BOOL_ARM_CRYPTO_INTRINSICS_AVAILABLE 1
# endif
#endif
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
#define CRYPTOPP_BOOL_ALIGN16 1
#else
#define CRYPTOPP_BOOL_ALIGN16 0
#endif
// how to allocate 16-byte aligned memory (for SSE2)
#if defined(CRYPTOPP_MSVC6PP_OR_LATER)
#define CRYPTOPP_MM_MALLOC_AVAILABLE
#elif defined(__APPLE__)
#define CRYPTOPP_APPLE_MALLOC_AVAILABLE
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
#define CRYPTOPP_MEMALIGN_AVAILABLE
#else
#define CRYPTOPP_NO_ALIGNED_ALLOC
#endif
// Apple always provides 16-byte aligned, and tells us to use calloc
// http://developer.apple.com/library/mac/documentation/Performance/Conceptual/ManagingMemory/Articles/MemoryAlloc.html
// how to disable inlining
#if defined(_MSC_VER) && _MSC_VER >= 1300
# define CRYPTOPP_NOINLINE_DOTDOTDOT
# define CRYPTOPP_NOINLINE __declspec(noinline)
#elif defined(__GNUC__)
# define CRYPTOPP_NOINLINE_DOTDOTDOT
# define CRYPTOPP_NOINLINE __attribute__((noinline))
#else
# define CRYPTOPP_NOINLINE_DOTDOTDOT ...
# define CRYPTOPP_NOINLINE
#endif
// How to declare class constants
// Use enum for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__INTEL_COMPILER) || defined(__BORLANDC__) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
# define CRYPTOPP_CONSTANT(x) enum {x};
#else
# define CRYPTOPP_CONSTANT(x) static const int x;
#endif
// Linux provides X32, which is 32-bit integers, longs and pointers on x86_64 using the full x86_64 register set.
// Detect via __ILP32__ (http://wiki.debian.org/X32Port). However, __ILP32__ shows up in more places than
// the System V ABI specs calls out, like on some Solaris installations and just about any 32-bit system with Clang.
#if (defined(__ILP32__) || defined(_ILP32)) && defined(__x86_64__)
#define CRYPTOPP_BOOL_X32 1
#else
#define CRYPTOPP_BOOL_X32 0
#endif
// see http://predef.sourceforge.net/prearch.html
#if (defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)) && !CRYPTOPP_BOOL_X32
#define CRYPTOPP_BOOL_X86 1
#else
#define CRYPTOPP_BOOL_X86 0
#endif
#if (defined(_M_X64) || defined(__x86_64__)) && !CRYPTOPP_BOOL_X32
#define CRYPTOPP_BOOL_X64 1
#else
#define CRYPTOPP_BOOL_X64 0
#endif
// Undo the ASM and Intrinsic related defines due to X32.
#if CRYPTOPP_BOOL_X32
# undef CRYPTOPP_BOOL_X64
# undef CRYPTOPP_X64_ASM_AVAILABLE
# undef CRYPTOPP_X64_MASM_AVAILABLE
#endif
#if defined(__arm__) || defined(__aarch32__) || defined(_M_ARM)
#define CRYPTOPP_BOOL_ARM32 1
#else
#define CRYPTOPP_BOOL_ARM32 0
#endif
// Microsoft plans to support ARM-64, but its not clear how to detect it.
// TODO: Add MSC_VER and ARM-64 platform define when available
#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
#define CRYPTOPP_BOOL_ARM64 1
#else
#define CRYPTOPP_BOOL_ARM64 0
#endif
#if !defined(CRYPTOPP_NO_UNALIGNED_DATA_ACCESS) && !defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS)
#if (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || defined(__powerpc__) || (__ARM_FEATURE_UNALIGNED >= 1))
#define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
#endif
#endif
// ***************** determine availability of OS features ********************
#ifndef NO_OS_DEPENDENCE
#if defined(_WIN32) || defined(__CYGWIN__)
#define CRYPTOPP_WIN32_AVAILABLE
#endif
#if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
#define CRYPTOPP_UNIX_AVAILABLE
#endif
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define CRYPTOPP_BSD_AVAILABLE
#endif
#if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
# define HIGHRES_TIMER_AVAILABLE
#endif
#ifdef CRYPTOPP_WIN32_AVAILABLE
# if !defined(WINAPI_FAMILY)
# define THREAD_TIMER_AVAILABLE
# elif defined(WINAPI_FAMILY)
# if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
# define THREAD_TIMER_AVAILABLE
# endif
# endif
#endif
#ifdef CRYPTOPP_UNIX_AVAILABLE
# define HAS_BERKELEY_STYLE_SOCKETS
# define SOCKETS_AVAILABLE
#endif
// Sockets are only available under Windows Runtime desktop partition apps (despite the MSDN literature)
#ifdef CRYPTOPP_WIN32_AVAILABLE
# define HAS_WINDOWS_STYLE_SOCKETS
# if !defined(WINAPI_FAMILY)
# define SOCKETS_AVAILABLE
# elif defined(WINAPI_FAMILY)
# if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
# define SOCKETS_AVAILABLE
# endif
# endif
#endif
#if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
# define USE_WINDOWS_STYLE_SOCKETS
#else
# define USE_BERKELEY_STYLE_SOCKETS
#endif
#if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(SOCKETS_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
# define WINDOWS_PIPES_AVAILABLE
#endif
#if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
# define NONBLOCKING_RNG_AVAILABLE
# define BLOCKING_RNG_AVAILABLE
# define OS_RNG_AVAILABLE
# define HAS_PTHREADS
# define THREADS_AVAILABLE
#endif
// Newlib on Cygwin is a problem. __NEWLIB__ is not defined yet; use __CYGWIN__ as a proxy
// Also see https://github.com/weidai11/cryptopp/issues/315
#if defined(CRYPTOPP_UNIX_AVAILABLE) && !defined(__CYGWIN__)
# define UNIX_SIGNALS_AVAILABLE 1
#endif
#ifdef CRYPTOPP_WIN32_AVAILABLE
# if !defined(WINAPI_FAMILY)
# define HAS_WINTHREADS
# define THREADS_AVAILABLE
# define NONBLOCKING_RNG_AVAILABLE
# define OS_RNG_AVAILABLE
# elif defined(WINAPI_FAMILY)
# if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
# define HAS_WINTHREADS
# define THREADS_AVAILABLE
# define NONBLOCKING_RNG_AVAILABLE
# define OS_RNG_AVAILABLE
# elif !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
# if ((WINVER >= 0x0A00 /*_WIN32_WINNT_WIN10*/) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/))
# define NONBLOCKING_RNG_AVAILABLE
# define OS_RNG_AVAILABLE
# endif
# endif
# endif
#endif
#endif // NO_OS_DEPENDENCE
// ***************** DLL related ********************
#if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
#ifdef CRYPTOPP_EXPORTS
#define CRYPTOPP_IS_DLL
#define CRYPTOPP_DLL __declspec(dllexport)
#elif defined(CRYPTOPP_IMPORTS)
#define CRYPTOPP_IS_DLL
#define CRYPTOPP_DLL __declspec(dllimport)
#else
#define CRYPTOPP_DLL
#endif
#define CRYPTOPP_API __cdecl
#else // not CRYPTOPP_WIN32_AVAILABLE
#define CRYPTOPP_DLL
#define CRYPTOPP_API
#endif // CRYPTOPP_WIN32_AVAILABLE
#if defined(__MWERKS__)
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
#elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
#else
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
#endif
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
#define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
#else
#define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
#endif
#if defined(__MWERKS__)
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
#elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
#else
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
#endif
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
#define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
#else
#define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
#endif
// ************** Unused variable ***************
// Portable way to suppress warnings.
// Moved from misc.h due to circular depenedencies.
#define CRYPTOPP_UNUSED(x) ((void)(x))
// ************** Deprecated ***************
#if (CRYPTOPP_GCC_VERSION >= 40500) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20800)
# define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated (msg)));
#elif (CRYPTOPP_GCC_VERSION)
# define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated));
#else
# define CRYPTOPP_DEPRECATED(msg)
#endif
// ***************** C++11 related ********************
// Visual Studio began at VS2010, http://msdn.microsoft.com/en-us/library/hh567368%28v=vs.110%29.aspx.
// Intel and C++11 language features, http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler
// GCC and C++11 language features, http://gcc.gnu.org/projects/cxx0x.html
// Clang and C++11 language features, http://clang.llvm.org/cxx_status.html
#if ((_MSC_VER >= 1600) || (__cplusplus >= 201103L)) && !defined(_STLPORT_VERSION)
# define CRYPTOPP_CXX11 1
#endif
// Hack ahead. Apple's standard library does not have C++'s unique_ptr in C++11. We can't
// test for unique_ptr directly because some of the non-Apple Clangs on OS X fail the same
// way. However, modern standard libraries have <forward_list>, so we test for it instead.
// Thanks to Jonathan Wakely for devising the clever test for modern/ancient versions.
// TODO: test under Xcode 3, where g++ is really g++.
#if defined(__APPLE__) && defined(__clang__)
# if !(defined(__has_include) && __has_include(<forward_list>))
# undef CRYPTOPP_CXX11
# endif
#endif
// C++11 or C++14 is available
#if defined(CRYPTOPP_CXX11)
// atomics: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.1/3.2; Intel 13.0; SunCC 12.5.
#if (CRYPTOPP_MSC_VERSION >= 1700)
# define CRYPTOPP_CXX11_ATOMICS 1
#elif (__INTEL_COMPILER >= 1300)
# define CRYPTOPP_CXX11_ATOMICS 1
#elif defined(__clang__)
# if __has_feature(cxx_atomic)
# define CRYPTOPP_CXX11_ATOMICS 1
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40400)
# define CRYPTOPP_CXX11_ATOMICS 1
#elif (__SUNPRO_CC >= 0x5140)
# define CRYPTOPP_CXX11_ATOMICS 1
#endif // atomics
// synchronization: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.3; Xcode 5.0; Intel 12.0; SunCC 12.4.
// TODO: verify Clang and Intel versions; find __has_feature(x) extension for Clang
#if (CRYPTOPP_MSC_VERSION >= 1700)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#elif (__INTEL_COMPILER >= 1200)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#elif (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 50000)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#elif (CRYPTOPP_GCC_VERSION >= 40400)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#endif // synchronization
// alignof/alignas: MS at VS2015 (19.00); GCC at 4.8; Clang at 3.3; Intel 15.0; SunCC 12.4.
#if (CRYPTOPP_MSC_VERSION >= 1900)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#elif (__INTEL_COMPILER >= 1500)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#elif defined(__clang__)
# if __has_feature(cxx_alignas)
# define CRYPTOPP_CXX11_ALIGNAS 1
# endif
# if __has_feature(cxx_alignof)
# define CRYPTOPP_CXX11_ALIGNOF 1
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40800)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#endif // alignof/alignas
// noexcept: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; Intel 14.0; SunCC 12.4.
#if (CRYPTOPP_MSC_VERSION >= 1900)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#elif (__INTEL_COMPILER >= 1400)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#elif defined(__clang__)
# if __has_feature(cxx_noexcept)
# define CRYPTOPP_CXX11_NOEXCEPT 1
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40600)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#endif // noexcept compilers
// variadic templates: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; Intel 12.1; SunCC 12.4.
#if (CRYPTOPP_MSC_VERSION >= 1800)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#elif (__INTEL_COMPILER >= 1210)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#elif defined(__clang__)
# if __has_feature(cxx_variadic_templates)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40300)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#endif // variadic templates
// constexpr: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; Intel 16.0; SunCC 12.4.
// Intel has mis-supported the feature since at least ICPC 13.00
#if (CRYPTOPP_MSC_VERSION >= 1900)
# define CRYPTOPP_CXX11_CONSTEXPR 1
#elif (__INTEL_COMPILER >= 1600)
# define CRYPTOPP_CXX11_CONSTEXPR 1
#elif defined(__clang__)
# if __has_feature(cxx_constexpr)
# define CRYPTOPP_CXX11_CONSTEXPR 1
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40600)
# define CRYPTOPP_CXX11_CONSTEXPR 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_CONSTEXPR 1
#endif // constexpr compilers
// TODO: Emplacement, R-values and Move semantics
// Needed because we are catching warnings with GCC and MSC
#endif // CRYPTOPP_CXX11
#if defined(CRYPTOPP_CXX11_NOEXCEPT)
# define CRYPTOPP_THROW noexcept(false)
# define CRYPTOPP_NO_THROW noexcept(true)
#else
# define CRYPTOPP_THROW
# define CRYPTOPP_NO_THROW
#endif // CRYPTOPP_CXX11_NOEXCEPT
// http://stackoverflow.com/a/13867690/608639
#if defined(CRYPTOPP_CXX11_CONSTEXPR)
# define CRYPTOPP_STATIC_CONSTEXPR static constexpr const
# define CRYPTOPP_CONSTEXPR constexpr
#else
# define CRYPTOPP_STATIC_CONSTEXPR static const
# define CRYPTOPP_CONSTEXPR
#endif // CRYPTOPP_CXX11_CONSTEXPR
// Hack... CRYPTOPP_ALIGN_DATA is defined earlier, before C++11 alignas availability is determined
#if defined(CRYPTOPP_CXX11_ALIGNAS)
# undef CRYPTOPP_ALIGN_DATA
# define CRYPTOPP_ALIGN_DATA(x) alignas(x)
#endif // CRYPTOPP_CXX11_ALIGNAS
// Hack... CRYPTOPP_CONSTANT is defined earlier, before C++11 constexpr availability is determined
// http://stackoverflow.com/q/35213098/608639
#if defined(CRYPTOPP_CXX11_CONSTEXPR)
# undef CRYPTOPP_CONSTANT
# define CRYPTOPP_CONSTANT(x) constexpr static int x;
#endif
// OK to comment the following out, but please report it so we can fix it.
// C++17 value taken from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4567.pdf.
#if (defined(__cplusplus) && (__cplusplus >= 199711L) && (__cplusplus < 201402L)) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE)
# error "std::uncaught_exception is not available. This is likely a configuration error."
#endif
#endif

View File

@ -75,10 +75,6 @@
// define this to retain (as much as possible) old deprecated function and class names // define this to retain (as much as possible) old deprecated function and class names
// #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY // #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
// Define this to retain (as much as possible) ABI and binary compatibility with Crypto++ 5.6.2.
// Also see https://cryptopp.com/wiki/Config.h#Avoid_MAINTAIN_BACKWARDS_COMPATIBILITY
// #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
// Define this if you want or need the library's memcpy_s and memmove_s. // Define this if you want or need the library's memcpy_s and memmove_s.
// See http://github.com/weidai11/cryptopp/issues/28. // See http://github.com/weidai11/cryptopp/issues/28.
// #if !defined(CRYPTOPP_WANT_SECURE_LIB) // #if !defined(CRYPTOPP_WANT_SECURE_LIB)

View File

@ -30,12 +30,6 @@
# rather than all of them. Its useful at places like the GCC Compile Farm, where being nice is policy. # rather than all of them. Its useful at places like the GCC Compile Farm, where being nice is policy.
# ./cryptest.sh nice # ./cryptest.sh nice
# You can test using original config.h with the following. 'orig', 'original' and 'config.h' are synonyms:
# ./cryptest.sh original
# You can test 5.6.2 compatibility using config.compat with the following. 'compat', 'compatibility' and 'config.compat' are synonyms:
# ./cryptest.sh compatibility
############################################ ############################################
# Set to suite your taste # Set to suite your taste
@ -177,9 +171,6 @@ do
WANT_NICE=1 WANT_NICE=1
elif [[ ($("$EGREP" -ix "orig" <<< "$ARG") || $("$EGREP" -ix "original" <<< "$ARG") || $("$EGREP" -ix "config.h" <<< "$ARG")) ]]; then elif [[ ($("$EGREP" -ix "orig" <<< "$ARG") || $("$EGREP" -ix "original" <<< "$ARG") || $("$EGREP" -ix "config.h" <<< "$ARG")) ]]; then
git checkout config.h > /dev/null 2>&1 git checkout config.h > /dev/null 2>&1
elif [[ ($("$EGREP" -ix "compat" <<< "$ARG") || $("$EGREP" -ix "compatibility" <<< "$ARG") || $("$EGREP" -ix "config.compat" <<< "$ARG")) ]]; then
git checkout config.compatibility > /dev/null 2>&1
cp config.compatibility config.h
else else
echo "Unknown option $ARG" echo "Unknown option $ARG"
fi fi
@ -2675,63 +2666,6 @@ if [[ "$HAVE_X32" -ne "0" ]]; then
fi fi
fi fi
############################################
# Backwards compatibility
if true; then
############################################
# Debug build
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Debug, MAINTAIN_BACKWARDS_COMPATIBILITY" | tee -a "$TEST_RESULTS"
echo
"$MAKE" clean > /dev/null 2>&1
rm -f adhoc.cpp > /dev/null 2>&1
CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ${PLATFORM_CXXFLAGS[@]} $USER_CXXFLAGS ${DEPRECATED_CXXFLAGS[@]}"
CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
else
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
fi
fi
############################################
# Release build
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Release, MAINTAIN_BACKWARDS_COMPATIBILITY" | tee -a "$TEST_RESULTS"
echo
"$MAKE" clean > /dev/null 2>&1
rm -f adhoc.cpp > /dev/null 2>&1
CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ${PLATFORM_CXXFLAGS[@]} $USER_CXXFLAGS ${DEPRECATED_CXXFLAGS[@]}"
CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
fi
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
fi
fi
############################################ ############################################
# init_priority # init_priority
if true; then if true; then

View File

@ -159,9 +159,10 @@ public:
OTHER_ERROR OTHER_ERROR
}; };
virtual ~Exception() throw() {}
//! \brief Construct a new Exception //! \brief Construct a new Exception
explicit Exception(ErrorType errorType, const std::string &s) : m_errorType(errorType), m_what(s) {} explicit Exception(ErrorType errorType, const std::string &s) : m_errorType(errorType), m_what(s) {}
virtual ~Exception() throw() {}
//! \brief Retrieves a C-string describing the exception //! \brief Retrieves a C-string describing the exception
const char *what() const throw() {return (m_what.c_str());} const char *what() const throw() {return (m_what.c_str());}
@ -218,9 +219,9 @@ public:
class CRYPTOPP_DLL OS_Error : public Exception class CRYPTOPP_DLL OS_Error : public Exception
{ {
public: public:
virtual ~OS_Error() throw() {}
OS_Error(ErrorType errorType, const std::string &s, const std::string& operation, int errorCode) OS_Error(ErrorType errorType, const std::string &s, const std::string& operation, int errorCode)
: Exception(errorType, s), m_operation(operation), m_errorCode(errorCode) {} : Exception(errorType, s), m_operation(operation), m_errorCode(errorCode) {}
~OS_Error() throw() {}
//! \brief Retrieve the operating system API that reported the error //! \brief Retrieve the operating system API that reported the error
const std::string & GetOperation() const {return m_operation;} const std::string & GetOperation() const {return m_operation;}
@ -496,9 +497,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Algorithm : public Clonable class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Algorithm : public Clonable
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~Algorithm() {} virtual ~Algorithm() {}
#endif
//! \brief Interface for all crypto algorithms //! \brief Interface for all crypto algorithms
//! \param checkSelfTestStatus determines whether the object can proceed if the self //! \param checkSelfTestStatus determines whether the object can proceed if the self
@ -735,9 +734,7 @@ protected:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BlockTransformation : public Algorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BlockTransformation : public Algorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~BlockTransformation() {} virtual ~BlockTransformation() {}
#endif
//! \brief Encrypt or decrypt a block //! \brief Encrypt or decrypt a block
//! \param inBlock the input message before processing //! \param inBlock the input message before processing
@ -826,9 +823,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE StreamTransformation : public Algorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE StreamTransformation : public Algorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~StreamTransformation() {} virtual ~StreamTransformation() {}
#endif
//! \brief Provides a reference to this object //! \brief Provides a reference to this object
//! \return A reference to this object //! \return A reference to this object
@ -935,9 +930,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HashTransformation : public Algorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HashTransformation : public Algorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~HashTransformation() {} virtual ~HashTransformation() {}
#endif
//! \brief Provides a reference to this object //! \brief Provides a reference to this object
//! \return A reference to this object //! \return A reference to this object
@ -1128,9 +1121,7 @@ protected:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AuthenticatedSymmetricCipher : public MessageAuthenticationCode, public StreamTransformation class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AuthenticatedSymmetricCipher : public MessageAuthenticationCode, public StreamTransformation
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~AuthenticatedSymmetricCipher() {} virtual ~AuthenticatedSymmetricCipher() {}
#endif
//! \brief Exception thrown when the object is in the wrong state for the operation //! \brief Exception thrown when the object is in the wrong state for the operation
//! \details this indicates that a member function was called in the wrong state, for example trying to encrypt //! \details this indicates that a member function was called in the wrong state, for example trying to encrypt
@ -1197,9 +1188,7 @@ typedef SymmetricCipher StreamCipher;
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomNumberGenerator : public Algorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomNumberGenerator : public Algorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~RandomNumberGenerator() {} virtual ~RandomNumberGenerator() {}
#endif
//! \brief Update RNG state with additional unpredictable values //! \brief Update RNG state with additional unpredictable values
//! \param input the entropy to add to the generator //! \param input the entropy to add to the generator
@ -1366,9 +1355,7 @@ public:
// placed up here for CW8 // placed up here for CW8
static const std::string &NULL_CHANNEL; // same as DEFAULT_CHANNEL, for backwards compatibility static const std::string &NULL_CHANNEL; // same as DEFAULT_CHANNEL, for backwards compatibility
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~BufferedTransformation() {} virtual ~BufferedTransformation() {}
#endif
//! \brief Construct a BufferedTransformation //! \brief Construct a BufferedTransformation
BufferedTransformation() : Algorithm(false) {} BufferedTransformation() : Algorithm(false) {}
@ -2055,10 +2042,6 @@ CRYPTOPP_DLL BufferedTransformation & TheBitBucket();
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CryptoMaterial : public NameValuePairs class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CryptoMaterial : public NameValuePairs
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~CryptoMaterial() {}
#endif
//! Exception thrown when invalid crypto material is detected //! Exception thrown when invalid crypto material is detected
class CRYPTOPP_DLL InvalidMaterial : public InvalidDataFormat class CRYPTOPP_DLL InvalidMaterial : public InvalidDataFormat
{ {
@ -2066,6 +2049,8 @@ public:
explicit InvalidMaterial(const std::string &s) : InvalidDataFormat(s) {} explicit InvalidMaterial(const std::string &s) : InvalidDataFormat(s) {}
}; };
virtual ~CryptoMaterial() {}
//! \brief Assign values to this object //! \brief Assign values to this object
//! \details This function can be used to create a public key from a private key. //! \details This function can be used to create a public key from a private key.
virtual void AssignFrom(const NameValuePairs &source) =0; virtual void AssignFrom(const NameValuePairs &source) =0;
@ -2170,9 +2155,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE GeneratableCryptoMaterial : virtual public CryptoMaterial class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE GeneratableCryptoMaterial : virtual public CryptoMaterial
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~GeneratableCryptoMaterial() {} virtual ~GeneratableCryptoMaterial() {}
#endif
//! \brief Generate a random key or crypto parameters //! \brief Generate a random key or crypto parameters
//! \param rng a RandomNumberGenerator to produce keying material //! \param rng a RandomNumberGenerator to produce keying material
@ -2213,9 +2196,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CryptoParameters : public GeneratableCrypt
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AsymmetricAlgorithm : public Algorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AsymmetricAlgorithm : public Algorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~AsymmetricAlgorithm() {} virtual ~AsymmetricAlgorithm() {}
#endif
//! \brief Retrieves a reference to CryptoMaterial //! \brief Retrieves a reference to CryptoMaterial
//! \return a reference to the crypto material //! \return a reference to the crypto material
@ -2242,9 +2223,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PublicKeyAlgorithm : public AsymmetricAlgorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PublicKeyAlgorithm : public AsymmetricAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~PublicKeyAlgorithm() {} virtual ~PublicKeyAlgorithm() {}
#endif
// VC60 workaround: no co-variant return type // VC60 workaround: no co-variant return type
@ -2270,9 +2249,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PrivateKeyAlgorithm : public AsymmetricAlgorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PrivateKeyAlgorithm : public AsymmetricAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~PrivateKeyAlgorithm() {} virtual ~PrivateKeyAlgorithm() {}
#endif
//! \brief Retrieves a reference to a Private Key //! \brief Retrieves a reference to a Private Key
//! \return a reference the private key //! \return a reference the private key
@ -2293,9 +2270,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE KeyAgreementAlgorithm : public AsymmetricAlgorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE KeyAgreementAlgorithm : public AsymmetricAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~KeyAgreementAlgorithm() {} virtual ~KeyAgreementAlgorithm() {}
#endif
//! \brief Retrieves a reference to Crypto Parameters //! \brief Retrieves a reference to Crypto Parameters
//! \return a reference the crypto parameters //! \return a reference the crypto parameters
@ -2351,8 +2326,8 @@ public:
virtual size_t FixedMaxPlaintextLength() const {return 0;} virtual size_t FixedMaxPlaintextLength() const {return 0;}
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY #ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
size_t MaxPlainTextLength(size_t cipherTextLength) const {return MaxPlaintextLength(cipherTextLength);} //size_t MaxPlainTextLength(size_t cipherTextLength) const {return MaxPlaintextLength(cipherTextLength);}
size_t CipherTextLength(size_t plainTextLength) const {return CiphertextLength(plainTextLength);} //size_t CipherTextLength(size_t plainTextLength) const {return CiphertextLength(plainTextLength);}
#endif #endif
}; };
@ -2397,9 +2372,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Decryptor : public PK_CryptoSystem, public PrivateKeyAlgorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Decryptor : public PK_CryptoSystem, public PrivateKeyAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~PK_Decryptor() {} virtual ~PK_Decryptor() {}
#endif
//! \brief Decrypt a byte string //! \brief Decrypt a byte string
//! \param rng a RandomNumberGenerator derived class //! \param rng a RandomNumberGenerator derived class
@ -2446,9 +2419,9 @@ public:
}; };
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY #ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
typedef PK_CryptoSystem PK_FixedLengthCryptoSystem; //typedef PK_CryptoSystem PK_FixedLengthCryptoSystem;
typedef PK_Encryptor PK_FixedLengthEncryptor; //typedef PK_Encryptor PK_FixedLengthEncryptor;
typedef PK_Decryptor PK_FixedLengthDecryptor; //typedef PK_Decryptor PK_FixedLengthDecryptor;
#endif #endif
//! \class PK_SignatureScheme //! \class PK_SignatureScheme
@ -2553,9 +2526,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Signer : public PK_SignatureScheme, public PrivateKeyAlgorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Signer : public PK_SignatureScheme, public PrivateKeyAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~PK_Signer() {} virtual ~PK_Signer() {}
#endif
//! \brief Create a new HashTransformation to accumulate the message to be signed //! \brief Create a new HashTransformation to accumulate the message to be signed
//! \param rng a RandomNumberGenerator derived class //! \param rng a RandomNumberGenerator derived class
@ -2620,9 +2591,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Verifier : public PK_SignatureScheme, public PublicKeyAlgorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Verifier : public PK_SignatureScheme, public PublicKeyAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~PK_Verifier() {} virtual ~PK_Verifier() {}
#endif
//! \brief Create a new HashTransformation to accumulate the message to be verified //! \brief Create a new HashTransformation to accumulate the message to be verified
//! \return a pointer to a PK_MessageAccumulator //! \return a pointer to a PK_MessageAccumulator
@ -2694,9 +2663,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE SimpleKeyAgreementDomain : public KeyAgreementAlgorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE SimpleKeyAgreementDomain : public KeyAgreementAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~SimpleKeyAgreementDomain() {} virtual ~SimpleKeyAgreementDomain() {}
#endif
//! \brief Provides the size of the agreed value //! \brief Provides the size of the agreed value
//! \return size of agreed value produced in this domain //! \return size of agreed value produced in this domain
@ -2759,9 +2726,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AuthenticatedKeyAgreementDomain : public KeyAgreementAlgorithm class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AuthenticatedKeyAgreementDomain : public KeyAgreementAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~AuthenticatedKeyAgreementDomain() {} virtual ~AuthenticatedKeyAgreementDomain() {}
#endif
//! \brief Provides the size of the agreed value //! \brief Provides the size of the agreed value
//! \return size of agreed value produced in this domain //! \return size of agreed value produced in this domain
@ -2893,9 +2858,10 @@ public:
UnexpectedMethodCall(const std::string &s) : Exception(OTHER_ERROR, s) {} UnexpectedMethodCall(const std::string &s) : Exception(OTHER_ERROR, s) {}
}; };
ProtocolSession() : m_rng(NULL), m_throwOnProtocolError(true), m_validState(false) {}
virtual ~ProtocolSession() {} virtual ~ProtocolSession() {}
ProtocolSession() : m_rng(NULL), m_throwOnProtocolError(true), m_validState(false) {}
virtual void InitializeSession(RandomNumberGenerator &rng, const NameValuePairs &parameters) =0; virtual void InitializeSession(RandomNumberGenerator &rng, const NameValuePairs &parameters) =0;
bool GetThrowOnProtocolError() const {return m_throwOnProtocolError;} bool GetThrowOnProtocolError() const {return m_throwOnProtocolError;}
@ -2924,9 +2890,7 @@ private:
class KeyAgreementSession : public ProtocolSession class KeyAgreementSession : public ProtocolSession
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~KeyAgreementSession() {} virtual ~KeyAgreementSession() {}
#endif
virtual unsigned int GetAgreedValueLength() const =0; virtual unsigned int GetAgreedValueLength() const =0;
virtual void GetAgreedValue(byte *agreedValue) const =0; virtual void GetAgreedValue(byte *agreedValue) const =0;
@ -2935,9 +2899,7 @@ public:
class PasswordAuthenticatedKeyAgreementSession : public KeyAgreementSession class PasswordAuthenticatedKeyAgreementSession : public KeyAgreementSession
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~PasswordAuthenticatedKeyAgreementSession() {} virtual ~PasswordAuthenticatedKeyAgreementSession() {}
#endif
void InitializePasswordAuthenticatedKeyAgreementSession(RandomNumberGenerator &rng, void InitializePasswordAuthenticatedKeyAgreementSession(RandomNumberGenerator &rng,
const byte *myId, unsigned int myIdLength, const byte *myId, unsigned int myIdLength,
@ -2948,9 +2910,7 @@ public:
class PasswordAuthenticatedKeyAgreementDomain : public KeyAgreementAlgorithm class PasswordAuthenticatedKeyAgreementDomain : public KeyAgreementAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~PasswordAuthenticatedKeyAgreementDomain() {} virtual ~PasswordAuthenticatedKeyAgreementDomain() {}
#endif
//! return whether the domain parameters stored in this object are valid //! return whether the domain parameters stored in this object are valid
virtual bool ValidateDomainParameters(RandomNumberGenerator &rng) const virtual bool ValidateDomainParameters(RandomNumberGenerator &rng) const

View File

@ -240,7 +240,7 @@ DefaultDecryptorWithMAC::DefaultDecryptorWithMAC(const char *passphrase, Buffere
, m_mac(NewDefaultEncryptorMAC((const byte *)passphrase, strlen(passphrase))) , m_mac(NewDefaultEncryptorMAC((const byte *)passphrase, strlen(passphrase)))
, m_throwException(throwException) , m_throwException(throwException)
{ {
SetFilter(new DefaultDecryptor(passphrase, m_hashVerifier=new HashVerifier(*m_mac, NULL, HashVerifier::PUT_MESSAGE), throwException)); SetFilter(new DefaultDecryptor(passphrase, m_hashVerifier=new HashVerificationFilter(*m_mac, NULL, HashVerificationFilter::PUT_MESSAGE), throwException));
} }
DefaultDecryptorWithMAC::DefaultDecryptorWithMAC(const byte *passphrase, size_t passphraseLength, BufferedTransformation *attachment, bool throwException) DefaultDecryptorWithMAC::DefaultDecryptorWithMAC(const byte *passphrase, size_t passphraseLength, BufferedTransformation *attachment, bool throwException)
@ -248,7 +248,7 @@ DefaultDecryptorWithMAC::DefaultDecryptorWithMAC(const byte *passphrase, size_t
, m_mac(NewDefaultEncryptorMAC(passphrase, passphraseLength)) , m_mac(NewDefaultEncryptorMAC(passphrase, passphraseLength))
, m_throwException(throwException) , m_throwException(throwException)
{ {
SetFilter(new DefaultDecryptor(passphrase, passphraseLength, m_hashVerifier=new HashVerifier(*m_mac, NULL, HashVerifier::PUT_MESSAGE), throwException)); SetFilter(new DefaultDecryptor(passphrase, passphraseLength, m_hashVerifier=new HashVerificationFilter(*m_mac, NULL, HashVerificationFilter::PUT_MESSAGE), throwException));
} }
DefaultDecryptor::State DefaultDecryptorWithMAC::CurrentState() const DefaultDecryptor::State DefaultDecryptorWithMAC::CurrentState() const

View File

@ -167,7 +167,7 @@ protected:
private: private:
member_ptr<DefaultMAC> m_mac; member_ptr<DefaultMAC> m_mac;
HashVerifier *m_hashVerifier; HashVerificationFilter *m_hashVerifier;
bool m_throwException; bool m_throwException;
} CRYPTOPP_DEPRECATED ("DefaultDecryptorWithMAC will be changing in the near future because the algorithms are no longer secure"); } CRYPTOPP_DEPRECATED ("DefaultDecryptorWithMAC will be changing in the near future because the algorithms are no longer secure");

2
dh.h
View File

@ -32,9 +32,7 @@ public:
typedef DL_KeyAgreementAlgorithm_DH<Element, COFACTOR_OPTION> DH_Algorithm; typedef DL_KeyAgreementAlgorithm_DH<Element, COFACTOR_OPTION> DH_Algorithm;
typedef DH_Domain<GROUP_PARAMETERS, COFACTOR_OPTION> Domain; typedef DH_Domain<GROUP_PARAMETERS, COFACTOR_OPTION> Domain;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DH_Domain() {} virtual ~DH_Domain() {}
#endif
//! \brief Construct a Diffie-Hellman domain //! \brief Construct a Diffie-Hellman domain
DH_Domain() {} DH_Domain() {}

3
dh2.h
View File

@ -20,10 +20,7 @@ NAMESPACE_BEGIN(CryptoPP)
class DH2 : public AuthenticatedKeyAgreementDomain class DH2 : public AuthenticatedKeyAgreementDomain
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DH2() {} virtual ~DH2() {}
#endif
//! \brief Construct a DH2 //! \brief Construct a DH2
DH2(SimpleKeyAgreementDomain &domain) DH2(SimpleKeyAgreementDomain &domain)

4
ec2n.h
View File

@ -28,9 +28,7 @@ public:
typedef Field::Element FieldElement; typedef Field::Element FieldElement;
typedef EC2NPoint Point; typedef EC2NPoint Point;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~EC2N() {} virtual ~EC2N() {}
#endif
//! \brief Construct an EC2N //! \brief Construct an EC2N
EC2N() {} EC2N() {}
@ -108,9 +106,7 @@ template<> class EcPrecomputation<EC2N> : public DL_GroupPrecomputation<EC2N::Po
public: public:
typedef EC2N EllipticCurve; typedef EC2N EllipticCurve;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~EcPrecomputation() {} virtual ~EcPrecomputation() {}
#endif
// DL_GroupPrecomputation // DL_GroupPrecomputation
const AbstractGroup<Element> & GetGroup() const {return m_ec;} const AbstractGroup<Element> & GetGroup() const {return m_ec;}

View File

@ -38,9 +38,7 @@ public:
typedef Point Element; typedef Point Element;
typedef IncompatibleCofactorMultiplication DefaultCofactorOption; typedef IncompatibleCofactorMultiplication DefaultCofactorOption;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupParameters_EC() {} virtual ~DL_GroupParameters_EC() {}
#endif
DL_GroupParameters_EC() : m_compress(false), m_encodeAsOID(true) {} DL_GroupParameters_EC() : m_compress(false), m_encodeAsOID(true) {}
DL_GroupParameters_EC(const OID &oid) DL_GroupParameters_EC(const OID &oid)
@ -156,9 +154,7 @@ class DL_PublicKey_EC : public DL_PublicKeyImpl<DL_GroupParameters_EC<EC> >
public: public:
typedef typename EC::Point Element; typedef typename EC::Point Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_PublicKey_EC() {} virtual ~DL_PublicKey_EC() {}
#endif
void Initialize(const DL_GroupParameters_EC<EC> &params, const Element &Q) void Initialize(const DL_GroupParameters_EC<EC> &params, const Element &Q)
{this->AccessGroupParameters() = params; this->SetPublicElement(Q);} {this->AccessGroupParameters() = params; this->SetPublicElement(Q);}
@ -179,9 +175,7 @@ class DL_PrivateKey_EC : public DL_PrivateKeyImpl<DL_GroupParameters_EC<EC> >
public: public:
typedef typename EC::Point Element; typedef typename EC::Point Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_PrivateKey_EC() {} virtual ~DL_PrivateKey_EC() {}
#endif
void Initialize(const DL_GroupParameters_EC<EC> &params, const Integer &x) void Initialize(const DL_GroupParameters_EC<EC> &params, const Integer &x)
{this->AccessGroupParameters() = params; this->SetPrivateExponent(x);} {this->AccessGroupParameters() = params; this->SetPrivateExponent(x);}
@ -206,10 +200,6 @@ template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<E
struct ECDH struct ECDH
{ {
typedef DH_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION> Domain; typedef DH_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION> Domain;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ECDH() {}
#endif
}; };
//! \class ECMQV //! \class ECMQV
@ -221,10 +211,6 @@ template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<E
struct ECMQV struct ECMQV
{ {
typedef MQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION> Domain; typedef MQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION> Domain;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ECMQV() {}
#endif
}; };
//! \class ECHMQV //! \class ECHMQV
@ -237,10 +223,6 @@ template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<E
struct ECHMQV struct ECHMQV
{ {
typedef HMQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION, HASH> Domain; typedef HMQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION, HASH> Domain;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ECHMQV() {}
#endif
}; };
typedef ECHMQV< ECP, DL_GroupParameters_EC< ECP >::DefaultCofactorOption, SHA1 >::Domain ECHMQV160; typedef ECHMQV< ECP, DL_GroupParameters_EC< ECP >::DefaultCofactorOption, SHA1 >::Domain ECHMQV160;
@ -259,10 +241,6 @@ template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<E
struct ECFHMQV struct ECFHMQV
{ {
typedef FHMQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION, HASH> Domain; typedef FHMQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION, HASH> Domain;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ECFHMQV() {}
#endif
}; };
typedef ECFHMQV< ECP, DL_GroupParameters_EC< ECP >::DefaultCofactorOption, SHA1 >::Domain ECFHMQV160; typedef ECFHMQV< ECP, DL_GroupParameters_EC< ECP >::DefaultCofactorOption, SHA1 >::Domain ECFHMQV160;
@ -278,10 +256,6 @@ struct DL_Keys_EC
{ {
typedef DL_PublicKey_EC<EC> PublicKey; typedef DL_PublicKey_EC<EC> PublicKey;
typedef DL_PrivateKey_EC<EC> PrivateKey; typedef DL_PrivateKey_EC<EC> PrivateKey;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Keys_EC() {}
#endif
}; };
// Forward declaration; documented below // Forward declaration; documented below
@ -296,10 +270,6 @@ struct DL_Keys_ECDSA
{ {
typedef DL_PublicKey_EC<EC> PublicKey; typedef DL_PublicKey_EC<EC> PublicKey;
typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<EC>, ECDSA<EC, SHA256> > PrivateKey; typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<EC>, ECDSA<EC, SHA256> > PrivateKey;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Keys_ECDSA() {}
#endif
}; };
//! \class DL_Algorithm_ECDSA //! \class DL_Algorithm_ECDSA
@ -310,10 +280,6 @@ class DL_Algorithm_ECDSA : public DL_Algorithm_GDSA<typename EC::Point>
{ {
public: public:
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "ECDSA";} CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "ECDSA";}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Algorithm_ECDSA() {}
#endif
}; };
//! \class DL_Algorithm_ECNR //! \class DL_Algorithm_ECNR
@ -324,10 +290,6 @@ class DL_Algorithm_ECNR : public DL_Algorithm_NR<typename EC::Point>
{ {
public: public:
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "ECNR";} CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "ECNR";}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Algorithm_ECNR() {}
#endif
}; };
//! \class ECDSA //! \class ECDSA
@ -338,9 +300,6 @@ public:
template <class EC, class H> template <class EC, class H>
struct ECDSA : public DL_SS<DL_Keys_ECDSA<EC>, DL_Algorithm_ECDSA<EC>, DL_SignatureMessageEncodingMethod_DSA, H> struct ECDSA : public DL_SS<DL_Keys_ECDSA<EC>, DL_Algorithm_ECDSA<EC>, DL_SignatureMessageEncodingMethod_DSA, H>
{ {
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ECDSA() {}
#endif
}; };
//! \class ECNR //! \class ECNR
@ -350,9 +309,6 @@ struct ECDSA : public DL_SS<DL_Keys_ECDSA<EC>, DL_Algorithm_ECDSA<EC>, DL_Signat
template <class EC, class H = SHA> template <class EC, class H = SHA>
struct ECNR : public DL_SS<DL_Keys_EC<EC>, DL_Algorithm_ECNR<EC>, DL_SignatureMessageEncodingMethod_NR, H> struct ECNR : public DL_SS<DL_Keys_EC<EC>, DL_Algorithm_ECNR<EC>, DL_SignatureMessageEncodingMethod_NR, H>
{ {
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ECNR() {}
#endif
}; };
@ -400,10 +356,6 @@ struct ECIES
ECIES<EC> > ECIES<EC> >
{ {
static std::string CRYPTOPP_API StaticAlgorithmName() {return "ECIES";} // TODO: fix this after name is standardized static std::string CRYPTOPP_API StaticAlgorithmName() {return "ECIES";} // TODO: fix this after name is standardized
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ECIES() {}
#endif
}; };
NAMESPACE_END NAMESPACE_END

4
ecp.h
View File

@ -26,9 +26,7 @@ public:
typedef Integer FieldElement; typedef Integer FieldElement;
typedef ECPPoint Point; typedef ECPPoint Point;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ECP() {} virtual ~ECP() {}
#endif
//! \brief Construct an ECP //! \brief Construct an ECP
ECP() {} ECP() {}
@ -116,9 +114,7 @@ template<> class EcPrecomputation<ECP> : public DL_GroupPrecomputation<ECP::Poin
public: public:
typedef ECP EllipticCurve; typedef ECP EllipticCurve;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~EcPrecomputation() {} virtual ~EcPrecomputation() {}
#endif
// DL_GroupPrecomputation // DL_GroupPrecomputation
bool NeedConversions() const {return true;} bool NeedConversions() const {return true;}

View File

@ -24,10 +24,7 @@ class CRYPTOPP_NO_VTABLE ElGamalBase : public DL_KeyAgreementAlgorithm_DH<Intege
public DL_SymmetricEncryptionAlgorithm public DL_SymmetricEncryptionAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ElGamalBase() {} virtual ~ElGamalBase() {}
#endif
void Derive(const DL_GroupParameters<Integer> &groupParams, byte *derivedKey, size_t derivedLength, const Integer &agreedElement, const Integer &ephemeralPublicKey, const NameValuePairs &derivationParams) const void Derive(const DL_GroupParameters<Integer> &groupParams, byte *derivedKey, size_t derivedLength, const Integer &agreedElement, const Integer &ephemeralPublicKey, const NameValuePairs &derivationParams) const
{ {
@ -103,10 +100,7 @@ template <class BASE, class SCHEME_OPTIONS, class KEY>
class ElGamalObjectImpl : public DL_ObjectImplBase<BASE, SCHEME_OPTIONS, KEY>, public ElGamalBase class ElGamalObjectImpl : public DL_ObjectImplBase<BASE, SCHEME_OPTIONS, KEY>, public ElGamalBase
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ElGamalObjectImpl() {} virtual ~ElGamalObjectImpl() {}
#endif
size_t FixedMaxPlaintextLength() const {return this->MaxPlaintextLength(FixedCiphertextLength());} size_t FixedMaxPlaintextLength() const {return this->MaxPlaintextLength(FixedCiphertextLength());}
size_t FixedCiphertextLength() const {return this->CiphertextLength(0);} size_t FixedCiphertextLength() const {return this->CiphertextLength(0);}
@ -138,7 +132,7 @@ struct ElGamal
{ {
typedef DL_CryptoSchemeOptions<ElGamal, ElGamalKeys, int, int, int> SchemeOptions; typedef DL_CryptoSchemeOptions<ElGamal, ElGamalKeys, int, int, int> SchemeOptions;
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "ElgamalEnc/Crypto++Padding";} CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "ElgamalEnc/Crypto++Padding";}
typedef SchemeOptions::GroupParameters GroupParameters; typedef SchemeOptions::GroupParameters GroupParameters;
//! implements PK_Encryptor interface //! implements PK_Encryptor interface

View File

@ -19,16 +19,14 @@ class DL_GroupPrecomputation
public: public:
typedef T Element; typedef T Element;
virtual ~DL_GroupPrecomputation() {}
virtual bool NeedConversions() const {return false;} virtual bool NeedConversions() const {return false;}
virtual Element ConvertIn(const Element &v) const {return v;} virtual Element ConvertIn(const Element &v) const {return v;}
virtual Element ConvertOut(const Element &v) const {return v;} virtual Element ConvertOut(const Element &v) const {return v;}
virtual const AbstractGroup<Element> & GetGroup() const =0; virtual const AbstractGroup<Element> & GetGroup() const =0;
virtual Element BERDecodeElement(BufferedTransformation &bt) const =0; virtual Element BERDecodeElement(BufferedTransformation &bt) const =0;
virtual void DEREncodeElement(BufferedTransformation &bt, const Element &P) const =0; virtual void DEREncodeElement(BufferedTransformation &bt, const Element &P) const =0;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupPrecomputation() {}
#endif
}; };
template <class T> template <class T>
@ -37,6 +35,8 @@ class DL_FixedBasePrecomputation
public: public:
typedef T Element; typedef T Element;
virtual ~DL_FixedBasePrecomputation() {}
virtual bool IsInitialized() const =0; virtual bool IsInitialized() const =0;
virtual void SetBase(const DL_GroupPrecomputation<Element> &group, const Element &base) =0; virtual void SetBase(const DL_GroupPrecomputation<Element> &group, const Element &base) =0;
virtual const Element & GetBase(const DL_GroupPrecomputation<Element> &group) const =0; virtual const Element & GetBase(const DL_GroupPrecomputation<Element> &group) const =0;
@ -45,10 +45,6 @@ public:
virtual void Save(const DL_GroupPrecomputation<Element> &group, BufferedTransformation &storedPrecomputation) const =0; virtual void Save(const DL_GroupPrecomputation<Element> &group, BufferedTransformation &storedPrecomputation) const =0;
virtual Element Exponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent) const =0; virtual Element Exponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent) const =0;
virtual Element CascadeExponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent, const DL_FixedBasePrecomputation<Element> &pc2, const Integer &exponent2) const =0; virtual Element CascadeExponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent, const DL_FixedBasePrecomputation<Element> &pc2, const Integer &exponent2) const =0;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_FixedBasePrecomputation() {}
#endif
}; };
template <class T> template <class T>
@ -57,6 +53,8 @@ class DL_FixedBasePrecomputationImpl : public DL_FixedBasePrecomputation<T>
public: public:
typedef T Element; typedef T Element;
virtual ~DL_FixedBasePrecomputationImpl() {}
DL_FixedBasePrecomputationImpl() : m_windowSize(0) {} DL_FixedBasePrecomputationImpl() : m_windowSize(0) {}
// DL_FixedBasePrecomputation // DL_FixedBasePrecomputation
@ -71,10 +69,6 @@ public:
Element Exponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent) const; Element Exponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent) const;
Element CascadeExponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent, const DL_FixedBasePrecomputation<Element> &pc2, const Integer &exponent2) const; Element CascadeExponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent, const DL_FixedBasePrecomputation<Element> &pc2, const Integer &exponent2) const;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_FixedBasePrecomputationImpl() {}
#endif
private: private:
void PrepareCascade(const DL_GroupPrecomputation<Element> &group, std::vector<BaseAndExponent<Element> > &eb, const Integer &exponent) const; void PrepareCascade(const DL_GroupPrecomputation<Element> &group, std::vector<BaseAndExponent<Element> > &eb, const Integer &exponent) const;

View File

@ -1,3 +1,5 @@
// factory.h - written and placed in the public domain by Wei Dai
#ifndef CRYPTOPP_OBJFACT_H #ifndef CRYPTOPP_OBJFACT_H
#define CRYPTOPP_OBJFACT_H #define CRYPTOPP_OBJFACT_H
@ -93,14 +95,16 @@ ObjectFactoryRegistry<AbstractClass, instance> & ObjectFactoryRegistry<AbstractC
} }
template <class AbstractClass, class ConcreteClass, int instance = 0> template <class AbstractClass, class ConcreteClass, int instance = 0>
struct RegisterDefaultFactoryFor { struct RegisterDefaultFactoryFor
RegisterDefaultFactoryFor(const char *name=NULL)
{ {
// BCB2006 workaround RegisterDefaultFactoryFor(const char *name=NULL)
std::string n = name ? std::string(name) : std::string(ConcreteClass::StaticAlgorithmName()); {
ObjectFactoryRegistry<AbstractClass, instance>::Registry(). // BCB2006 workaround
std::string n = name ? std::string(name) : std::string(ConcreteClass::StaticAlgorithmName());
ObjectFactoryRegistry<AbstractClass, instance>::Registry().
RegisterFactory(n, new DefaultObjectFactory<AbstractClass, ConcreteClass>); RegisterFactory(n, new DefaultObjectFactory<AbstractClass, ConcreteClass>);
}}; }
};
template <class SchemeClass> template <class SchemeClass>
void RegisterAsymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL) void RegisterAsymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)

View File

@ -28,9 +28,7 @@ public:
typedef typename GroupParameters::Element Element; typedef typename GroupParameters::Element Element;
typedef FHMQV_Domain<GROUP_PARAMETERS, COFACTOR_OPTION, HASH> Domain; typedef FHMQV_Domain<GROUP_PARAMETERS, COFACTOR_OPTION, HASH> Domain;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~FHMQV_Domain() {}
virtual ~FHMQV_Domain() {}
#endif
FHMQV_Domain(bool clientRole = true): m_role(clientRole ? RoleClient : RoleServer) {} FHMQV_Domain(bool clientRole = true): m_role(clientRole ? RoleClient : RoleServer) {}

View File

@ -312,13 +312,6 @@ void FilterWithBufferedInput::BlockQueue::Put(const byte *inString, size_t lengt
m_size += length; m_size += length;
} }
#if !defined(CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562)
FilterWithBufferedInput::FilterWithBufferedInput()
: Filter(), m_firstSize(SIZE_MAX), m_blockSize(0), m_lastSize(SIZE_MAX), m_firstInputDone(false)
{
}
#endif
FilterWithBufferedInput::FilterWithBufferedInput(BufferedTransformation *attachment) FilterWithBufferedInput::FilterWithBufferedInput(BufferedTransformation *attachment)
: Filter(attachment), m_firstSize(SIZE_MAX), m_blockSize(0), m_lastSize(SIZE_MAX), m_firstInputDone(false) : Filter(attachment), m_firstSize(SIZE_MAX), m_blockSize(0), m_lastSize(SIZE_MAX), m_firstInputDone(false)
{ {

View File

@ -36,9 +36,7 @@ NAMESPACE_BEGIN(CryptoPP)
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Filter : public BufferedTransformation, public NotCopyable class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Filter : public BufferedTransformation, public NotCopyable
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~Filter() {} virtual ~Filter() {}
#endif
//! \name ATTACHMENT //! \name ATTACHMENT
//@{ //@{
@ -149,18 +147,20 @@ protected:
//! \note There should be a MessageEnd() immediately before MessageSeriesEnd(). //! \note There should be a MessageEnd() immediately before MessageSeriesEnd().
bool OutputMessageSeriesEnd(int outputSite, int propagation, bool blocking, const std::string &channel=DEFAULT_CHANNEL); bool OutputMessageSeriesEnd(int outputSite, int propagation, bool blocking, const std::string &channel=DEFAULT_CHANNEL);
private:
member_ptr<BufferedTransformation> m_attachment;
protected: protected:
size_t m_inputPosition; size_t m_inputPosition;
int m_continueAt; int m_continueAt;
private:
member_ptr<BufferedTransformation> m_attachment;
}; };
//! \class FilterPutSpaceHelper //! \class FilterPutSpaceHelper
//! \brief Create a working space in a BufferedTransformation //! \brief Create a working space in a BufferedTransformation
struct CRYPTOPP_DLL FilterPutSpaceHelper struct CRYPTOPP_DLL FilterPutSpaceHelper
{ {
virtual ~FilterPutSpaceHelper() {}
//! \brief Create a working space in a BufferedTransformation //! \brief Create a working space in a BufferedTransformation
//! \param target BufferedTransformation for the working space //! \param target BufferedTransformation for the working space
//! \param channel channel for the working space //! \param channel channel for the working space
@ -220,6 +220,8 @@ struct CRYPTOPP_DLL FilterPutSpaceHelper
class CRYPTOPP_DLL MeterFilter : public Bufferless<Filter> class CRYPTOPP_DLL MeterFilter : public Bufferless<Filter>
{ {
public: public:
virtual ~MeterFilter() {}
//! \brief Construct a MeterFilter //! \brief Construct a MeterFilter
//! \param attachment an optional attached transformation //! \param attachment an optional attached transformation
//! \param transparent flag indicating if the filter should function transparently //! \param transparent flag indicating if the filter should function transparently
@ -315,11 +317,7 @@ public:
class CRYPTOPP_DLL FilterWithBufferedInput : public Filter class CRYPTOPP_DLL FilterWithBufferedInput : public Filter
{ {
public: public:
virtual ~FilterWithBufferedInput() {}
#if !defined(CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562)
//! default FilterWithBufferedInput for temporaries
FilterWithBufferedInput();
#endif
//! \brief Construct a FilterWithBufferedInput with an attached transformation //! \brief Construct a FilterWithBufferedInput with an attached transformation
//! \param attachment an attached transformation //! \param attachment an attached transformation
@ -434,6 +432,8 @@ protected:
class CRYPTOPP_DLL FilterWithInputQueue : public Filter class CRYPTOPP_DLL FilterWithInputQueue : public Filter
{ {
public: public:
virtual ~FilterWithInputQueue() {}
//! \brief Construct a FilterWithInputQueue //! \brief Construct a FilterWithInputQueue
//! \param attachment an optional attached transformation //! \param attachment an optional attached transformation
FilterWithInputQueue(BufferedTransformation *attachment=NULL) : Filter(attachment) {} FilterWithInputQueue(BufferedTransformation *attachment=NULL) : Filter(attachment) {}
@ -491,6 +491,8 @@ struct BlockPaddingSchemeDef
class CRYPTOPP_DLL StreamTransformationFilter : public FilterWithBufferedInput, public BlockPaddingSchemeDef, private FilterPutSpaceHelper class CRYPTOPP_DLL StreamTransformationFilter : public FilterWithBufferedInput, public BlockPaddingSchemeDef, private FilterPutSpaceHelper
{ {
public: public:
virtual ~StreamTransformationFilter() {}
//! \brief Construct a StreamTransformationFilter //! \brief Construct a StreamTransformationFilter
//! \param c reference to a StreamTransformation //! \param c reference to a StreamTransformation
//! \param attachment an optional attached transformation //! \param attachment an optional attached transformation
@ -514,15 +516,13 @@ protected:
unsigned int m_optimalBufferSize; unsigned int m_optimalBufferSize;
}; };
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
typedef StreamTransformationFilter StreamCipherFilter;
#endif
//! \class HashFilter //! \class HashFilter
//! \brief Filter wrapper for HashTransformation //! \brief Filter wrapper for HashTransformation
class CRYPTOPP_DLL HashFilter : public Bufferless<Filter>, private FilterPutSpaceHelper class CRYPTOPP_DLL HashFilter : public Bufferless<Filter>, private FilterPutSpaceHelper
{ {
public: public:
virtual ~HashFilter() {}
//! \brief Construct a HashFilter //! \brief Construct a HashFilter
//! \param hm reference to a HashTransformation //! \param hm reference to a HashTransformation
//! \param attachment an optional attached transformation //! \param attachment an optional attached transformation
@ -550,6 +550,8 @@ private:
class CRYPTOPP_DLL HashVerificationFilter : public FilterWithBufferedInput class CRYPTOPP_DLL HashVerificationFilter : public FilterWithBufferedInput
{ {
public: public:
virtual ~HashVerificationFilter() {}
//! \class HashVerificationFailed //! \class HashVerificationFailed
//! \brief Exception thrown when a data integrity check failure is encountered //! \brief Exception thrown when a data integrity check failure is encountered
class HashVerificationFailed : public Exception class HashVerificationFailed : public Exception
@ -606,8 +608,6 @@ private:
SecByteBlock m_expectedHash; SecByteBlock m_expectedHash;
}; };
typedef HashVerificationFilter HashVerifier; // for backwards compatibility
//! \class AuthenticatedEncryptionFilter //! \class AuthenticatedEncryptionFilter
//! \brief Filter wrapper for encrypting with AuthenticatedSymmetricCipher //! \brief Filter wrapper for encrypting with AuthenticatedSymmetricCipher
//! \details AuthenticatedEncryptionFilter() is a wrapper for encrypting with AuthenticatedSymmetricCipher(), //! \details AuthenticatedEncryptionFilter() is a wrapper for encrypting with AuthenticatedSymmetricCipher(),
@ -617,6 +617,8 @@ typedef HashVerificationFilter HashVerifier; // for backwards compatibility
class CRYPTOPP_DLL AuthenticatedEncryptionFilter : public StreamTransformationFilter class CRYPTOPP_DLL AuthenticatedEncryptionFilter : public StreamTransformationFilter
{ {
public: public:
virtual ~AuthenticatedEncryptionFilter() {}
//! \brief Construct a AuthenticatedEncryptionFilter //! \brief Construct a AuthenticatedEncryptionFilter
//! \param c reference to a AuthenticatedSymmetricCipher //! \param c reference to a AuthenticatedSymmetricCipher
//! \param attachment an optional attached transformation //! \param attachment an optional attached transformation
@ -671,6 +673,8 @@ public:
DEFAULT_FLAGS = THROW_EXCEPTION DEFAULT_FLAGS = THROW_EXCEPTION
}; };
virtual ~AuthenticatedDecryptionFilter() {}
//! \brief Construct a AuthenticatedDecryptionFilter //! \brief Construct a AuthenticatedDecryptionFilter
//! \param c reference to a AuthenticatedSymmetricCipher //! \param c reference to a AuthenticatedSymmetricCipher
//! \param attachment an optional attached transformation //! \param attachment an optional attached transformation
@ -713,6 +717,8 @@ protected:
class CRYPTOPP_DLL SignerFilter : public Unflushable<Filter> class CRYPTOPP_DLL SignerFilter : public Unflushable<Filter>
{ {
public: public:
virtual ~SignerFilter() {}
//! \brief Construct a SignerFilter //! \brief Construct a SignerFilter
//! \param rng a RandomNumberGenerator derived class //! \param rng a RandomNumberGenerator derived class
//! \param signer a PK_Signer derived class //! \param signer a PK_Signer derived class
@ -767,6 +773,8 @@ public:
DEFAULT_FLAGS = SIGNATURE_AT_BEGIN | PUT_RESULT DEFAULT_FLAGS = SIGNATURE_AT_BEGIN | PUT_RESULT
}; };
virtual ~SignatureVerificationFilter() {}
//! \brief Construct a SignatureVerificationFilter //! \brief Construct a SignatureVerificationFilter
//! \param verifier a PK_Verifier derived class //! \param verifier a PK_Verifier derived class
//! \param attachment an optional attached transformation //! \param attachment an optional attached transformation
@ -815,6 +823,8 @@ public:
PASS_EVERYTHING = PASS_SIGNALS | PASS_WAIT_OBJECTS PASS_EVERYTHING = PASS_SIGNALS | PASS_WAIT_OBJECTS
}; };
virtual ~Redirector() {}
//! \brief Construct a Redirector //! \brief Construct a Redirector
Redirector() : m_target(NULL), m_behavior(PASS_EVERYTHING) {} Redirector() : m_target(NULL), m_behavior(PASS_EVERYTHING) {}
@ -893,6 +903,8 @@ private:
class CRYPTOPP_DLL OutputProxy : public CustomSignalPropagation<Sink> class CRYPTOPP_DLL OutputProxy : public CustomSignalPropagation<Sink>
{ {
public: public:
virtual ~OutputProxy() {}
//! \brief Construct an OutputProxy //! \brief Construct an OutputProxy
//! \param owner the owning transformation //! \param owner the owning transformation
//! \param passSignal flag indicating if signals should be passed //! \param passSignal flag indicating if signals should be passed
@ -939,6 +951,8 @@ private:
class CRYPTOPP_DLL ProxyFilter : public FilterWithBufferedInput class CRYPTOPP_DLL ProxyFilter : public FilterWithBufferedInput
{ {
public: public:
virtual ~ProxyFilter() {}
//! \brief Construct a ProxyFilter //! \brief Construct a ProxyFilter
//! \param filter an output filter //! \param filter an output filter
//! \param firstSize the first Put size //! \param firstSize the first Put size
@ -1024,8 +1038,7 @@ template <class T>
class StringSinkTemplate : public Bufferless<Sink> class StringSinkTemplate : public Bufferless<Sink>
{ {
public: public:
// VC60 workaround: no T::char_type virtual ~StringSinkTemplate() {}
typedef typename T::traits_type::char_type char_type;
//! \brief Construct a StringSinkTemplate //! \brief Construct a StringSinkTemplate
//! \param output std::basic_string<char> type //! \param output std::basic_string<char> type
@ -1038,6 +1051,8 @@ public:
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking) size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
{ {
CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
typedef typename T::traits_type::char_type char_type;
if (length > 0) if (length > 0)
{ {
typename T::size_type size = m_output->size(); typename T::size_type size = m_output->size();
@ -1063,6 +1078,8 @@ CRYPTOPP_DLL_TEMPLATE_CLASS StringSinkTemplate<std::string>;
class RandomNumberSink : public Bufferless<Sink> class RandomNumberSink : public Bufferless<Sink>
{ {
public: public:
virtual ~RandomNumberSink() {}
//! \brief Construct a RandomNumberSink //! \brief Construct a RandomNumberSink
RandomNumberSink() RandomNumberSink()
: m_rng(NULL) {} : m_rng(NULL) {}
@ -1084,6 +1101,8 @@ private:
class CRYPTOPP_DLL ArraySink : public Bufferless<Sink> class CRYPTOPP_DLL ArraySink : public Bufferless<Sink>
{ {
public: public:
virtual ~ArraySink() {}
//! \brief Construct an ArraySink //! \brief Construct an ArraySink
//! \param parameters a set of NameValuePairs to initialize this object //! \param parameters a set of NameValuePairs to initialize this object
//! \details Name::OutputBuffer() is a mandatory parameter using this constructor. //! \details Name::OutputBuffer() is a mandatory parameter using this constructor.
@ -1119,6 +1138,8 @@ protected:
class CRYPTOPP_DLL ArrayXorSink : public ArraySink class CRYPTOPP_DLL ArrayXorSink : public ArraySink
{ {
public: public:
virtual ~ArrayXorSink() {}
//! \brief Construct an ArrayXorSink //! \brief Construct an ArrayXorSink
//! \param buf pointer to a memory buffer //! \param buf pointer to a memory buffer
//! \param size length of the memory buffer //! \param size length of the memory buffer
@ -1165,6 +1186,8 @@ private:
class CRYPTOPP_DLL RandomNumberStore : public Store class CRYPTOPP_DLL RandomNumberStore : public Store
{ {
public: public:
virtual ~RandomNumberStore() {}
RandomNumberStore() RandomNumberStore()
: m_rng(NULL), m_length(0), m_count(0) {} : m_rng(NULL), m_length(0), m_count(0) {}
@ -1216,9 +1239,7 @@ private:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Source : public InputRejecting<Filter> class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Source : public InputRejecting<Filter>
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~Source() {} virtual ~Source() {}
#endif
//! \brief Construct a Source //! \brief Construct a Source
//! \param attachment an optional attached transformation //! \param attachment an optional attached transformation
@ -1291,6 +1312,8 @@ template <class T>
class SourceTemplate : public Source class SourceTemplate : public Source
{ {
public: public:
virtual ~SourceTemplate() {}
//! \brief Construct a SourceTemplate //! \brief Construct a SourceTemplate
//! \tparam T the class or type //! \tparam T the class or type
//! \param attachment an attached transformation //! \param attachment an attached transformation

View File

@ -204,7 +204,6 @@ void DL_GroupParameters_IntegerBased::GenerateRandom(RandomNumberGenerator &rng,
Initialize(p, q, g); Initialize(p, q, g);
} }
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
void DL_GroupParameters_IntegerBased::EncodeElement(bool reversible, const Element &element, byte *encoded) const void DL_GroupParameters_IntegerBased::EncodeElement(bool reversible, const Element &element, byte *encoded) const
{ {
CRYPTOPP_UNUSED(reversible); CRYPTOPP_UNUSED(reversible);
@ -216,7 +215,6 @@ unsigned int DL_GroupParameters_IntegerBased::GetEncodedElementSize(bool reversi
CRYPTOPP_UNUSED(reversible); CRYPTOPP_UNUSED(reversible);
return GetModulus().ByteCount(); return GetModulus().ByteCount();
} }
#endif
Integer DL_GroupParameters_IntegerBased::DecodeElement(const byte *encoded, bool checkForGroupMembership) const Integer DL_GroupParameters_IntegerBased::DecodeElement(const byte *encoded, bool checkForGroupMembership) const
{ {

View File

@ -35,10 +35,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBased : public A
typedef DL_GroupParameters_IntegerBased ThisClass; typedef DL_GroupParameters_IntegerBased ThisClass;
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupParameters_IntegerBased() {} virtual ~DL_GroupParameters_IntegerBased() {}
#endif
void Initialize(const DL_GroupParameters_IntegerBased &params) void Initialize(const DL_GroupParameters_IntegerBased &params)
{Initialize(params.GetModulus(), params.GetSubgroupOrder(), params.GetSubgroupGenerator());} {Initialize(params.GetModulus(), params.GetSubgroupOrder(), params.GetSubgroupGenerator());}
@ -66,16 +63,9 @@ public:
bool ValidateElement(unsigned int level, const Integer &element, const DL_FixedBasePrecomputation<Integer> *precomp) const; bool ValidateElement(unsigned int level, const Integer &element, const DL_FixedBasePrecomputation<Integer> *precomp) const;
bool FastSubgroupCheckAvailable() const {return GetCofactor() == 2;} bool FastSubgroupCheckAvailable() const {return GetCofactor() == 2;}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 // Cygwin i386 crash at -O3; see http://github.com/weidai11/cryptopp/issues/40.
// Cygwin i386 crash at -O3; see .
void EncodeElement(bool reversible, const Element &element, byte *encoded) const; void EncodeElement(bool reversible, const Element &element, byte *encoded) const;
unsigned int GetEncodedElementSize(bool reversible) const; unsigned int GetEncodedElementSize(bool reversible) const;
#else
void EncodeElement(bool reversible, const Element &element, byte *encoded) const
{CRYPTOPP_UNUSED(reversible); element.Encode(encoded, GetModulus().ByteCount());}
unsigned int GetEncodedElementSize(bool reversible) const
{CRYPTOPP_UNUSED(reversible); return GetModulus().ByteCount();}
#endif
Integer DecodeElement(const byte *encoded, bool checkForGroupMembership) const; Integer DecodeElement(const byte *encoded, bool checkForGroupMembership) const;
Integer ConvertElementToInteger(const Element &element) const Integer ConvertElementToInteger(const Element &element) const
@ -115,9 +105,7 @@ class CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBasedImpl : public DL_GroupPa
public: public:
typedef typename GROUP_PRECOMP::Element Element; typedef typename GROUP_PRECOMP::Element Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupParameters_IntegerBasedImpl() {} virtual ~DL_GroupParameters_IntegerBasedImpl() {}
#endif
// GeneratibleCryptoMaterial interface // GeneratibleCryptoMaterial interface
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
@ -151,10 +139,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_IntegerBasedImpl<ModExpPrecomputa
class CRYPTOPP_DLL DL_GroupParameters_GFP : public DL_GroupParameters_IntegerBasedImpl<ModExpPrecomputation> class CRYPTOPP_DLL DL_GroupParameters_GFP : public DL_GroupParameters_IntegerBasedImpl<ModExpPrecomputation>
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupParameters_GFP() {} virtual ~DL_GroupParameters_GFP() {}
#endif
// DL_GroupParameters // DL_GroupParameters
bool IsIdentity(const Integer &element) const {return element == Integer::One();} bool IsIdentity(const Integer &element) const {return element == Integer::One();}
@ -181,9 +166,7 @@ class CRYPTOPP_DLL DL_GroupParameters_GFP_DefaultSafePrime : public DL_GroupPara
public: public:
typedef NoCofactorMultiplication DefaultCofactorOption; typedef NoCofactorMultiplication DefaultCofactorOption;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupParameters_GFP_DefaultSafePrime() {} virtual ~DL_GroupParameters_GFP_DefaultSafePrime() {}
#endif
protected: protected:
unsigned int GetDefaultSubgroupOrderSize(unsigned int modulusSize) const {return modulusSize-1;} unsigned int GetDefaultSubgroupOrderSize(unsigned int modulusSize) const {return modulusSize-1;}
@ -196,11 +179,9 @@ template <class T>
class DL_Algorithm_GDSA : public DL_ElgamalLikeSignatureAlgorithm<T> class DL_Algorithm_GDSA : public DL_ElgamalLikeSignatureAlgorithm<T>
{ {
public: public:
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "DSA-1363";} CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "DSA-1363";}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Algorithm_GDSA() {} virtual ~DL_Algorithm_GDSA() {}
#endif
void Sign(const DL_GroupParameters<T> &params, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const void Sign(const DL_GroupParameters<T> &params, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const
{ {
@ -236,9 +217,7 @@ class DL_Algorithm_NR : public DL_ElgamalLikeSignatureAlgorithm<T>
public: public:
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "NR";} CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "NR";}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Algorithm_NR() {} virtual ~DL_Algorithm_NR() {}
#endif
void Sign(const DL_GroupParameters<T> &params, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const void Sign(const DL_GroupParameters<T> &params, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const
{ {
@ -267,9 +246,7 @@ template <class GP>
class DL_PublicKey_GFP : public DL_PublicKeyImpl<GP> class DL_PublicKey_GFP : public DL_PublicKeyImpl<GP>
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_PublicKey_GFP() {} virtual ~DL_PublicKey_GFP() {}
#endif
void Initialize(const DL_GroupParameters_IntegerBased &params, const Integer &y) void Initialize(const DL_GroupParameters_IntegerBased &params, const Integer &y)
{this->AccessGroupParameters().Initialize(params); this->SetPublicElement(y);} {this->AccessGroupParameters().Initialize(params); this->SetPublicElement(y);}
@ -292,9 +269,7 @@ template <class GP>
class DL_PrivateKey_GFP : public DL_PrivateKeyImpl<GP> class DL_PrivateKey_GFP : public DL_PrivateKeyImpl<GP>
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_PrivateKey_GFP() {} virtual ~DL_PrivateKey_GFP() {}
#endif
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits) void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits)
{this->GenerateRandomWithKeySize(rng, modulusBits);} {this->GenerateRandomWithKeySize(rng, modulusBits);}
@ -317,10 +292,6 @@ struct DL_SignatureKeys_GFP
typedef DL_GroupParameters_GFP GroupParameters; typedef DL_GroupParameters_GFP GroupParameters;
typedef DL_PublicKey_GFP<GroupParameters> PublicKey; typedef DL_PublicKey_GFP<GroupParameters> PublicKey;
typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey; typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_SignatureKeys_GFP() {}
#endif
}; };
//! \class DL_CryptoKeys_GFP //! \class DL_CryptoKeys_GFP
@ -330,10 +301,6 @@ struct DL_CryptoKeys_GFP
typedef DL_GroupParameters_GFP_DefaultSafePrime GroupParameters; typedef DL_GroupParameters_GFP_DefaultSafePrime GroupParameters;
typedef DL_PublicKey_GFP<GroupParameters> PublicKey; typedef DL_PublicKey_GFP<GroupParameters> PublicKey;
typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey; typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_CryptoKeys_GFP() {}
#endif
}; };
//! \class DL_PublicKey_GFP_OldFormat //! \class DL_PublicKey_GFP_OldFormat
@ -345,9 +312,7 @@ template <class BASE>
class DL_PublicKey_GFP_OldFormat : public BASE class DL_PublicKey_GFP_OldFormat : public BASE
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_PublicKey_GFP_OldFormat() {} virtual ~DL_PublicKey_GFP_OldFormat() {}
#endif
void BERDecode(BufferedTransformation &bt) void BERDecode(BufferedTransformation &bt)
{ {
@ -392,9 +357,7 @@ template <class BASE>
class DL_PrivateKey_GFP_OldFormat : public BASE class DL_PrivateKey_GFP_OldFormat : public BASE
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_PrivateKey_GFP_OldFormat() {} virtual ~DL_PrivateKey_GFP_OldFormat() {}
#endif
void BERDecode(BufferedTransformation &bt) void BERDecode(BufferedTransformation &bt)
{ {
@ -444,9 +407,6 @@ struct GDSA : public DL_SS<
DL_SignatureMessageEncodingMethod_DSA, DL_SignatureMessageEncodingMethod_DSA,
H> H>
{ {
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~GDSA() {}
#endif
}; };
//! \class NR //! \class NR
@ -460,9 +420,6 @@ struct NR : public DL_SS<
DL_SignatureMessageEncodingMethod_NR, DL_SignatureMessageEncodingMethod_NR,
H> H>
{ {
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~NR() {}
#endif
}; };
//! \class DL_GroupParameters_DSA //! \class DL_GroupParameters_DSA
@ -472,9 +429,7 @@ struct NR : public DL_SS<
class CRYPTOPP_DLL DL_GroupParameters_DSA : public DL_GroupParameters_GFP class CRYPTOPP_DLL DL_GroupParameters_DSA : public DL_GroupParameters_GFP
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupParameters_DSA() {} virtual ~DL_GroupParameters_DSA() {}
#endif
/*! also checks that the lengths of p and q are allowed by the DSA standard */ /*! also checks that the lengths of p and q are allowed by the DSA standard */
bool ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const; bool ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const;
@ -498,10 +453,6 @@ struct DL_Keys_DSA
{ {
typedef DL_PublicKey_GFP<DL_GroupParameters_DSA> PublicKey; typedef DL_PublicKey_GFP<DL_GroupParameters_DSA> PublicKey;
typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_GFP<DL_GroupParameters_DSA>, DSA2<SHA> > PrivateKey; typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_GFP<DL_GroupParameters_DSA>, DSA2<SHA> > PrivateKey;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Keys_DSA() {}
#endif
}; };
//! \class DSA2 //! \class DSA2
@ -521,13 +472,9 @@ class DSA2 : public DL_SS<
public: public:
static std::string CRYPTOPP_API StaticAlgorithmName() {return "DSA/" + (std::string)H::StaticAlgorithmName();} static std::string CRYPTOPP_API StaticAlgorithmName() {return "DSA/" + (std::string)H::StaticAlgorithmName();}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 //#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
virtual ~DSA2() {} //enum {MIN_PRIME_LENGTH = 1024, MAX_PRIME_LENGTH = 3072, PRIME_LENGTH_MULTIPLE = 1024};
#endif //#endif
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
enum {MIN_PRIME_LENGTH = 1024, MAX_PRIME_LENGTH = 3072, PRIME_LENGTH_MULTIPLE = 1024};
#endif
}; };
//! DSA with SHA-1, typedef'd for backwards compatibility //! DSA with SHA-1, typedef'd for backwards compatibility
@ -555,9 +502,7 @@ template <class MAC, bool DHAES_MODE, bool LABEL_OCTETS=false>
class DL_EncryptionAlgorithm_Xor : public DL_SymmetricEncryptionAlgorithm class DL_EncryptionAlgorithm_Xor : public DL_SymmetricEncryptionAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_EncryptionAlgorithm_Xor() {} virtual ~DL_EncryptionAlgorithm_Xor() {}
#endif
bool ParameterSupported(const char *name) const {return strcmp(name, Name::EncodingParameters()) == 0;} bool ParameterSupported(const char *name) const {return strcmp(name, Name::EncodingParameters()) == 0;}
size_t GetSymmetricKeyLength(size_t plaintextLength) const size_t GetSymmetricKeyLength(size_t plaintextLength) const
@ -640,6 +585,8 @@ template <class T, bool DHAES_MODE, class KDF>
class DL_KeyDerivationAlgorithm_P1363 : public DL_KeyDerivationAlgorithm<T> class DL_KeyDerivationAlgorithm_P1363 : public DL_KeyDerivationAlgorithm<T>
{ {
public: public:
virtual ~DL_KeyDerivationAlgorithm_P1363() {}
bool ParameterSupported(const char *name) const {return strcmp(name, Name::KeyDerivationParameters()) == 0;} bool ParameterSupported(const char *name) const {return strcmp(name, Name::KeyDerivationParameters()) == 0;}
void Derive(const DL_GroupParameters<T> &params, byte *derivedKey, size_t derivedLength, const T &agreedElement, const T &ephemeralPublicKey, const NameValuePairs &parameters) const void Derive(const DL_GroupParameters<T> &params, byte *derivedKey, size_t derivedLength, const T &agreedElement, const T &ephemeralPublicKey, const NameValuePairs &parameters) const
{ {
@ -660,10 +607,6 @@ public:
parameters.GetValue(Name::KeyDerivationParameters(), derivationParameters); parameters.GetValue(Name::KeyDerivationParameters(), derivationParameters);
KDF::DeriveKey(derivedKey, derivedLength, agreedSecret, agreedSecret.size(), derivationParameters.begin(), derivationParameters.size()); KDF::DeriveKey(derivedKey, derivedLength, agreedSecret, agreedSecret.size(), derivationParameters.begin(), derivationParameters.size());
} }
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_KeyDerivationAlgorithm_P1363() {}
#endif
}; };
//! \class DLIES //! \class DLIES
@ -710,10 +653,6 @@ struct DLIES
DLIES<> > DLIES<> >
{ {
static std::string CRYPTOPP_API StaticAlgorithmName() {return "DLIES";} // TODO: fix this after name is standardized static std::string CRYPTOPP_API StaticAlgorithmName() {return "DLIES";} // TODO: fix this after name is standardized
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DLIES() {}
#endif
}; };
NAMESPACE_END NAMESPACE_END

8
hmqv.h
View File

@ -27,9 +27,7 @@ public:
typedef typename GroupParameters::Element Element; typedef typename GroupParameters::Element Element;
typedef HMQV_Domain<GROUP_PARAMETERS, COFACTOR_OPTION, HASH> Domain; typedef HMQV_Domain<GROUP_PARAMETERS, COFACTOR_OPTION, HASH> Domain;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~HMQV_Domain() {}
virtual ~HMQV_Domain() {}
#endif
HMQV_Domain(bool clientRole = true): m_role(clientRole ? RoleClient : RoleServer) {} HMQV_Domain(bool clientRole = true): m_role(clientRole ? RoleClient : RoleServer) {}
@ -258,7 +256,7 @@ protected:
if(sigma) if(sigma)
{ {
if (e1len != 0 || s1len != 0) { if (e1len != 0 || s1len != 0) {
CRYPTOPP_ASSERT(0); CRYPTOPP_ASSERT(0);
} }
Integer x = GetAbstractGroupParameters().ConvertElementToInteger(*sigma); Integer x = GetAbstractGroupParameters().ConvertElementToInteger(*sigma);
SecByteBlock sbb(x.MinEncodedSize()); SecByteBlock sbb(x.MinEncodedSize());
@ -266,7 +264,7 @@ protected:
hash.Update(sbb.BytePtr(), sbb.SizeInBytes()); hash.Update(sbb.BytePtr(), sbb.SizeInBytes());
} else { } else {
if (e1len == 0 || s1len == 0) { if (e1len == 0 || s1len == 0) {
CRYPTOPP_ASSERT(0); CRYPTOPP_ASSERT(0);
} }
hash.Update(e1, e1len); hash.Update(e1, e1len);
hash.Update(s1, s1len); hash.Update(s1, s1len);

View File

@ -104,14 +104,12 @@ public:
typedef T_Endianness ByteOrderClass; typedef T_Endianness ByteOrderClass;
typedef T_HashWordType HashWordType; typedef T_HashWordType HashWordType;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~IteratedHash() { }
#endif
CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize) CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize)
// BCB2006 workaround: can't use BLOCKSIZE here // BCB2006 workaround: can't use BLOCKSIZE here
CRYPTOPP_COMPILE_ASSERT((T_BlockSize & (T_BlockSize - 1)) == 0); // blockSize is a power of 2 CRYPTOPP_COMPILE_ASSERT((T_BlockSize & (T_BlockSize - 1)) == 0); // blockSize is a power of 2
virtual ~IteratedHash() {}
//! \brief Provides the block size of the hash //! \brief Provides the block size of the hash
//! \return the block size of the hash, in bytes //! \return the block size of the hash, in bytes
//! \details BlockSize() returns <tt>T_BlockSize</tt>. //! \details BlockSize() returns <tt>T_BlockSize</tt>.
@ -153,13 +151,10 @@ class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform
: public ClonableImpl<T_Transform, AlgorithmImpl<IteratedHash<T_HashWordType, T_Endianness, T_BlockSize>, T_Transform> > : public ClonableImpl<T_Transform, AlgorithmImpl<IteratedHash<T_HashWordType, T_Endianness, T_BlockSize>, T_Transform> >
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~IteratedHashWithStaticTransform() { }
#endif
CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize) CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize)
virtual ~IteratedHashWithStaticTransform() {}
//! \brief Provides the digest size of the hash //! \brief Provides the digest size of the hash
//! \return the digest size of the hash, in bytes //! \return the digest size of the hash, in bytes
//! \details DigestSize() returns <tt>DIGESTSIZE</tt>. //! \details DigestSize() returns <tt>DIGESTSIZE</tt>.

93
luc.h
View File

@ -1,9 +1,14 @@
// luc.h - written and placed in the public domain by Wei Dai
//! \file luc.h
//! \brief Classes for the LUC cryptosystem
//! \details This class is here for historical and pedagogical interest. It has no practical advantages over other
//! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
//! defined later in this .h file may be of more practical interest.
#ifndef CRYPTOPP_LUC_H #ifndef CRYPTOPP_LUC_H
#define CRYPTOPP_LUC_H #define CRYPTOPP_LUC_H
/** \file
*/
#include "cryptlib.h" #include "cryptlib.h"
#include "gfpcrypt.h" #include "gfpcrypt.h"
#include "integer.h" #include "integer.h"
@ -24,17 +29,17 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
//! The LUC function. //! \brief The LUC function.
/*! This class is here for historical and pedagogical interest. It has no //! \details This class is here for historical and pedagogical interest. It has no practical advantages over other
practical advantages over other trapdoor functions and probably shouldn't //! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
be used in production software. The discrete log based LUC schemes //! defined later in this .h file may be of more practical interest.
defined later in this .h file may be of more practical interest.
*/
class LUCFunction : public TrapdoorFunction, public PublicKey class LUCFunction : public TrapdoorFunction, public PublicKey
{ {
typedef LUCFunction ThisClass; typedef LUCFunction ThisClass;
public: public:
virtual ~LUCFunction() {}
void Initialize(const Integer &n, const Integer &e) void Initialize(const Integer &n, const Integer &e)
{m_n = n; m_e = e;} {m_n = n; m_e = e;}
@ -56,20 +61,21 @@ public:
void SetModulus(const Integer &n) {m_n = n;} void SetModulus(const Integer &n) {m_n = n;}
void SetPublicExponent(const Integer &e) {m_e = e;} void SetPublicExponent(const Integer &e) {m_e = e;}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~LUCFunction() {}
#endif
protected: protected:
Integer m_n, m_e; Integer m_n, m_e;
}; };
//! _ //! \brief The LUC inverse function.
//! \details This class is here for historical and pedagogical interest. It has no practical advantages over other
//! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
//! defined later in this .h file may be of more practical interest.
class InvertibleLUCFunction : public LUCFunction, public TrapdoorFunctionInverse, public PrivateKey class InvertibleLUCFunction : public LUCFunction, public TrapdoorFunctionInverse, public PrivateKey
{ {
typedef InvertibleLUCFunction ThisClass; typedef InvertibleLUCFunction ThisClass;
public: public:
virtual ~InvertibleLUCFunction() {}
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &eStart=17); void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &eStart=17);
void Initialize(const Integer &n, const Integer &e, const Integer &p, const Integer &q, const Integer &u) void Initialize(const Integer &n, const Integer &e, const Integer &p, const Integer &q, const Integer &u)
{m_n = n; m_e = e; m_p = p; m_q = q; m_u = u;} {m_n = n; m_e = e; m_p = p; m_q = q; m_u = u;}
@ -94,10 +100,6 @@ public:
void SetPrime2(const Integer &q) {m_q = q;} void SetPrime2(const Integer &q) {m_q = q;}
void SetMultiplicativeInverseOfPrime2ModPrime1(const Integer &u) {m_u = u;} void SetMultiplicativeInverseOfPrime2ModPrime1(const Integer &u) {m_u = u;}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~InvertibleLUCFunction() {}
#endif
protected: protected:
Integer m_p, m_q, m_u; Integer m_p, m_q, m_u;
}; };
@ -109,13 +111,19 @@ struct LUC
typedef InvertibleLUCFunction PrivateKey; typedef InvertibleLUCFunction PrivateKey;
}; };
//! LUC cryptosystem //! \brief LUC cryptosystem
//! \details This class is here for historical and pedagogical interest. It has no practical advantages over other
//! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
//! defined later in this .h file may be of more practical interest.
template <class STANDARD> template <class STANDARD>
struct LUCES : public TF_ES<STANDARD, LUC> struct LUCES : public TF_ES<STANDARD, LUC>
{ {
}; };
//! LUC signature scheme with appendix //! \brief LUC signature scheme with appendix
//! \details This class is here for historical and pedagogical interest. It has no practical advantages over other
//! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
//! defined later in this .h file may be of more practical interest.
template <class STANDARD, class H> template <class STANDARD, class H>
struct LUCSS : public TF_SS<STANDARD, H, LUC> struct LUCSS : public TF_SS<STANDARD, H, LUC>
{ {
@ -134,6 +142,8 @@ typedef LUCSS<PKCS1v15, SHA>::Verifier LUCSSA_PKCS1v15_SHA_Verifier;
class DL_GroupPrecomputation_LUC : public DL_GroupPrecomputation<Integer> class DL_GroupPrecomputation_LUC : public DL_GroupPrecomputation<Integer>
{ {
public: public:
virtual ~DL_GroupPrecomputation_LUC() {}
const AbstractGroup<Element> & GetGroup() const {CRYPTOPP_ASSERT(false); throw 0;} const AbstractGroup<Element> & GetGroup() const {CRYPTOPP_ASSERT(false); throw 0;}
Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);} Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);}
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);} void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);}
@ -142,10 +152,6 @@ public:
void SetModulus(const Integer &v) {m_p = v;} void SetModulus(const Integer &v) {m_p = v;}
const Integer & GetModulus() const {return m_p;} const Integer & GetModulus() const {return m_p;}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupPrecomputation_LUC() {}
#endif
private: private:
Integer m_p; Integer m_p;
}; };
@ -154,6 +160,8 @@ private:
class DL_BasePrecomputation_LUC : public DL_FixedBasePrecomputation<Integer> class DL_BasePrecomputation_LUC : public DL_FixedBasePrecomputation<Integer>
{ {
public: public:
virtual ~DL_BasePrecomputation_LUC() {}
// DL_FixedBasePrecomputation // DL_FixedBasePrecomputation
bool IsInitialized() const {return m_g.NotZero();} bool IsInitialized() const {return m_g.NotZero();}
void SetBase(const DL_GroupPrecomputation<Element> &group, const Integer &base) void SetBase(const DL_GroupPrecomputation<Element> &group, const Integer &base)
@ -174,10 +182,6 @@ public:
throw NotImplemented("DL_BasePrecomputation_LUC: CascadeExponentiate not implemented"); throw NotImplemented("DL_BasePrecomputation_LUC: CascadeExponentiate not implemented");
} }
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_BasePrecomputation_LUC() {}
#endif
private: private:
Integer m_g; Integer m_g;
}; };
@ -186,6 +190,8 @@ private:
class DL_GroupParameters_LUC : public DL_GroupParameters_IntegerBasedImpl<DL_GroupPrecomputation_LUC, DL_BasePrecomputation_LUC> class DL_GroupParameters_LUC : public DL_GroupParameters_IntegerBasedImpl<DL_GroupPrecomputation_LUC, DL_BasePrecomputation_LUC>
{ {
public: public:
virtual ~DL_GroupParameters_LUC() {}
// DL_GroupParameters // DL_GroupParameters
bool IsIdentity(const Integer &element) const {return element == Integer::Two();} bool IsIdentity(const Integer &element) const {return element == Integer::Two();}
void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const; void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const;
@ -206,10 +212,6 @@ public:
return GetValueHelper<DL_GroupParameters_IntegerBased>(this, name, valueType, pValue).Assignable(); return GetValueHelper<DL_GroupParameters_IntegerBased>(this, name, valueType, pValue).Assignable();
} }
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupParameters_LUC() {}
#endif
private: private:
int GetFieldType() const {return 2;} int GetFieldType() const {return 2;}
}; };
@ -220,10 +222,6 @@ class DL_GroupParameters_LUC_DefaultSafePrime : public DL_GroupParameters_LUC
public: public:
typedef NoCofactorMultiplication DefaultCofactorOption; typedef NoCofactorMultiplication DefaultCofactorOption;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupParameters_LUC_DefaultSafePrime() {}
#endif
protected: protected:
unsigned int GetDefaultSubgroupOrderSize(unsigned int modulusSize) const {return modulusSize-1;} unsigned int GetDefaultSubgroupOrderSize(unsigned int modulusSize) const {return modulusSize-1;}
}; };
@ -234,15 +232,13 @@ class DL_Algorithm_LUC_HMP : public DL_ElgamalLikeSignatureAlgorithm<Integer>
public: public:
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "LUC-HMP";} CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "LUC-HMP";}
virtual ~DL_Algorithm_LUC_HMP() {}
void Sign(const DL_GroupParameters<Integer> &params, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const; void Sign(const DL_GroupParameters<Integer> &params, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const;
bool Verify(const DL_GroupParameters<Integer> &params, const DL_PublicKey<Integer> &publicKey, const Integer &e, const Integer &r, const Integer &s) const; bool Verify(const DL_GroupParameters<Integer> &params, const DL_PublicKey<Integer> &publicKey, const Integer &e, const Integer &r, const Integer &s) const;
size_t RLen(const DL_GroupParameters<Integer> &params) const size_t RLen(const DL_GroupParameters<Integer> &params) const
{return params.GetGroupOrder().ByteCount();} {return params.GetGroupOrder().ByteCount();}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Algorithm_LUC_HMP() {}
#endif
}; };
//! _ //! _
@ -251,13 +247,12 @@ struct DL_SignatureKeys_LUC
typedef DL_GroupParameters_LUC GroupParameters; typedef DL_GroupParameters_LUC GroupParameters;
typedef DL_PublicKey_GFP<GroupParameters> PublicKey; typedef DL_PublicKey_GFP<GroupParameters> PublicKey;
typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey; typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_SignatureKeys_LUC() {}
#endif
}; };
//! LUC-HMP, based on "Digital signature schemes based on Lucas functions" by Patrick Horster, Markus Michels, Holger Petersen //! \brief LUC-HMP, based on "Digital signature schemes based on Lucas functions" by Patrick Horster, Markus Michels, Holger Petersen
//! \details This class is here for historical and pedagogical interest. It has no practical advantages over other
//! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
//! defined later in this .h file may be of more practical interest.
template <class H> template <class H>
struct LUC_HMP : public DL_SS<DL_SignatureKeys_LUC, DL_Algorithm_LUC_HMP, DL_SignatureMessageEncodingMethod_DSA, H> struct LUC_HMP : public DL_SS<DL_SignatureKeys_LUC, DL_Algorithm_LUC_HMP, DL_SignatureMessageEncodingMethod_DSA, H>
{ {
@ -269,10 +264,6 @@ struct DL_CryptoKeys_LUC
typedef DL_GroupParameters_LUC_DefaultSafePrime GroupParameters; typedef DL_GroupParameters_LUC_DefaultSafePrime GroupParameters;
typedef DL_PublicKey_GFP<GroupParameters> PublicKey; typedef DL_PublicKey_GFP<GroupParameters> PublicKey;
typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey; typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_CryptoKeys_LUC() {}
#endif
}; };
//! LUC-IES //! LUC-IES
@ -286,10 +277,6 @@ struct LUC_IES
LUC_IES<> > LUC_IES<> >
{ {
static std::string StaticAlgorithmName() {return "LUC-IES";} // non-standard name static std::string StaticAlgorithmName() {return "LUC-IES";} // non-standard name
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~LUC_IES() {}
#endif
}; };
// ******************************************************** // ********************************************************

View File

@ -133,7 +133,6 @@ bool VerifyBufsEqual(const byte *buf, const byte *mask, size_t count)
return acc8 == 0; return acc8 == 0;
} }
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
std::string StringNarrow(const wchar_t *str, bool throwOnError) std::string StringNarrow(const wchar_t *str, bool throwOnError)
{ {
CRYPTOPP_ASSERT(str); CRYPTOPP_ASSERT(str);
@ -150,15 +149,19 @@ std::string StringNarrow(const wchar_t *str, bool throwOnError)
err = wcstombs_s(&size, NULL, 0, str, len*sizeof(wchar_t)); err = wcstombs_s(&size, NULL, 0, str, len*sizeof(wchar_t));
CRYPTOPP_ASSERT(err == 0); CRYPTOPP_ASSERT(err == 0);
if (err != 0) {goto CONVERSION_ERROR;} if (err != 0)
{
if (throwOnError)
throw InvalidArgument("StringNarrow: wcstombs_s() call failed with error " + IntToString(err));
else
return std::string();
}
result.resize(size); result.resize(size);
err = wcstombs_s(&size, &result[0], size, str, len*sizeof(wchar_t)); err = wcstombs_s(&size, &result[0], size, str, len*sizeof(wchar_t));
CRYPTOPP_ASSERT(err == 0); CRYPTOPP_ASSERT(err == 0);
if (err != 0) if (err != 0)
{ {
CONVERSION_ERROR:
if (throwOnError) if (throwOnError)
throw InvalidArgument("StringNarrow: wcstombs_s() call failed with error " + IntToString(err)); throw InvalidArgument("StringNarrow: wcstombs_s() call failed with error " + IntToString(err));
else else
@ -171,15 +174,19 @@ CONVERSION_ERROR:
#else #else
size_t size = wcstombs(NULL, str, 0); size_t size = wcstombs(NULL, str, 0);
CRYPTOPP_ASSERT(size != (size_t)-1); CRYPTOPP_ASSERT(size != (size_t)-1);
if (size == (size_t)-1) {goto CONVERSION_ERROR;} if (size == (size_t)-1)
{
if (throwOnError)
throw InvalidArgument("StringNarrow: wcstombs() call failed");
else
return std::string();
}
result.resize(size); result.resize(size);
size = wcstombs(&result[0], str, size); size = wcstombs(&result[0], str, size);
CRYPTOPP_ASSERT(size != (size_t)-1); CRYPTOPP_ASSERT(size != (size_t)-1);
if (size == (size_t)-1) if (size == (size_t)-1)
{ {
CONVERSION_ERROR:
if (throwOnError) if (throwOnError)
throw InvalidArgument("StringNarrow: wcstombs() call failed"); throw InvalidArgument("StringNarrow: wcstombs() call failed");
else else
@ -189,7 +196,6 @@ CONVERSION_ERROR:
return result; return result;
} }
#endif // StringNarrow and CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
#if !(defined(_MSC_VER) && (_MSC_VER < 1300)) #if !(defined(_MSC_VER) && (_MSC_VER < 1300))
using std::new_handler; using std::new_handler;

60
misc.h
View File

@ -1091,7 +1091,7 @@ void SecureWipeBuffer(T *buf, size_t n)
// GCC 4.3.2 on Cygwin optimizes away the first store if this loop is done in the forward direction // GCC 4.3.2 on Cygwin optimizes away the first store if this loop is done in the forward direction
volatile T *p = buf+n; volatile T *p = buf+n;
while (n--) while (n--)
*((volatile T*)(--p)) = 0; *(--p) = 0;
} }
#if (_MSC_VER >= 1400 || defined(__GNUC__)) && (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86) #if (_MSC_VER >= 1400 || defined(__GNUC__)) && (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86)
@ -1217,65 +1217,7 @@ inline void SecureWipeArray(T *buf, size_t n)
//! \note If you try to convert, say, the Chinese character for "bone" from UTF-16 (0x9AA8) to UTF-8 //! \note If you try to convert, say, the Chinese character for "bone" from UTF-16 (0x9AA8) to UTF-8
//! (0xE9 0xAA 0xA8), then you must ensure the locale is available. If the locale is not available, //! (0xE9 0xAA 0xA8), then you must ensure the locale is available. If the locale is not available,
//! then a 0x21 error is returned on Windows which eventually results in an InvalidArgument() exception. //! then a 0x21 error is returned on Windows which eventually results in an InvalidArgument() exception.
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
std::string StringNarrow(const wchar_t *str, bool throwOnError = true); std::string StringNarrow(const wchar_t *str, bool throwOnError = true);
#else
static std::string StringNarrow(const wchar_t *str, bool throwOnError = true)
{
CRYPTOPP_ASSERT(str);
std::string result;
// Safer functions on Windows for C&A, https://github.com/weidai11/cryptopp/issues/55
#if (CRYPTOPP_MSC_VERSION >= 1400)
size_t len=0, size=0;
errno_t err = 0;
//const wchar_t* ptr = str;
//while (*ptr++) len++;
len = wcslen(str)+1;
err = wcstombs_s(&size, NULL, 0, str, len*sizeof(wchar_t));
CRYPTOPP_ASSERT(err == 0);
if (err != 0) {goto CONVERSION_ERROR;}
result.resize(size);
err = wcstombs_s(&size, &result[0], size, str, len*sizeof(wchar_t));
CRYPTOPP_ASSERT(err == 0);
if (err != 0)
{
CONVERSION_ERROR:
if (throwOnError)
throw InvalidArgument("StringNarrow: wcstombs_s() call failed with error " + IntToString(err));
else
return std::string();
}
// The safe routine's size includes the NULL.
if (!result.empty() && result[size - 1] == '\0')
result.erase(size - 1);
#else
size_t size = wcstombs(NULL, str, 0);
CRYPTOPP_ASSERT(size != (size_t)-1);
if (size == (size_t)-1) {goto CONVERSION_ERROR;}
result.resize(size);
size = wcstombs(&result[0], str, size);
CRYPTOPP_ASSERT(size != (size_t)-1);
if (size == (size_t)-1)
{
CONVERSION_ERROR:
if (throwOnError)
throw InvalidArgument("StringNarrow: wcstombs() call failed");
else
return std::string();
}
#endif
return result;
}
#endif // StringNarrow and CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
#ifdef CRYPTOPP_DOXYGEN_PROCESSING #ifdef CRYPTOPP_DOXYGEN_PROCESSING

View File

@ -38,9 +38,7 @@ public:
typedef int RandomizationParameter; typedef int RandomizationParameter;
typedef Integer Element; typedef Integer Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ModularArithmetic() {} virtual ~ModularArithmetic() {}
#endif
//! \brief Construct a ModularArithmetic //! \brief Construct a ModularArithmetic
//! \param modulus congruence class modulus //! \param modulus congruence class modulus
@ -273,9 +271,7 @@ protected:
class CRYPTOPP_DLL MontgomeryRepresentation : public ModularArithmetic class CRYPTOPP_DLL MontgomeryRepresentation : public ModularArithmetic
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~MontgomeryRepresentation() {} virtual ~MontgomeryRepresentation() {}
#endif
//! \brief Construct a MontgomeryRepresentation //! \brief Construct a MontgomeryRepresentation
//! \param modulus congruence class modulus //! \param modulus congruence class modulus

View File

@ -25,13 +25,10 @@ void Modes_TestInstantiations()
} }
#endif #endif
// Thanks to Zireael, http://github.com/weidai11/cryptopp/pull/46
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
void CipherModeBase::ResizeBuffers() void CipherModeBase::ResizeBuffers()
{ {
m_register.New(m_cipher->BlockSize()); m_register.New(m_cipher->BlockSize());
} }
#endif
void CFB_ModePolicy::Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount) void CFB_ModePolicy::Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount)
{ {
@ -163,14 +160,11 @@ void BlockOrientedCipherModeBase::UncheckedSetKey(const byte *key, unsigned int
} }
} }
// Thanks to Zireael, http://github.com/weidai11/cryptopp/pull/46
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
void BlockOrientedCipherModeBase::ResizeBuffers() void BlockOrientedCipherModeBase::ResizeBuffers()
{ {
CipherModeBase::ResizeBuffers(); CipherModeBase::ResizeBuffers();
m_buffer.New(BlockSize()); m_buffer.New(BlockSize());
} }
#endif
void ECB_OneWay::ProcessData(byte *outString, const byte *inString, size_t length) void ECB_OneWay::ProcessData(byte *outString, const byte *inString, size_t length)
{ {
@ -218,14 +212,11 @@ void CBC_CTS_Encryption::ProcessLastBlock(byte *outString, const byte *inString,
memcpy(outString, m_register, BlockSize()); memcpy(outString, m_register, BlockSize());
} }
// Thanks to Zireael, http://github.com/weidai11/cryptopp/pull/46
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
void CBC_Decryption::ResizeBuffers() void CBC_Decryption::ResizeBuffers()
{ {
BlockOrientedCipherModeBase::ResizeBuffers(); BlockOrientedCipherModeBase::ResizeBuffers();
m_temp.New(BlockSize()); m_temp.New(BlockSize());
} }
#endif
void CBC_Decryption::ProcessData(byte *outString, const byte *inString, size_t length) void CBC_Decryption::ProcessData(byte *outString, const byte *inString, size_t length)
{ {

70
modes.h
View File

@ -43,6 +43,7 @@ struct CipherModeDocumentation : public SymmetricCipherDocumentation
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CipherModeBase : public SymmetricCipher class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CipherModeBase : public SymmetricCipher
{ {
public: public:
virtual ~CipherModeBase() {}
size_t MinKeyLength() const {return m_cipher->MinKeyLength();} size_t MinKeyLength() const {return m_cipher->MinKeyLength();}
size_t MaxKeyLength() const {return m_cipher->MaxKeyLength();} size_t MaxKeyLength() const {return m_cipher->MaxKeyLength();}
size_t DefaultKeyLength() const {return m_cipher->DefaultKeyLength();} size_t DefaultKeyLength() const {return m_cipher->DefaultKeyLength();}
@ -80,15 +81,7 @@ protected:
throw InvalidArgument("CipherModeBase: feedback size cannot be specified for this cipher mode"); throw InvalidArgument("CipherModeBase: feedback size cannot be specified for this cipher mode");
} }
// Thanks to Zireael, http://github.com/weidai11/cryptopp/pull/46
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual void ResizeBuffers(); virtual void ResizeBuffers();
#else
virtual void ResizeBuffers()
{
m_register.New(m_cipher->BlockSize());
}
#endif
BlockCipher *m_cipher; BlockCipher *m_cipher;
AlignedSecByteBlock m_register; AlignedSecByteBlock m_register;
@ -118,9 +111,11 @@ void ModePolicyCommonTemplate<POLICY_INTERFACE>::CipherSetKey(const NameValuePai
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_ModePolicy : public ModePolicyCommonTemplate<CFB_CipherAbstractPolicy> class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_ModePolicy : public ModePolicyCommonTemplate<CFB_CipherAbstractPolicy>
{ {
public: public:
IV_Requirement IVRequirement() const {return RANDOM_IV;}
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CFB";} CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CFB";}
virtual ~CFB_ModePolicy() {}
IV_Requirement IVRequirement() const {return RANDOM_IV;}
protected: protected:
unsigned int GetBytesPerIteration() const {return m_feedbackSize;} unsigned int GetBytesPerIteration() const {return m_feedbackSize;}
byte * GetRegisterBegin() {return m_register + BlockSize() - m_feedbackSize;} byte * GetRegisterBegin() {return m_register + BlockSize() - m_feedbackSize;}
@ -148,9 +143,10 @@ inline void CopyOrZero(void *dest, const void *src, size_t s)
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE OFB_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy> class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE OFB_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy>
{ {
public: public:
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "OFB";}
bool CipherIsRandomAccess() const {return false;} bool CipherIsRandomAccess() const {return false;}
IV_Requirement IVRequirement() const {return UNIQUE_IV;} IV_Requirement IVRequirement() const {return UNIQUE_IV;}
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "OFB";}
private: private:
unsigned int GetBytesPerIteration() const {return BlockSize();} unsigned int GetBytesPerIteration() const {return BlockSize();}
@ -164,13 +160,14 @@ private:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CTR_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy> class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CTR_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy>
{ {
public: public:
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CTR";}
virtual ~CTR_ModePolicy() {}
bool CipherIsRandomAccess() const {return true;} bool CipherIsRandomAccess() const {return true;}
IV_Requirement IVRequirement() const {return RANDOM_IV;} IV_Requirement IVRequirement() const {return RANDOM_IV;}
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CTR";}
protected: protected:
virtual void IncrementCounterBy256(); virtual void IncrementCounterBy256();
unsigned int GetAlignment() const {return m_cipher->OptimalDataAlignment();} unsigned int GetAlignment() const {return m_cipher->OptimalDataAlignment();}
unsigned int GetBytesPerIteration() const {return BlockSize();} unsigned int GetBytesPerIteration() const {return BlockSize();}
unsigned int GetIterationsToBuffer() const {return m_cipher->OptimalNumberOfParallelBlocks();} unsigned int GetIterationsToBuffer() const {return m_cipher->OptimalNumberOfParallelBlocks();}
@ -189,6 +186,7 @@ protected:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BlockOrientedCipherModeBase : public CipherModeBase class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BlockOrientedCipherModeBase : public CipherModeBase
{ {
public: public:
virtual ~BlockOrientedCipherModeBase() {}
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params); void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
unsigned int MandatoryBlockSize() const {return BlockSize();} unsigned int MandatoryBlockSize() const {return BlockSize();}
bool IsRandomAccess() const {return false;} bool IsRandomAccess() const {return false;}
@ -198,17 +196,7 @@ public:
protected: protected:
bool RequireAlignedInput() const {return true;} bool RequireAlignedInput() const {return true;}
virtual void ResizeBuffers();
// Thanks to Zireael, http://github.com/weidai11/cryptopp/pull/46
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
void ResizeBuffers();
#else
void ResizeBuffers()
{
CipherModeBase::ResizeBuffers();
m_buffer.New(BlockSize());
}
#endif
SecByteBlock m_buffer; SecByteBlock m_buffer;
}; };
@ -218,12 +206,13 @@ protected:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE ECB_OneWay : public BlockOrientedCipherModeBase class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE ECB_OneWay : public BlockOrientedCipherModeBase
{ {
public: public:
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "ECB";}
void SetKey(const byte *key, size_t length, const NameValuePairs &params = g_nullNameValuePairs) void SetKey(const byte *key, size_t length, const NameValuePairs &params = g_nullNameValuePairs)
{m_cipher->SetKey(key, length, params); BlockOrientedCipherModeBase::ResizeBuffers();} {m_cipher->SetKey(key, length, params); BlockOrientedCipherModeBase::ResizeBuffers();}
IV_Requirement IVRequirement() const {return NOT_RESYNCHRONIZABLE;} IV_Requirement IVRequirement() const {return NOT_RESYNCHRONIZABLE;}
unsigned int OptimalBlockSize() const {return BlockSize() * m_cipher->OptimalNumberOfParallelBlocks();} unsigned int OptimalBlockSize() const {return BlockSize() * m_cipher->OptimalNumberOfParallelBlocks();}
void ProcessData(byte *outString, const byte *inString, size_t length); void ProcessData(byte *outString, const byte *inString, size_t length);
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "ECB";}
}; };
//! \class CBC_ModeBase //! \class CBC_ModeBase
@ -231,10 +220,11 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_ModeBase : public BlockOrientedCipherModeBase class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_ModeBase : public BlockOrientedCipherModeBase
{ {
public: public:
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CBC";}
IV_Requirement IVRequirement() const {return UNPREDICTABLE_RANDOM_IV;} IV_Requirement IVRequirement() const {return UNPREDICTABLE_RANDOM_IV;}
bool RequireAlignedInput() const {return false;} bool RequireAlignedInput() const {return false;}
unsigned int MinLastBlockSize() const {return 0;} unsigned int MinLastBlockSize() const {return 0;}
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CBC";}
}; };
//! \class CBC_Encryption //! \class CBC_Encryption
@ -250,10 +240,11 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_CTS_Encryption : public CBC_Encryption class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_CTS_Encryption : public CBC_Encryption
{ {
public: public:
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CBC/CTS";}
void SetStolenIV(byte *iv) {m_stolenIV = iv;} void SetStolenIV(byte *iv) {m_stolenIV = iv;}
unsigned int MinLastBlockSize() const {return BlockSize()+1;} unsigned int MinLastBlockSize() const {return BlockSize()+1;}
void ProcessLastBlock(byte *outString, const byte *inString, size_t length); void ProcessLastBlock(byte *outString, const byte *inString, size_t length);
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CBC/CTS";}
protected: protected:
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params) void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)
@ -270,20 +261,11 @@ protected:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_Decryption : public CBC_ModeBase class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_Decryption : public CBC_ModeBase
{ {
public: public:
virtual ~CBC_Decryption() {}
void ProcessData(byte *outString, const byte *inString, size_t length); void ProcessData(byte *outString, const byte *inString, size_t length);
protected: protected:
virtual void ResizeBuffers();
// Thanks to Zireael, http://github.com/weidai11/cryptopp/pull/46
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
void ResizeBuffers();
#else
void ResizeBuffers()
{
BlockOrientedCipherModeBase::ResizeBuffers();
m_temp.New(BlockSize());
}
#endif
AlignedSecByteBlock m_temp; AlignedSecByteBlock m_temp;
}; };
@ -303,6 +285,9 @@ template <class CIPHER, class BASE>
class CipherModeFinalTemplate_CipherHolder : protected ObjectHolder<CIPHER>, public AlgorithmImpl<BASE, CipherModeFinalTemplate_CipherHolder<CIPHER, BASE> > class CipherModeFinalTemplate_CipherHolder : protected ObjectHolder<CIPHER>, public AlgorithmImpl<BASE, CipherModeFinalTemplate_CipherHolder<CIPHER, BASE> >
{ {
public: public:
static std::string CRYPTOPP_API StaticAlgorithmName()
{return CIPHER::StaticAlgorithmName() + "/" + BASE::StaticAlgorithmName();}
CipherModeFinalTemplate_CipherHolder() CipherModeFinalTemplate_CipherHolder()
{ {
this->m_cipher = &this->m_object; this->m_cipher = &this->m_object;
@ -323,9 +308,6 @@ public:
this->m_cipher = &this->m_object; this->m_cipher = &this->m_object;
this->SetKey(key, length, MakeParameters(Name::IV(), ConstByteArrayParameter(iv, this->m_cipher->BlockSize()))(Name::FeedbackSize(), feedbackSize)); this->SetKey(key, length, MakeParameters(Name::IV(), ConstByteArrayParameter(iv, this->m_cipher->BlockSize()))(Name::FeedbackSize(), feedbackSize));
} }
static std::string CRYPTOPP_API StaticAlgorithmName()
{return CIPHER::StaticAlgorithmName() + "/" + BASE::StaticAlgorithmName();}
}; };
//! \class CipherModeFinalTemplate_ExternalCipher //! \class CipherModeFinalTemplate_ExternalCipher
@ -481,10 +463,10 @@ struct CBC_CTS_Mode_ExternalCipher : public CipherModeDocumentation
}; };
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY #ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
typedef CFB_Mode_ExternalCipher::Encryption CFBEncryption; //typedef CFB_Mode_ExternalCipher::Encryption CFBEncryption;
typedef CFB_Mode_ExternalCipher::Decryption CFBDecryption; //typedef CFB_Mode_ExternalCipher::Decryption CFBDecryption;
typedef OFB_Mode_ExternalCipher::Encryption OFB; //typedef OFB_Mode_ExternalCipher::Encryption OFB;
typedef CTR_Mode_ExternalCipher::Encryption CounterMode; //typedef CTR_Mode_ExternalCipher::Encryption CounterMode;
#endif #endif
NAMESPACE_END NAMESPACE_END

View File

@ -16,6 +16,8 @@ CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<Integer>;
class ModExpPrecomputation : public DL_GroupPrecomputation<Integer> class ModExpPrecomputation : public DL_GroupPrecomputation<Integer>
{ {
public: public:
virtual ~ModExpPrecomputation() {}
// DL_GroupPrecomputation // DL_GroupPrecomputation
bool NeedConversions() const {return true;} bool NeedConversions() const {return true;}
Element ConvertIn(const Element &v) const {return m_mr->ConvertIn(v);} Element ConvertIn(const Element &v) const {return m_mr->ConvertIn(v);}

5
oaep.h
View File

@ -7,7 +7,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
//! _ //! \brief OAEP padding base class
class CRYPTOPP_DLL OAEP_Base : public PK_EncryptionMessageEncodingMethod class CRYPTOPP_DLL OAEP_Base : public PK_EncryptionMessageEncodingMethod
{ {
public: public:
@ -22,7 +22,8 @@ protected:
virtual MaskGeneratingFunction * NewMGF() const =0; virtual MaskGeneratingFunction * NewMGF() const =0;
}; };
//! <a href="http://www.weidai.com/scan-mirror/ca.html#cem_OAEP-MGF1">EME-OAEP</a>, for use with classes derived from TF_ES //! \brief OAEP padding
//! \sa <a href="http://www.weidai.com/scan-mirror/ca.html#cem_OAEP-MGF1">EME-OAEP</a>, for use with classes derived from TF_ES
template <class H, class MGF=P1363_MGF1> template <class H, class MGF=P1363_MGF1>
class OAEP : public OAEP_Base, public EncryptionStandard class OAEP : public OAEP_Base, public EncryptionStandard
{ {

4
oids.h
View File

@ -46,8 +46,8 @@ DEFINE_OID(1, iso)
DEFINE_OID(dod()+1, internet) DEFINE_OID(dod()+1, internet)
DEFINE_OID(internet()+4, internet_private) DEFINE_OID(internet()+4, internet_private)
DEFINE_OID(internet_private()+1, enterprise) DEFINE_OID(internet_private()+1, enterprise)
DEFINE_OID(enterprise()+11591,GNU) DEFINE_OID(enterprise()+11591,gnu)
DEFINE_OID(GNU()+15,ellipticCurve) DEFINE_OID(gnu()+15,ellipticCurve)
DEFINE_OID(ellipticCurve()+1,curve25519) DEFINE_OID(ellipticCurve()+1,curve25519)
DEFINE_OID(ellipticCurve()+2,curve448) DEFINE_OID(ellipticCurve()+2,curve448)
DEFINE_OID(ellipticCurve()+3,curve25519ph) DEFINE_OID(ellipticCurve()+3,curve25519ph)

6
pssr.h
View File

@ -20,17 +20,15 @@ NAMESPACE_BEGIN(CryptoPP)
class CRYPTOPP_DLL PSSR_MEM_Base : public PK_RecoverableSignatureMessageEncodingMethod class CRYPTOPP_DLL PSSR_MEM_Base : public PK_RecoverableSignatureMessageEncodingMethod
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~PSSR_MEM_Base() {} virtual ~PSSR_MEM_Base() {}
#endif
private: protected:
virtual bool AllowRecovery() const =0; virtual bool AllowRecovery() const =0;
virtual size_t SaltLen(size_t hashLen) const =0; virtual size_t SaltLen(size_t hashLen) const =0;
virtual size_t MinPadLen(size_t hashLen) const =0; virtual size_t MinPadLen(size_t hashLen) const =0;
virtual const MaskGeneratingFunction & GetMGF() const =0; virtual const MaskGeneratingFunction & GetMGF() const =0;
public: private:
size_t MinRepresentativeBitLength(size_t hashIdentifierLength, size_t digestLength) const; size_t MinRepresentativeBitLength(size_t hashIdentifierLength, size_t digestLength) const;
size_t MaxRecoverableLength(size_t representativeBitLength, size_t hashIdentifierLength, size_t digestLength) const; size_t MaxRecoverableLength(size_t representativeBitLength, size_t hashIdentifierLength, size_t digestLength) const;
bool IsProbabilistic() const; bool IsProbabilistic() const;

193
pubkey.h
View File

@ -105,9 +105,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomizedTrapdoorFunction : public TrapdoorFunctionBounds class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomizedTrapdoorFunction : public TrapdoorFunctionBounds
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~RandomizedTrapdoorFunction() {}
virtual ~RandomizedTrapdoorFunction() { }
#endif
//! \brief Applies the trapdoor function, using random data if required //! \brief Applies the trapdoor function, using random data if required
//! \param rng a \p RandomNumberGenerator derived class //! \param rng a \p RandomNumberGenerator derived class
@ -133,9 +131,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunction : public RandomizedTrapdoorFunction class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunction : public RandomizedTrapdoorFunction
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TrapdoorFunction() {}
virtual ~TrapdoorFunction() { }
#endif
//! \brief Applies the trapdoor function //! \brief Applies the trapdoor function
//! \param rng a \p RandomNumberGenerator derived class //! \param rng a \p RandomNumberGenerator derived class
@ -244,9 +240,7 @@ template <class TFI, class MEI>
class CRYPTOPP_NO_VTABLE TF_Base class CRYPTOPP_NO_VTABLE TF_Base
{ {
protected: protected:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TF_Base() {}
virtual ~TF_Base() { }
#endif
virtual const TrapdoorFunctionBounds & GetTrapdoorFunctionBounds() const =0; virtual const TrapdoorFunctionBounds & GetTrapdoorFunctionBounds() const =0;
@ -266,9 +260,7 @@ template <class BASE>
class CRYPTOPP_NO_VTABLE PK_FixedLengthCryptoSystemImpl : public BASE class CRYPTOPP_NO_VTABLE PK_FixedLengthCryptoSystemImpl : public BASE
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~PK_FixedLengthCryptoSystemImpl() {}
virtual ~PK_FixedLengthCryptoSystemImpl() { }
#endif
size_t MaxPlaintextLength(size_t ciphertextLength) const size_t MaxPlaintextLength(size_t ciphertextLength) const
{return ciphertextLength == FixedCiphertextLength() ? FixedMaxPlaintextLength() : 0;} {return ciphertextLength == FixedCiphertextLength() ? FixedMaxPlaintextLength() : 0;}
@ -287,9 +279,7 @@ template <class INTERFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_CryptoSystemBase : public PK_FixedLengthCryptoSystemImpl<INTERFACE>, protected BASE class CRYPTOPP_NO_VTABLE TF_CryptoSystemBase : public PK_FixedLengthCryptoSystemImpl<INTERFACE>, protected BASE
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TF_CryptoSystemBase() {}
virtual ~TF_CryptoSystemBase() { }
#endif
bool ParameterSupported(const char *name) const {return this->GetMessageEncodingInterface().ParameterSupported(name);} bool ParameterSupported(const char *name) const {return this->GetMessageEncodingInterface().ParameterSupported(name);}
size_t FixedMaxPlaintextLength() const {return this->GetMessageEncodingInterface().MaxUnpaddedLength(PaddedBlockBitLength());} size_t FixedMaxPlaintextLength() const {return this->GetMessageEncodingInterface().MaxUnpaddedLength(PaddedBlockBitLength());}
@ -306,9 +296,7 @@ protected:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_DecryptorBase : public TF_CryptoSystemBase<PK_Decryptor, TF_Base<TrapdoorFunctionInverse, PK_EncryptionMessageEncodingMethod> > class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_DecryptorBase : public TF_CryptoSystemBase<PK_Decryptor, TF_Base<TrapdoorFunctionInverse, PK_EncryptionMessageEncodingMethod> >
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TF_DecryptorBase() {}
virtual ~TF_DecryptorBase() { }
#endif
DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs &parameters = g_nullNameValuePairs) const; DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs &parameters = g_nullNameValuePairs) const;
}; };
@ -318,9 +306,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_EncryptorBase : public TF_CryptoSystemBase<PK_Encryptor, TF_Base<RandomizedTrapdoorFunction, PK_EncryptionMessageEncodingMethod> > class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_EncryptorBase : public TF_CryptoSystemBase<PK_Encryptor, TF_Base<RandomizedTrapdoorFunction, PK_EncryptionMessageEncodingMethod> >
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TF_EncryptorBase() {}
virtual ~TF_EncryptorBase() { }
#endif
void Encrypt(RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs &parameters = g_nullNameValuePairs) const; void Encrypt(RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs &parameters = g_nullNameValuePairs) const;
}; };
@ -496,9 +482,7 @@ template <class INTERFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_SignatureSchemeBase : public INTERFACE, protected BASE class CRYPTOPP_NO_VTABLE TF_SignatureSchemeBase : public INTERFACE, protected BASE
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TF_SignatureSchemeBase() {}
virtual ~TF_SignatureSchemeBase() { }
#endif
size_t SignatureLength() const size_t SignatureLength() const
{return this->GetTrapdoorFunctionBounds().MaxPreimage().ByteCount();} {return this->GetTrapdoorFunctionBounds().MaxPreimage().ByteCount();}
@ -526,9 +510,7 @@ protected:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_SignerBase : public TF_SignatureSchemeBase<PK_Signer, TF_Base<RandomizedTrapdoorFunctionInverse, PK_SignatureMessageEncodingMethod> > class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_SignerBase : public TF_SignatureSchemeBase<PK_Signer, TF_Base<RandomizedTrapdoorFunctionInverse, PK_SignatureMessageEncodingMethod> >
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TF_SignerBase() {}
virtual ~TF_SignerBase() { }
#endif
void InputRecoverableMessage(PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, size_t recoverableMessageLength) const; void InputRecoverableMessage(PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, size_t recoverableMessageLength) const;
size_t SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart=true) const; size_t SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart=true) const;
@ -538,9 +520,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_VerifierBase : public TF_SignatureSchemeBase<PK_Verifier, TF_Base<TrapdoorFunction, PK_SignatureMessageEncodingMethod> > class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_VerifierBase : public TF_SignatureSchemeBase<PK_Verifier, TF_Base<TrapdoorFunction, PK_SignatureMessageEncodingMethod> >
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TF_VerifierBase() {}
virtual ~TF_VerifierBase() { }
#endif
void InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const; void InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const;
bool VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const; bool VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const;
@ -575,9 +555,7 @@ public:
typedef SCHEME_OPTIONS SchemeOptions; typedef SCHEME_OPTIONS SchemeOptions;
typedef KEY_CLASS KeyClass; typedef KEY_CLASS KeyClass;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TF_ObjectImplBase() {}
virtual ~TF_ObjectImplBase() { }
#endif
PublicKey & AccessPublicKey() {return AccessKey();} PublicKey & AccessPublicKey() {return AccessKey();}
const PublicKey & GetPublicKey() const {return GetKey();} const PublicKey & GetPublicKey() const {return GetKey();}
@ -626,9 +604,7 @@ template <class BASE, class SCHEME_OPTIONS, class KEY>
class TF_ObjectImplExtRef : public TF_ObjectImplBase<BASE, SCHEME_OPTIONS, KEY> class TF_ObjectImplExtRef : public TF_ObjectImplBase<BASE, SCHEME_OPTIONS, KEY>
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TF_ObjectImplExtRef() {}
virtual ~TF_ObjectImplExtRef() { }
#endif
TF_ObjectImplExtRef(const KEY *pKey = NULL) : m_pKey(pKey) {} TF_ObjectImplExtRef(const KEY *pKey = NULL) : m_pKey(pKey) {}
void SetKeyPtr(const KEY *pKey) {m_pKey = pKey;} void SetKeyPtr(const KEY *pKey) {m_pKey = pKey;}
@ -647,9 +623,7 @@ class CRYPTOPP_NO_VTABLE TF_ObjectImpl : public TF_ObjectImplBase<BASE, SCHEME_O
public: public:
typedef KEY_CLASS KeyClass; typedef KEY_CLASS KeyClass;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~TF_ObjectImpl() {}
virtual ~TF_ObjectImpl() { }
#endif
const KeyClass & GetKey() const {return m_trapdoorFunction;} const KeyClass & GetKey() const {return m_trapdoorFunction;}
KeyClass & AccessKey() {return m_trapdoorFunction;} KeyClass & AccessKey() {return m_trapdoorFunction;}
@ -763,9 +737,7 @@ class CRYPTOPP_NO_VTABLE DL_GroupParameters : public CryptoParameters
public: public:
typedef T Element; typedef T Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_GroupParameters() {}
virtual ~DL_GroupParameters() { }
#endif
DL_GroupParameters() : m_validationLevel(0) {} DL_GroupParameters() : m_validationLevel(0) {}
@ -976,9 +948,7 @@ public:
typedef typename GROUP_PRECOMP::Element Element; typedef typename GROUP_PRECOMP::Element Element;
typedef BASE_PRECOMP BasePrecomputation; typedef BASE_PRECOMP BasePrecomputation;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_GroupParametersImpl() {}
virtual ~DL_GroupParametersImpl() { }
#endif
//! \brief Retrieves the group precomputation //! \brief Retrieves the group precomputation
//! \return a const reference to the group precomputation //! \return a const reference to the group precomputation
@ -1004,9 +974,7 @@ template <class T>
class CRYPTOPP_NO_VTABLE DL_Key class CRYPTOPP_NO_VTABLE DL_Key
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_Key() {}
virtual ~DL_Key() { }
#endif
//! \brief Retrieves abstract group parameters //! \brief Retrieves abstract group parameters
//! \return a const reference to the group parameters //! \return a const reference to the group parameters
@ -1025,9 +993,7 @@ class CRYPTOPP_NO_VTABLE DL_PublicKey : public DL_Key<T>
public: public:
typedef T Element; typedef T Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_PublicKey() {}
virtual ~DL_PublicKey() { }
#endif
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
{ {
@ -1064,9 +1030,7 @@ class CRYPTOPP_NO_VTABLE DL_PrivateKey : public DL_Key<T>
public: public:
typedef T Element; typedef T Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_PrivateKey() {}
virtual ~DL_PrivateKey() { }
#endif
void MakePublicKey(DL_PublicKey<T> &pub) const void MakePublicKey(DL_PublicKey<T> &pub) const
{ {
@ -1114,15 +1078,9 @@ class DL_KeyImpl : public PK
public: public:
typedef GP GroupParameters; typedef GP GroupParameters;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_KeyImpl() {}
virtual ~DL_KeyImpl() { }
#endif
O GetAlgorithmID() const {return GetGroupParameters().GetAlgorithmID();} O GetAlgorithmID() const {return GetGroupParameters().GetAlgorithmID();}
// void BERDecode(BufferedTransformation &bt)
// {PK::BERDecode(bt);}
// void DEREncode(BufferedTransformation &bt) const
// {PK::DEREncode(bt);}
bool BERDecodeAlgorithmParameters(BufferedTransformation &bt) bool BERDecodeAlgorithmParameters(BufferedTransformation &bt)
{AccessGroupParameters().BERDecode(bt); return true;} {AccessGroupParameters().BERDecode(bt); return true;}
bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const
@ -1145,9 +1103,7 @@ class DL_PrivateKeyImpl : public DL_PrivateKey<CPP_TYPENAME GP::Element>, public
public: public:
typedef typename GP::Element Element; typedef typename GP::Element Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_PrivateKeyImpl() {}
virtual ~DL_PrivateKeyImpl() { }
#endif
// GeneratableCryptoMaterial // GeneratableCryptoMaterial
bool Validate(RandomNumberGenerator &rng, unsigned int level) const bool Validate(RandomNumberGenerator &rng, unsigned int level) const
@ -1177,10 +1133,7 @@ public:
{ {
if (!params.GetThisObject(this->AccessGroupParameters())) if (!params.GetThisObject(this->AccessGroupParameters()))
this->AccessGroupParameters().GenerateRandom(rng, params); this->AccessGroupParameters().GenerateRandom(rng, params);
// std::pair<const byte *, int> seed;
Integer x(rng, Integer::One(), GetAbstractGroupParameters().GetMaxExponent()); Integer x(rng, Integer::One(), GetAbstractGroupParameters().GetMaxExponent());
// Integer::ANY, Integer::Zero(), Integer::One(),
// params.GetValue("DeterministicKeyGenerationSeed", seed) ? &seed : NULL);
SetPrivateExponent(x); SetPrivateExponent(x);
} }
@ -1218,9 +1171,7 @@ template <class BASE, class SIGNATURE_SCHEME>
class DL_PrivateKey_WithSignaturePairwiseConsistencyTest : public BASE class DL_PrivateKey_WithSignaturePairwiseConsistencyTest : public BASE
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_PrivateKey_WithSignaturePairwiseConsistencyTest() {}
virtual ~DL_PrivateKey_WithSignaturePairwiseConsistencyTest() { }
#endif
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &params) void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &params)
{ {
@ -1242,9 +1193,7 @@ class DL_PublicKeyImpl : public DL_PublicKey<typename GP::Element>, public DL_Ke
public: public:
typedef typename GP::Element Element; typedef typename GP::Element Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_PublicKeyImpl() {}
virtual ~DL_PublicKeyImpl() { }
#endif
// CryptoMaterial // CryptoMaterial
bool Validate(RandomNumberGenerator &rng, unsigned int level) const bool Validate(RandomNumberGenerator &rng, unsigned int level) const
@ -1305,9 +1254,7 @@ template <class T>
class CRYPTOPP_NO_VTABLE DL_ElgamalLikeSignatureAlgorithm class CRYPTOPP_NO_VTABLE DL_ElgamalLikeSignatureAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_ElgamalLikeSignatureAlgorithm() {}
virtual ~DL_ElgamalLikeSignatureAlgorithm() { }
#endif
virtual void Sign(const DL_GroupParameters<T> &params, const Integer &privateKey, const Integer &k, const Integer &e, Integer &r, Integer &s) const =0; virtual void Sign(const DL_GroupParameters<T> &params, const Integer &privateKey, const Integer &k, const Integer &e, Integer &r, Integer &s) const =0;
virtual bool Verify(const DL_GroupParameters<T> &params, const DL_PublicKey<T> &publicKey, const Integer &e, const Integer &r, const Integer &s) const =0; virtual bool Verify(const DL_GroupParameters<T> &params, const DL_PublicKey<T> &publicKey, const Integer &e, const Integer &r, const Integer &s) const =0;
@ -1330,9 +1277,7 @@ class CRYPTOPP_NO_VTABLE DL_KeyAgreementAlgorithm
public: public:
typedef T Element; typedef T Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_KeyAgreementAlgorithm() {}
virtual ~DL_KeyAgreementAlgorithm() { }
#endif
virtual Element AgreeWithEphemeralPrivateKey(const DL_GroupParameters<Element> &params, const DL_FixedBasePrecomputation<Element> &publicPrecomputation, const Integer &privateExponent) const =0; virtual Element AgreeWithEphemeralPrivateKey(const DL_GroupParameters<Element> &params, const DL_FixedBasePrecomputation<Element> &publicPrecomputation, const Integer &privateExponent) const =0;
virtual Element AgreeWithStaticPrivateKey(const DL_GroupParameters<Element> &params, const Element &publicElement, bool validateOtherPublicKey, const Integer &privateExponent) const =0; virtual Element AgreeWithStaticPrivateKey(const DL_GroupParameters<Element> &params, const Element &publicElement, bool validateOtherPublicKey, const Integer &privateExponent) const =0;
@ -1343,9 +1288,7 @@ template <class T>
class CRYPTOPP_NO_VTABLE DL_KeyDerivationAlgorithm class CRYPTOPP_NO_VTABLE DL_KeyDerivationAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_KeyDerivationAlgorithm() {}
virtual ~DL_KeyDerivationAlgorithm() { }
#endif
virtual bool ParameterSupported(const char *name) const virtual bool ParameterSupported(const char *name) const
{CRYPTOPP_UNUSED(name); return false;} {CRYPTOPP_UNUSED(name); return false;}
@ -1356,9 +1299,7 @@ public:
class CRYPTOPP_NO_VTABLE DL_SymmetricEncryptionAlgorithm class CRYPTOPP_NO_VTABLE DL_SymmetricEncryptionAlgorithm
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_SymmetricEncryptionAlgorithm() {}
virtual ~DL_SymmetricEncryptionAlgorithm() { }
#endif
virtual bool ParameterSupported(const char *name) const virtual bool ParameterSupported(const char *name) const
{CRYPTOPP_UNUSED(name); return false;} {CRYPTOPP_UNUSED(name); return false;}
@ -1378,9 +1319,7 @@ protected:
typedef KI KeyInterface; typedef KI KeyInterface;
typedef typename KI::Element Element; typedef typename KI::Element Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_Base() {}
virtual ~DL_Base() { }
#endif
const DL_GroupParameters<Element> & GetAbstractGroupParameters() const {return GetKeyInterface().GetAbstractGroupParameters();} const DL_GroupParameters<Element> & GetAbstractGroupParameters() const {return GetKeyInterface().GetAbstractGroupParameters();}
DL_GroupParameters<Element> & AccessAbstractGroupParameters() {return AccessKeyInterface().AccessAbstractGroupParameters();} DL_GroupParameters<Element> & AccessAbstractGroupParameters() {return AccessKeyInterface().AccessAbstractGroupParameters();}
@ -1398,9 +1337,7 @@ template <class INTERFACE, class KEY_INTERFACE>
class CRYPTOPP_NO_VTABLE DL_SignatureSchemeBase : public INTERFACE, public DL_Base<KEY_INTERFACE> class CRYPTOPP_NO_VTABLE DL_SignatureSchemeBase : public INTERFACE, public DL_Base<KEY_INTERFACE>
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_SignatureSchemeBase() {}
virtual ~DL_SignatureSchemeBase() { }
#endif
//! \brief Provides the signature length //! \brief Provides the signature length
//! \returns signature length, in bytes //! \returns signature length, in bytes
@ -1454,9 +1391,7 @@ template <class T>
class CRYPTOPP_NO_VTABLE DL_SignerBase : public DL_SignatureSchemeBase<PK_Signer, DL_PrivateKey<T> > class CRYPTOPP_NO_VTABLE DL_SignerBase : public DL_SignatureSchemeBase<PK_Signer, DL_PrivateKey<T> >
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_SignerBase() {}
virtual ~DL_SignerBase() { }
#endif
//! \brief Testing interface //! \brief Testing interface
//! \param k Integer //! \param k Integer
@ -1552,9 +1487,7 @@ template <class T>
class CRYPTOPP_NO_VTABLE DL_VerifierBase : public DL_SignatureSchemeBase<PK_Verifier, DL_PublicKey<T> > class CRYPTOPP_NO_VTABLE DL_VerifierBase : public DL_SignatureSchemeBase<PK_Verifier, DL_PublicKey<T> >
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_VerifierBase() {}
virtual ~DL_VerifierBase() { }
#endif
void InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const void InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const
{ {
@ -1629,9 +1562,7 @@ class CRYPTOPP_NO_VTABLE DL_CryptoSystemBase : public PK, public DL_Base<KI>
public: public:
typedef typename DL_Base<KI>::Element Element; typedef typename DL_Base<KI>::Element Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_CryptoSystemBase() {}
virtual ~DL_CryptoSystemBase() { }
#endif
size_t MaxPlaintextLength(size_t ciphertextLength) const size_t MaxPlaintextLength(size_t ciphertextLength) const
{ {
@ -1662,9 +1593,7 @@ class CRYPTOPP_NO_VTABLE DL_DecryptorBase : public DL_CryptoSystemBase<PK_Decryp
public: public:
typedef T Element; typedef T Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_DecryptorBase() {}
virtual ~DL_DecryptorBase() { }
#endif
DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs &parameters = g_nullNameValuePairs) const DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs &parameters = g_nullNameValuePairs) const
{ {
@ -1704,9 +1633,7 @@ class CRYPTOPP_NO_VTABLE DL_EncryptorBase : public DL_CryptoSystemBase<PK_Encryp
public: public:
typedef T Element; typedef T Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_EncryptorBase() {}
virtual ~DL_EncryptorBase() { }
#endif
void Encrypt(RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs &parameters = g_nullNameValuePairs) const void Encrypt(RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs &parameters = g_nullNameValuePairs) const
{ {
@ -1792,9 +1719,7 @@ public:
typedef SCHEME_OPTIONS SchemeOptions; typedef SCHEME_OPTIONS SchemeOptions;
typedef typename KEY::Element Element; typedef typename KEY::Element Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_ObjectImplBase() {}
virtual ~DL_ObjectImplBase() { }
#endif
PrivateKey & AccessPrivateKey() {return m_key;} PrivateKey & AccessPrivateKey() {return m_key;}
PublicKey & AccessPublicKey() {return m_key;} PublicKey & AccessPublicKey() {return m_key;}
@ -1833,9 +1758,7 @@ class CRYPTOPP_NO_VTABLE DL_ObjectImpl : public DL_ObjectImplBase<BASE, SCHEME_O
public: public:
typedef typename KEY::Element Element; typedef typename KEY::Element Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_ObjectImpl() {}
virtual ~DL_ObjectImpl() { }
#endif
protected: protected:
const DL_ElgamalLikeSignatureAlgorithm<Element> & GetSignatureAlgorithm() const const DL_ElgamalLikeSignatureAlgorithm<Element> & GetSignatureAlgorithm() const
@ -1902,9 +1825,7 @@ class CRYPTOPP_NO_VTABLE DL_SimpleKeyAgreementDomainBase : public SimpleKeyAgree
public: public:
typedef T Element; typedef T Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 virtual ~DL_SimpleKeyAgreementDomainBase() {}
virtual ~DL_SimpleKeyAgreementDomainBase() { }
#endif
CryptoParameters & AccessCryptoParameters() {return AccessAbstractGroupParameters();} CryptoParameters & AccessCryptoParameters() {return AccessAbstractGroupParameters();}
unsigned int AgreedValueLength() const {return GetAbstractGroupParameters().GetEncodedElementSize(false);} unsigned int AgreedValueLength() const {return GetAbstractGroupParameters().GetEncodedElementSize(false);}
@ -1975,20 +1896,18 @@ typedef EnumToType<CofactorMultiplicationOption, NO_COFACTOR_MULTIPLICTION> NoCo
typedef EnumToType<CofactorMultiplicationOption, COMPATIBLE_COFACTOR_MULTIPLICTION> CompatibleCofactorMultiplication; typedef EnumToType<CofactorMultiplicationOption, COMPATIBLE_COFACTOR_MULTIPLICTION> CompatibleCofactorMultiplication;
typedef EnumToType<CofactorMultiplicationOption, INCOMPATIBLE_COFACTOR_MULTIPLICTION> IncompatibleCofactorMultiplication; typedef EnumToType<CofactorMultiplicationOption, INCOMPATIBLE_COFACTOR_MULTIPLICTION> IncompatibleCofactorMultiplication;
//! \details Diffie-Hellman key agreement algorithm //! \brief Diffie-Hellman key agreement algorithm
template <class ELEMENT, class COFACTOR_OPTION> template <class ELEMENT, class COFACTOR_OPTION>
class DL_KeyAgreementAlgorithm_DH : public DL_KeyAgreementAlgorithm<ELEMENT> class DL_KeyAgreementAlgorithm_DH : public DL_KeyAgreementAlgorithm<ELEMENT>
{ {
public: public:
typedef ELEMENT Element; typedef ELEMENT Element;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_KeyAgreementAlgorithm_DH() {}
#endif
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName()
{return COFACTOR_OPTION::ToEnum() == INCOMPATIBLE_COFACTOR_MULTIPLICTION ? "DHC" : "DH";} {return COFACTOR_OPTION::ToEnum() == INCOMPATIBLE_COFACTOR_MULTIPLICTION ? "DHC" : "DH";}
virtual ~DL_KeyAgreementAlgorithm_DH() {}
Element AgreeWithEphemeralPrivateKey(const DL_GroupParameters<Element> &params, const DL_FixedBasePrecomputation<Element> &publicPrecomputation, const Integer &privateExponent) const Element AgreeWithEphemeralPrivateKey(const DL_GroupParameters<Element> &params, const DL_FixedBasePrecomputation<Element> &publicPrecomputation, const Integer &privateExponent) const
{ {
return publicPrecomputation.Exponentiate(params.GetGroupPrecomputation(), return publicPrecomputation.Exponentiate(params.GetGroupPrecomputation(),
@ -2052,38 +1971,6 @@ public:
PK_FinalTemplate(const Integer &v1) PK_FinalTemplate(const Integer &v1)
{this->AccessKey().Initialize(v1);} {this->AccessKey().Initialize(v1);}
#if (defined(_MSC_VER) && _MSC_VER < 1300)
template <class T1, class T2>
PK_FinalTemplate(T1 &v1, T2 &v2)
{this->AccessKey().Initialize(v1, v2);}
template <class T1, class T2, class T3>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3)
{this->AccessKey().Initialize(v1, v2, v3);}
template <class T1, class T2, class T3, class T4>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4)
{this->AccessKey().Initialize(v1, v2, v3, v4);}
template <class T1, class T2, class T3, class T4, class T5>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5)
{this->AccessKey().Initialize(v1, v2, v3, v4, v5);}
template <class T1, class T2, class T3, class T4, class T5, class T6>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5, T6 &v6)
{this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
template <class T1, class T2, class T3, class T4, class T5, class T6, class T7>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5, T6 &v6, T7 &v7)
{this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5, T6 &v6, T7 &v7, T8 &v8)
{this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
#else
template <class T1, class T2> template <class T1, class T2>
PK_FinalTemplate(const T1 &v1, const T2 &v2) PK_FinalTemplate(const T1 &v1, const T2 &v2)
{this->AccessKey().Initialize(v1, v2);} {this->AccessKey().Initialize(v1, v2);}
@ -2139,8 +2026,6 @@ public:
template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8> template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8>
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8) PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8)
{this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);} {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
#endif
}; };
//! \brief Base class for public key encryption standard classes. //! \brief Base class for public key encryption standard classes.

View File

@ -17,9 +17,7 @@ NAMESPACE_BEGIN(CryptoPP)
class PasswordBasedKeyDerivationFunction class PasswordBasedKeyDerivationFunction
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~PasswordBasedKeyDerivationFunction() {} virtual ~PasswordBasedKeyDerivationFunction() {}
#endif
//! \brief Provides the maximum derived key length //! \brief Provides the maximum derived key length
//! \returns maximum derived key length, in bytes //! \returns maximum derived key length, in bytes

View File

@ -1,7 +1,6 @@
// rabin.h - written and placed in the public domain by Wei Dai // rabin.h - written and placed in the public domain by Wei Dai
//! \file //! \file rabin.h
//! \headerfile rabin.h
//! \brief Classes for Rabin encryption and signature schemes //! \brief Classes for Rabin encryption and signature schemes
#ifndef CRYPTOPP_RABIN_H #ifndef CRYPTOPP_RABIN_H

11
sha.cpp
View File

@ -357,17 +357,8 @@ extern const word32 SHA256_K[64] = {
#if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_GENERATE_X64_MASM)) #if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_GENERATE_X64_MASM))
static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len)
#if defined(_MSC_VER) && (_MSC_VER == 1200)
, ... // VC60 workaround: prevent VC 6 from inlining this function
#endif
)
{ {
#if defined(_MSC_VER) && (_MSC_VER == 1200)
AS2(mov ecx, [state])
AS2(mov edx, [data])
#endif
#define LOCALS_SIZE 8*4 + 16*4 + 4*WORD_SZ #define LOCALS_SIZE 8*4 + 16*4 + 4*WORD_SZ
#define H(i) [BASE+ASM_MOD(1024+7-(i),8)*4] #define H(i) [BASE+ASM_MOD(1024+7-(i),8)*4]
#define G(i) H(i+1) #define G(i) H(i+1)

View File

@ -66,9 +66,7 @@ template <class POLICY, class BASE, class POLICY_INTERFACE = CPP_TYPENAME BASE::
class ConcretePolicyHolder : public BASE, protected POLICY class ConcretePolicyHolder : public BASE, protected POLICY
{ {
public: public:
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ConcretePolicyHolder() {} virtual ~ConcretePolicyHolder() {}
#endif
protected: protected:
const POLICY_INTERFACE & GetPolicy() const {return *this;} const POLICY_INTERFACE & GetPolicy() const {return *this;}
POLICY_INTERFACE & AccessPolicy() {return *this;} POLICY_INTERFACE & AccessPolicy() {return *this;}
@ -269,6 +267,8 @@ template <class BASE = AbstractPolicyHolder<AdditiveCipherAbstractPolicy, Symmet
class CRYPTOPP_NO_VTABLE AdditiveCipherTemplate : public BASE, public RandomNumberGenerator class CRYPTOPP_NO_VTABLE AdditiveCipherTemplate : public BASE, public RandomNumberGenerator
{ {
public: public:
virtual ~AdditiveCipherTemplate() {}
//! \brief Generate random array of bytes //! \brief Generate random array of bytes
//! \param output the byte buffer //! \param output the byte buffer
//! \param size the length of the buffer, in bytes //! \param size the length of the buffer, in bytes
@ -584,6 +584,8 @@ template <class BASE, class INFO = BASE>
class SymmetricCipherFinal : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO> class SymmetricCipherFinal : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
{ {
public: public:
virtual ~SymmetricCipherFinal() {}
//! \brief Construct a stream cipher //! \brief Construct a stream cipher
SymmetricCipherFinal() {} SymmetricCipherFinal() {}

8
wait.h
View File

@ -187,11 +187,7 @@ public:
bool Wait(unsigned long milliseconds); bool Wait(unsigned long milliseconds);
#ifdef USE_WINDOWS_STYLE_SOCKETS #ifdef USE_WINDOWS_STYLE_SOCKETS
# ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~WaitObjectContainer(); virtual ~WaitObjectContainer();
# else
~WaitObjectContainer();
#endif
void AddHandle(HANDLE handle, CallStack const& callStack); void AddHandle(HANDLE handle, CallStack const& callStack);
#else #else
void AddReadFd(int fd, CallStack const& callStack); void AddReadFd(int fd, CallStack const& callStack);
@ -234,6 +230,6 @@ NAMESPACE_END
# pragma warning(pop) # pragma warning(pop)
#endif #endif
#endif #endif // NO_OS_DEPENDENCE
#endif #endif // CRYPTOPP_WAIT_H

View File

@ -16,6 +16,8 @@ NAMESPACE_BEGIN(CryptoPP)
class WindowsHandle class WindowsHandle
{ {
public: public:
virtual ~WindowsHandle() {}
WindowsHandle(HANDLE h = INVALID_HANDLE_VALUE, bool own=false); WindowsHandle(HANDLE h = INVALID_HANDLE_VALUE, bool own=false);
WindowsHandle(const WindowsHandle &h) : m_h(h.m_h), m_own(false) {} WindowsHandle(const WindowsHandle &h) : m_h(h.m_h), m_own(false) {}
virtual ~WindowsHandle(); virtual ~WindowsHandle();