diff options
Diffstat (limited to 'lib/crypto')
-rw-r--r-- | lib/crypto/CipherAES.cpp | 4 | ||||
-rw-r--r-- | lib/crypto/CipherAES.h | 4 | ||||
-rwxr-xr-x | lib/crypto/CipherBlowfish.cpp | 16 | ||||
-rwxr-xr-x | lib/crypto/CipherBlowfish.h | 6 | ||||
-rwxr-xr-x | lib/crypto/CipherContext.cpp | 24 | ||||
-rwxr-xr-x | lib/crypto/CipherContext.h | 4 | ||||
-rwxr-xr-x | lib/crypto/CipherDescription.h | 2 | ||||
-rwxr-xr-x | lib/crypto/Random.cpp | 4 |
8 files changed, 32 insertions, 32 deletions
diff --git a/lib/crypto/CipherAES.cpp b/lib/crypto/CipherAES.cpp index b4de6048..fad8b968 100644 --- a/lib/crypto/CipherAES.cpp +++ b/lib/crypto/CipherAES.cpp @@ -10,7 +10,7 @@ #include "Box.h" // Only available in new versions of openssl -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL #include <openssl/evp.h> @@ -159,5 +159,5 @@ void CipherAES::SetupParameters(EVP_CIPHER_CTX *pCipherContext) const -#endif // n PLATFORM_OLD_OPENSSL +#endif // n HAVE_OLD_SSL diff --git a/lib/crypto/CipherAES.h b/lib/crypto/CipherAES.h index 51fb146a..50b96dc3 100644 --- a/lib/crypto/CipherAES.h +++ b/lib/crypto/CipherAES.h @@ -11,7 +11,7 @@ #define CIPHERAES__H // Only available in new versions of openssl -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL #include "CipherDescription.h" @@ -44,7 +44,7 @@ private: const void *mpInitialisationVector; }; -#endif // n PLATFORM_OLD_OPENSSL +#endif // n HAVE_OLD_SSL #endif // CIPHERAES__H diff --git a/lib/crypto/CipherBlowfish.cpp b/lib/crypto/CipherBlowfish.cpp index e27e3b0a..e16cc6ed 100755 --- a/lib/crypto/CipherBlowfish.cpp +++ b/lib/crypto/CipherBlowfish.cpp @@ -11,7 +11,7 @@ #include <openssl/evp.h> -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL #include <string.h> #include <strings.h> #endif @@ -34,7 +34,7 @@ CipherBlowfish::CipherBlowfish(CipherDescription::CipherMode Mode, const void *pKey, unsigned int KeyLength, const void *pInitialisationVector) : CipherDescription(), mMode(Mode) -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL , mpKey(pKey), mKeyLength(KeyLength), mpInitialisationVector(pInitialisationVector) @@ -66,7 +66,7 @@ CipherBlowfish::CipherBlowfish(CipherDescription::CipherMode Mode, const void *p CipherBlowfish::CipherBlowfish(const CipherBlowfish &rToCopy) : CipherDescription(rToCopy), mMode(rToCopy.mMode), -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL mpKey(rToCopy.mpKey), mKeyLength(rToCopy.mKeyLength), mpInitialisationVector(rToCopy.mpInitialisationVector) @@ -80,7 +80,7 @@ CipherBlowfish::CipherBlowfish(const CipherBlowfish &rToCopy) #endif -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL // Hack functions to support old OpenSSL API CipherDescription *CipherBlowfish::Clone() const { @@ -110,7 +110,7 @@ void CipherBlowfish::SetIV(const void *pIV) // -------------------------------------------------------------------------- CipherBlowfish::~CipherBlowfish() { -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL // Zero copy of key for(unsigned int l = 0; l < mKey.size(); ++l) { @@ -134,7 +134,7 @@ CipherBlowfish &CipherBlowfish::operator=(const CipherBlowfish &rToCopy) CipherDescription::operator=(rToCopy); mMode = rToCopy.mMode; -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL mpKey = rToCopy.mpKey; mKeyLength = rToCopy.mKeyLength; mpInitialisationVector = rToCopy.mpInitialisationVector; @@ -196,7 +196,7 @@ void CipherBlowfish::SetupParameters(EVP_CIPHER_CTX *pCipherContext) const ASSERT(pCipherContext != 0); // Set key length -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL if(EVP_CIPHER_CTX_set_key_length(pCipherContext, mKeyLength) != 1) #else if(EVP_CIPHER_CTX_set_key_length(pCipherContext, mKey.size()) != 1) @@ -205,7 +205,7 @@ void CipherBlowfish::SetupParameters(EVP_CIPHER_CTX *pCipherContext) const THROW_EXCEPTION(CipherException, EVPBadKeyLength) } // Set key -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL if(EVP_CipherInit_ex(pCipherContext, NULL, NULL, (unsigned char*)mpKey, (unsigned char*)mpInitialisationVector, -1) != 1) #else if(EVP_CipherInit(pCipherContext, NULL, (unsigned char*)mKey.c_str(), (unsigned char*)mInitialisationVector, -1) != 1) diff --git a/lib/crypto/CipherBlowfish.h b/lib/crypto/CipherBlowfish.h index 92db1d85..b3bcf028 100755 --- a/lib/crypto/CipherBlowfish.h +++ b/lib/crypto/CipherBlowfish.h @@ -10,7 +10,7 @@ #ifndef CIPHERBLOWFISH__H #define CIPHERBLOWFISH__H -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL #include <string> #endif @@ -38,14 +38,14 @@ public: // Setup any other parameters virtual void SetupParameters(EVP_CIPHER_CTX *pCipherContext) const; -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL CipherDescription *Clone() const; void SetIV(const void *pIV); #endif private: CipherDescription::CipherMode mMode; -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL const void *mpKey; unsigned int mKeyLength; const void *mpInitialisationVector; diff --git a/lib/crypto/CipherContext.cpp b/lib/crypto/CipherContext.cpp index 42707497..8c3b25b2 100755 --- a/lib/crypto/CipherContext.cpp +++ b/lib/crypto/CipherContext.cpp @@ -29,7 +29,7 @@ CipherContext::CipherContext() : mInitialised(false), mWithinTransform(false), mPaddingOn(true) -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL , mFunction(Decrypt), mpDescription(0) #endif @@ -52,7 +52,7 @@ CipherContext::~CipherContext() EVP_CIPHER_CTX_cleanup(&ctx); mInitialised = false; } -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL if(mpDescription != 0) { delete mpDescription; @@ -83,7 +83,7 @@ void CipherContext::Init(CipherContext::CipherFunction Function, const CipherDes } // Initialise the cipher -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL EVP_CIPHER_CTX_init(&ctx); // no error return code, even though the docs says it does if(EVP_CipherInit_ex(&ctx, rDescription.GetCipher(), NULL, NULL, NULL, Function) != 1) @@ -100,7 +100,7 @@ void CipherContext::Init(CipherContext::CipherFunction Function, const CipherDes try { -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL // Let the description set up everything else rDescription.SetupParameters(&ctx); #else @@ -137,7 +137,7 @@ void CipherContext::Reset() EVP_CIPHER_CTX_cleanup(&ctx); mInitialised = false; } -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL if(mpDescription != 0) { delete mpDescription; @@ -270,7 +270,7 @@ int CipherContext::Final(void *pOutBuffer, int OutLength) // Do the transform int outLength = OutLength; -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL if(EVP_CipherFinal_ex(&ctx, (unsigned char*)pOutBuffer, &outLength) != 1) { THROW_EXCEPTION(CipherException, EVPFinalFailure) @@ -285,7 +285,7 @@ int CipherContext::Final(void *pOutBuffer, int OutLength) } -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL // -------------------------------------------------------------------------- // // Function @@ -458,7 +458,7 @@ int CipherContext::TransformBlock(void *pOutBuffer, int OutLength, const void *p } // Finalise int outLength2 = OutLength - outLength; -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL if(EVP_CipherFinal_ex(&ctx, ((unsigned char*)pOutBuffer) + outLength, &outLength2) != 1) { THROW_EXCEPTION(CipherException, EVPFinalFailure) @@ -472,7 +472,7 @@ int CipherContext::TransformBlock(void *pOutBuffer, int OutLength, const void *p { // Finalise the context, so definately ready for the next caller int outs = OutLength; -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL EVP_CipherFinal_ex(&ctx, (unsigned char*)pOutBuffer, &outs); #else OldOpenSSLFinal((unsigned char*)pOutBuffer, outs); @@ -530,7 +530,7 @@ void CipherContext::SetIV(const void *pIV) THROW_EXCEPTION(CipherException, EVPInitFailure) } -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL // Update description if(mpDescription != 0) { @@ -578,7 +578,7 @@ const void *CipherContext::SetRandomIV(int &rLengthOut) THROW_EXCEPTION(CipherException, EVPInitFailure) } -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL // Update description if(mpDescription != 0) { @@ -602,7 +602,7 @@ const void *CipherContext::SetRandomIV(int &rLengthOut) // -------------------------------------------------------------------------- void CipherContext::UsePadding(bool Padding) { -#ifndef PLATFORM_OLD_OPENSSL +#ifndef HAVE_OLD_SSL if(EVP_CIPHER_CTX_set_padding(&ctx, Padding) != 1) { THROW_EXCEPTION(CipherException, EVPSetPaddingFailure) diff --git a/lib/crypto/CipherContext.h b/lib/crypto/CipherContext.h index f9dcd022..64ce52d8 100755 --- a/lib/crypto/CipherContext.h +++ b/lib/crypto/CipherContext.h @@ -62,7 +62,7 @@ public: void UsePadding(bool Padding = true); -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL void OldOpenSSLFinal(unsigned char *Buffer, int &rOutLengthOut); #endif @@ -72,7 +72,7 @@ private: bool mWithinTransform; bool mPaddingOn; uint8_t mGeneratedIV[CIPHERCONTEXT_MAX_GENERATED_IV_LENGTH]; -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL CipherFunction mFunction; CipherDescription *mpDescription; #endif diff --git a/lib/crypto/CipherDescription.h b/lib/crypto/CipherDescription.h index 2977f7da..f825eefa 100755 --- a/lib/crypto/CipherDescription.h +++ b/lib/crypto/CipherDescription.h @@ -47,7 +47,7 @@ public: Mode_OFB = 3 } CipherMode; -#ifdef PLATFORM_OLD_OPENSSL +#ifdef HAVE_OLD_SSL // For the old version of OpenSSL, we need to be able to store cipher descriptions. virtual CipherDescription *Clone() const = 0; // And to be able to store new IVs diff --git a/lib/crypto/Random.cpp b/lib/crypto/Random.cpp index 3df5fc5e..c64e7d50 100755 --- a/lib/crypto/Random.cpp +++ b/lib/crypto/Random.cpp @@ -28,8 +28,8 @@ // -------------------------------------------------------------------------- void Random::Initialise() { -#ifndef PLATFORM_RANDOM_DEVICE_NONE - if(::RAND_load_file(PLATFORM_RANDOM_DEVICE, 1024) != 1024) +#ifdef HAVE_RANDOM_DEVICE + if(::RAND_load_file(RANDOM_DEVICE, 1024) != 1024) { THROW_EXCEPTION(CipherException, RandomInitFailed) } |