From 40aaaa64e86ba6710bbeb31c4615a6ce80e75e11 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 28 Apr 2021 20:21:43 +0100 Subject: gentoo resync : 28.04.2021 --- dev-libs/nss/Manifest | 14 +- .../nss/files/nss-3.53-fix-building-on-ppc.patch | 39 --- ...8-always-tolerate-the-first-CCS-in-TLS1.3.patch | 200 ------------ dev-libs/nss/nss-3.58-r2.ebuild | 360 --------------------- dev-libs/nss/nss-3.62.ebuild | 359 -------------------- dev-libs/nss/nss-3.63.1.ebuild | 357 ++++++++++++++++++++ dev-libs/nss/nss-3.63.ebuild | 359 -------------------- dev-libs/nss/nss-3.64.ebuild | 357 ++++++++++++++++++++ 8 files changed, 719 insertions(+), 1326 deletions(-) delete mode 100644 dev-libs/nss/files/nss-3.53-fix-building-on-ppc.patch delete mode 100644 dev-libs/nss/files/nss-3.58-always-tolerate-the-first-CCS-in-TLS1.3.patch delete mode 100644 dev-libs/nss/nss-3.58-r2.ebuild delete mode 100644 dev-libs/nss/nss-3.62.ebuild create mode 100644 dev-libs/nss/nss-3.63.1.ebuild delete mode 100644 dev-libs/nss/nss-3.63.ebuild create mode 100644 dev-libs/nss/nss-3.64.ebuild (limited to 'dev-libs/nss') diff --git a/dev-libs/nss/Manifest b/dev-libs/nss/Manifest index c9348020ea5c..a6379d034c46 100644 --- a/dev-libs/nss/Manifest +++ b/dev-libs/nss/Manifest @@ -1,13 +1,9 @@ AUX nss-3.21-gentoo-fixup-warnings.patch 178 BLAKE2B b51f80310db3db416d8aeaf9117ef801389b5b2df47c04aff51bf0759dd5bff41b09d1e9011f99b345d5769a3aab19acb943ee97f8437465518115f6902a0da1 SHA512 7667a020311ca11e8f1836bc146e4a3c94ff2a489882dbe87debcccfeaafeb50e6607574c64254a826b4b6f0bb436b310a3386fff4a58324f0e5e58debaa9d51 AUX nss-3.23-hppa-byte_order.patch 460 BLAKE2B 97358cc8fbea0b0d3beee0697833e48ef01039ceb08fd00792a7f7ef68409eb076022c03764ab079fdaa971a0358130002fa11c0c182ebeb33dcdf660be26408 SHA512 ad0097bb6cf409d61eb28202d7460c87e983d6db977aba38ff9ef2749b3f7bb8fdadce4174f5bf806350ae33733097a1f444792d31cc43574b28341893642e5a -AUX nss-3.53-fix-building-on-ppc.patch 1206 BLAKE2B e6189802769197b290fd332ee2b7d074c0bacf47313998117734dafd1eb6a536db19bc8a329944d9fad51a6f9f90f81d98181272e0068bf852fea7ca928d2713 SHA512 859162070aa3c5e6e8be259f5e6648d37a5194a02958310f8caf56ff772dcaa4ebb26e4d754c99608fc7a45b641c5088cccd9e2c7d9c92c5ccc85c6b47320720 AUX nss-3.53-gentoo-fixups.patch 6886 BLAKE2B 1c605d8db02ebe0492c41955207368197a79990e43e219a71962cb28ac0cecd9e0acc2b76e16f5b116fdb8bf8790d96046cb4f376df9b8634ac48e54924589f8 SHA512 51031f92519f57d4b57a547cf549f2d5da1c5a7212d4b304fb0d71d6a85a5aefd64724ec9075c14c9b49c1e99c3ffe91cbec501c3504985aa9b16eacf2aa15ed -AUX nss-3.58-always-tolerate-the-first-CCS-in-TLS1.3.patch 8546 BLAKE2B 25c222f44f714226364dbda760989e7e255ab93a79121238ccce2962c346c37971a8440e8cc16ac5555f78c15b7a1b72e7311a7b7257b254fefe7e9a75d94924 SHA512 79fff678895a5643b34c42a0b0d34299b1b63c19baf0bbeb43fcee6b7f01bb24baf7047261b16e913d39fe9e69a637c7dc2bba0fec9ceedd43fa4f5dcc99f38f -DIST nss-3.58.tar.gz 81846254 BLAKE2B f8e7d0b231916b197ad21706a057d055f8377059d76d4f09aff523cc4cd071a3184f02dc488259df22109b70be7b8a5d5fa7ea2273a830de825cc9a8c95dcca9 SHA512 03d2ab1517ac07620ea3f02dcf680cf019e0129006ff2559b2d0a047036340c20b98c9679b17a594e5502aa30e158caf309f046901b9ec7c7adeeaa13ec50b80 -DIST nss-3.62.tar.gz 82159506 BLAKE2B 9abd7504766fb57214a16608a7299f8cf6d25c9a4e285665eabd812bce536ba244b698de31fd53796148f3856e4bee6c8a03ce5b6c5234a9337d7af8f300f007 SHA512 7044008ea8e5d6f658da96e202a896e24a1ffa29d7ca862f32ed37cfa09adf8c2d5fbc371e3af6bc5151b2d1216c38207976b41888d5ad8efd4dc3049cb5831d -DIST nss-3.63.tar.gz 82167087 BLAKE2B 3db1aea3aea8373ba8e285a5a87e8b5e39107af8cc5977701fb2fe29b6e7657dba1b1ea3bf80aa0768b0d5f6d130cacc3e029eec69b071a0d87da0825860ffd9 SHA512 2f1f75dce7fd049453cbcf53263a3d9d4d9e62ad2cc2fef4dd0d5645fe14dad4ce47ed64aae507a09214d7fccbe83c142844121f55b44783e5a1bcfe24ea671c -DIST nss-cacert-class1-class3.patch 22950 BLAKE2B 9d5e60df5f161a3c27c41e5a9419440a54f888eda454e3cde5ebe626d4075b65cf9938b5144d0fb022377f4bd415bff5e5c67d104409860aa9391b3eb8872c68 SHA512 a5aa740bf110a3f0262e3f1ef2fc739ac2b44f042e220039d48aee8e97cd764d5c10718220364f4098aba955882bd02cadb5481512388971a8290312f88a7df0 -EBUILD nss-3.58-r2.ebuild 9243 BLAKE2B d064a59fb9780ffa37454397ff738b4ba91ceca46d98facfd9e2fff2f73980280a3ed06bc02d5ea8ba6915440c4cbf697006484cb5580fae8b16472230f01186 SHA512 ebf3a0df5de6170fa14428bfeae73d8a34d02bf010c9cac49d9edcfbc3303044dde0bd28d6b330f327a9f4f7e8cf9fe2b7b1fad8dba19768fbc51aee06ceaac9 -EBUILD nss-3.62.ebuild 9229 BLAKE2B 52f2a039116fed8ef049d585a9d70b5a0b021a36745f300b548f90c4c5a0936b415b38f0c5752bdb5ecf1b6e0a3995b2e7a63fce63010b259a6cbb6e745950c5 SHA512 36a492b736cec0b1ab99a798fdacf877af54d2f606c67b386b3f78d2edab550f096b88200329309dd916263773ad0d9313427aa2be307ab606301d60a4f89c6d -EBUILD nss-3.63.ebuild 9229 BLAKE2B 52f2a039116fed8ef049d585a9d70b5a0b021a36745f300b548f90c4c5a0936b415b38f0c5752bdb5ecf1b6e0a3995b2e7a63fce63010b259a6cbb6e745950c5 SHA512 36a492b736cec0b1ab99a798fdacf877af54d2f606c67b386b3f78d2edab550f096b88200329309dd916263773ad0d9313427aa2be307ab606301d60a4f89c6d +DIST nss-3.63.1.tar.gz 82166899 BLAKE2B a3c1939d16dcb083fae819659c0a61ff1d4dab70c8a7fc4b176a391bf7cd22eae1c93c85533b6af15e1c1cd9fb6b007380741e0b1670f3891f298ffa1b309284 SHA512 62d1bc161fc8eea6be191dc23ec42042a2626e119b7329f6449cf78729775776fd8e9faebd0457c2413684c15be6e10722ee4a7087c7c3e103fe993f3acec730 +DIST nss-3.64.tar.gz 82173054 BLAKE2B 4786a1ff6f4e47dbb6bfef6a2bc47ffeac51aa37f12168872d23799b8d6ca440578acf512e9ec7563ef64331d3fd84c387f17e41afa2ee30d8623c6f66207631 SHA512 0a85e1f64f97670f70596d8a479693939ca454025a4b3bbd557a54ed683ffed625c670fef6a6e3440365af9aa472384f84464942381b1c093659f6a6a222ba04 +DIST nss-cacert-class1-class3-r1.patch 22503 BLAKE2B d2ba6b5c3675484dab5b6709478101a9dadc0baded3dbf891dcd04e5eb912079b87cdd17f893a0f539a2a53fb05357c6dd309fb624facac3b021c82c7424a91f SHA512 68906d2442986ad13ebf9cd97c26fac34af3efd5cfaacb3d7824adad966349ad796c9cec8dec44c46d5c571df88ce83aea02ce82e71da337aa4e1aeef58eda66 +EBUILD nss-3.63.1.ebuild 9222 BLAKE2B ef1afc1f6d05c0b1797759b093a1e5baa00d75371f6260302d2fe998d0b5d4f7dcfbb0ed05f21a122b5a9ed210d5e4f520353ff403d62c80d6cedc225a08fb94 SHA512 f7c24d8da1afe3514c4019b054d710061d095a808ebca71b1147eff17af1b62fb22d8853692a6820b70e3aae24e617f029f2767395b8fa1776698d0c6593f003 +EBUILD nss-3.64.ebuild 9230 BLAKE2B b75b7ae2b93705d2d87560a4307ef92691c5d9e566e3fd5c91362457a083a20f188671478f8bb03eece5ee599ef9725e67fe00a3d47e5dfae3d22d616f81fbf5 SHA512 7cc7697cf96188d5eacd43d849e9df72ce16fdc60f9e8833411941ffb653db68657aa57fa9ccef82936fc09e947a55d983c2727deeba0510569a03502631e7b5 MISC metadata.xml 515 BLAKE2B a63fb05a1a3e1b06f929f963ab0794ec1230e89903fc97a7c7db81a0b3c7b7e8b9277eaa7440f8929738ec0f805d8a8dd51c8262e569fb9be2fa0938b08ad7a2 SHA512 6bec952825416ba0ab8282669483eb75935f6b4a3052e0f78dad911c0246b8d8ce245c86cbd82b292d49338848fa50fb2009fb4a9def1ac8d81bf9a3320cd2b0 diff --git a/dev-libs/nss/files/nss-3.53-fix-building-on-ppc.patch b/dev-libs/nss/files/nss-3.53-fix-building-on-ppc.patch deleted file mode 100644 index 962b9cb1eedb..000000000000 --- a/dev-libs/nss/files/nss-3.53-fix-building-on-ppc.patch +++ /dev/null @@ -1,39 +0,0 @@ -https://bugzilla.mozilla.org/show_bug.cgi?id=1642174 - -From a7a862bab5e4aae4615ddae3cbe230345f92ed0d Mon Sep 17 00:00:00 2001 -From: Lauri Kasanen -Date: Mon, 1 Jun 2020 12:11:45 +0300 -Subject: [PATCH v3] Bug 1642174 /usr/bin/ld: OBJS/Linux_SINGLE_SHLIB/sha512-p8.o: - ABI version 2 is not compatible with ABI version 1 output - -Don't try to build the SHA-2 accelerated asm on old-ABI ppc. - -Currently make only, I don't have enough gyp-fu to do that side. -However, the reporters of 1642174 and 1635625 both used make, not gyp. - -Signed-off-by: Lauri Kasanen ---- - lib/freebl/Makefile | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/lib/freebl/Makefile b/lib/freebl/Makefile -index 5f7384429..e0461c7d3 100644 ---- a/lib/freebl/Makefile -+++ b/lib/freebl/Makefile -@@ -267,9 +267,12 @@ ifeq ($(CPU_ARCH),arm) - endif - ifeq ($(CPU_ARCH),ppc) - EXTRA_SRCS += gcm-ppc.c -- ASFILES += sha512-p8.s - ifdef USE_64 - DEFINES += -DNSS_NO_INIT_SUPPORT -+ PPC_ABI := $(shell $(CC) -dM -E - < /dev/null | awk '$$2 == "_CALL_ELF" {print $$3}') -+ ifeq ($(PPC_ABI),2) -+ ASFILES += sha512-p8.s -+ endif - endif # USE_64 - endif # ppc - endif # Linux --- -2.19.1 - diff --git a/dev-libs/nss/files/nss-3.58-always-tolerate-the-first-CCS-in-TLS1.3.patch b/dev-libs/nss/files/nss-3.58-always-tolerate-the-first-CCS-in-TLS1.3.patch deleted file mode 100644 index a92c03899360..000000000000 --- a/dev-libs/nss/files/nss-3.58-always-tolerate-the-first-CCS-in-TLS1.3.patch +++ /dev/null @@ -1,200 +0,0 @@ - -# HG changeset patch -# User Daiki Ueno -# Date 1603691171 -3600 -# Node ID b03a4fc5b902498414b02640dcb2717dfef9682f -# Parent 6f79a76958129dc09c353c288f115fd9a51ab7d4 -Bug 1672703, always tolerate the first CCS in TLS 1.3, r=mt - -Summary: -This flips the meaning of the flag for checking excessive CCS -messages, so it only rejects multiple CCS messages while the first CCS -message is always accepted. - -Reviewers: mt - -Reviewed By: mt - -Bug #: 1672703 - -Differential Revision: https://phabricator.services.mozilla.com/D94603 - ---- a/gtests/ssl_gtest/ssl_tls13compat_unittest.cc -+++ b/gtests/ssl_gtest/ssl_tls13compat_unittest.cc -@@ -343,29 +343,28 @@ TEST_F(TlsConnectStreamTls13, ChangeCiph - // Client sends CCS before starting the handshake. - client_->SendDirect(DataBuffer(kCannedCcs, sizeof(kCannedCcs))); - client_->SendDirect(DataBuffer(kCannedCcs, sizeof(kCannedCcs))); - ConnectExpectAlert(server_, kTlsAlertUnexpectedMessage); - server_->CheckErrorCode(SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER); - client_->CheckErrorCode(SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT); - } - --// The server rejects a ChangeCipherSpec if the client advertises an --// empty session ID. -+// The server accepts a ChangeCipherSpec even if the client advertises -+// an empty session ID. - TEST_F(TlsConnectStreamTls13, ChangeCipherSpecAfterClientHelloEmptySid) { - EnsureTlsSetup(); - ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3); - - StartConnect(); - client_->Handshake(); // Send ClientHello - client_->SendDirect(DataBuffer(kCannedCcs, sizeof(kCannedCcs))); // Send CCS - -- server_->ExpectSendAlert(kTlsAlertUnexpectedMessage); -- server_->Handshake(); // Consume ClientHello and CCS -- server_->CheckErrorCode(SSL_ERROR_RX_MALFORMED_CHANGE_CIPHER); -+ Handshake(); -+ CheckConnected(); - } - - // The server rejects multiple ChangeCipherSpec even if the client - // indicates compatibility mode with non-empty session ID. - TEST_F(Tls13CompatTest, ChangeCipherSpecAfterClientHelloTwice) { - EnsureTlsSetup(); - ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3); - EnableCompatMode(); -@@ -376,36 +375,37 @@ TEST_F(Tls13CompatTest, ChangeCipherSpec - client_->SendDirect(DataBuffer(kCannedCcs, sizeof(kCannedCcs))); - client_->SendDirect(DataBuffer(kCannedCcs, sizeof(kCannedCcs))); - - server_->ExpectSendAlert(kTlsAlertUnexpectedMessage); - server_->Handshake(); // Consume ClientHello and CCS. - server_->CheckErrorCode(SSL_ERROR_RX_MALFORMED_CHANGE_CIPHER); - } - --// The client rejects a ChangeCipherSpec if it advertises an empty -+// The client accepts a ChangeCipherSpec even if it advertises an empty - // session ID. - TEST_F(TlsConnectStreamTls13, ChangeCipherSpecAfterServerHelloEmptySid) { - EnsureTlsSetup(); - ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3); - - // To replace Finished with a CCS below - auto filter = MakeTlsFilter(server_); - filter->SetHandshakeTypes({kTlsHandshakeFinished}); - filter->EnableDecryption(); - - StartConnect(); - client_->Handshake(); // Send ClientHello - server_->Handshake(); // Consume ClientHello, and - // send ServerHello..CertificateVerify - // Send CCS - server_->SendDirect(DataBuffer(kCannedCcs, sizeof(kCannedCcs))); -- client_->ExpectSendAlert(kTlsAlertUnexpectedMessage); -- client_->Handshake(); // Consume ClientHello and CCS -- client_->CheckErrorCode(SSL_ERROR_RX_MALFORMED_CHANGE_CIPHER); -+ -+ // No alert is sent from the client. As Finished is dropped, we -+ // can't use Handshake() and CheckConnected(). -+ client_->Handshake(); - } - - // The client rejects multiple ChangeCipherSpec in a row even if the - // client indicates compatibility mode with non-empty session ID. - TEST_F(Tls13CompatTest, ChangeCipherSpecAfterServerHelloTwice) { - EnsureTlsSetup(); - ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3); - EnableCompatMode(); ---- a/lib/ssl/ssl3con.c -+++ b/lib/ssl/ssl3con.c -@@ -6640,21 +6640,17 @@ ssl_CheckServerSessionIdCorrectness(sslS - if (sentFakeSid) { - return !sidMatch; - } - return PR_TRUE; - } - - /* TLS 1.3: We sent a session ID. The server's should match. */ - if (!IS_DTLS(ss) && (sentRealSid || sentFakeSid)) { -- if (sidMatch) { -- ss->ssl3.hs.allowCcs = PR_TRUE; -- return PR_TRUE; -- } -- return PR_FALSE; -+ return sidMatch; - } - - /* TLS 1.3 (no SID)/DTLS 1.3: The server shouldn't send a session ID. */ - return sidBytes->len == 0; - } - - static SECStatus - ssl_CheckServerRandom(sslSocket *ss) -@@ -8691,17 +8687,16 @@ ssl3_HandleClientHello(sslSocket *ss, PR - if (sidBytes.len > 0 && !IS_DTLS(ss)) { - SECITEM_FreeItem(&ss->ssl3.hs.fakeSid, PR_FALSE); - rv = SECITEM_CopyItem(NULL, &ss->ssl3.hs.fakeSid, &sidBytes); - if (rv != SECSuccess) { - desc = internal_error; - errCode = PORT_GetError(); - goto alert_loser; - } -- ss->ssl3.hs.allowCcs = PR_TRUE; - } - - /* TLS 1.3 requires that compression include only null. */ - if (comps.len != 1 || comps.data[0] != ssl_compression_null) { - goto alert_loser; - } - - /* If there is a cookie, then this is a second ClientHello (TLS 1.3). */ -@@ -13061,25 +13056,24 @@ ssl3_HandleRecord(sslSocket *ss, SSL3Cip - * will fail if the server fails to negotiate compatibility mode in a - * 0-RTT session that is resumed from a session that did negotiate it. - * We don't care about that corner case right now. */ - if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3 && - cText->hdr[0] == ssl_ct_change_cipher_spec && - ss->ssl3.hs.ws != idle_handshake && - cText->buf->len == 1 && - cText->buf->buf[0] == change_cipher_spec_choice) { -- if (ss->ssl3.hs.allowCcs) { -- /* Ignore the first CCS. */ -- ss->ssl3.hs.allowCcs = PR_FALSE; -+ if (!ss->ssl3.hs.rejectCcs) { -+ /* Allow only the first CCS. */ -+ ss->ssl3.hs.rejectCcs = PR_TRUE; - return SECSuccess; -- } -- -- /* Compatibility mode is not negotiated. */ -- alert = unexpected_message; -- PORT_SetError(SSL_ERROR_RX_MALFORMED_CHANGE_CIPHER); -+ } else { -+ alert = unexpected_message; -+ PORT_SetError(SSL_ERROR_RX_MALFORMED_CHANGE_CIPHER); -+ } - } - - if ((IS_DTLS(ss) && !dtls13_AeadLimitReached(spec)) || - (!IS_DTLS(ss) && ss->sec.isServer && - ss->ssl3.hs.zeroRttIgnore == ssl_0rtt_ignore_trial)) { - /* Silently drop the packet unless we sent a fatal alert. */ - if (ss->ssl3.fatalAlertSent) { - return SECFailure; ---- a/lib/ssl/sslimpl.h -+++ b/lib/ssl/sslimpl.h -@@ -705,20 +705,17 @@ typedef struct SSL3HandshakeStateStr { - sslZeroRttIgnore zeroRttIgnore; /* Are we ignoring 0-RTT? */ - ssl3CipherSuite zeroRttSuite; /* The cipher suite we used for 0-RTT. */ - PRCList bufferedEarlyData; /* Buffered TLS 1.3 early data - * on server.*/ - PRBool helloRetry; /* True if HelloRetryRequest has been sent - * or received. */ - PRBool receivedCcs; /* A server received ChangeCipherSpec - * before the handshake started. */ -- PRBool allowCcs; /* A server allows ChangeCipherSpec -- * as the middlebox compatibility mode -- * is explicitly indicarted by -- * legacy_session_id in TLS 1.3 ClientHello. */ -+ PRBool rejectCcs; /* Excessive ChangeCipherSpecs are rejected. */ - PRBool clientCertRequested; /* True if CertificateRequest received. */ - PRBool endOfFlight; /* Processed a full flight (DTLS 1.3). */ - ssl3KEADef kea_def_mutable; /* Used to hold the writable kea_def - * we use for TLS 1.3 */ - PRUint16 ticketNonce; /* A counter we use for tickets. */ - SECItem fakeSid; /* ... (server) the SID the client used. */ - - /* rttEstimate is used to guess the round trip time between server and client. - diff --git a/dev-libs/nss/nss-3.58-r2.ebuild b/dev-libs/nss/nss-3.58-r2.ebuild deleted file mode 100644 index 50de523f59f0..000000000000 --- a/dev-libs/nss/nss-3.58-r2.ebuild +++ /dev/null @@ -1,360 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit flag-o-matic multilib toolchain-funcs multilib-minimal - -NSPR_VER="4.29" -RTM_NAME="NSS_${PV//./_}_RTM" - -DESCRIPTION="Mozilla's Network Security Services library that implements PKI support" -HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS" -SRC_URI="https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/${P}.tar.gz - cacert? ( https://dev.gentoo.org/~axs/distfiles/${PN}-cacert-class1-class3.patch )" - -LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )" -SLOT="0" -KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~x64-solaris ~x86-solaris" -IUSE="cacert utils" -# pkg-config called by nss-config -> virtual/pkgconfig in RDEPEND -RDEPEND=" - >=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}] - >=dev-db/sqlite-3.8.2[${MULTILIB_USEDEP}] - >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] - virtual/pkgconfig -" -DEPEND="${RDEPEND}" - -RESTRICT="test" - -S="${WORKDIR}/${P}/${PN}" - -MULTILIB_CHOST_TOOLS=( - /usr/bin/nss-config -) - -PATCHES=( - # Custom changes for gentoo - "${FILESDIR}/${PN}-3.53-gentoo-fixups.patch" - "${FILESDIR}/${PN}-3.21-gentoo-fixup-warnings.patch" - "${FILESDIR}/${PN}-3.23-hppa-byte_order.patch" - "${FILESDIR}/${PN}-3.53-fix-building-on-ppc.patch" - "${FILESDIR}/${PN}-3.58-always-tolerate-the-first-CCS-in-TLS1.3.patch" -) - -src_prepare() { - if use cacert ; then #521462 - PATCHES+=( - "${DISTDIR}/${PN}-cacert-class1-class3.patch" - ) - fi - - default - - pushd coreconf >/dev/null || die - # hack nspr paths - echo 'INCLUDES += -I$(DIST)/include/dbm' \ - >> headers.mk || die "failed to append include" - - # modify install path - sed -e '/CORE_DEPTH/s:SOURCE_PREFIX.*$:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \ - -i source.mk || die - - # Respect LDFLAGS - sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' rules.mk - popd >/dev/null || die - - # Fix pkgconfig file for Prefix - sed -i -e "/^PREFIX =/s:= /usr:= ${EPREFIX}/usr:" \ - config/Makefile || die - - # use host shlibsign if need be #436216 - if tc-is-cross-compiler ; then - sed -i \ - -e 's:"${2}"/shlibsign:shlibsign:' \ - cmd/shlibsign/sign.sh || die - fi - - # dirty hack - sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../freebl/\$(OBJDIR):" \ - lib/ssl/config.mk || die - sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../../lib/freebl/\$(OBJDIR):" \ - cmd/platlibs.mk || die - - multilib_copy_sources - - strip-flags -} - -multilib_src_configure() { - # Ensure we stay multilib aware - sed -i -e "/@libdir@/ s:lib64:$(get_libdir):" config/Makefile || die -} - -nssarch() { - # Most of the arches are the same as $ARCH - local t=${1:-${CHOST}} - case ${t} in - aarch64*)echo "aarch64";; - hppa*) echo "parisc";; - i?86*) echo "i686";; - x86_64*) echo "x86_64";; - *) tc-arch ${t};; - esac -} - -nssbits() { - local cc cppflags="${1}CPPFLAGS" cflags="${1}CFLAGS" - if [[ ${1} == BUILD_ ]]; then - cc=$(tc-getBUILD_CC) - else - cc=$(tc-getCC) - fi - echo > "${T}"/test.c || die - ${cc} ${!cppflags} ${!cflags} -c "${T}"/test.c -o "${T}/${1}test.o" || die - case $(file "${T}/${1}test.o") in - *32-bit*x86-64*) echo USE_X32=1;; - *64-bit*|*ppc64*|*x86_64*) echo USE_64=1;; - *32-bit*|*ppc*|*i386*) ;; - *) die "Failed to detect whether ${cc} builds 64bits or 32bits, disable distcc if you're using it, please";; - esac -} - -multilib_src_compile() { - # use ABI to determine bit'ness, or fallback if unset - local buildbits mybits - case "${ABI}" in - n32) mybits="USE_N32=1";; - x32) mybits="USE_X32=1";; - s390x|*64) mybits="USE_64=1";; - ${DEFAULT_ABI}) - einfo "Running compilation test to determine bit'ness" - mybits=$(nssbits) - ;; - esac - # bitness of host may differ from target - if tc-is-cross-compiler; then - buildbits=$(nssbits BUILD_) - fi - - local makeargs=( - CC="$(tc-getCC)" - CCC="$(tc-getCXX)" - AR="$(tc-getAR) rc \$@" - RANLIB="$(tc-getRANLIB)" - OPTIMIZER= - ${mybits} - ) - - # Take care of nspr settings #436216 - local myCPPFLAGS="${CPPFLAGS} $($(tc-getPKG_CONFIG) nspr --cflags)" - unset NSPR_INCLUDE_DIR - - export NSS_ALLOW_SSLKEYLOGFILE=1 - export NSS_ENABLE_WERROR=0 #567158 - export BUILD_OPT=1 - export NSS_USE_SYSTEM_SQLITE=1 - export NSDISTMODE=copy - export FREEBL_NO_DEPEND=1 - export FREEBL_LOWHASH=1 - export NSS_SEED_ONLY_DEV_URANDOM=1 - export USE_SYSTEM_ZLIB=1 - export ZLIB_LIBS=-lz - export ASFLAGS="" - # Fix build failure on arm64 - export NS_USE_GCC=1 - # Detect compiler type and set proper environment value - if tc-is-gcc; then - export CC_IS_GCC=1 - elif tc-is-clang; then - export CC_IS_CLANG=1 - fi - - local d - - # Build the host tools first. - LDFLAGS="${BUILD_LDFLAGS}" \ - XCFLAGS="${BUILD_CFLAGS}" \ - NSPR_LIB_DIR="${T}/fakedir" \ - emake -j1 -C coreconf \ - CC="$(tc-getBUILD_CC)" \ - ${buildbits-${mybits}} - makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" ) - - # Then build the target tools. - for d in . lib/dbm ; do - CPPFLAGS="${myCPPFLAGS}" \ - XCFLAGS="${CFLAGS} ${CPPFLAGS}" \ - NSPR_LIB_DIR="${T}/fakedir" \ - emake -j1 "${makeargs[@]}" -C ${d} OS_TEST="$(nssarch)" - done -} - -# Altering these 3 libraries breaks the CHK verification. -# All of the following cause it to break: -# - stripping -# - prelink -# - ELF signing -# http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html -# Either we have to NOT strip them, or we have to forcibly resign after -# stripping. -#local_libdir="$(get_libdir)" -#export STRIP_MASK=" -# */${local_libdir}/libfreebl3.so* -# */${local_libdir}/libnssdbm3.so* -# */${local_libdir}/libsoftokn3.so*" - -export NSS_CHK_SIGN_LIBS="freebl3 nssdbm3 softokn3" - -generate_chk() { - local shlibsign="$1" - local libdir="$2" - einfo "Resigning core NSS libraries for FIPS validation" - shift 2 - local i - for i in ${NSS_CHK_SIGN_LIBS} ; do - local libname=lib${i}.so - local chkname=lib${i}.chk - "${shlibsign}" \ - -i "${libdir}"/${libname} \ - -o "${libdir}"/${chkname}.tmp \ - && mv -f \ - "${libdir}"/${chkname}.tmp \ - "${libdir}"/${chkname} \ - || die "Failed to sign ${libname}" - done -} - -cleanup_chk() { - local libdir="$1" - shift 1 - local i - for i in ${NSS_CHK_SIGN_LIBS} ; do - local libfname="${libdir}/lib${i}.so" - # If the major version has changed, then we have old chk files. - [ ! -f "${libfname}" -a -f "${libfname}.chk" ] \ - && rm -f "${libfname}.chk" - done -} - -multilib_src_install() { - pushd dist >/dev/null || die - - dodir /usr/$(get_libdir) - cp -L */lib/*$(get_libname) "${ED}"/usr/$(get_libdir) || die "copying shared libs failed" - local i - for i in crmf freebl nssb nssckfw ; do - cp -L */lib/lib${i}.a "${ED}"/usr/$(get_libdir) || die "copying libs failed" - done - - # Install nss-config and pkgconfig file - dodir /usr/bin - cp -L */bin/nss-config "${ED}"/usr/bin || die - dodir /usr/$(get_libdir)/pkgconfig - cp -L */lib/pkgconfig/nss.pc "${ED}"/usr/$(get_libdir)/pkgconfig || die - - # create an nss-softokn.pc from nss.pc for libfreebl and some private headers - # bug 517266 - sed -e 's#Libs:#Libs: -lfreebl#' \ - -e 's#Cflags:#Cflags: -I${includedir}/private#' \ - */lib/pkgconfig/nss.pc >"${ED}"/usr/$(get_libdir)/pkgconfig/nss-softokn.pc \ - || die "could not create nss-softokn.pc" - - # all the include files - insinto /usr/include/nss - doins public/nss/*.{h,api} - insinto /usr/include/nss/private - doins private/nss/{blapi,alghmac,cmac}.h - - popd >/dev/null || die - - local f nssutils - # Always enabled because we need it for chk generation. - nssutils=( shlibsign ) - - if multilib_is_native_abi ; then - if use utils; then - # The tests we do not need to install. - #nssutils_test="bltest crmftest dbtest dertimetest - #fipstest remtest sdrtest" - # checkcert utils has been removed in nss-3.22: - # https://bugzilla.mozilla.org/show_bug.cgi?id=1187545 - # https://hg.mozilla.org/projects/nss/rev/df1729d37870 - # certcgi has been removed in nss-3.36: - # https://bugzilla.mozilla.org/show_bug.cgi?id=1426602 - nssutils+=( - addbuiltin - atob - baddbdir - btoa - certutil - cmsutil - conflict - crlutil - derdump - digest - makepqg - mangle - modutil - multinit - nonspr10 - ocspclnt - oidcalc - p7content - p7env - p7sign - p7verify - pk11mode - pk12util - pp - rsaperf - selfserv - signtool - signver - ssltap - strsclnt - symkeyutil - tstclnt - vfychain - vfyserv - ) - # install man-pages for utils (bug #516810) - doman doc/nroff/*.1 - fi - pushd dist/*/bin >/dev/null || die - for f in ${nssutils[@]}; do - dobin ${f} - done - popd >/dev/null || die - fi - - # Prelink breaks the CHK files. We don't have any reliable way to run - # shlibsign after prelink. - dodir /etc/prelink.conf.d - printf -- "-b ${EPREFIX}/usr/$(get_libdir)/lib%s.so\n" ${NSS_CHK_SIGN_LIBS} \ - > "${ED}"/etc/prelink.conf.d/nss.conf -} - -pkg_postinst() { - multilib_pkg_postinst() { - # We must re-sign the libraries AFTER they are stripped. - local shlibsign="${EROOT}/usr/bin/shlibsign" - # See if we can execute it (cross-compiling & such). #436216 - "${shlibsign}" -h >&/dev/null - if [[ $? -gt 1 ]] ; then - shlibsign="shlibsign" - fi - generate_chk "${shlibsign}" "${EROOT}"/usr/$(get_libdir) - } - - multilib_foreach_abi multilib_pkg_postinst -} - -pkg_postrm() { - multilib_pkg_postrm() { - cleanup_chk "${EROOT}"/usr/$(get_libdir) - } - - multilib_foreach_abi multilib_pkg_postrm -} diff --git a/dev-libs/nss/nss-3.62.ebuild b/dev-libs/nss/nss-3.62.ebuild deleted file mode 100644 index 5e3240e8db8d..000000000000 --- a/dev-libs/nss/nss-3.62.ebuild +++ /dev/null @@ -1,359 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit flag-o-matic multilib toolchain-funcs multilib-minimal - -NSPR_VER="4.29" -RTM_NAME="NSS_${PV//./_}_RTM" - -DESCRIPTION="Mozilla's Network Security Services library that implements PKI support" -HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS" -SRC_URI="https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/${P}.tar.gz - cacert? ( https://dev.gentoo.org/~axs/distfiles/${PN}-cacert-class1-class3.patch )" - -LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-solaris ~x86-solaris" -IUSE="cacert utils" -# pkg-config called by nss-config -> virtual/pkgconfig in RDEPEND -RDEPEND=" - >=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}] - >=dev-db/sqlite-3.8.2[${MULTILIB_USEDEP}] - >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] - virtual/pkgconfig -" -DEPEND="${RDEPEND}" - -RESTRICT="test" - -S="${WORKDIR}/${P}/${PN}" - -MULTILIB_CHOST_TOOLS=( - /usr/bin/nss-config -) - -PATCHES=( - # Custom changes for gentoo - "${FILESDIR}/${PN}-3.53-gentoo-fixups.patch" - "${FILESDIR}/${PN}-3.21-gentoo-fixup-warnings.patch" - "${FILESDIR}/${PN}-3.23-hppa-byte_order.patch" -) - -src_prepare() { - if use cacert ; then #521462 - PATCHES+=( - "${DISTDIR}/${PN}-cacert-class1-class3.patch" - ) - fi - - default - - pushd coreconf >/dev/null || die - # hack nspr paths - echo 'INCLUDES += -I$(DIST)/include/dbm' \ - >> headers.mk || die "failed to append include" - - # modify install path - sed -e '/CORE_DEPTH/s:SOURCE_PREFIX.*$:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \ - -i source.mk || die - - # Respect LDFLAGS - sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' rules.mk - popd >/dev/null || die - - # Fix pkgconfig file for Prefix - sed -i -e "/^PREFIX =/s:= /usr:= ${EPREFIX}/usr:" \ - config/Makefile || die - - # use host shlibsign if need be #436216 - if tc-is-cross-compiler ; then - sed -i \ - -e 's:"${2}"/shlibsign:shlibsign:' \ - cmd/shlibsign/sign.sh || die - fi - - # dirty hack - sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../freebl/\$(OBJDIR):" \ - lib/ssl/config.mk || die - sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../../lib/freebl/\$(OBJDIR):" \ - cmd/platlibs.mk || die - - multilib_copy_sources - - strip-flags -} - -multilib_src_configure() { - # Ensure we stay multilib aware - sed -i -e "/@libdir@/ s:lib64:$(get_libdir):" config/Makefile || die -} - -nssarch() { - # Most of the arches are the same as $ARCH - local t=${1:-${CHOST}} - case ${t} in - *86*-pc-solaris2*) echo "i86pc" ;; - aarch64*) echo "aarch64" ;; - hppa*) echo "parisc" ;; - i?86*) echo "i686" ;; - x86_64*) echo "x86_64" ;; - *) tc-arch ${t} ;; - esac -} - -nssbits() { - local cc cppflags="${1}CPPFLAGS" cflags="${1}CFLAGS" - if [[ ${1} == BUILD_ ]]; then - cc=$(tc-getBUILD_CC) - else - cc=$(tc-getCC) - fi - echo > "${T}"/test.c || die - ${cc} ${!cppflags} ${!cflags} -c "${T}"/test.c -o "${T}/${1}test.o" || die - case $(file "${T}/${1}test.o") in - *32-bit*x86-64*) echo USE_X32=1;; - *64-bit*|*ppc64*|*x86_64*) echo USE_64=1;; - *32-bit*|*ppc*|*i386*) ;; - *) die "Failed to detect whether ${cc} builds 64bits or 32bits, disable distcc if you're using it, please";; - esac -} - -multilib_src_compile() { - # use ABI to determine bit'ness, or fallback if unset - local buildbits mybits - case "${ABI}" in - n32) mybits="USE_N32=1";; - x32) mybits="USE_X32=1";; - s390x|*64) mybits="USE_64=1";; - ${DEFAULT_ABI}) - einfo "Running compilation test to determine bit'ness" - mybits=$(nssbits) - ;; - esac - # bitness of host may differ from target - if tc-is-cross-compiler; then - buildbits=$(nssbits BUILD_) - fi - - local makeargs=( - CC="$(tc-getCC)" - CCC="$(tc-getCXX)" - AR="$(tc-getAR) rc \$@" - RANLIB="$(tc-getRANLIB)" - OPTIMIZER= - ${mybits} - ) - - # Take care of nspr settings #436216 - local myCPPFLAGS="${CPPFLAGS} $($(tc-getPKG_CONFIG) nspr --cflags)" - unset NSPR_INCLUDE_DIR - - export NSS_ALLOW_SSLKEYLOGFILE=1 - export NSS_ENABLE_WERROR=0 #567158 - export BUILD_OPT=1 - export NSS_USE_SYSTEM_SQLITE=1 - export NSDISTMODE=copy - export FREEBL_NO_DEPEND=1 - export FREEBL_LOWHASH=1 - export NSS_SEED_ONLY_DEV_URANDOM=1 - export USE_SYSTEM_ZLIB=1 - export ZLIB_LIBS=-lz - export ASFLAGS="" - # Fix build failure on arm64 - export NS_USE_GCC=1 - # Detect compiler type and set proper environment value - if tc-is-gcc; then - export CC_IS_GCC=1 - elif tc-is-clang; then - export CC_IS_CLANG=1 - fi - - local d - - # Build the host tools first. - LDFLAGS="${BUILD_LDFLAGS}" \ - XCFLAGS="${BUILD_CFLAGS}" \ - NSPR_LIB_DIR="${T}/fakedir" \ - emake -j1 -C coreconf \ - CC="$(tc-getBUILD_CC)" \ - ${buildbits-${mybits}} - makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" ) - - # Then build the target tools. - for d in . lib/dbm ; do - CPPFLAGS="${myCPPFLAGS}" \ - XCFLAGS="${CFLAGS} ${CPPFLAGS}" \ - NSPR_LIB_DIR="${T}/fakedir" \ - emake -j1 "${makeargs[@]}" -C ${d} OS_TEST="$(nssarch)" - done -} - -# Altering these 3 libraries breaks the CHK verification. -# All of the following cause it to break: -# - stripping -# - prelink -# - ELF signing -# http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html -# Either we have to NOT strip them, or we have to forcibly resign after -# stripping. -#local_libdir="$(get_libdir)" -#export STRIP_MASK=" -# */${local_libdir}/libfreebl3.so* -# */${local_libdir}/libnssdbm3.so* -# */${local_libdir}/libsoftokn3.so*" - -export NSS_CHK_SIGN_LIBS="freebl3 nssdbm3 softokn3" - -generate_chk() { - local shlibsign="$1" - local libdir="$2" - einfo "Resigning core NSS libraries for FIPS validation" - shift 2 - local i - for i in ${NSS_CHK_SIGN_LIBS} ; do - local libname=lib${i}.so - local chkname=lib${i}.chk - "${shlibsign}" \ - -i "${libdir}"/${libname} \ - -o "${libdir}"/${chkname}.tmp \ - && mv -f \ - "${libdir}"/${chkname}.tmp \ - "${libdir}"/${chkname} \ - || die "Failed to sign ${libname}" - done -} - -cleanup_chk() { - local libdir="$1" - shift 1 - local i - for i in ${NSS_CHK_SIGN_LIBS} ; do - local libfname="${libdir}/lib${i}.so" - # If the major version has changed, then we have old chk files. - [ ! -f "${libfname}" -a -f "${libfname}.chk" ] \ - && rm -f "${libfname}.chk" - done -} - -multilib_src_install() { - pushd dist >/dev/null || die - - dodir /usr/$(get_libdir) - cp -L */lib/*$(get_libname) "${ED}"/usr/$(get_libdir) || die "copying shared libs failed" - local i - for i in crmf freebl nssb nssckfw ; do - cp -L */lib/lib${i}.a "${ED}"/usr/$(get_libdir) || die "copying libs failed" - done - - # Install nss-config and pkgconfig file - dodir /usr/bin - cp -L */bin/nss-config "${ED}"/usr/bin || die - dodir /usr/$(get_libdir)/pkgconfig - cp -L */lib/pkgconfig/nss.pc "${ED}"/usr/$(get_libdir)/pkgconfig || die - - # create an nss-softokn.pc from nss.pc for libfreebl and some private headers - # bug 517266 - sed -e 's#Libs:#Libs: -lfreebl#' \ - -e 's#Cflags:#Cflags: -I${includedir}/private#' \ - */lib/pkgconfig/nss.pc >"${ED}"/usr/$(get_libdir)/pkgconfig/nss-softokn.pc \ - || die "could not create nss-softokn.pc" - - # all the include files - insinto /usr/include/nss - doins public/nss/*.{h,api} - insinto /usr/include/nss/private - doins private/nss/{blapi,alghmac,cmac}.h - - popd >/dev/null || die - - local f nssutils - # Always enabled because we need it for chk generation. - nssutils=( shlibsign ) - - if multilib_is_native_abi ; then - if use utils; then - # The tests we do not need to install. - #nssutils_test="bltest crmftest dbtest dertimetest - #fipstest remtest sdrtest" - # checkcert utils has been removed in nss-3.22: - # https://bugzilla.mozilla.org/show_bug.cgi?id=1187545 - # https://hg.mozilla.org/projects/nss/rev/df1729d37870 - # certcgi has been removed in nss-3.36: - # https://bugzilla.mozilla.org/show_bug.cgi?id=1426602 - nssutils+=( - addbuiltin - atob - baddbdir - btoa - certutil - cmsutil - conflict - crlutil - derdump - digest - makepqg - mangle - modutil - multinit - nonspr10 - ocspclnt - oidcalc - p7content - p7env - p7sign - p7verify - pk11mode - pk12util - pp - rsaperf - selfserv - signtool - signver - ssltap - strsclnt - symkeyutil - tstclnt - vfychain - vfyserv - ) - # install man-pages for utils (bug #516810) - doman doc/nroff/*.1 - fi - pushd dist/*/bin >/dev/null || die - for f in ${nssutils[@]}; do - dobin ${f} - done - popd >/dev/null || die - fi - - # Prelink breaks the CHK files. We don't have any reliable way to run - # shlibsign after prelink. - dodir /etc/prelink.conf.d - printf -- "-b ${EPREFIX}/usr/$(get_libdir)/lib%s.so\n" ${NSS_CHK_SIGN_LIBS} \ - > "${ED}"/etc/prelink.conf.d/nss.conf -} - -pkg_postinst() { - multilib_pkg_postinst() { - # We must re-sign the libraries AFTER they are stripped. - local shlibsign="${EROOT}/usr/bin/shlibsign" - # See if we can execute it (cross-compiling & such). #436216 - "${shlibsign}" -h >&/dev/null - if [[ $? -gt 1 ]] ; then - shlibsign="shlibsign" - fi - generate_chk "${shlibsign}" "${EROOT}"/usr/$(get_libdir) - } - - multilib_foreach_abi multilib_pkg_postinst -} - -pkg_postrm() { - multilib_pkg_postrm() { - cleanup_chk "${EROOT}"/usr/$(get_libdir) - } - - multilib_foreach_abi multilib_pkg_postrm -} diff --git a/dev-libs/nss/nss-3.63.1.ebuild b/dev-libs/nss/nss-3.63.1.ebuild new file mode 100644 index 000000000000..106c5b77225a --- /dev/null +++ b/dev-libs/nss/nss-3.63.1.ebuild @@ -0,0 +1,357 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit flag-o-matic multilib toolchain-funcs multilib-minimal + +NSPR_VER="4.29" +RTM_NAME="NSS_${PV//./_}_RTM" + +DESCRIPTION="Mozilla's Network Security Services library that implements PKI support" +HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS" +SRC_URI="https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/${P}.tar.gz + cacert? ( https://dev.gentoo.org/~whissi/dist/ca-certificates/nss-cacert-class1-class3-r1.patch )" + +LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )" +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~x64-solaris ~x86-solaris" +IUSE="cacert utils" +# pkg-config called by nss-config -> virtual/pkgconfig in RDEPEND +RDEPEND=" + >=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}] + >=dev-db/sqlite-3.8.2[${MULTILIB_USEDEP}] + >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] + virtual/pkgconfig +" +DEPEND="${RDEPEND}" + +RESTRICT="test" + +S="${WORKDIR}/${P}/${PN}" + +MULTILIB_CHOST_TOOLS=( + /usr/bin/nss-config +) + +PATCHES=( + # Custom changes for gentoo + "${FILESDIR}/${PN}-3.53-gentoo-fixups.patch" + "${FILESDIR}/${PN}-3.21-gentoo-fixup-warnings.patch" + "${FILESDIR}/${PN}-3.23-hppa-byte_order.patch" +) + +src_prepare() { + default + + if use cacert ; then + eapply -p2 "${DISTDIR}"/nss-cacert-class1-class3-r1.patch + fi + + pushd coreconf >/dev/null || die + # hack nspr paths + echo 'INCLUDES += -I$(DIST)/include/dbm' \ + >> headers.mk || die "failed to append include" + + # modify install path + sed -e '/CORE_DEPTH/s:SOURCE_PREFIX.*$:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \ + -i source.mk || die + + # Respect LDFLAGS + sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' rules.mk + popd >/dev/null || die + + # Fix pkgconfig file for Prefix + sed -i -e "/^PREFIX =/s:= /usr:= ${EPREFIX}/usr:" \ + config/Makefile || die + + # use host shlibsign if need be #436216 + if tc-is-cross-compiler ; then + sed -i \ + -e 's:"${2}"/shlibsign:shlibsign:' \ + cmd/shlibsign/sign.sh || die + fi + + # dirty hack + sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../freebl/\$(OBJDIR):" \ + lib/ssl/config.mk || die + sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../../lib/freebl/\$(OBJDIR):" \ + cmd/platlibs.mk || die + + multilib_copy_sources + + strip-flags +} + +multilib_src_configure() { + # Ensure we stay multilib aware + sed -i -e "/@libdir@/ s:lib64:$(get_libdir):" config/Makefile || die +} + +nssarch() { + # Most of the arches are the same as $ARCH + local t=${1:-${CHOST}} + case ${t} in + *86*-pc-solaris2*) echo "i86pc" ;; + aarch64*) echo "aarch64" ;; + hppa*) echo "parisc" ;; + i?86*) echo "i686" ;; + x86_64*) echo "x86_64" ;; + *) tc-arch ${t} ;; + esac +} + +nssbits() { + local cc cppflags="${1}CPPFLAGS" cflags="${1}CFLAGS" + if [[ ${1} == BUILD_ ]]; then + cc=$(tc-getBUILD_CC) + else + cc=$(tc-getCC) + fi + echo > "${T}"/test.c || die + ${cc} ${!cppflags} ${!cflags} -c "${T}"/test.c -o "${T}/${1}test.o" || die + case $(file "${T}/${1}test.o") in + *32-bit*x86-64*) echo USE_X32=1;; + *64-bit*|*ppc64*|*x86_64*) echo USE_64=1;; + *32-bit*|*ppc*|*i386*) ;; + *) die "Failed to detect whether ${cc} builds 64bits or 32bits, disable distcc if you're using it, please";; + esac +} + +multilib_src_compile() { + # use ABI to determine bit'ness, or fallback if unset + local buildbits mybits + case "${ABI}" in + n32) mybits="USE_N32=1";; + x32) mybits="USE_X32=1";; + s390x|*64) mybits="USE_64=1";; + ${DEFAULT_ABI}) + einfo "Running compilation test to determine bit'ness" + mybits=$(nssbits) + ;; + esac + # bitness of host may differ from target + if tc-is-cross-compiler; then + buildbits=$(nssbits BUILD_) + fi + + local makeargs=( + CC="$(tc-getCC)" + CCC="$(tc-getCXX)" + AR="$(tc-getAR) rc \$@" + RANLIB="$(tc-getRANLIB)" + OPTIMIZER= + ${mybits} + ) + + # Take care of nspr settings #436216 + local myCPPFLAGS="${CPPFLAGS} $($(tc-getPKG_CONFIG) nspr --cflags)" + unset NSPR_INCLUDE_DIR + + export NSS_ALLOW_SSLKEYLOGFILE=1 + export NSS_ENABLE_WERROR=0 #567158 + export BUILD_OPT=1 + export NSS_USE_SYSTEM_SQLITE=1 + export NSDISTMODE=copy + export FREEBL_NO_DEPEND=1 + export FREEBL_LOWHASH=1 + export NSS_SEED_ONLY_DEV_URANDOM=1 + export USE_SYSTEM_ZLIB=1 + export ZLIB_LIBS=-lz + export ASFLAGS="" + # Fix build failure on arm64 + export NS_USE_GCC=1 + # Detect compiler type and set proper environment value + if tc-is-gcc; then + export CC_IS_GCC=1 + elif tc-is-clang; then + export CC_IS_CLANG=1 + fi + + local d + + # Build the host tools first. + LDFLAGS="${BUILD_LDFLAGS}" \ + XCFLAGS="${BUILD_CFLAGS}" \ + NSPR_LIB_DIR="${T}/fakedir" \ + emake -j1 -C coreconf \ + CC="$(tc-getBUILD_CC)" \ + ${buildbits-${mybits}} + makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" ) + + # Then build the target tools. + for d in . lib/dbm ; do + CPPFLAGS="${myCPPFLAGS}" \ + XCFLAGS="${CFLAGS} ${CPPFLAGS}" \ + NSPR_LIB_DIR="${T}/fakedir" \ + emake -j1 "${makeargs[@]}" -C ${d} OS_TEST="$(nssarch)" + done +} + +# Altering these 3 libraries breaks the CHK verification. +# All of the following cause it to break: +# - stripping +# - prelink +# - ELF signing +# http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html +# Either we have to NOT strip them, or we have to forcibly resign after +# stripping. +#local_libdir="$(get_libdir)" +#export STRIP_MASK=" +# */${local_libdir}/libfreebl3.so* +# */${local_libdir}/libnssdbm3.so* +# */${local_libdir}/libsoftokn3.so*" + +export NSS_CHK_SIGN_LIBS="freebl3 nssdbm3 softokn3" + +generate_chk() { + local shlibsign="$1" + local libdir="$2" + einfo "Resigning core NSS libraries for FIPS validation" + shift 2 + local i + for i in ${NSS_CHK_SIGN_LIBS} ; do + local libname=lib${i}.so + local chkname=lib${i}.chk + "${shlibsign}" \ + -i "${libdir}"/${libname} \ + -o "${libdir}"/${chkname}.tmp \ + && mv -f \ + "${libdir}"/${chkname}.tmp \ + "${libdir}"/${chkname} \ + || die "Failed to sign ${libname}" + done +} + +cleanup_chk() { + local libdir="$1" + shift 1 + local i + for i in ${NSS_CHK_SIGN_LIBS} ; do + local libfname="${libdir}/lib${i}.so" + # If the major version has changed, then we have old chk files. + [ ! -f "${libfname}" -a -f "${libfname}.chk" ] \ + && rm -f "${libfname}.chk" + done +} + +multilib_src_install() { + pushd dist >/dev/null || die + + dodir /usr/$(get_libdir) + cp -L */lib/*$(get_libname) "${ED}"/usr/$(get_libdir) || die "copying shared libs failed" + local i + for i in crmf freebl nssb nssckfw ; do + cp -L */lib/lib${i}.a "${ED}"/usr/$(get_libdir) || die "copying libs failed" + done + + # Install nss-config and pkgconfig file + dodir /usr/bin + cp -L */bin/nss-config "${ED}"/usr/bin || die + dodir /usr/$(get_libdir)/pkgconfig + cp -L */lib/pkgconfig/nss.pc "${ED}"/usr/$(get_libdir)/pkgconfig || die + + # create an nss-softokn.pc from nss.pc for libfreebl and some private headers + # bug 517266 + sed -e 's#Libs:#Libs: -lfreebl#' \ + -e 's#Cflags:#Cflags: -I${includedir}/private#' \ + */lib/pkgconfig/nss.pc >"${ED}"/usr/$(get_libdir)/pkgconfig/nss-softokn.pc \ + || die "could not create nss-softokn.pc" + + # all the include files + insinto /usr/include/nss + doins public/nss/*.{h,api} + insinto /usr/include/nss/private + doins private/nss/{blapi,alghmac,cmac}.h + + popd >/dev/null || die + + local f nssutils + # Always enabled because we need it for chk generation. + nssutils=( shlibsign ) + + if multilib_is_native_abi ; then + if use utils; then + # The tests we do not need to install. + #nssutils_test="bltest crmftest dbtest dertimetest + #fipstest remtest sdrtest" + # checkcert utils has been removed in nss-3.22: + # https://bugzilla.mozilla.org/show_bug.cgi?id=1187545 + # https://hg.mozilla.org/projects/nss/rev/df1729d37870 + # certcgi has been removed in nss-3.36: + # https://bugzilla.mozilla.org/show_bug.cgi?id=1426602 + nssutils+=( + addbuiltin + atob + baddbdir + btoa + certutil + cmsutil + conflict + crlutil + derdump + digest + makepqg + mangle + modutil + multinit + nonspr10 + ocspclnt + oidcalc + p7content + p7env + p7sign + p7verify + pk11mode + pk12util + pp + rsaperf + selfserv + signtool + signver + ssltap + strsclnt + symkeyutil + tstclnt + vfychain + vfyserv + ) + # install man-pages for utils (bug #516810) + doman doc/nroff/*.1 + fi + pushd dist/*/bin >/dev/null || die + for f in ${nssutils[@]}; do + dobin ${f} + done + popd >/dev/null || die + fi + + # Prelink breaks the CHK files. We don't have any reliable way to run + # shlibsign after prelink. + dodir /etc/prelink.conf.d + printf -- "-b ${EPREFIX}/usr/$(get_libdir)/lib%s.so\n" ${NSS_CHK_SIGN_LIBS} \ + > "${ED}"/etc/prelink.conf.d/nss.conf +} + +pkg_postinst() { + multilib_pkg_postinst() { + # We must re-sign the libraries AFTER they are stripped. + local shlibsign="${EROOT}/usr/bin/shlibsign" + # See if we can execute it (cross-compiling & such). #436216 + "${shlibsign}" -h >&/dev/null + if [[ $? -gt 1 ]] ; then + shlibsign="shlibsign" + fi + generate_chk "${shlibsign}" "${EROOT}"/usr/$(get_libdir) + } + + multilib_foreach_abi multilib_pkg_postinst +} + +pkg_postrm() { + multilib_pkg_postrm() { + cleanup_chk "${EROOT}"/usr/$(get_libdir) + } + + multilib_foreach_abi multilib_pkg_postrm +} diff --git a/dev-libs/nss/nss-3.63.ebuild b/dev-libs/nss/nss-3.63.ebuild deleted file mode 100644 index 5e3240e8db8d..000000000000 --- a/dev-libs/nss/nss-3.63.ebuild +++ /dev/null @@ -1,359 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit flag-o-matic multilib toolchain-funcs multilib-minimal - -NSPR_VER="4.29" -RTM_NAME="NSS_${PV//./_}_RTM" - -DESCRIPTION="Mozilla's Network Security Services library that implements PKI support" -HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS" -SRC_URI="https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/${P}.tar.gz - cacert? ( https://dev.gentoo.org/~axs/distfiles/${PN}-cacert-class1-class3.patch )" - -LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-solaris ~x86-solaris" -IUSE="cacert utils" -# pkg-config called by nss-config -> virtual/pkgconfig in RDEPEND -RDEPEND=" - >=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}] - >=dev-db/sqlite-3.8.2[${MULTILIB_USEDEP}] - >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] - virtual/pkgconfig -" -DEPEND="${RDEPEND}" - -RESTRICT="test" - -S="${WORKDIR}/${P}/${PN}" - -MULTILIB_CHOST_TOOLS=( - /usr/bin/nss-config -) - -PATCHES=( - # Custom changes for gentoo - "${FILESDIR}/${PN}-3.53-gentoo-fixups.patch" - "${FILESDIR}/${PN}-3.21-gentoo-fixup-warnings.patch" - "${FILESDIR}/${PN}-3.23-hppa-byte_order.patch" -) - -src_prepare() { - if use cacert ; then #521462 - PATCHES+=( - "${DISTDIR}/${PN}-cacert-class1-class3.patch" - ) - fi - - default - - pushd coreconf >/dev/null || die - # hack nspr paths - echo 'INCLUDES += -I$(DIST)/include/dbm' \ - >> headers.mk || die "failed to append include" - - # modify install path - sed -e '/CORE_DEPTH/s:SOURCE_PREFIX.*$:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \ - -i source.mk || die - - # Respect LDFLAGS - sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' rules.mk - popd >/dev/null || die - - # Fix pkgconfig file for Prefix - sed -i -e "/^PREFIX =/s:= /usr:= ${EPREFIX}/usr:" \ - config/Makefile || die - - # use host shlibsign if need be #436216 - if tc-is-cross-compiler ; then - sed -i \ - -e 's:"${2}"/shlibsign:shlibsign:' \ - cmd/shlibsign/sign.sh || die - fi - - # dirty hack - sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../freebl/\$(OBJDIR):" \ - lib/ssl/config.mk || die - sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../../lib/freebl/\$(OBJDIR):" \ - cmd/platlibs.mk || die - - multilib_copy_sources - - strip-flags -} - -multilib_src_configure() { - # Ensure we stay multilib aware - sed -i -e "/@libdir@/ s:lib64:$(get_libdir):" config/Makefile || die -} - -nssarch() { - # Most of the arches are the same as $ARCH - local t=${1:-${CHOST}} - case ${t} in - *86*-pc-solaris2*) echo "i86pc" ;; - aarch64*) echo "aarch64" ;; - hppa*) echo "parisc" ;; - i?86*) echo "i686" ;; - x86_64*) echo "x86_64" ;; - *) tc-arch ${t} ;; - esac -} - -nssbits() { - local cc cppflags="${1}CPPFLAGS" cflags="${1}CFLAGS" - if [[ ${1} == BUILD_ ]]; then - cc=$(tc-getBUILD_CC) - else - cc=$(tc-getCC) - fi - echo > "${T}"/test.c || die - ${cc} ${!cppflags} ${!cflags} -c "${T}"/test.c -o "${T}/${1}test.o" || die - case $(file "${T}/${1}test.o") in - *32-bit*x86-64*) echo USE_X32=1;; - *64-bit*|*ppc64*|*x86_64*) echo USE_64=1;; - *32-bit*|*ppc*|*i386*) ;; - *) die "Failed to detect whether ${cc} builds 64bits or 32bits, disable distcc if you're using it, please";; - esac -} - -multilib_src_compile() { - # use ABI to determine bit'ness, or fallback if unset - local buildbits mybits - case "${ABI}" in - n32) mybits="USE_N32=1";; - x32) mybits="USE_X32=1";; - s390x|*64) mybits="USE_64=1";; - ${DEFAULT_ABI}) - einfo "Running compilation test to determine bit'ness" - mybits=$(nssbits) - ;; - esac - # bitness of host may differ from target - if tc-is-cross-compiler; then - buildbits=$(nssbits BUILD_) - fi - - local makeargs=( - CC="$(tc-getCC)" - CCC="$(tc-getCXX)" - AR="$(tc-getAR) rc \$@" - RANLIB="$(tc-getRANLIB)" - OPTIMIZER= - ${mybits} - ) - - # Take care of nspr settings #436216 - local myCPPFLAGS="${CPPFLAGS} $($(tc-getPKG_CONFIG) nspr --cflags)" - unset NSPR_INCLUDE_DIR - - export NSS_ALLOW_SSLKEYLOGFILE=1 - export NSS_ENABLE_WERROR=0 #567158 - export BUILD_OPT=1 - export NSS_USE_SYSTEM_SQLITE=1 - export NSDISTMODE=copy - export FREEBL_NO_DEPEND=1 - export FREEBL_LOWHASH=1 - export NSS_SEED_ONLY_DEV_URANDOM=1 - export USE_SYSTEM_ZLIB=1 - export ZLIB_LIBS=-lz - export ASFLAGS="" - # Fix build failure on arm64 - export NS_USE_GCC=1 - # Detect compiler type and set proper environment value - if tc-is-gcc; then - export CC_IS_GCC=1 - elif tc-is-clang; then - export CC_IS_CLANG=1 - fi - - local d - - # Build the host tools first. - LDFLAGS="${BUILD_LDFLAGS}" \ - XCFLAGS="${BUILD_CFLAGS}" \ - NSPR_LIB_DIR="${T}/fakedir" \ - emake -j1 -C coreconf \ - CC="$(tc-getBUILD_CC)" \ - ${buildbits-${mybits}} - makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" ) - - # Then build the target tools. - for d in . lib/dbm ; do - CPPFLAGS="${myCPPFLAGS}" \ - XCFLAGS="${CFLAGS} ${CPPFLAGS}" \ - NSPR_LIB_DIR="${T}/fakedir" \ - emake -j1 "${makeargs[@]}" -C ${d} OS_TEST="$(nssarch)" - done -} - -# Altering these 3 libraries breaks the CHK verification. -# All of the following cause it to break: -# - stripping -# - prelink -# - ELF signing -# http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html -# Either we have to NOT strip them, or we have to forcibly resign after -# stripping. -#local_libdir="$(get_libdir)" -#export STRIP_MASK=" -# */${local_libdir}/libfreebl3.so* -# */${local_libdir}/libnssdbm3.so* -# */${local_libdir}/libsoftokn3.so*" - -export NSS_CHK_SIGN_LIBS="freebl3 nssdbm3 softokn3" - -generate_chk() { - local shlibsign="$1" - local libdir="$2" - einfo "Resigning core NSS libraries for FIPS validation" - shift 2 - local i - for i in ${NSS_CHK_SIGN_LIBS} ; do - local libname=lib${i}.so - local chkname=lib${i}.chk - "${shlibsign}" \ - -i "${libdir}"/${libname} \ - -o "${libdir}"/${chkname}.tmp \ - && mv -f \ - "${libdir}"/${chkname}.tmp \ - "${libdir}"/${chkname} \ - || die "Failed to sign ${libname}" - done -} - -cleanup_chk() { - local libdir="$1" - shift 1 - local i - for i in ${NSS_CHK_SIGN_LIBS} ; do - local libfname="${libdir}/lib${i}.so" - # If the major version has changed, then we have old chk files. - [ ! -f "${libfname}" -a -f "${libfname}.chk" ] \ - && rm -f "${libfname}.chk" - done -} - -multilib_src_install() { - pushd dist >/dev/null || die - - dodir /usr/$(get_libdir) - cp -L */lib/*$(get_libname) "${ED}"/usr/$(get_libdir) || die "copying shared libs failed" - local i - for i in crmf freebl nssb nssckfw ; do - cp -L */lib/lib${i}.a "${ED}"/usr/$(get_libdir) || die "copying libs failed" - done - - # Install nss-config and pkgconfig file - dodir /usr/bin - cp -L */bin/nss-config "${ED}"/usr/bin || die - dodir /usr/$(get_libdir)/pkgconfig - cp -L */lib/pkgconfig/nss.pc "${ED}"/usr/$(get_libdir)/pkgconfig || die - - # create an nss-softokn.pc from nss.pc for libfreebl and some private headers - # bug 517266 - sed -e 's#Libs:#Libs: -lfreebl#' \ - -e 's#Cflags:#Cflags: -I${includedir}/private#' \ - */lib/pkgconfig/nss.pc >"${ED}"/usr/$(get_libdir)/pkgconfig/nss-softokn.pc \ - || die "could not create nss-softokn.pc" - - # all the include files - insinto /usr/include/nss - doins public/nss/*.{h,api} - insinto /usr/include/nss/private - doins private/nss/{blapi,alghmac,cmac}.h - - popd >/dev/null || die - - local f nssutils - # Always enabled because we need it for chk generation. - nssutils=( shlibsign ) - - if multilib_is_native_abi ; then - if use utils; then - # The tests we do not need to install. - #nssutils_test="bltest crmftest dbtest dertimetest - #fipstest remtest sdrtest" - # checkcert utils has been removed in nss-3.22: - # https://bugzilla.mozilla.org/show_bug.cgi?id=1187545 - # https://hg.mozilla.org/projects/nss/rev/df1729d37870 - # certcgi has been removed in nss-3.36: - # https://bugzilla.mozilla.org/show_bug.cgi?id=1426602 - nssutils+=( - addbuiltin - atob - baddbdir - btoa - certutil - cmsutil - conflict - crlutil - derdump - digest - makepqg - mangle - modutil - multinit - nonspr10 - ocspclnt - oidcalc - p7content - p7env - p7sign - p7verify - pk11mode - pk12util - pp - rsaperf - selfserv - signtool - signver - ssltap - strsclnt - symkeyutil - tstclnt - vfychain - vfyserv - ) - # install man-pages for utils (bug #516810) - doman doc/nroff/*.1 - fi - pushd dist/*/bin >/dev/null || die - for f in ${nssutils[@]}; do - dobin ${f} - done - popd >/dev/null || die - fi - - # Prelink breaks the CHK files. We don't have any reliable way to run - # shlibsign after prelink. - dodir /etc/prelink.conf.d - printf -- "-b ${EPREFIX}/usr/$(get_libdir)/lib%s.so\n" ${NSS_CHK_SIGN_LIBS} \ - > "${ED}"/etc/prelink.conf.d/nss.conf -} - -pkg_postinst() { - multilib_pkg_postinst() { - # We must re-sign the libraries AFTER they are stripped. - local shlibsign="${EROOT}/usr/bin/shlibsign" - # See if we can execute it (cross-compiling & such). #436216 - "${shlibsign}" -h >&/dev/null - if [[ $? -gt 1 ]] ; then - shlibsign="shlibsign" - fi - generate_chk "${shlibsign}" "${EROOT}"/usr/$(get_libdir) - } - - multilib_foreach_abi multilib_pkg_postinst -} - -pkg_postrm() { - multilib_pkg_postrm() { - cleanup_chk "${EROOT}"/usr/$(get_libdir) - } - - multilib_foreach_abi multilib_pkg_postrm -} diff --git a/dev-libs/nss/nss-3.64.ebuild b/dev-libs/nss/nss-3.64.ebuild new file mode 100644 index 000000000000..f05b462f30da --- /dev/null +++ b/dev-libs/nss/nss-3.64.ebuild @@ -0,0 +1,357 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit flag-o-matic multilib toolchain-funcs multilib-minimal + +NSPR_VER="4.29" +RTM_NAME="NSS_${PV//./_}_RTM" + +DESCRIPTION="Mozilla's Network Security Services library that implements PKI support" +HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS" +SRC_URI="https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/${P}.tar.gz + cacert? ( https://dev.gentoo.org/~whissi/dist/ca-certificates/nss-cacert-class1-class3-r1.patch )" + +LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-solaris ~x86-solaris" +IUSE="cacert utils" +# pkg-config called by nss-config -> virtual/pkgconfig in RDEPEND +RDEPEND=" + >=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}] + >=dev-db/sqlite-3.8.2[${MULTILIB_USEDEP}] + >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] + virtual/pkgconfig +" +DEPEND="${RDEPEND}" + +RESTRICT="test" + +S="${WORKDIR}/${P}/${PN}" + +MULTILIB_CHOST_TOOLS=( + /usr/bin/nss-config +) + +PATCHES=( + # Custom changes for gentoo + "${FILESDIR}/${PN}-3.53-gentoo-fixups.patch" + "${FILESDIR}/${PN}-3.21-gentoo-fixup-warnings.patch" + "${FILESDIR}/${PN}-3.23-hppa-byte_order.patch" +) + +src_prepare() { + default + + if use cacert ; then + eapply -p2 "${DISTDIR}"/nss-cacert-class1-class3-r1.patch + fi + + pushd coreconf >/dev/null || die + # hack nspr paths + echo 'INCLUDES += -I$(DIST)/include/dbm' \ + >> headers.mk || die "failed to append include" + + # modify install path + sed -e '/CORE_DEPTH/s:SOURCE_PREFIX.*$:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \ + -i source.mk || die + + # Respect LDFLAGS + sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' rules.mk + popd >/dev/null || die + + # Fix pkgconfig file for Prefix + sed -i -e "/^PREFIX =/s:= /usr:= ${EPREFIX}/usr:" \ + config/Makefile || die + + # use host shlibsign if need be #436216 + if tc-is-cross-compiler ; then + sed -i \ + -e 's:"${2}"/shlibsign:shlibsign:' \ + cmd/shlibsign/sign.sh || die + fi + + # dirty hack + sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../freebl/\$(OBJDIR):" \ + lib/ssl/config.mk || die + sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../../lib/freebl/\$(OBJDIR):" \ + cmd/platlibs.mk || die + + multilib_copy_sources + + strip-flags +} + +multilib_src_configure() { + # Ensure we stay multilib aware + sed -i -e "/@libdir@/ s:lib64:$(get_libdir):" config/Makefile || die +} + +nssarch() { + # Most of the arches are the same as $ARCH + local t=${1:-${CHOST}} + case ${t} in + *86*-pc-solaris2*) echo "i86pc" ;; + aarch64*) echo "aarch64" ;; + hppa*) echo "parisc" ;; + i?86*) echo "i686" ;; + x86_64*) echo "x86_64" ;; + *) tc-arch ${t} ;; + esac +} + +nssbits() { + local cc cppflags="${1}CPPFLAGS" cflags="${1}CFLAGS" + if [[ ${1} == BUILD_ ]]; then + cc=$(tc-getBUILD_CC) + else + cc=$(tc-getCC) + fi + echo > "${T}"/test.c || die + ${cc} ${!cppflags} ${!cflags} -c "${T}"/test.c -o "${T}/${1}test.o" || die + case $(file "${T}/${1}test.o") in + *32-bit*x86-64*) echo USE_X32=1;; + *64-bit*|*ppc64*|*x86_64*) echo USE_64=1;; + *32-bit*|*ppc*|*i386*) ;; + *) die "Failed to detect whether ${cc} builds 64bits or 32bits, disable distcc if you're using it, please";; + esac +} + +multilib_src_compile() { + # use ABI to determine bit'ness, or fallback if unset + local buildbits mybits + case "${ABI}" in + n32) mybits="USE_N32=1";; + x32) mybits="USE_X32=1";; + s390x|*64) mybits="USE_64=1";; + ${DEFAULT_ABI}) + einfo "Running compilation test to determine bit'ness" + mybits=$(nssbits) + ;; + esac + # bitness of host may differ from target + if tc-is-cross-compiler; then + buildbits=$(nssbits BUILD_) + fi + + local makeargs=( + CC="$(tc-getCC)" + CCC="$(tc-getCXX)" + AR="$(tc-getAR) rc \$@" + RANLIB="$(tc-getRANLIB)" + OPTIMIZER= + ${mybits} + ) + + # Take care of nspr settings #436216 + local myCPPFLAGS="${CPPFLAGS} $($(tc-getPKG_CONFIG) nspr --cflags)" + unset NSPR_INCLUDE_DIR + + export NSS_ALLOW_SSLKEYLOGFILE=1 + export NSS_ENABLE_WERROR=0 #567158 + export BUILD_OPT=1 + export NSS_USE_SYSTEM_SQLITE=1 + export NSDISTMODE=copy + export FREEBL_NO_DEPEND=1 + export FREEBL_LOWHASH=1 + export NSS_SEED_ONLY_DEV_URANDOM=1 + export USE_SYSTEM_ZLIB=1 + export ZLIB_LIBS=-lz + export ASFLAGS="" + # Fix build failure on arm64 + export NS_USE_GCC=1 + # Detect compiler type and set proper environment value + if tc-is-gcc; then + export CC_IS_GCC=1 + elif tc-is-clang; then + export CC_IS_CLANG=1 + fi + + local d + + # Build the host tools first. + LDFLAGS="${BUILD_LDFLAGS}" \ + XCFLAGS="${BUILD_CFLAGS}" \ + NSPR_LIB_DIR="${T}/fakedir" \ + emake -j1 -C coreconf \ + CC="$(tc-getBUILD_CC)" \ + ${buildbits-${mybits}} + makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" ) + + # Then build the target tools. + for d in . lib/dbm ; do + CPPFLAGS="${myCPPFLAGS}" \ + XCFLAGS="${CFLAGS} ${CPPFLAGS}" \ + NSPR_LIB_DIR="${T}/fakedir" \ + emake -j1 "${makeargs[@]}" -C ${d} OS_TEST="$(nssarch)" + done +} + +# Altering these 3 libraries breaks the CHK verification. +# All of the following cause it to break: +# - stripping +# - prelink +# - ELF signing +# http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html +# Either we have to NOT strip them, or we have to forcibly resign after +# stripping. +#local_libdir="$(get_libdir)" +#export STRIP_MASK=" +# */${local_libdir}/libfreebl3.so* +# */${local_libdir}/libnssdbm3.so* +# */${local_libdir}/libsoftokn3.so*" + +export NSS_CHK_SIGN_LIBS="freebl3 nssdbm3 softokn3" + +generate_chk() { + local shlibsign="$1" + local libdir="$2" + einfo "Resigning core NSS libraries for FIPS validation" + shift 2 + local i + for i in ${NSS_CHK_SIGN_LIBS} ; do + local libname=lib${i}.so + local chkname=lib${i}.chk + "${shlibsign}" \ + -i "${libdir}"/${libname} \ + -o "${libdir}"/${chkname}.tmp \ + && mv -f \ + "${libdir}"/${chkname}.tmp \ + "${libdir}"/${chkname} \ + || die "Failed to sign ${libname}" + done +} + +cleanup_chk() { + local libdir="$1" + shift 1 + local i + for i in ${NSS_CHK_SIGN_LIBS} ; do + local libfname="${libdir}/lib${i}.so" + # If the major version has changed, then we have old chk files. + [ ! -f "${libfname}" -a -f "${libfname}.chk" ] \ + && rm -f "${libfname}.chk" + done +} + +multilib_src_install() { + pushd dist >/dev/null || die + + dodir /usr/$(get_libdir) + cp -L */lib/*$(get_libname) "${ED}"/usr/$(get_libdir) || die "copying shared libs failed" + local i + for i in crmf freebl nssb nssckfw ; do + cp -L */lib/lib${i}.a "${ED}"/usr/$(get_libdir) || die "copying libs failed" + done + + # Install nss-config and pkgconfig file + dodir /usr/bin + cp -L */bin/nss-config "${ED}"/usr/bin || die + dodir /usr/$(get_libdir)/pkgconfig + cp -L */lib/pkgconfig/nss.pc "${ED}"/usr/$(get_libdir)/pkgconfig || die + + # create an nss-softokn.pc from nss.pc for libfreebl and some private headers + # bug 517266 + sed -e 's#Libs:#Libs: -lfreebl#' \ + -e 's#Cflags:#Cflags: -I${includedir}/private#' \ + */lib/pkgconfig/nss.pc >"${ED}"/usr/$(get_libdir)/pkgconfig/nss-softokn.pc \ + || die "could not create nss-softokn.pc" + + # all the include files + insinto /usr/include/nss + doins public/nss/*.{h,api} + insinto /usr/include/nss/private + doins private/nss/{blapi,alghmac,cmac}.h + + popd >/dev/null || die + + local f nssutils + # Always enabled because we need it for chk generation. + nssutils=( shlibsign ) + + if multilib_is_native_abi ; then + if use utils; then + # The tests we do not need to install. + #nssutils_test="bltest crmftest dbtest dertimetest + #fipstest remtest sdrtest" + # checkcert utils has been removed in nss-3.22: + # https://bugzilla.mozilla.org/show_bug.cgi?id=1187545 + # https://hg.mozilla.org/projects/nss/rev/df1729d37870 + # certcgi has been removed in nss-3.36: + # https://bugzilla.mozilla.org/show_bug.cgi?id=1426602 + nssutils+=( + addbuiltin + atob + baddbdir + btoa + certutil + cmsutil + conflict + crlutil + derdump + digest + makepqg + mangle + modutil + multinit + nonspr10 + ocspclnt + oidcalc + p7content + p7env + p7sign + p7verify + pk11mode + pk12util + pp + rsaperf + selfserv + signtool + signver + ssltap + strsclnt + symkeyutil + tstclnt + vfychain + vfyserv + ) + # install man-pages for utils (bug #516810) + doman doc/nroff/*.1 + fi + pushd dist/*/bin >/dev/null || die + for f in ${nssutils[@]}; do + dobin ${f} + done + popd >/dev/null || die + fi + + # Prelink breaks the CHK files. We don't have any reliable way to run + # shlibsign after prelink. + dodir /etc/prelink.conf.d + printf -- "-b ${EPREFIX}/usr/$(get_libdir)/lib%s.so\n" ${NSS_CHK_SIGN_LIBS} \ + > "${ED}"/etc/prelink.conf.d/nss.conf +} + +pkg_postinst() { + multilib_pkg_postinst() { + # We must re-sign the libraries AFTER they are stripped. + local shlibsign="${EROOT}/usr/bin/shlibsign" + # See if we can execute it (cross-compiling & such). #436216 + "${shlibsign}" -h >&/dev/null + if [[ $? -gt 1 ]] ; then + shlibsign="shlibsign" + fi + generate_chk "${shlibsign}" "${EROOT}"/usr/$(get_libdir) + } + + multilib_foreach_abi multilib_pkg_postinst +} + +pkg_postrm() { + multilib_pkg_postrm() { + cleanup_chk "${EROOT}"/usr/$(get_libdir) + } + + multilib_foreach_abi multilib_pkg_postrm +} -- cgit v1.2.3