summaryrefslogtreecommitdiff
path: root/sysutils/boxbackup-client
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2020-04-12 19:45:51 +0000
committerjoerg <joerg@pkgsrc.org>2020-04-12 19:45:51 +0000
commit6e27dfef70ca0df3f4780db18bd9976ffdc8dbfc (patch)
tree8487bac880ab119e3053cfc7b3ab5b6a4c7ecfdb /sysutils/boxbackup-client
parent713cdb2bbe02ffbec90e3655e76ed3cdc9418a41 (diff)
downloadpkgsrc-6e27dfef70ca0df3f4780db18bd9976ffdc8dbfc.tar.gz
Deal with OpenSSL 1.1. Use explicit cast for non-value-preserving
conversions in initializers.
Diffstat (limited to 'sysutils/boxbackup-client')
-rw-r--r--sysutils/boxbackup-client/distinfo5
-rw-r--r--sysutils/boxbackup-client/patches/patch-lib_backupstore_BackupStoreInfo.cpp25
-rw-r--r--sysutils/boxbackup-client/patches/patch-lib_crypto_CipherContext.cpp278
-rw-r--r--sysutils/boxbackup-client/patches/patch-lib_crypto_CipherContext.h15
4 files changed, 322 insertions, 1 deletions
diff --git a/sysutils/boxbackup-client/distinfo b/sysutils/boxbackup-client/distinfo
index 3863596f9c8..cd05424894b 100644
--- a/sysutils/boxbackup-client/distinfo
+++ b/sysutils/boxbackup-client/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.7 2016/09/29 12:19:48 joerg Exp $
+$NetBSD: distinfo,v 1.8 2020/04/12 19:45:51 joerg Exp $
SHA1 (boxbackup-0.11.1.tgz) = 254253dbfc8cbfc2e5272d1e3589d4d73ccf3597
RMD160 (boxbackup-0.11.1.tgz) = 17553b3ff06d19f353dbadc0166b7dceaa11c271
@@ -8,3 +8,6 @@ SHA1 (patch-aa) = d6c76bce9a706ee05a19705c80f367519316667f
SHA1 (patch-ab) = c94b950a59f4d01b9e4dfb3b74d93b52ff264ed0
SHA1 (patch-ac) = 7584de0bf727ad24f7d8d9c8d75ad24b29a676dc
SHA1 (patch-infrastructure_BoxPlatform.pm.in) = aec1271129fc343fc44a305c2042528901605f99
+SHA1 (patch-lib_backupstore_BackupStoreInfo.cpp) = 71fc8028a5aaee3a9bb3a5606a27ce35a2f06f71
+SHA1 (patch-lib_crypto_CipherContext.cpp) = b1778e068a86c546320ae931dce7f38709d98661
+SHA1 (patch-lib_crypto_CipherContext.h) = e99b80b750558132152599bcd2d4f815ab9af397
diff --git a/sysutils/boxbackup-client/patches/patch-lib_backupstore_BackupStoreInfo.cpp b/sysutils/boxbackup-client/patches/patch-lib_backupstore_BackupStoreInfo.cpp
new file mode 100644
index 00000000000..febf2ca0994
--- /dev/null
+++ b/sysutils/boxbackup-client/patches/patch-lib_backupstore_BackupStoreInfo.cpp
@@ -0,0 +1,25 @@
+$NetBSD: patch-lib_backupstore_BackupStoreInfo.cpp,v 1.1 2020/04/12 19:45:51 joerg Exp $
+
+No implicit conversion from uint32_t to int32_t or uint64_t to int64_t.
+
+--- lib/backupstore/BackupStoreInfo.cpp.orig 2020-04-12 15:18:51.313053606 +0000
++++ lib/backupstore/BackupStoreInfo.cpp
+@@ -151,15 +151,15 @@ void BackupStoreInfo::CreateNew(int32_t
+ // Initial header (is entire file)
+ info_StreamFormat hdr = {
+ htonl(INFO_MAGIC_VALUE), // mMagicValue
+- htonl(AccountID), // mAccountID
++ (int32_t)htonl(AccountID), // mAccountID
+ 0, // mClientStoreMarker
+ box_hton64(1), // mLastObjectIDUsed (which is the root directory)
+ 0, // mBlocksUsed
+ 0, // mBlocksInOldFiles
+ 0, // mBlocksInDeletedFiles
+ 0, // mBlocksInDirectories
+- box_hton64(BlockSoftLimit), // mBlocksSoftLimit
+- box_hton64(BlockHardLimit), // mBlocksHardLimit
++ (int64_t)box_hton64(BlockSoftLimit), // mBlocksSoftLimit
++ (int64_t)box_hton64(BlockHardLimit), // mBlocksHardLimit
+ 0, // mCurrentMarkNumber
+ 0, // mOptionsPresent
+ 0 // mNumberDeletedDirectories
diff --git a/sysutils/boxbackup-client/patches/patch-lib_crypto_CipherContext.cpp b/sysutils/boxbackup-client/patches/patch-lib_crypto_CipherContext.cpp
new file mode 100644
index 00000000000..e2c83bfad0e
--- /dev/null
+++ b/sysutils/boxbackup-client/patches/patch-lib_crypto_CipherContext.cpp
@@ -0,0 +1,278 @@
+$NetBSD: patch-lib_crypto_CipherContext.cpp,v 1.1 2020/04/12 19:45:51 joerg Exp $
+
+OpenSSL 1.1 compat.
+
+--- lib/crypto/CipherContext.cpp.orig 2020-04-12 15:12:39.687647444 +0000
++++ lib/crypto/CipherContext.cpp
+@@ -94,6 +94,7 @@ CipherContext::CipherContext()
+ mpDescription(0)
+ #endif
+ {
++ ctx = EVP_CIPHER_CTX_new();
+ }
+
+ // --------------------------------------------------------------------------
+@@ -109,7 +110,7 @@ CipherContext::~CipherContext()
+ if(mInitialised)
+ {
+ // Clean up
+- EVP_CIPHER_CTX_cleanup(&ctx);
++ EVP_CIPHER_CTX_free(ctx);
+ mInitialised = false;
+ }
+ #ifdef HAVE_OLD_SSL
+@@ -144,15 +145,15 @@ void CipherContext::Init(CipherContext::
+
+ // Initialise the cipher
+ #ifndef HAVE_OLD_SSL
+- EVP_CIPHER_CTX_init(&ctx); // no error return code, even though the docs says it does
++ 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)
++ if(EVP_CipherInit_ex(ctx, rDescription.GetCipher(), NULL, NULL, NULL, Function) != 1)
+ #else
+ // Store function for later
+ mFunction = Function;
+
+ // Use old version of init call
+- if(EVP_CipherInit(&ctx, rDescription.GetCipher(), NULL, NULL, Function) != 1)
++ if(EVP_CipherInit(ctx, rDescription.GetCipher(), NULL, NULL, Function) != 1)
+ #endif
+ {
+ THROW_EXCEPTION(CipherException, EVPInitFailure)
+@@ -162,19 +163,19 @@ void CipherContext::Init(CipherContext::
+ {
+ #ifndef HAVE_OLD_SSL
+ // Let the description set up everything else
+- rDescription.SetupParameters(&ctx);
++ rDescription.SetupParameters(ctx);
+ #else
+ // With the old version, a copy needs to be taken first.
+ mpDescription = rDescription.Clone();
+ // Mark it as not a leak, otherwise static cipher contexts
+ // cause spurious memory leaks to be reported
+ MEMLEAKFINDER_NOT_A_LEAK(mpDescription);
+- mpDescription->SetupParameters(&ctx);
++ mpDescription->SetupParameters(ctx);
+ #endif
+ }
+ catch(...)
+ {
+- EVP_CIPHER_CTX_cleanup(&ctx);
++ EVP_CIPHER_CTX_cleanup(ctx);
+ throw;
+ }
+
+@@ -195,7 +196,7 @@ void CipherContext::Reset()
+ if(mInitialised)
+ {
+ // Clean up
+- EVP_CIPHER_CTX_cleanup(&ctx);
++ EVP_CIPHER_CTX_cleanup(ctx);
+ mInitialised = false;
+ }
+ #ifdef HAVE_OLD_SSL
+@@ -232,7 +233,7 @@ void CipherContext::Begin()
+ }
+
+ // Initialise the cipher context again
+- if(EVP_CipherInit(&ctx, NULL, NULL, NULL, -1) != 1)
++ if(EVP_CipherInit(ctx, NULL, NULL, NULL, -1) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPInitFailure)
+ }
+@@ -278,14 +279,14 @@ int CipherContext::Transform(void *pOutB
+ }
+
+ // Check output buffer size
+- if(OutLength < (InLength + EVP_CIPHER_CTX_block_size(&ctx)))
++ if(OutLength < (InLength + EVP_CIPHER_CTX_block_size(ctx)))
+ {
+ THROW_EXCEPTION(CipherException, OutputBufferTooSmall);
+ }
+
+ // Do the transform
+ int outLength = OutLength;
+- if(EVP_CipherUpdate(&ctx, (unsigned char*)pOutBuffer, &outLength, (unsigned char*)pInBuffer, InLength) != 1)
++ if(EVP_CipherUpdate(ctx, (unsigned char*)pOutBuffer, &outLength, (unsigned char*)pInBuffer, InLength) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPUpdateFailure)
+ }
+@@ -325,7 +326,7 @@ int CipherContext::Final(void *pOutBuffe
+ }
+
+ // Check output buffer size
+- if(OutLength < (2 * EVP_CIPHER_CTX_block_size(&ctx)))
++ if(OutLength < (2 * EVP_CIPHER_CTX_block_size(ctx)))
+ {
+ THROW_EXCEPTION(CipherException, OutputBufferTooSmall);
+ }
+@@ -333,7 +334,7 @@ int CipherContext::Final(void *pOutBuffe
+ // Do the transform
+ int outLength = OutLength;
+ #ifndef HAVE_OLD_SSL
+- if(EVP_CipherFinal_ex(&ctx, (unsigned char*)pOutBuffer, &outLength) != 1)
++ if(EVP_CipherFinal_ex(ctx, (unsigned char*)pOutBuffer, &outLength) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPFinalFailure)
+ }
+@@ -362,11 +363,11 @@ void CipherContext::OldOpenSSLFinal(unsi
+ // Old version needs to use a different form, and then set up the cipher again for next time around
+ int outLength = rOutLengthOut;
+ // Have to emulate padding off...
+- int blockSize = EVP_CIPHER_CTX_block_size(&ctx);
++ int blockSize = EVP_CIPHER_CTX_block_size(ctx);
+ if(mPaddingOn)
+ {
+ // Just use normal final call
+- if(EVP_CipherFinal(&ctx, Buffer, &outLength) != 1)
++ if(EVP_CipherFinal(ctx, Buffer, &outLength) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPFinalFailure)
+ }
+@@ -379,13 +380,13 @@ void CipherContext::OldOpenSSLFinal(unsi
+ {
+ // NASTY -- fiddling around with internals like this is bad.
+ // But only way to get this working on old versions of OpenSSL.
+- if(!EVP_EncryptUpdate(&ctx,Buffer,&outLength,ctx.buf,0)
++ if(!EVP_EncryptUpdate(ctx,Buffer,&outLength,ctx.buf,0)
+ || outLength != blockSize)
+ {
+ THROW_EXCEPTION(CipherException, EVPFinalFailure)
+ }
+ // Clean up
+- EVP_CIPHER_CTX_cleanup(&ctx);
++ EVP_CIPHER_CTX_cleanup(ctx);
+ }
+ else
+ {
+@@ -398,7 +399,7 @@ void CipherContext::OldOpenSSLFinal(unsi
+ // padding, and remove it.
+ char temp[1024];
+ outLength = sizeof(temp);
+- if(EVP_CipherFinal(&ctx, Buffer, &outLength) != 1)
++ if(EVP_CipherFinal(ctx, Buffer, &outLength) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPFinalFailure)
+ }
+@@ -413,11 +414,11 @@ void CipherContext::OldOpenSSLFinal(unsi
+ }
+ }
+ // Reinitialise the cipher for the next time around
+- if(EVP_CipherInit(&ctx, mpDescription->GetCipher(), NULL, NULL, mFunction) != 1)
++ if(EVP_CipherInit(ctx, mpDescription->GetCipher(), NULL, NULL, mFunction) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPInitFailure)
+ }
+- mpDescription->SetupParameters(&ctx);
++ mpDescription->SetupParameters(ctx);
+
+ // Update length for caller
+ rOutLengthOut = outLength;
+@@ -442,7 +443,7 @@ int CipherContext::InSizeForOutBufferSiz
+
+ // Strictly speaking, the *2 is unnecessary. However...
+ // Final() is paranoid, and requires two input blocks of space to work.
+- return OutLength - (EVP_CIPHER_CTX_block_size(&ctx) * 2);
++ return OutLength - (EVP_CIPHER_CTX_block_size(ctx) * 2);
+ }
+
+ // --------------------------------------------------------------------------
+@@ -463,7 +464,7 @@ int CipherContext::MaxOutSizeForInBuffer
+
+ // Final() is paranoid, and requires two input blocks of space to work, and so we need to add
+ // three blocks on to be absolutely sure.
+- return InLength + (EVP_CIPHER_CTX_block_size(&ctx) * 3);
++ return InLength + (EVP_CIPHER_CTX_block_size(ctx) * 3);
+ }
+
+
+@@ -490,7 +491,7 @@ int CipherContext::TransformBlock(void *
+ }
+
+ // Check output buffer size
+- if(OutLength < (InLength + EVP_CIPHER_CTX_block_size(&ctx)))
++ if(OutLength < (InLength + EVP_CIPHER_CTX_block_size(ctx)))
+ {
+ // Check if padding is off, in which case the buffer can be smaller
+ if(!mPaddingOn && OutLength <= InLength)
+@@ -504,7 +505,7 @@ int CipherContext::TransformBlock(void *
+ }
+
+ // Initialise the cipher context again
+- if(EVP_CipherInit(&ctx, NULL, NULL, NULL, -1) != 1)
++ if(EVP_CipherInit(ctx, NULL, NULL, NULL, -1) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPInitFailure)
+ }
+@@ -515,14 +516,14 @@ int CipherContext::TransformBlock(void *
+ {
+ // Update
+ outLength = OutLength;
+- if(EVP_CipherUpdate(&ctx, (unsigned char*)pOutBuffer, &outLength, (unsigned char*)pInBuffer, InLength) != 1)
++ if(EVP_CipherUpdate(ctx, (unsigned char*)pOutBuffer, &outLength, (unsigned char*)pInBuffer, InLength) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPUpdateFailure)
+ }
+ // Finalise
+ int outLength2 = OutLength - outLength;
+ #ifndef HAVE_OLD_SSL
+- if(EVP_CipherFinal_ex(&ctx, ((unsigned char*)pOutBuffer) + outLength, &outLength2) != 1)
++ if(EVP_CipherFinal_ex(ctx, ((unsigned char*)pOutBuffer) + outLength, &outLength2) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPFinalFailure)
+ }
+@@ -536,7 +537,7 @@ int CipherContext::TransformBlock(void *
+ // Finalise the context, so definately ready for the next caller
+ int outs = OutLength;
+ #ifndef HAVE_OLD_SSL
+- EVP_CipherFinal_ex(&ctx, (unsigned char*)pOutBuffer, &outs);
++ EVP_CipherFinal_ex(ctx, (unsigned char*)pOutBuffer, &outs);
+ #else
+ OldOpenSSLFinal((unsigned char*)pOutBuffer, outs);
+ #endif
+@@ -562,7 +563,7 @@ int CipherContext::GetIVLength()
+ THROW_EXCEPTION(CipherException, NotInitialised)
+ }
+
+- return EVP_CIPHER_CTX_iv_length(&ctx);
++ return EVP_CIPHER_CTX_iv_length(ctx);
+ }
+
+
+@@ -589,7 +590,7 @@ void CipherContext::SetIV(const void *pI
+ }
+
+ // Set IV
+- if(EVP_CipherInit(&ctx, NULL, NULL, (unsigned char *)pIV, -1) != 1)
++ if(EVP_CipherInit(ctx, NULL, NULL, (unsigned char *)pIV, -1) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPInitFailure)
+ }
+@@ -628,7 +629,7 @@ const void *CipherContext::SetRandomIV(i
+ }
+
+ // Get length of IV
+- unsigned int ivLen = EVP_CIPHER_CTX_iv_length(&ctx);
++ unsigned int ivLen = EVP_CIPHER_CTX_iv_length(ctx);
+ if(ivLen > sizeof(mGeneratedIV))
+ {
+ THROW_EXCEPTION(CipherException, IVSizeImplementationLimitExceeded)
+@@ -638,7 +639,7 @@ const void *CipherContext::SetRandomIV(i
+ Random::Generate(mGeneratedIV, ivLen);
+
+ // Set IV
+- if(EVP_CipherInit(&ctx, NULL, NULL, mGeneratedIV, -1) != 1)
++ if(EVP_CipherInit(ctx, NULL, NULL, mGeneratedIV, -1) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPInitFailure)
+ }
+@@ -668,7 +669,7 @@ const void *CipherContext::SetRandomIV(i
+ void CipherContext::UsePadding(bool Padding)
+ {
+ #ifndef HAVE_OLD_SSL
+- if(EVP_CIPHER_CTX_set_padding(&ctx, Padding) != 1)
++ if(EVP_CIPHER_CTX_set_padding(ctx, Padding) != 1)
+ {
+ THROW_EXCEPTION(CipherException, EVPSetPaddingFailure)
+ }
diff --git a/sysutils/boxbackup-client/patches/patch-lib_crypto_CipherContext.h b/sysutils/boxbackup-client/patches/patch-lib_crypto_CipherContext.h
new file mode 100644
index 00000000000..be8fcb06176
--- /dev/null
+++ b/sysutils/boxbackup-client/patches/patch-lib_crypto_CipherContext.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-lib_crypto_CipherContext.h,v 1.1 2020/04/12 19:45:51 joerg Exp $
+
+OpenSSL 1.1 compat.
+
+--- lib/crypto/CipherContext.h.orig 2020-04-12 15:12:22.390595514 +0000
++++ lib/crypto/CipherContext.h
+@@ -127,7 +127,7 @@ public:
+ #endif
+
+ private:
+- EVP_CIPHER_CTX ctx;
++ EVP_CIPHER_CTX *ctx;
+ bool mInitialised;
+ bool mWithinTransform;
+ bool mPaddingOn;