Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applied xrootd/xrootd#1665 patch #7732

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions xrootd-ssl3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 7a4871cd64f153b7a704415dcc6cb5ba67254285 Mon Sep 17 00:00:00 2001
From: Michal Simon <[email protected]>
Date: Wed, 30 Mar 2022 17:14:31 +0200
Subject: [PATCH] [XrdCrypto] openssl3: correctly initialize cipher with public
key and DH parameters, fixes #1662

---
src/XrdCrypto/openssl3/XrdCryptosslCipher.cc | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/XrdCrypto/openssl3/XrdCryptosslCipher.cc b/src/XrdCrypto/openssl3/XrdCryptosslCipher.cc
index 937f9693a40..991fa933605 100644
--- a/src/XrdCrypto/openssl3/XrdCryptosslCipher.cc
+++ b/src/XrdCrypto/openssl3/XrdCryptosslCipher.cc
@@ -570,21 +570,27 @@ XrdCryptosslCipher::XrdCryptosslCipher(bool padded, int bits, char *pub,
EVP_PKEY_CTX_free(pkctx);
if (fDH) {
// Now we can compute the cipher
- ktmp = new char[EVP_PKEY_size(fDH)];
- memset(ktmp, 0, EVP_PKEY_size(fDH));
+ ltmp = EVP_PKEY_size(fDH);
+ ktmp = new char[ltmp];
+ memset(ktmp, 0, ltmp);
if (ktmp) {
// Create peer public key
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_PKEY *peer = 0;
+ OSSL_PARAM *params1 = 0;
+ EVP_PKEY_todata( dhParam, EVP_PKEY_KEY_PARAMETERS, &params1 );
OSSL_PARAM_BLD *bld = OSSL_PARAM_BLD_new();
OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_PUB_KEY, bnpub);
- OSSL_PARAM *params = OSSL_PARAM_BLD_to_param(bld);
+ OSSL_PARAM *params2 = OSSL_PARAM_BLD_to_param(bld);
OSSL_PARAM_BLD_free(bld);
+ OSSL_PARAM *params = OSSL_PARAM_merge( params1, params2 );
pkctx = EVP_PKEY_CTX_new_id(EVP_PKEY_DH, 0);
EVP_PKEY_fromdata_init(pkctx);
- EVP_PKEY_fromdata(pkctx, &peer, EVP_PKEY_PUBLIC_KEY, params);
+ EVP_PKEY_fromdata(pkctx, &peer, EVP_PKEY_KEYPAIR, params);
EVP_PKEY_CTX_free(pkctx);
OSSL_PARAM_free(params);
+ OSSL_PARAM_free(params1);
+ OSSL_PARAM_free(params2);
#else
DH* dh = DH_new();
DH_set0_key(dh, BN_dup(bnpub), NULL);
3 changes: 2 additions & 1 deletion xrootd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%define branch master
%define github_user xrootd
Source: git+https://github.com/%github_user/xrootd.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}.tgz

Patch: xrootd-ssl3
BuildRequires: cmake gmake autotools
Requires: zlib libuuid
Requires: python3
Expand All @@ -21,6 +21,7 @@ Requires: scitokens-cpp

%prep
%setup -n %n-%{realversion}
%patch -p1
sed -i -e 's|UUID REQUIRED|UUID |' cmake/XRootDFindLibs.cmake

%build
Expand Down