databases/mongodb: backport a patch from mongdb 3.4 to make it compile

with OpenSSL 1.1 where EVP_MD_CTX is opaque.
This commit is contained in:
tb 2021-11-27 14:17:02 +00:00
parent 518e732b51
commit d08af4dfe9
2 changed files with 30 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.44 2021/10/31 17:31:43 sthen Exp $
# $OpenBSD: Makefile,v 1.45 2021/11/27 14:17:02 tb Exp $
PORTROACH = limitw:1,even
USE_WXNEEDED = Yes
@ -12,7 +12,7 @@ COMMENT = scalable, high-performance document-oriented database
DISTNAME = mongodb-src-r3.2.22
PKGNAME = ${DISTNAME:S/src-r//}
CATEGORIES = databases
REVISION = 4
REVISION = 5
HOMEPAGE = https://www.mongodb.com/

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-src_mongo_crypto_sha1_block_openssl_cpp,v 1.1 2021/11/27 14:17:02 tb Exp $
Part of
https://github.com/mongodb/mongo/commit/62ecb7bc5294461244bc07995ac6d113d582bc84
Index: src/mongo/crypto/sha1_block_openssl.cpp
--- src/mongo/crypto/sha1_block_openssl.cpp.orig
+++ src/mongo/crypto/sha1_block_openssl.cpp
@@ -70,14 +70,12 @@ namespace mongo {
SHA1Block SHA1Block::computeHash(const uint8_t* input, size_t inputLen) {
HashType output;
- EVP_MD_CTX digestCtx;
- EVP_MD_CTX_init(&digestCtx);
- ON_BLOCK_EXIT(EVP_MD_CTX_cleanup, &digestCtx);
-
+ std::unique_ptr<EVP_MD_CTX, decltype(&EVP_MD_CTX_free)> digestCtx(EVP_MD_CTX_new(),
+ EVP_MD_CTX_free);
fassert(40379,
- EVP_DigestInit_ex(&digestCtx, EVP_sha1(), NULL) == 1 &&
- EVP_DigestUpdate(&digestCtx, input, inputLen) == 1 &&
- EVP_DigestFinal_ex(&digestCtx, output.data(), NULL) == 1);
+ EVP_DigestInit_ex(digestCtx.get(), EVP_sha1(), NULL) == 1 &&
+ EVP_DigestUpdate(digestCtx.get(), input, inputLen) == 1 &&
+ EVP_DigestFinal_ex(digestCtx.get(), output.data(), NULL) == 1);
return SHA1Block(output);
}