From owner-svn-ports-all@freebsd.org Fri Apr 3 21:25:53 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BC452721AF; Fri, 3 Apr 2020 21:25:53 +0000 (UTC) (envelope-from tcberner@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48vCf649PSz47bf; Fri, 3 Apr 2020 21:25:50 +0000 (UTC) (envelope-from tcberner@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6D58C2CD; Fri, 3 Apr 2020 21:25:41 +0000 (UTC) (envelope-from tcberner@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 033LPf99074589; Fri, 3 Apr 2020 21:25:41 GMT (envelope-from tcberner@FreeBSD.org) Received: (from tcberner@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 033LPf61074588; Fri, 3 Apr 2020 21:25:41 GMT (envelope-from tcberner@FreeBSD.org) Message-Id: <202004032125.033LPf61074588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tcberner set sender to tcberner@FreeBSD.org using -f From: "Tobias C. Berner" Date: Fri, 3 Apr 2020 21:25:41 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r530522 - head/devel/qca/files X-SVN-Group: ports-head X-SVN-Commit-Author: tcberner X-SVN-Commit-Paths: head/devel/qca/files X-SVN-Commit-Revision: 530522 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Apr 2020 21:25:53 -0000 Author: tcberner Date: Fri Apr 3 21:25:41 2020 New Revision: 530522 URL: https://svnweb.freebsd.org/changeset/ports/530522 Log: devel/qca: add support for libressl PR: 245116 Submitted by: Felix Palmen Added: head/devel/qca/files/ head/devel/qca/files/patch-plugins_qca-ossl_qca-ossl.cpp (contents, props changed) Added: head/devel/qca/files/patch-plugins_qca-ossl_qca-ossl.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/qca/files/patch-plugins_qca-ossl_qca-ossl.cpp Fri Apr 3 21:25:41 2020 (r530522) @@ -0,0 +1,58 @@ +--- plugins/qca-ossl/qca-ossl.cpp.orig 2020-02-25 09:08:01 UTC ++++ plugins/qca-ossl/qca-ossl.cpp +@@ -43,6 +43,10 @@ + + #include + ++#ifndef RSA_F_RSA_OSSL_PRIVATE_DECRYPT ++#define RSA_F_RSA_OSSL_PRIVATE_DECRYPT RSA_F_RSA_EAY_PRIVATE_DECRYPT ++#endif ++ + using namespace QCA; + + namespace opensslQCAPlugin { +@@ -1272,6 +1276,7 @@ class opensslHkdfContext : public HKDFContext (public) + const InitializationVector &info, unsigned int keyLength) override + { + SecureArray out(keyLength); ++#ifdef EVP_PKEY_HKDF + EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, nullptr); + EVP_PKEY_derive_init(pctx); + EVP_PKEY_CTX_set_hkdf_md(pctx, EVP_sha256()); +@@ -1281,6 +1286,36 @@ class opensslHkdfContext : public HKDFContext (public) + size_t outlen = out.size(); + EVP_PKEY_derive(pctx, reinterpret_cast(out.data()), &outlen); + EVP_PKEY_CTX_free(pctx); ++#else ++ unsigned char prk[EVP_MAX_MD_SIZE]; ++ unsigned char *ret; ++ unsigned int prk_len; ++ HMAC(EVP_sha256(), salt.data(), salt.size(), reinterpret_cast(secret.data()), secret.size(), prk, &prk_len); ++ HMAC_CTX hmac; ++ unsigned char prev[EVP_MAX_MD_SIZE]; ++ size_t done_len = 0; ++ size_t dig_len = EVP_MD_size(EVP_sha256()); ++ size_t n = out.size() / dig_len; ++ if (out.size() % dig_len) ++n; ++ HMAC_CTX_init(&hmac); ++ HMAC_Init_ex(&hmac, prk, prk_len, EVP_sha256(), nullptr); ++ for (unsigned int i = 1; i <= n; ++i) { ++ const unsigned char ctr = i; ++ if (i > 1) { ++ HMAC_Init_ex(&hmac, nullptr, 0, nullptr, nullptr); ++ HMAC_Update(&hmac, prev, dig_len); ++ } ++ HMAC_Update(&hmac, reinterpret_cast(info.data()), info.size()); ++ HMAC_Update(&hmac, &ctr, 1); ++ HMAC_Final(&hmac, prev, nullptr); ++ size_t copy_len = (done_len + dig_len > out.size()) ? ++ out.size() - done_len : dig_len; ++ memcpy(reinterpret_cast(out.data()) + done_len, prev, copy_len); ++ done_len += copy_len; ++ } ++ HMAC_CTX_cleanup(&hmac); ++ OPENSSL_cleanse(prk, sizeof prk); ++#endif + return out; + } + };