Crypto++ 3.0 Porting Note to Visual C++ 5.0 (SP3) Summary: VC 5 cannot handle the CryptoPP namespace properly, and crashes upon compilation. A workaround has been designed to create a macro called PARTIAL_NAMESPACE. This will cause the CryptoPP namespace to not exist, but the code will still use the std:: namespace for all Standard library stuff. VC 5 also chokes on a couple of classes that derive with templates, and these are fixed via a simple typedef as used per the Crypto++ 2.3 libraries. Code changes: ----------------------------------------------------------- File config.h -- ----------------------------------------------------------- Below: #ifdef __GNUC__ #define NO_NAMESPACE #endif Add the following lines of code: #if (_MSC_VER == 1100) || defined(__BORLANDC__) //MSVC version 5.0 or //C++ Builder #define PARTIAL_NAMESPACE #endif Locate: #ifdef NO_NAMESPACE #define std #define CryptoPP #define USING_NAMESPACE(x) #define NAMESPACE_BEGIN(x) #define NAMESPACE_END #define ANONYMOUS_NAMESPACE_BEGIN #else #define USING_NAMESPACE(x) using namespace x; #define USING_NAMESPACE_STD using namespace std; #define NAMESPACE_BEGIN(x) namespace x { #define ANONYMOUS_NAMESPACE_BEGIN namespace { #define NAMESPACE_END } #endif And change it to: #ifdef NO_NAMESPACE #define std #define CryptoPP #define USING_NAMESPACE(x) #define NAMESPACE_BEGIN(x) #define NAMESPACE_END #define ANONYMOUS_NAMESPACE_BEGIN #define USING_NAMESPACE_STD #elif defined PARTIAL_NAMESPACE #define CryptoPP #define USING_NAMESPACE(x) #define USING_NAMESPACE_STD using namespace std; #define NAMESPACE_BEGIN(x) #define NAMESPACE_END #define ANONYMOUS_NAMESPACE_BEGIN #else #define USING_NAMESPACE(x) using namespace x; #define USING_NAMESPACE_STD using namespace std; #define NAMESPACE_BEGIN(x) namespace x { #define ANONYMOUS_NAMESPACE_BEGIN namespace { #define NAMESPACE_END } #endif ----------------------------------------------------------- File ECC Crypto.h -- ----------------------------------------------------------- At the top of the file: Below: template <class T> class EcPrecomputation; Add the lines: typedef PK_WithPrecomputation<PK_FixedLengthEncryptor> PKWPFLE; typedef PK_WithPrecomputation<DigestVerifier> PKWDV; Change the line template <class EC> class ECPublicKey : public PK_WithPrecomputation<PK_FixedLengthEncryptor>, public PK_WithPrecomputation<DigestVerifier> to template <class EC> class ECPublicKey : public PKWPFLE, public PKWDV ----------------------------------------------------------- ----------------------------------------------------------- That's it for the main library. To compile the test executable, perform the following changes: ----------------------------------------------------------- Files bench.cpp, test.cpp, validat1.cpp, validat2.cpp, validat3.cpp -- ----------------------------------------------------------- Change the line near the top of the file that reads: USING_NAMESPACE(std) to USING_NAMESPACE_STD ----------------------------------------------------------- ***OPTIONAL*** ----------------------------------------------------------- You might want to grep the entire project and replace all occurances of Exception with CryptlibException (which was the name for it in the 2.3 release) this way since there is no CryptoPP:: namespace wrapper over the name Exception, you run less of a chance of conflicting with another company's "Exception" class.