Commits

Andreas Tscharner committed d1b9a3b

Update (internal) cyrpto lib (cryptopp r540/v5.6.2)

  • Participants
  • Parent commits 52cd896

Comments (0)

Files changed (32)

File src/strategies/cryptopp/License.txt

-Compilation Copyright (c) 1995-2010 by Wei Dai.  All rights reserved.
+Compilation Copyright (c) 1995-2013 by Wei Dai.  All rights reserved.
 This copyright applies only to this software distribution package 
 as a compilation, and does not imply a copyright on any particular 
 file in the package.
 Richard De Moliner - safer.cpp
 Matthew Skala - twofish.cpp
 Kevin Springle - camellia.cpp, shacal2.cpp, ttmac.cpp, whrlpool.cpp, ripemd.cpp
+Ronny Van Keer - sha3.cpp
 
-Permission to use, copy, modify, and distribute this compilation for
-any purpose, including commercial applications, is hereby granted
-without fee, subject to the following restrictions:
+The Crypto++ Library (as a compilation) is currently licensed under the Boost
+Software License 1.0 (http://www.boost.org/users/license.html).
 
-1. Any copy or modification of this compilation in any form, except
-in object code form as part of an application software, must include
-the above copyright notice and this license.
+Boost Software License - Version 1.0 - August 17th, 2003
 
-2. Users of this software agree that any modification or extension
-they provide to Wei Dai will be considered public domain and not
-copyrighted unless it includes an explicit copyright notice.
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
 
-3. Wei Dai makes no warranty or representation that the operation of the
-software in this compilation will be error-free, and Wei Dai is under no
-obligation to provide any services, by way of maintenance, update, or
-otherwise.  THE SOFTWARE AND ANY DOCUMENTATION ARE PROVIDED "AS IS"
-WITHOUT EXPRESS OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. IN NO EVENT WILL WEI DAI OR ANY OTHER CONTRIBUTOR BE LIABLE FOR
-DIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
 
-4. Users will not use Wei Dai or any other contributor's name in any 
-publicity or advertising, without prior written consent in each case.
-
-5. Export of this software from the United States may require a
-specific license from the United States Government.  It is the
-responsibility of any person or organization contemplating export
-to obtain such a license before exporting.
-
-6. Certain parts of this software may be protected by patents.  It
-is the users' responsibility to obtain the appropriate
-licenses before using those parts.
-
-If this compilation is used in object code form in an application
-software, acknowledgement of the author is not required but would be
-appreciated. The contribution of any useful modifications or extensions
-to Wei Dai is not required but would also be appreciated.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.

File src/strategies/cryptopp/Makefile

 EGREP = egrep
 UNAME = $(shell uname)
 ISX86 = $(shell uname -m | $(EGREP) -c "i.86|x86|i86|amd64")
+IS_SUN_CC = $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: Sun")
+IS_LINUX = $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -c "linux")
+IS_MINGW = $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -c "mingw")
+CLANG_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang version")
 
 # Default prefix for make install
 ifeq ($(PREFIX),)
 GCC42_OR_LATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -c "^gcc version (4.[2-9]|[5-9])")
 INTEL_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\)")
 ICC111_OR_LATER = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\) ([2-9][0-9]|1[2-9]|11\.[1-9])")
-IS_SUN_CC = $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: Sun")
-GAS210_OR_LATER = $(shell echo "" | $(AS) -v 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-9]|[3-9])")
-GAS217_OR_LATER = $(shell echo "" | $(AS) -v 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
-GAS219_OR_LATER = $(shell echo "" | $(AS) -v 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
-ISMINGW = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "mingw")
+GAS210_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-9]|[3-9])")
+GAS217_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
+GAS219_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
 
 ifneq ($(GCC42_OR_LATER),0)
 ifeq ($(UNAME),Darwin)
 endif
 endif
 
-ifeq ($(ISMINGW),1)
-LDLIBS += -lws2_32
-endif
-
 endif	# ISX86
 
 ifeq ($(UNAME),)	# for DJGPP, where uname doesn't exist
 CXXFLAGS += -pipe
 endif
 
-ifeq ($(UNAME),Linux)
+ifeq ($(IS_MINGW),1)
+LDLIBS += -lws2_32
+endif
+
+ifeq ($(IS_LINUX),1)
 LDFLAGS += -pthread
 ifneq ($(shell uname -i | $(EGREP) -c "(_64|d64)"),0)
 M32OR64 = -m64
 M32OR64 = -m$(shell isainfo -b)
 endif
 
+ifneq ($(CLANG_COMPILER),0)
+CXXFLAGS += -Wno-tautological-compare
+endif
+
 ifneq ($(IS_SUN_CC),0)	# override flags for CC Sun C++ compiler
 CXXFLAGS = -DNDEBUG -O -g0 -native -template=no%extdef $(M32OR64)
 LDFLAGS =
 DLLTESTOBJS = dlltest.dllonly.o
 
 all: cryptest.exe
+static: libcryptopp.a
+dynamic: libcryptopp.so
 
 test: cryptest.exe
 	./cryptest.exe v
 
 clean:
-	$(RM) cryptest.exe libcryptopp.a $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
+	-$(RM) cryptest.exe libcryptopp.a libcryptopp.so $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTI MPORTOBJS) $(DLLTESTOBJS)
 
 install:
 	$(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin
-	$(CP) *.h $(PREFIX)/include/cryptopp
-	$(CP) *.a $(PREFIX)/lib
-	$(CP) *.so $(PREFIX)/lib
-	$(CP) *.exe $(PREFIX)/bin
+	-$(CP) *.h $(PREFIX)/include/cryptopp
+	-$(CP) *.a $(PREFIX)/lib
+	-$(CP) *.so $(PREFIX)/lib
+	-$(CP) *.exe $(PREFIX)/bin
+
+remove:
+	-$(RM) -rf $(PREFIX)/include/cryptopp
+	-$(RM) $(PREFIX)/lib/libcryptopp.a
+	-$(RM) $(PREFIX)/lib/libcryptopp.so
+	-$(RM) $(PREFIX)/bin/cryptest.exe
 
 libcryptopp.a: $(LIBOBJS)
 	$(AR) $(ARFLAGS) $@ $(LIBOBJS)
 	$(CXX) -shared -o $@ $(LIBOBJS)
 
 cryptest.exe: libcryptopp.a $(TESTOBJS)
-	$(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) -L. -lcryptopp $(LDFLAGS) $(LDLIBS)
+	$(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
 
 nolib: $(OBJS)		# makes it faster to test changes
 	$(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS)

File src/strategies/cryptopp/Readme.txt

 Crypto++: a C++ Class Library of Cryptographic Schemes
-Version 5.6.1 (8/9/2010, SVN r520)
+Version 5.6.2 (in development)
 
 Crypto++ Library is a free C++ class library of cryptographic schemes.
 Currently the library contains the following algorithms:
       elliptic curve cryptography  ECDSA, ECNR, ECIES, ECDH, ECMQV
 
           insecure or obsolescent  MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL
-algorithms retained for backwards  3.0, WAKE, WAKE-OFB, DESX (DES-XEX3), RC2,
+algorithms retained for backwards  3.0, WAKE-OFB, DESX (DES-XEX3), RC2,
      compatibility and historical  SAFER, 3-WAY, GOST, SHARK, CAST-128, Square
                             value
 

File src/strategies/cryptopp/algebra.cpp

 
 template <class T> const T& AbstractGroup<T>::Double(const Element &a) const
 {
-	return Add(a, a);
+	return this->Add(a, a);
 }
 
 template <class T> const T& AbstractGroup<T>::Subtract(const Element &a, const Element &b) const
 {
 	// make copy of a in case Inverse() overwrites it
 	Element a1(a);
-	return Add(a1, Inverse(b));
+	return this->Add(a1, Inverse(b));
 }
 
 template <class T> T& AbstractGroup<T>::Accumulate(Element &a, const Element &b) const
 {
-	return a = Add(a, b);
+	return a = this->Add(a, b);
 }
 
 template <class T> T& AbstractGroup<T>::Reduce(Element &a, const Element &b) const
 {
-	return a = Subtract(a, b);
+	return a = this->Subtract(a, b);
 }
 
 template <class T> const T& AbstractRing<T>::Square(const Element &a) const
 {
-	return Multiply(a, a);
+	return this->Multiply(a, a);
 }
 
 template <class T> const T& AbstractRing<T>::Divide(const Element &a, const Element &b) const
 {
 	// make copy of a in case MultiplicativeInverse() overwrites it
 	Element a1(a);
-	return Multiply(a1, MultiplicativeInverse(b));
+	return this->Multiply(a1, this->MultiplicativeInverse(b));
 }
 
 template <class T> const T& AbstractEuclideanDomain<T>::Mod(const Element &a, const Element &b) const
 {
 	Element q;
-	DivisionAlgorithm(result, q, a, b);
+	this->DivisionAlgorithm(result, q, a, b);
 	return result;
 }
 
 
 	while (!this->Equal(g[i1], this->Identity()))
 	{
-		g[i2] = Mod(g[i0], g[i1]);
+		g[i2] = this->Mod(g[i0], g[i1]);
 		unsigned int t = i0; i0 = i1; i1 = i2; i2 = t;
 	}
 
 	Element y;
 	unsigned int i0=0, i1=1, i2=2;
 
-	while (!Equal(g[i1], Identity()))
+	while (!this->Equal(g[i1], this->Identity()))
 	{
 		// y = g[i0] / g[i1];
 		// g[i2] = g[i0] % g[i1];
 template <class T> T AbstractGroup<T>::ScalarMultiply(const Element &base, const Integer &exponent) const
 {
 	Element result;
-	SimultaneousMultiply(&result, base, &exponent, 1);
+	this->SimultaneousMultiply(&result, base, &exponent, 1);
 	return result;
 }
 
 {
 	const unsigned expLen = STDMAX(e1.BitCount(), e2.BitCount());
 	if (expLen==0)
-		return Identity();
+		return this->Identity();
 
 	const unsigned w = (expLen <= 46 ? 1 : (expLen <= 260 ? 2 : 3));
 	const unsigned tableSize = 1<<w;
 	powerTable[1] = x;
 	powerTable[tableSize] = y;
 	if (w==1)
-		powerTable[3] = Add(x,y);
+		powerTable[3] = this->Add(x,y);
 	else
 	{
-		powerTable[2] = Double(x);
-		powerTable[2*tableSize] = Double(y);
+		powerTable[2] = this->Double(x);
+		powerTable[2*tableSize] = this->Double(y);
 
 		unsigned i, j;
 
 			else
 			{
 				while (squaresBefore--)
-					result = Double(result);
+					result = this->Double(result);
 				if (power1 || power2)
 					Accumulate(result, powerTable[(power2<<w) + power1]);
 			}
 			while (squaresAfter--)
-				result = Double(result);
+				result = this->Double(result);
 			power1 = power2 = 0;
 		}
 	}

File src/strategies/cryptopp/authenc.cpp

-// authenc.cpp - written and placed in the public domain by Wei Dai
-
-#include "pch.h"
-
-#ifndef CRYPTOPP_IMPORTS
-
-#include "authenc.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-void AuthenticatedSymmetricCipherBase::AuthenticateData(const byte *input, size_t len)
-{
-	unsigned int blockSize = AuthenticationBlockSize();
-	unsigned int &num = m_bufferedDataLength;
-	byte* data = m_buffer.begin();
-
-	if (num != 0)	// process left over data
-	{
-		if (num+len >= blockSize)
-		{
-			memcpy(data+num, input, blockSize-num);
-			AuthenticateBlocks(data, blockSize);
-			input += (blockSize-num);
-			len -= (blockSize-num);
-			num = 0;
-			// drop through and do the rest
-		}
-		else
-		{
-			memcpy(data+num, input, len);
-			num += (unsigned int)len;
-			return;
-		}
-	}
-
-	// now process the input data in blocks of blockSize bytes and save the leftovers to m_data
-	if (len >= blockSize)
-	{
-		size_t leftOver = AuthenticateBlocks(input, len);
-		input += (len - leftOver);
-		len = leftOver;
-	}
-
-	memcpy(data, input, len);
-	num = (unsigned int)len;
-}
-
-void AuthenticatedSymmetricCipherBase::SetKey(const byte *userKey, size_t keylength, const NameValuePairs &params)
-{
-	m_bufferedDataLength = 0;
-	m_state = State_Start;
-
-	SetKeyWithoutResync(userKey, keylength, params);
-	m_state = State_KeySet;
-
-	size_t length;
-	const byte *iv = GetIVAndThrowIfInvalid(params, length);
-	if (iv)
-		Resynchronize(iv, (int)length);
-}
-
-void AuthenticatedSymmetricCipherBase::Resynchronize(const byte *iv, int length)
-{
-	if (m_state < State_KeySet)
-		throw BadState(AlgorithmName(), "Resynchronize", "key is set");
-
-	m_bufferedDataLength = 0;
-	m_totalHeaderLength = m_totalMessageLength = m_totalFooterLength = 0;
-	m_state = State_KeySet;
-
-	Resync(iv, this->ThrowIfInvalidIVLength(length));
-	m_state = State_IVSet;
-}
-
-void AuthenticatedSymmetricCipherBase::Update(const byte *input, size_t length)
-{
-	if (length == 0)
-		return;
-
-	switch (m_state)
-	{
-	case State_Start:
-	case State_KeySet:
-		throw BadState(AlgorithmName(), "Update", "setting key and IV");
-	case State_IVSet:
-		AuthenticateData(input, length);
-		m_totalHeaderLength += length;
-		break;
-	case State_AuthUntransformed:
-	case State_AuthTransformed:
-		AuthenticateLastConfidentialBlock();
-		m_bufferedDataLength = 0;
-		m_state = State_AuthFooter;
-		// fall through
-	case State_AuthFooter:
-		AuthenticateData(input, length);
-		m_totalFooterLength += length;
-		break;
-	default:
-		assert(false);
-	}
-}
-
-void AuthenticatedSymmetricCipherBase::ProcessData(byte *outString, const byte *inString, size_t length)
-{
-	m_totalMessageLength += length;
-	if (m_state >= State_IVSet && m_totalMessageLength > MaxMessageLength())
-		throw InvalidArgument(AlgorithmName() + ": message length exceeds maximum");
-
-reswitch:
-	switch (m_state)
-	{
-	case State_Start:
-	case State_KeySet:
-		throw BadState(AlgorithmName(), "ProcessData", "setting key and IV");
-	case State_AuthFooter:
-		throw BadState(AlgorithmName(), "ProcessData was called after footer input has started");
-	case State_IVSet:
-		AuthenticateLastHeaderBlock();
-		m_bufferedDataLength = 0;
-		m_state = AuthenticationIsOnPlaintext()==IsForwardTransformation() ? State_AuthUntransformed : State_AuthTransformed;
-		goto reswitch;
-	case State_AuthUntransformed:
-		AuthenticateData(inString, length);
-		AccessSymmetricCipher().ProcessData(outString, inString, length);
-		break;
-	case State_AuthTransformed:
-		AccessSymmetricCipher().ProcessData(outString, inString, length);
-		AuthenticateData(outString, length);
-		break;
-	default:
-		assert(false);
-	}
-}
-
-void AuthenticatedSymmetricCipherBase::TruncatedFinal(byte *mac, size_t macSize)
-{
-	if (m_totalHeaderLength > MaxHeaderLength())
-		throw InvalidArgument(AlgorithmName() + ": header length of " + IntToString(m_totalHeaderLength) + " exceeds the maximum of " + IntToString(MaxHeaderLength()));
-
-	if (m_totalFooterLength > MaxFooterLength())
-	{
-		if (MaxFooterLength() == 0)
-			throw InvalidArgument(AlgorithmName() + ": additional authenticated data (AAD) cannot be input after data to be encrypted or decrypted");
-		else
-			throw InvalidArgument(AlgorithmName() + ": footer length of " + IntToString(m_totalFooterLength) + " exceeds the maximum of " + IntToString(MaxFooterLength()));
-	}
-
-	switch (m_state)
-	{
-	case State_Start:
-	case State_KeySet:
-		throw BadState(AlgorithmName(), "TruncatedFinal", "setting key and IV");
-
-	case State_IVSet:
-		AuthenticateLastHeaderBlock();
-		m_bufferedDataLength = 0;
-		// fall through
-
-	case State_AuthUntransformed:
-	case State_AuthTransformed:
-		AuthenticateLastConfidentialBlock();
-		m_bufferedDataLength = 0;
-		// fall through
-
-	case State_AuthFooter:
-		AuthenticateLastFooterBlock(mac, macSize);
-		m_bufferedDataLength = 0;
-		break;
-
-	default:
-		assert(false);
-	}
-
-	m_state = State_KeySet;
-}
-
-NAMESPACE_END
-
-#endif
+// authenc.cpp - written and placed in the public domain by Wei Dai
+
+#include "pch.h"
+
+#ifndef CRYPTOPP_IMPORTS
+
+#include "authenc.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+void AuthenticatedSymmetricCipherBase::AuthenticateData(const byte *input, size_t len)
+{
+	unsigned int blockSize = AuthenticationBlockSize();
+	unsigned int &num = m_bufferedDataLength;
+	byte* data = m_buffer.begin();
+
+	if (num != 0)	// process left over data
+	{
+		if (num+len >= blockSize)
+		{
+			memcpy(data+num, input, blockSize-num);
+			AuthenticateBlocks(data, blockSize);
+			input += (blockSize-num);
+			len -= (blockSize-num);
+			num = 0;
+			// drop through and do the rest
+		}
+		else
+		{
+			memcpy(data+num, input, len);
+			num += (unsigned int)len;
+			return;
+		}
+	}
+
+	// now process the input data in blocks of blockSize bytes and save the leftovers to m_data
+	if (len >= blockSize)
+	{
+		size_t leftOver = AuthenticateBlocks(input, len);
+		input += (len - leftOver);
+		len = leftOver;
+	}
+
+	memcpy(data, input, len);
+	num = (unsigned int)len;
+}
+
+void AuthenticatedSymmetricCipherBase::SetKey(const byte *userKey, size_t keylength, const NameValuePairs &params)
+{
+	m_bufferedDataLength = 0;
+	m_state = State_Start;
+
+	SetKeyWithoutResync(userKey, keylength, params);
+	m_state = State_KeySet;
+
+	size_t length;
+	const byte *iv = GetIVAndThrowIfInvalid(params, length);
+	if (iv)
+		Resynchronize(iv, (int)length);
+}
+
+void AuthenticatedSymmetricCipherBase::Resynchronize(const byte *iv, int length)
+{
+	if (m_state < State_KeySet)
+		throw BadState(AlgorithmName(), "Resynchronize", "key is set");
+
+	m_bufferedDataLength = 0;
+	m_totalHeaderLength = m_totalMessageLength = m_totalFooterLength = 0;
+	m_state = State_KeySet;
+
+	Resync(iv, this->ThrowIfInvalidIVLength(length));
+	m_state = State_IVSet;
+}
+
+void AuthenticatedSymmetricCipherBase::Update(const byte *input, size_t length)
+{
+	if (length == 0)
+		return;
+
+	switch (m_state)
+	{
+	case State_Start:
+	case State_KeySet:
+		throw BadState(AlgorithmName(), "Update", "setting key and IV");
+	case State_IVSet:
+		AuthenticateData(input, length);
+		m_totalHeaderLength += length;
+		break;
+	case State_AuthUntransformed:
+	case State_AuthTransformed:
+		AuthenticateLastConfidentialBlock();
+		m_bufferedDataLength = 0;
+		m_state = State_AuthFooter;
+		// fall through
+	case State_AuthFooter:
+		AuthenticateData(input, length);
+		m_totalFooterLength += length;
+		break;
+	default:
+		assert(false);
+	}
+}
+
+void AuthenticatedSymmetricCipherBase::ProcessData(byte *outString, const byte *inString, size_t length)
+{
+	m_totalMessageLength += length;
+	if (m_state >= State_IVSet && m_totalMessageLength > MaxMessageLength())
+		throw InvalidArgument(AlgorithmName() + ": message length exceeds maximum");
+
+reswitch:
+	switch (m_state)
+	{
+	case State_Start:
+	case State_KeySet:
+		throw BadState(AlgorithmName(), "ProcessData", "setting key and IV");
+	case State_AuthFooter:
+		throw BadState(AlgorithmName(), "ProcessData was called after footer input has started");
+	case State_IVSet:
+		AuthenticateLastHeaderBlock();
+		m_bufferedDataLength = 0;
+		m_state = AuthenticationIsOnPlaintext()==IsForwardTransformation() ? State_AuthUntransformed : State_AuthTransformed;
+		goto reswitch;
+	case State_AuthUntransformed:
+		AuthenticateData(inString, length);
+		AccessSymmetricCipher().ProcessData(outString, inString, length);
+		break;
+	case State_AuthTransformed:
+		AccessSymmetricCipher().ProcessData(outString, inString, length);
+		AuthenticateData(outString, length);
+		break;
+	default:
+		assert(false);
+	}
+}
+
+void AuthenticatedSymmetricCipherBase::TruncatedFinal(byte *mac, size_t macSize)
+{
+	if (m_totalHeaderLength > MaxHeaderLength())
+		throw InvalidArgument(AlgorithmName() + ": header length of " + IntToString(m_totalHeaderLength) + " exceeds the maximum of " + IntToString(MaxHeaderLength()));
+
+	if (m_totalFooterLength > MaxFooterLength())
+	{
+		if (MaxFooterLength() == 0)
+			throw InvalidArgument(AlgorithmName() + ": additional authenticated data (AAD) cannot be input after data to be encrypted or decrypted");
+		else
+			throw InvalidArgument(AlgorithmName() + ": footer length of " + IntToString(m_totalFooterLength) + " exceeds the maximum of " + IntToString(MaxFooterLength()));
+	}
+
+	switch (m_state)
+	{
+	case State_Start:
+	case State_KeySet:
+		throw BadState(AlgorithmName(), "TruncatedFinal", "setting key and IV");
+
+	case State_IVSet:
+		AuthenticateLastHeaderBlock();
+		m_bufferedDataLength = 0;
+		// fall through
+
+	case State_AuthUntransformed:
+	case State_AuthTransformed:
+		AuthenticateLastConfidentialBlock();
+		m_bufferedDataLength = 0;
+		// fall through
+
+	case State_AuthFooter:
+		AuthenticateLastFooterBlock(mac, macSize);
+		m_bufferedDataLength = 0;
+		break;
+
+	default:
+		assert(false);
+	}
+
+	m_state = State_KeySet;
+}
+
+NAMESPACE_END
+
+#endif

File src/strategies/cryptopp/authenc.h

-#ifndef CRYPTOPP_AUTHENC_H
-#define CRYPTOPP_AUTHENC_H
-
-#include "cryptlib.h"
-#include "secblock.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-//! .
-class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AuthenticatedSymmetricCipherBase : public AuthenticatedSymmetricCipher
-{
-public:
-	AuthenticatedSymmetricCipherBase() : m_state(State_Start) {}
-
-	bool IsRandomAccess() const {return false;}
-	bool IsSelfInverting() const {return true;}
-	void UncheckedSetKey(const byte *,unsigned int,const CryptoPP::NameValuePairs &) {assert(false);}
-
-	void SetKey(const byte *userKey, size_t keylength, const NameValuePairs &params);
-	void Restart() {if (m_state > State_KeySet) m_state = State_KeySet;}
-	void Resynchronize(const byte *iv, int length=-1);
-	void Update(const byte *input, size_t length);
-	void ProcessData(byte *outString, const byte *inString, size_t length);
-	void TruncatedFinal(byte *mac, size_t macSize);
-
-protected:
-	void AuthenticateData(const byte *data, size_t len);
-	const SymmetricCipher & GetSymmetricCipher() const {return const_cast<AuthenticatedSymmetricCipherBase *>(this)->AccessSymmetricCipher();};
-
-	virtual SymmetricCipher & AccessSymmetricCipher() =0;
-	virtual bool AuthenticationIsOnPlaintext() const =0;
-	virtual unsigned int AuthenticationBlockSize() const =0;
-	virtual void SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params) =0;
-	virtual void Resync(const byte *iv, size_t len) =0;
-	virtual size_t AuthenticateBlocks(const byte *data, size_t len) =0;
-	virtual void AuthenticateLastHeaderBlock() =0;
-	virtual void AuthenticateLastConfidentialBlock() {}
-	virtual void AuthenticateLastFooterBlock(byte *mac, size_t macSize) =0;
-
-	enum State {State_Start, State_KeySet, State_IVSet, State_AuthUntransformed, State_AuthTransformed, State_AuthFooter};
-	State m_state;
-	unsigned int m_bufferedDataLength;
-	lword m_totalHeaderLength, m_totalMessageLength, m_totalFooterLength;
-	AlignedSecByteBlock m_buffer;
-};
-
-NAMESPACE_END
-
-#endif
+#ifndef CRYPTOPP_AUTHENC_H
+#define CRYPTOPP_AUTHENC_H
+
+#include "cryptlib.h"
+#include "secblock.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+//! .
+class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AuthenticatedSymmetricCipherBase : public AuthenticatedSymmetricCipher
+{
+public:
+	AuthenticatedSymmetricCipherBase() : m_state(State_Start) {}
+
+	bool IsRandomAccess() const {return false;}
+	bool IsSelfInverting() const {return true;}
+	void UncheckedSetKey(const byte *,unsigned int,const CryptoPP::NameValuePairs &) {assert(false);}
+
+	void SetKey(const byte *userKey, size_t keylength, const NameValuePairs &params);
+	void Restart() {if (m_state > State_KeySet) m_state = State_KeySet;}
+	void Resynchronize(const byte *iv, int length=-1);
+	void Update(const byte *input, size_t length);
+	void ProcessData(byte *outString, const byte *inString, size_t length);
+	void TruncatedFinal(byte *mac, size_t macSize);
+
+protected:
+	void AuthenticateData(const byte *data, size_t len);
+	const SymmetricCipher & GetSymmetricCipher() const {return const_cast<AuthenticatedSymmetricCipherBase *>(this)->AccessSymmetricCipher();};
+
+	virtual SymmetricCipher & AccessSymmetricCipher() =0;
+	virtual bool AuthenticationIsOnPlaintext() const =0;
+	virtual unsigned int AuthenticationBlockSize() const =0;
+	virtual void SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params) =0;
+	virtual void Resync(const byte *iv, size_t len) =0;
+	virtual size_t AuthenticateBlocks(const byte *data, size_t len) =0;
+	virtual void AuthenticateLastHeaderBlock() =0;
+	virtual void AuthenticateLastConfidentialBlock() {}
+	virtual void AuthenticateLastFooterBlock(byte *mac, size_t macSize) =0;
+
+	enum State {State_Start, State_KeySet, State_IVSet, State_AuthUntransformed, State_AuthTransformed, State_AuthFooter};
+	State m_state;
+	unsigned int m_bufferedDataLength;
+	lword m_totalHeaderLength, m_totalMessageLength, m_totalFooterLength;
+	AlignedSecByteBlock m_buffer;
+};
+
+NAMESPACE_END
+
+#endif

File src/strategies/cryptopp/blowfish.h

 NAMESPACE_BEGIN(CryptoPP)
 
 //! _
-struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 56>, public FixedRounds<16>
+struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 4, 56>, public FixedRounds<16>
 {
 	static const char *StaticAlgorithmName() {return "Blowfish";}
 };

File src/strategies/cryptopp/ccm.cpp

-// ccm.cpp - written and placed in the public domain by Wei Dai
-
-#include "pch.h"
-
-#ifndef CRYPTOPP_IMPORTS
-
-#include "ccm.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-void CCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params)
-{
-	BlockCipher &blockCipher = AccessBlockCipher();
-
-	blockCipher.SetKey(userKey, keylength, params);
-
-	if (blockCipher.BlockSize() != REQUIRED_BLOCKSIZE)
-		throw InvalidArgument(AlgorithmName() + ": block size of underlying block cipher is not 16");
-
-	m_digestSize = params.GetIntValueWithDefault(Name::DigestSize(), DefaultDigestSize());
-	if (m_digestSize % 2 > 0 || m_digestSize < 4 || m_digestSize > 16)
-		throw InvalidArgument(AlgorithmName() + ": DigestSize must be 4, 6, 8, 10, 12, 14, or 16");
-
-	m_buffer.Grow(2*REQUIRED_BLOCKSIZE);
-	m_L = 8;
-}
-
-void CCM_Base::Resync(const byte *iv, size_t len)
-{
-	BlockCipher &cipher = AccessBlockCipher();
-
-	m_L = REQUIRED_BLOCKSIZE-1-(int)len;
-	assert(m_L >= 2);
-	if (m_L > 8)
-		m_L = 8;
-
-	m_buffer[0] = byte(m_L-1);	// flag
-	memcpy(m_buffer+1, iv, len);
-	memset(m_buffer+1+len, 0, REQUIRED_BLOCKSIZE-1-len);
-
-	if (m_state >= State_IVSet)
-		m_ctr.Resynchronize(m_buffer, REQUIRED_BLOCKSIZE);
-	else
-		m_ctr.SetCipherWithIV(cipher, m_buffer);
-
-	m_ctr.Seek(REQUIRED_BLOCKSIZE);
-	m_aadLength = 0; 
-	m_messageLength = 0;
-}
-
-void CCM_Base::UncheckedSpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength)
-{
-	if (m_state != State_IVSet)
-		throw BadState(AlgorithmName(), "SpecifyDataLengths", "or after State_IVSet");
-
-	m_aadLength = headerLength; 
-	m_messageLength = messageLength;
-
-	byte *cbcBuffer = CBC_Buffer();
-	const BlockCipher &cipher = GetBlockCipher();
-
-	cbcBuffer[0] = byte(64*(headerLength>0) + 8*((m_digestSize-2)/2) + (m_L-1));	// flag
-	PutWord<word64>(true, BIG_ENDIAN_ORDER, cbcBuffer+REQUIRED_BLOCKSIZE-8, m_messageLength);
-	memcpy(cbcBuffer+1, m_buffer+1, REQUIRED_BLOCKSIZE-1-m_L);
-	cipher.ProcessBlock(cbcBuffer);
-
-	if (headerLength>0)
-	{
-		assert(m_bufferedDataLength == 0);
-
-		if (headerLength < ((1<<16) - (1<<8)))
-		{
-			PutWord<word16>(true, BIG_ENDIAN_ORDER, m_buffer, (word16)headerLength);
-			m_bufferedDataLength = 2;
-		}
-		else if (headerLength < (W64LIT(1)<<32))
-		{
-			m_buffer[0] = 0xff;
-			m_buffer[1] = 0xfe;
-			PutWord<word32>(false, BIG_ENDIAN_ORDER, m_buffer+2, (word32)headerLength);
-			m_bufferedDataLength = 6;
-		}
-		else
-		{
-			m_buffer[0] = 0xff;
-			m_buffer[1] = 0xff;
-			PutWord<word64>(false, BIG_ENDIAN_ORDER, m_buffer+2, headerLength);
-			m_bufferedDataLength = 10;
-		}
-	}
-}
-
-size_t CCM_Base::AuthenticateBlocks(const byte *data, size_t len)
-{
-	byte *cbcBuffer = CBC_Buffer();
-	const BlockCipher &cipher = GetBlockCipher();
-	return cipher.AdvancedProcessBlocks(cbcBuffer, data, cbcBuffer, len, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
-}
-
-void CCM_Base::AuthenticateLastHeaderBlock()
-{
-	byte *cbcBuffer = CBC_Buffer();
-	const BlockCipher &cipher = GetBlockCipher();
-
-	if (m_aadLength != m_totalHeaderLength)
-		throw InvalidArgument(AlgorithmName() + ": header length doesn't match that given in SpecifyDataLengths");
-
-	if (m_bufferedDataLength > 0)
-	{
-		xorbuf(cbcBuffer, m_buffer, m_bufferedDataLength);
-		cipher.ProcessBlock(cbcBuffer);
-		m_bufferedDataLength = 0;
-	}
-}
-
-void CCM_Base::AuthenticateLastConfidentialBlock()
-{
-	byte *cbcBuffer = CBC_Buffer();
-	const BlockCipher &cipher = GetBlockCipher();
-
-	if (m_messageLength != m_totalMessageLength)
-		throw InvalidArgument(AlgorithmName() + ": message length doesn't match that given in SpecifyDataLengths");
-
-	if (m_bufferedDataLength > 0)
-	{
-		xorbuf(cbcBuffer, m_buffer, m_bufferedDataLength);
-		cipher.ProcessBlock(cbcBuffer);
-		m_bufferedDataLength = 0;
-	}
-}
-
-void CCM_Base::AuthenticateLastFooterBlock(byte *mac, size_t macSize)
-{
-	m_ctr.Seek(0);
-	m_ctr.ProcessData(mac, CBC_Buffer(), macSize);
-}
-
-NAMESPACE_END
-
-#endif
+// ccm.cpp - written and placed in the public domain by Wei Dai
+
+#include "pch.h"
+
+#ifndef CRYPTOPP_IMPORTS
+
+#include "ccm.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+void CCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params)
+{
+	BlockCipher &blockCipher = AccessBlockCipher();
+
+	blockCipher.SetKey(userKey, keylength, params);
+
+	if (blockCipher.BlockSize() != REQUIRED_BLOCKSIZE)
+		throw InvalidArgument(AlgorithmName() + ": block size of underlying block cipher is not 16");
+
+	m_digestSize = params.GetIntValueWithDefault(Name::DigestSize(), DefaultDigestSize());
+	if (m_digestSize % 2 > 0 || m_digestSize < 4 || m_digestSize > 16)
+		throw InvalidArgument(AlgorithmName() + ": DigestSize must be 4, 6, 8, 10, 12, 14, or 16");
+
+	m_buffer.Grow(2*REQUIRED_BLOCKSIZE);
+	m_L = 8;
+}
+
+void CCM_Base::Resync(const byte *iv, size_t len)
+{
+	BlockCipher &cipher = AccessBlockCipher();
+
+	m_L = REQUIRED_BLOCKSIZE-1-(int)len;
+	assert(m_L >= 2);
+	if (m_L > 8)
+		m_L = 8;
+
+	m_buffer[0] = byte(m_L-1);	// flag
+	memcpy(m_buffer+1, iv, len);
+	memset(m_buffer+1+len, 0, REQUIRED_BLOCKSIZE-1-len);
+
+	if (m_state >= State_IVSet)
+		m_ctr.Resynchronize(m_buffer, REQUIRED_BLOCKSIZE);
+	else
+		m_ctr.SetCipherWithIV(cipher, m_buffer);
+
+	m_ctr.Seek(REQUIRED_BLOCKSIZE);
+	m_aadLength = 0; 
+	m_messageLength = 0;
+}
+
+void CCM_Base::UncheckedSpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength)
+{
+	if (m_state != State_IVSet)
+		throw BadState(AlgorithmName(), "SpecifyDataLengths", "or after State_IVSet");
+
+	m_aadLength = headerLength; 
+	m_messageLength = messageLength;
+
+	byte *cbcBuffer = CBC_Buffer();
+	const BlockCipher &cipher = GetBlockCipher();
+
+	cbcBuffer[0] = byte(64*(headerLength>0) + 8*((m_digestSize-2)/2) + (m_L-1));	// flag
+	PutWord<word64>(true, BIG_ENDIAN_ORDER, cbcBuffer+REQUIRED_BLOCKSIZE-8, m_messageLength);
+	memcpy(cbcBuffer+1, m_buffer+1, REQUIRED_BLOCKSIZE-1-m_L);
+	cipher.ProcessBlock(cbcBuffer);
+
+	if (headerLength>0)
+	{
+		assert(m_bufferedDataLength == 0);
+
+		if (headerLength < ((1<<16) - (1<<8)))
+		{
+			PutWord<word16>(true, BIG_ENDIAN_ORDER, m_buffer, (word16)headerLength);
+			m_bufferedDataLength = 2;
+		}
+		else if (headerLength < (W64LIT(1)<<32))
+		{
+			m_buffer[0] = 0xff;
+			m_buffer[1] = 0xfe;
+			PutWord<word32>(false, BIG_ENDIAN_ORDER, m_buffer+2, (word32)headerLength);
+			m_bufferedDataLength = 6;
+		}
+		else
+		{
+			m_buffer[0] = 0xff;
+			m_buffer[1] = 0xff;
+			PutWord<word64>(false, BIG_ENDIAN_ORDER, m_buffer+2, headerLength);
+			m_bufferedDataLength = 10;
+		}
+	}
+}
+
+size_t CCM_Base::AuthenticateBlocks(const byte *data, size_t len)
+{
+	byte *cbcBuffer = CBC_Buffer();
+	const BlockCipher &cipher = GetBlockCipher();
+	return cipher.AdvancedProcessBlocks(cbcBuffer, data, cbcBuffer, len, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
+}
+
+void CCM_Base::AuthenticateLastHeaderBlock()
+{
+	byte *cbcBuffer = CBC_Buffer();
+	const BlockCipher &cipher = GetBlockCipher();
+
+	if (m_aadLength != m_totalHeaderLength)
+		throw InvalidArgument(AlgorithmName() + ": header length doesn't match that given in SpecifyDataLengths");
+
+	if (m_bufferedDataLength > 0)
+	{
+		xorbuf(cbcBuffer, m_buffer, m_bufferedDataLength);
+		cipher.ProcessBlock(cbcBuffer);
+		m_bufferedDataLength = 0;
+	}
+}
+
+void CCM_Base::AuthenticateLastConfidentialBlock()
+{
+	byte *cbcBuffer = CBC_Buffer();
+	const BlockCipher &cipher = GetBlockCipher();
+
+	if (m_messageLength != m_totalMessageLength)
+		throw InvalidArgument(AlgorithmName() + ": message length doesn't match that given in SpecifyDataLengths");
+
+	if (m_bufferedDataLength > 0)
+	{
+		xorbuf(cbcBuffer, m_buffer, m_bufferedDataLength);
+		cipher.ProcessBlock(cbcBuffer);
+		m_bufferedDataLength = 0;
+	}
+}
+
+void CCM_Base::AuthenticateLastFooterBlock(byte *mac, size_t macSize)
+{
+	m_ctr.Seek(0);
+	m_ctr.ProcessData(mac, CBC_Buffer(), macSize);
+}
+
+NAMESPACE_END
+
+#endif

File src/strategies/cryptopp/ccm.h

-#ifndef CRYPTOPP_CCM_H
-#define CRYPTOPP_CCM_H
-
-#include "authenc.h"
-#include "modes.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-//! .
-class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CCM_Base : public AuthenticatedSymmetricCipherBase
-{
-public:
-	CCM_Base()
-		: m_digestSize(0), m_L(0) {}
-
-	// AuthenticatedSymmetricCipher
-	std::string AlgorithmName() const
-		{return GetBlockCipher().AlgorithmName() + std::string("/CCM");}
-	size_t MinKeyLength() const
-		{return GetBlockCipher().MinKeyLength();}
-	size_t MaxKeyLength() const
-		{return GetBlockCipher().MaxKeyLength();}
-	size_t DefaultKeyLength() const
-		{return GetBlockCipher().DefaultKeyLength();}
-	size_t GetValidKeyLength(size_t n) const
-		{return GetBlockCipher().GetValidKeyLength(n);}
-	bool IsValidKeyLength(size_t n) const
-		{return GetBlockCipher().IsValidKeyLength(n);}
-	unsigned int OptimalDataAlignment() const
-		{return GetBlockCipher().OptimalDataAlignment();}
-	IV_Requirement IVRequirement() const
-		{return UNIQUE_IV;}
-	unsigned int IVSize() const
-		{return 8;}
-	unsigned int MinIVLength() const
-		{return 7;}
-	unsigned int MaxIVLength() const
-		{return 13;}
-	unsigned int DigestSize() const
-		{return m_digestSize;}
-	lword MaxHeaderLength() const
-		{return W64LIT(0)-1;}
-	lword MaxMessageLength() const
-		{return m_L<8 ? (W64LIT(1)<<(8*m_L))-1 : W64LIT(0)-1;}
-	bool NeedsPrespecifiedDataLengths() const
-		{return true;}
-	void UncheckedSpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength);
-
-protected:
-	// AuthenticatedSymmetricCipherBase
-	bool AuthenticationIsOnPlaintext() const
-		{return true;}
-	unsigned int AuthenticationBlockSize() const
-		{return GetBlockCipher().BlockSize();}
-	void SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params);
-	void Resync(const byte *iv, size_t len);
-	size_t AuthenticateBlocks(const byte *data, size_t len);
-	void AuthenticateLastHeaderBlock();
-	void AuthenticateLastConfidentialBlock();
-	void AuthenticateLastFooterBlock(byte *mac, size_t macSize);
-	SymmetricCipher & AccessSymmetricCipher() {return m_ctr;}
-
-	virtual BlockCipher & AccessBlockCipher() =0;
-	virtual int DefaultDigestSize() const =0;
-
-	const BlockCipher & GetBlockCipher() const {return const_cast<CCM_Base *>(this)->AccessBlockCipher();};
-	byte *CBC_Buffer() {return m_buffer+REQUIRED_BLOCKSIZE;}
-
-	enum {REQUIRED_BLOCKSIZE = 16};
-	int m_digestSize, m_L;
-	word64 m_messageLength, m_aadLength;
-	CTR_Mode_ExternalCipher::Encryption m_ctr;
-};
-
-//! .
-template <class T_BlockCipher, int T_DefaultDigestSize, bool T_IsEncryption>
-class CCM_Final : public CCM_Base
-{
-public:
-	static std::string StaticAlgorithmName()
-		{return T_BlockCipher::StaticAlgorithmName() + std::string("/CCM");}
-	bool IsForwardTransformation() const
-		{return T_IsEncryption;}
-
-private:
-	BlockCipher & AccessBlockCipher() {return m_cipher;}
-	int DefaultDigestSize() const {return T_DefaultDigestSize;}
-	typename T_BlockCipher::Encryption m_cipher;
-};
-
-/// <a href="http://www.cryptolounge.org/wiki/CCM">CCM</a>
-template <class T_BlockCipher, int T_DefaultDigestSize = 16>
-struct CCM : public AuthenticatedSymmetricCipherDocumentation
-{
-	typedef CCM_Final<T_BlockCipher, T_DefaultDigestSize, true> Encryption;
-	typedef CCM_Final<T_BlockCipher, T_DefaultDigestSize, false> Decryption;
-};
-
-NAMESPACE_END
-
-#endif
+#ifndef CRYPTOPP_CCM_H
+#define CRYPTOPP_CCM_H
+
+#include "authenc.h"
+#include "modes.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+//! .
+class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CCM_Base : public AuthenticatedSymmetricCipherBase
+{
+public:
+	CCM_Base()
+		: m_digestSize(0), m_L(0) {}
+
+	// AuthenticatedSymmetricCipher
+	std::string AlgorithmName() const
+		{return GetBlockCipher().AlgorithmName() + std::string("/CCM");}
+	size_t MinKeyLength() const
+		{return GetBlockCipher().MinKeyLength();}
+	size_t MaxKeyLength() const
+		{return GetBlockCipher().MaxKeyLength();}
+	size_t DefaultKeyLength() const
+		{return GetBlockCipher().DefaultKeyLength();}
+	size_t GetValidKeyLength(size_t n) const
+		{return GetBlockCipher().GetValidKeyLength(n);}
+	bool IsValidKeyLength(size_t n) const
+		{return GetBlockCipher().IsValidKeyLength(n);}
+	unsigned int OptimalDataAlignment() const
+		{return GetBlockCipher().OptimalDataAlignment();}
+	IV_Requirement IVRequirement() const
+		{return UNIQUE_IV;}
+	unsigned int IVSize() const
+		{return 8;}
+	unsigned int MinIVLength() const
+		{return 7;}
+	unsigned int MaxIVLength() const
+		{return 13;}
+	unsigned int DigestSize() const
+		{return m_digestSize;}
+	lword MaxHeaderLength() const
+		{return W64LIT(0)-1;}
+	lword MaxMessageLength() const
+		{return m_L<8 ? (W64LIT(1)<<(8*m_L))-1 : W64LIT(0)-1;}
+	bool NeedsPrespecifiedDataLengths() const
+		{return true;}
+	void UncheckedSpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength);
+
+protected:
+	// AuthenticatedSymmetricCipherBase
+	bool AuthenticationIsOnPlaintext() const
+		{return true;}
+	unsigned int AuthenticationBlockSize() const
+		{return GetBlockCipher().BlockSize();}
+	void SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params);
+	void Resync(const byte *iv, size_t len);
+	size_t AuthenticateBlocks(const byte *data, size_t len);
+	void AuthenticateLastHeaderBlock();
+	void AuthenticateLastConfidentialBlock();
+	void AuthenticateLastFooterBlock(byte *mac, size_t macSize);
+	SymmetricCipher & AccessSymmetricCipher() {return m_ctr;}
+
+	virtual BlockCipher & AccessBlockCipher() =0;
+	virtual int DefaultDigestSize() const =0;
+
+	const BlockCipher & GetBlockCipher() const {return const_cast<CCM_Base *>(this)->AccessBlockCipher();};
+	byte *CBC_Buffer() {return m_buffer+REQUIRED_BLOCKSIZE;}
+
+	enum {REQUIRED_BLOCKSIZE = 16};
+	int m_digestSize, m_L;
+	word64 m_messageLength, m_aadLength;
+	CTR_Mode_ExternalCipher::Encryption m_ctr;
+};
+
+//! .
+template <class T_BlockCipher, int T_DefaultDigestSize, bool T_IsEncryption>
+class CCM_Final : public CCM_Base
+{
+public:
+	static std::string StaticAlgorithmName()
+		{return T_BlockCipher::StaticAlgorithmName() + std::string("/CCM");}
+	bool IsForwardTransformation() const
+		{return T_IsEncryption;}
+
+private:
+	BlockCipher & AccessBlockCipher() {return m_cipher;}
+	int DefaultDigestSize() const {return T_DefaultDigestSize;}
+	typename T_BlockCipher::Encryption m_cipher;
+};
+
+/// <a href="http://www.cryptolounge.org/wiki/CCM">CCM</a>
+template <class T_BlockCipher, int T_DefaultDigestSize = 16>
+struct CCM : public AuthenticatedSymmetricCipherDocumentation
+{
+	typedef CCM_Final<T_BlockCipher, T_DefaultDigestSize, true> Encryption;
+	typedef CCM_Final<T_BlockCipher, T_DefaultDigestSize, false> Decryption;
+};
+
+NAMESPACE_END
+
+#endif

File src/strategies/cryptopp/cmac.cpp

-// cmac.cpp - written and placed in the public domain by Wei Dai
-
-#include "pch.h"
-
-#ifndef CRYPTOPP_IMPORTS
-
-#include "cmac.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-static void MulU(byte *k, unsigned int length)
-{
-	byte carry = 0;
-
-	for (int i=length-1; i>=1; i-=2)
-	{
-		byte carry2 = k[i] >> 7;
-		k[i] += k[i] + carry;
-		carry = k[i-1] >> 7;
-		k[i-1] += k[i-1] + carry2;
-	}
-
-	if (carry)
-	{
-		switch (length)
-		{
-		case 8:
-			k[7] ^= 0x1b;
-			break;
-		case 16:
-			k[15] ^= 0x87;
-			break;
-		case 32:
-			k[30] ^= 4; 
-			k[31] ^= 0x23;
-			break;
-		default:
-			throw InvalidArgument("CMAC: " + IntToString(length) + " is not a supported cipher block size");
-		}
-	}
-}
-
-void CMAC_Base::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)
-{
-	BlockCipher &cipher = AccessCipher();
-	unsigned int blockSize = cipher.BlockSize();
-
-	cipher.SetKey(key, length, params);
-	m_reg.CleanNew(3*blockSize);
-	m_counter = 0;
-
-	cipher.ProcessBlock(m_reg, m_reg+blockSize);
-	MulU(m_reg+blockSize, blockSize);
-	memcpy(m_reg+2*blockSize, m_reg+blockSize, blockSize);
-	MulU(m_reg+2*blockSize, blockSize);
-}
-
-void CMAC_Base::Update(const byte *input, size_t length)
-{
-	if (!length)
-		return;
-
-	BlockCipher &cipher = AccessCipher();
-	unsigned int blockSize = cipher.BlockSize();
-
-	if (m_counter > 0)
-	{
-		unsigned int len = UnsignedMin(blockSize - m_counter, length);
-		xorbuf(m_reg+m_counter, input, len);
-		length -= len;
-		input += len;
-		m_counter += len;
-
-		if (m_counter == blockSize && length > 0)
-		{
-			cipher.ProcessBlock(m_reg);
-			m_counter = 0;
-		}
-	}
-
-	if (length > blockSize)
-	{
-		assert(m_counter == 0);
-		size_t leftOver = 1 + cipher.AdvancedProcessBlocks(m_reg, input, m_reg, length-1, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
-		input += (length - leftOver);
-		length = leftOver;
-	}
-
-	if (length > 0)
-	{
-		assert(m_counter + length <= blockSize);
-		xorbuf(m_reg+m_counter, input, length);
-		m_counter += (unsigned int)length;
-	}
-
-	assert(m_counter > 0);
-}
-
-void CMAC_Base::TruncatedFinal(byte *mac, size_t size)
-{
-	ThrowIfInvalidTruncatedSize(size);
-
-	BlockCipher &cipher = AccessCipher();
-	unsigned int blockSize = cipher.BlockSize();
-
-	if (m_counter < blockSize)
-	{
-		m_reg[m_counter] ^= 0x80;
-		cipher.AdvancedProcessBlocks(m_reg, m_reg+2*blockSize, m_reg, blockSize, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
-	}
-	else
-		cipher.AdvancedProcessBlocks(m_reg, m_reg+blockSize, m_reg, blockSize, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
-
-	memcpy(mac, m_reg, size);
-
-	m_counter = 0;
-	memset(m_reg, 0, blockSize);
-}
-
-NAMESPACE_END
-
-#endif
+// cmac.cpp - written and placed in the public domain by Wei Dai
+
+#include "pch.h"
+
+#ifndef CRYPTOPP_IMPORTS
+
+#include "cmac.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+static void MulU(byte *k, unsigned int length)
+{
+	byte carry = 0;
+
+	for (int i=length-1; i>=1; i-=2)
+	{
+		byte carry2 = k[i] >> 7;
+		k[i] += k[i] + carry;
+		carry = k[i-1] >> 7;
+		k[i-1] += k[i-1] + carry2;
+	}
+
+	if (carry)
+	{
+		switch (length)
+		{
+		case 8:
+			k[7] ^= 0x1b;
+			break;
+		case 16:
+			k[15] ^= 0x87;
+			break;
+		case 32:
+			k[30] ^= 4; 
+			k[31] ^= 0x23;
+			break;
+		default:
+			throw InvalidArgument("CMAC: " + IntToString(length) + " is not a supported cipher block size");
+		}
+	}
+}
+
+void CMAC_Base::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)
+{
+	BlockCipher &cipher = AccessCipher();
+	unsigned int blockSize = cipher.BlockSize();
+
+	cipher.SetKey(key, length, params);
+	m_reg.CleanNew(3*blockSize);
+	m_counter = 0;
+
+	cipher.ProcessBlock(m_reg, m_reg+blockSize);
+	MulU(m_reg+blockSize, blockSize);
+	memcpy(m_reg+2*blockSize, m_reg+blockSize, blockSize);
+	MulU(m_reg+2*blockSize, blockSize);
+}
+
+void CMAC_Base::Update(const byte *input, size_t length)
+{
+	if (!length)
+		return;
+
+	BlockCipher &cipher = AccessCipher();
+	unsigned int blockSize = cipher.BlockSize();
+
+	if (m_counter > 0)
+	{
+		unsigned int len = UnsignedMin(blockSize - m_counter, length);
+		xorbuf(m_reg+m_counter, input, len);
+		length -= len;
+		input += len;
+		m_counter += len;
+
+		if (m_counter == blockSize && length > 0)
+		{
+			cipher.ProcessBlock(m_reg);
+			m_counter = 0;
+		}
+	}
+
+	if (length > blockSize)
+	{
+		assert(m_counter == 0);
+		size_t leftOver = 1 + cipher.AdvancedProcessBlocks(m_reg, input, m_reg, length-1, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
+		input += (length - leftOver);
+		length = leftOver;
+	}
+
+	if (length > 0)
+	{
+		assert(m_counter + length <= blockSize);
+		xorbuf(m_reg+m_counter, input, length);
+		m_counter += (unsigned int)length;
+	}
+
+	assert(m_counter > 0);
+}
+
+void CMAC_Base::TruncatedFinal(byte *mac, size_t size)
+{
+	ThrowIfInvalidTruncatedSize(size);
+
+	BlockCipher &cipher = AccessCipher();
+	unsigned int blockSize = cipher.BlockSize();
+
+	if (m_counter < blockSize)
+	{
+		m_reg[m_counter] ^= 0x80;
+		cipher.AdvancedProcessBlocks(m_reg, m_reg+2*blockSize, m_reg, blockSize, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
+	}
+	else
+		cipher.AdvancedProcessBlocks(m_reg, m_reg+blockSize, m_reg, blockSize, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
+
+	memcpy(mac, m_reg, size);
+
+	m_counter = 0;
+	memset(m_reg, 0, blockSize);
+}
+
+NAMESPACE_END
+
+#endif

File src/strategies/cryptopp/cmac.h

-#ifndef CRYPTOPP_CMAC_H
-#define CRYPTOPP_CMAC_H
-
-#include "seckey.h"
-#include "secblock.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-//! _
-class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CMAC_Base : public MessageAuthenticationCode
-{
-public:
-	CMAC_Base() {}
-
-	void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
-	void Update(const byte *input, size_t length);
-	void TruncatedFinal(byte *mac, size_t size);
-	unsigned int DigestSize() const {return GetCipher().BlockSize();}
-	unsigned int OptimalBlockSize() const {return GetCipher().BlockSize();}
-	unsigned int OptimalDataAlignment() const {return GetCipher().OptimalDataAlignment();}
-
-protected:
-	friend class EAX_Base;
-
-	const BlockCipher & GetCipher() const {return const_cast<CMAC_Base*>(this)->AccessCipher();}
-	virtual BlockCipher & AccessCipher() =0;
-
-	void ProcessBuf();
-	SecByteBlock m_reg;
-	unsigned int m_counter;
-};
-
-/// <a href="http://www.cryptolounge.org/wiki/CMAC">CMAC</a>
-/*! Template parameter T should be a class derived from BlockCipherDocumentation, for example AES, with a block size of 8, 16, or 32 */
-template <class T>
-class CMAC : public MessageAuthenticationCodeImpl<CMAC_Base, CMAC<T> >, public SameKeyLengthAs<T>
-{
-public:
-	CMAC() {}
-	CMAC(const byte *key, size_t length=SameKeyLengthAs<T>::DEFAULT_KEYLENGTH)
-		{this->SetKey(key, length);}
-
-	static std::string StaticAlgorithmName() {return std::string("CMAC(") + T::StaticAlgorithmName() + ")";}
-
-private:
-	BlockCipher & AccessCipher() {return m_cipher;}
-	typename T::Encryption m_cipher;
-};
-
-NAMESPACE_END
-
-#endif
+#ifndef CRYPTOPP_CMAC_H
+#define CRYPTOPP_CMAC_H
+
+#include "seckey.h"
+#include "secblock.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+//! _
+class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CMAC_Base : public MessageAuthenticationCode
+{
+public:
+	CMAC_Base() {}
+
+	void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
+	void Update(const byte *input, size_t length);
+	void TruncatedFinal(byte *mac, size_t size);
+	unsigned int DigestSize() const {return GetCipher().BlockSize();}
+	unsigned int OptimalBlockSize() const {return GetCipher().BlockSize();}
+	unsigned int OptimalDataAlignment() const {return GetCipher().OptimalDataAlignment();}
+
+protected:
+	friend class EAX_Base;
+
+	const BlockCipher & GetCipher() const {return const_cast<CMAC_Base*>(this)->AccessCipher();}
+	virtual BlockCipher & AccessCipher() =0;
+
+	void ProcessBuf();
+	SecByteBlock m_reg;
+	unsigned int m_counter;
+};
+
+/// <a href="http://www.cryptolounge.org/wiki/CMAC">CMAC</a>
+/*! Template parameter T should be a class derived from BlockCipherDocumentation, for example AES, with a block size of 8, 16, or 32 */
+template <class T>
+class CMAC : public MessageAuthenticationCodeImpl<CMAC_Base, CMAC<T> >, public SameKeyLengthAs<T>
+{
+public:
+	CMAC() {}
+	CMAC(const byte *key, size_t length=SameKeyLengthAs<T>::DEFAULT_KEYLENGTH)
+		{this->SetKey(key, length);}
+
+	static std::string StaticAlgorithmName() {return std::string("CMAC(") + T::StaticAlgorithmName() + ")";}
+
+private:
+	BlockCipher & AccessCipher() {return m_cipher;}
+	typename T::Encryption m_cipher;
+};
+
+NAMESPACE_END
+
+#endif

File src/strategies/cryptopp/config.h

 // This macro will be ignored if NO_OS_DEPENDENCE is defined.
 #define USE_MS_CRYPTOAPI
 
-// Define this to 1 to enforce the requirement in FIPS 186-2 Change Notice 1 that only 1024 bit moduli be used
-#ifndef DSA_1024_BIT_MODULUS_ONLY
-#	define DSA_1024_BIT_MODULUS_ONLY 1
-#endif
-
 // ***************** Less Important Settings ***************
 
 // define this to retain (as much as possible) old deprecated function and class names
 	#define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
 #endif
 
-#define CRYPTOPP_VERSION 561
+#define CRYPTOPP_VERSION 562
 
 // ***************** determine availability of OS features ********************
 

File src/strategies/cryptopp/cryptlib.h

 	classes that provide a uniform interface to this library.
 */
 
-/*!	\mainpage Crypto++ Library 5.6.1 API Reference
+/*!	\mainpage Crypto++ Library 5.6.2 API Reference
 <dl>
 <dt>Abstract Base Classes<dd>
 	cryptlib.h
 <dt>Public Key Cryptosystems<dd>
 	DLIES, ECIES, LUCES, RSAES, RabinES, LUC_IES
 <dt>Public Key Signature Schemes<dd>
-	DSA, GDSA, ECDSA, NR, ECNR, LUCSS, RSASS, RSASS_ISO, RabinSS, RWSS, ESIGN
+	DSA2, GDSA, ECDSA, NR, ECNR, LUCSS, RSASS, RSASS_ISO, RabinSS, RWSS, ESIGN
 <dt>Key Agreement<dd>
 	#DH, DH2, #MQV, ECDH, ECMQV, XTR_DH
 <dt>Algebraic Structures<dd>

File src/strategies/cryptopp/dsa.cpp

 	return (size_t)sink.TotalPutLength();
 }
 
-bool DSA::GeneratePrimes(const byte *seedIn, unsigned int g, int &counter,
-						  Integer &p, unsigned int L, Integer &q, bool useInputCounterValue)
-{
-	assert(g%8 == 0);
-
-	SHA sha;
-	SecByteBlock seed(seedIn, g/8);
-	SecByteBlock U(SHA::DIGESTSIZE);
-	SecByteBlock temp(SHA::DIGESTSIZE);
-	SecByteBlock W(((L-1)/160+1) * SHA::DIGESTSIZE);
-	const int n = (L-1) / 160;
-	const int b = (L-1) % 160;
-	Integer X;
-
-	sha.CalculateDigest(U, seed, g/8);
-
-	for (int i=g/8-1, carry=true; i>=0 && carry; i--)
-		carry=!++seed[i];
-
-	sha.CalculateDigest(temp, seed, g/8);
-	xorbuf(U, temp, SHA::DIGESTSIZE);
-
-	U[0] |= 0x80;
-	U[SHA::DIGESTSIZE-1] |= 1;
-	q.Decode(U, SHA::DIGESTSIZE);
-
-	if (!IsPrime(q))
-		return false;
-
-	int counterEnd = useInputCounterValue ? counter+1 : 4096;
-
-	for (int c = 0; c < counterEnd; c++)
-	{
-		for (int k=0; k<=n; k++)
-		{
-			for (int i=g/8-1, carry=true; i>=0 && carry; i--)
-				carry=!++seed[i];
-			if (!useInputCounterValue || c == counter)
-				sha.CalculateDigest(W+(n-k)*SHA::DIGESTSIZE, seed, g/8);
-		}
-		if (!useInputCounterValue || c == counter)
-		{
-			W[SHA::DIGESTSIZE - 1 - b/8] |= 0x80;
-			X.Decode(W + SHA::DIGESTSIZE - 1 - b/8, L/8);
-			p = X-((X % (2*q))-1);
-
-			if (p.GetBit(L-1) && IsPrime(p))
-			{
-				counter = c;
-				return true;
-			}
-		}
-	}
-	return false;
-}
-
 NAMESPACE_END
 
 #endif

File src/strategies/cryptopp/eax.cpp

-// eax.cpp - written and placed in the public domain by Wei Dai
-
-#include "pch.h"
-#include "eax.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-void EAX_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params)
-{
-	AccessMAC().SetKey(userKey, keylength, params);
-	m_buffer.New(2*AccessMAC().TagSize());
-}
-
-void EAX_Base::Resync(const byte *iv, size_t len)
-{
-	MessageAuthenticationCode &mac = AccessMAC();
-	unsigned int blockSize = mac.TagSize();
-
-	memset(m_buffer, 0, blockSize);
-	mac.Update(m_buffer, blockSize);
-	mac.CalculateDigest(m_buffer+blockSize, iv, len);
-
-	m_buffer[blockSize-1] = 1;
-	mac.Update(m_buffer, blockSize);
-
-	m_ctr.SetCipherWithIV(AccessMAC().AccessCipher(), m_buffer+blockSize, blockSize);
-}
-
-size_t EAX_Base::AuthenticateBlocks(const byte *data, size_t len)
-{
-	AccessMAC().Update(data, len);
-	return 0;
-}
-
-void EAX_Base::AuthenticateLastHeaderBlock()
-{
-	assert(m_bufferedDataLength == 0);
-	MessageAuthenticationCode &mac = AccessMAC();
-	unsigned int blockSize = mac.TagSize();
-
-	mac.Final(m_buffer);
-	xorbuf(m_buffer+blockSize, m_buffer, blockSize);
-
-	memset(m_buffer, 0, blockSize);
-	m_buffer[blockSize-1] = 2;
-	mac.Update(m_buffer, blockSize);
-}
-
-void EAX_Base::AuthenticateLastFooterBlock(byte *tag, size_t macSize)
-{
-	assert(m_bufferedDataLength == 0);
-	MessageAuthenticationCode &mac = AccessMAC();
-	unsigned int blockSize = mac.TagSize();
-
-	mac.TruncatedFinal(m_buffer, macSize);
-	xorbuf(tag, m_buffer, m_buffer+blockSize, macSize);
-}
-
-NAMESPACE_END
+// eax.cpp - written and placed in the public domain by Wei Dai
+
+#include "pch.h"
+#include "eax.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+void EAX_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params)
+{
+	AccessMAC().SetKey(userKey, keylength, params);
+	m_buffer.New(2*AccessMAC().TagSize());
+}
+
+void EAX_Base::Resync(const byte *iv, size_t len)
+{
+	MessageAuthenticationCode &mac = AccessMAC();
+	unsigned int blockSize = mac.TagSize();
+
+	memset(m_buffer, 0, blockSize);
+	mac.Update(m_buffer, blockSize);
+	mac.CalculateDigest(m_buffer+blockSize, iv, len);
+
+	m_buffer[blockSize-1] = 1;
+	mac.Update(m_buffer, blockSize);
+
+	m_ctr.SetCipherWithIV(AccessMAC().AccessCipher(), m_buffer+blockSize, blockSize);
+}
+
+size_t EAX_Base::AuthenticateBlocks(const byte *data, size_t len)
+{
+	AccessMAC().Update(data, len);
+	return 0;
+}
+
+void EAX_Base::AuthenticateLastHeaderBlock()
+{
+	assert(m_bufferedDataLength == 0);
+	MessageAuthenticationCode &mac = AccessMAC();
+	unsigned int blockSize = mac.TagSize();
+
+	mac.Final(m_buffer);
+	xorbuf(m_buffer+blockSize, m_buffer, blockSize);
+
+	memset(m_buffer, 0, blockSize);
+	m_buffer[blockSize-1] = 2;
+	mac.Update(m_buffer, blockSize);
+}
+
+void EAX_Base::AuthenticateLastFooterBlock(byte *tag, size_t macSize)
+{
+	assert(m_bufferedDataLength == 0);
+	MessageAuthenticationCode &mac = AccessMAC();
+	unsigned int blockSize = mac.TagSize();
+
+	mac.TruncatedFinal(m_buffer, macSize);
+	xorbuf(tag, m_buffer, m_buffer+blockSize, macSize);
+}
+
+NAMESPACE_END

File src/strategies/cryptopp/eccrypto.cpp

 {
 	// this array must be sorted by OID
 	static const EcRecommendedParameters<EC2N> rec[] = {
-		EcRecommendedParameters<EC2N>(ASN1::sect163k1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect163k1(), 
 			163, 7, 6, 3, 0,
 			"000000000000000000000000000000000000000001",
 			"000000000000000000000000000000000000000001",
 			"0402FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE80289070FB05D38FF58321F2E800536D538CCDAA3D9",
 			"04000000000000000000020108A2E0CC0D99F8A5EF",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect163r1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect163r1(), 
 			163, 7, 6, 3, 0,
 			"07B6882CAAEFA84F9554FF8428BD88E246D2782AE2",
 			"0713612DCDDCB40AAB946BDA29CA91F73AF958AFD9",
 			"040369979697AB43897789566789567F787A7876A65400435EDB42EFAFB2989D51FEFCE3C80988F41FF883",
 			"03FFFFFFFFFFFFFFFFFFFF48AAB689C29CA710279B",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect239k1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect239k1(), 
 			239, 158, 0,
 			"000000000000000000000000000000000000000000000000000000000000",
 			"000000000000000000000000000000000000000000000000000000000001",
 			"04009D73616F35F4AB1407D73562C10F00A52830277958EE84D1315ED31886",
 			"0100000000000000D9CCEC8A39E56F",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect113r2(),
+		EcRecommendedParameters<EC2N>(ASN1::sect113r2(), 
 			113, 9, 0,
 			"00689918DBEC7E5A0DD6DFC0AA55C7",
 			"0095E9A9EC9B297BD4BF36E059184F",
 			"0401A57A6A7B26CA5EF52FCDB816479700B3ADC94ED1FE674C06E695BABA1D",
 			"010000000000000108789B2496AF93",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect163r2(),
+		EcRecommendedParameters<EC2N>(ASN1::sect163r2(), 
 			163, 7, 6, 3, 0,
 			"000000000000000000000000000000000000000001",
 			"020A601907B8C953CA1481EB10512F78744A3205FD",
 			"0403F0EBA16286A2D57EA0991168D4994637E8343E3600D51FBC6C71A0094FA2CDD545B11C5C0C797324F1",
 			"040000000000000000000292FE77E70C12A4234C33",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect283k1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect283k1(), 
 			283, 12, 7, 5, 0,
 			"000000000000000000000000000000000000000000000000000000000000000000000000",
 			"000000000000000000000000000000000000000000000000000000000000000000000001",
 			"040503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC245849283601CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259",
 			"01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61",
 			4),
-		EcRecommendedParameters<EC2N>(ASN1::sect283r1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect283r1(), 
 			283, 12, 7, 5, 0,
 			"000000000000000000000000000000000000000000000000000000000000000000000001",
 			"027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5",
 			"0405F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B1205303676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4",
 			"03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect131r1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect131r1(), 
 			131, 8, 3, 2, 0,
 			"07A11B09A76B562144418FF3FF8C2570B8",
 			"0217C05610884B63B9C6C7291678F9D341",
 			"040081BAF91FDF9833C40F9C181343638399078C6E7EA38C001F73C8134B1B4EF9E150",
 			"0400000000000000023123953A9464B54D",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect131r2(),
+		EcRecommendedParameters<EC2N>(ASN1::sect131r2(), 
 			131, 8, 3, 2, 0,
 			"03E5A88919D7CAFCBF415F07C2176573B2",
 			"04B8266A46C55657AC734CE38F018F2192",
 			"040356DCD8F2F95031AD652D23951BB366A80648F06D867940A5366D9E265DE9EB240F",
 			"0400000000000000016954A233049BA98F",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect193r1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect193r1(), 
 			193, 15, 0,
 			"0017858FEB7A98975169E171F77B4087DE098AC8A911DF7B01",
 			"00FDFB49BFE6C3A89FACADAA7A1E5BBC7CC1C2E5D831478814",
 			"0401F481BC5F0FF84A74AD6CDF6FDEF4BF6179625372D8C0C5E10025E399F2903712CCF3EA9E3A1AD17FB0B3201B6AF7CE1B05",
 			"01000000000000000000000000C7F34A778F443ACC920EBA49",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect193r2(),
+		EcRecommendedParameters<EC2N>(ASN1::sect193r2(), 
 			193, 15, 0,
 			"0163F35A5137C2CE3EA6ED8667190B0BC43ECD69977702709B",
 			"00C9BB9E8927D4D64C377E2AB2856A5B16E3EFB7F61D4316AE",
 			"0400D9B67D192E0367C803F39E1A7E82CA14A651350AAE617E8F01CE94335607C304AC29E7DEFBD9CA01F596F927224CDECF6C",
 			"010000000000000000000000015AAB561B005413CCD4EE99D5",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect233k1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect233k1(), 
 			233, 74, 0,
 			"000000000000000000000000000000000000000000000000000000000000",
 			"000000000000000000000000000000000000000000000000000000000001",
 			"04017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD612601DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3",
 			"8000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF",
 			4),
-		EcRecommendedParameters<EC2N>(ASN1::sect233r1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect233r1(), 
 			233, 74, 0,
 			"000000000000000000000000000000000000000000000000000000000001",
 			"0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD",
 			"0400FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052",
 			"01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect409k1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect409k1(), 
 			409, 87, 0,
 			"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
 			"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
 			"040060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE902374601E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B",
 			"7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF",
 			4),
-		EcRecommendedParameters<EC2N>(ASN1::sect409r1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect409r1(), 
 			409, 87, 0,
 			"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
 			"0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F",
 			"04015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A70061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706",
 			"010000000000000000000000000000000000000000000000000001E2AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173",
 			2),
-		EcRecommendedParameters<EC2N>(ASN1::sect571k1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect571k1(), 
 			571, 10, 5, 2, 0,
 			"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
 			"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
 			"04026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C89720349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3",
 			"020000000000000000000000000000000000000000000000000000000000000000000000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001",
 			4),
-		EcRecommendedParameters<EC2N>(ASN1::sect571r1(),
+		EcRecommendedParameters<EC2N>(ASN1::sect571r1(), 
 			571, 10, 5, 2, 0,
 			"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
 			"02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFABBD8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F2955727A",

File src/strategies/cryptopp/factory.h