public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/grafana] rawhide: Remove boringcrypto workarounds for go1.27
@ 2026-11-06 15:49 Yaakov Selkowitz
  0 siblings, 0 replies; only message in thread
From: Yaakov Selkowitz @ 2026-11-06 15:49 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/grafana
            Branch : rawhide
            Commit : 4052ae4ecbd6e218eb1035809aaa5c89cb540927
            Author : Yaakov Selkowitz <yselkowi@redhat.com>
            Date   : 2026-11-06T09:31:30-05:00
            Stats  : +4/-167 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/grafana/c/4052ae4ecbd6e218eb1035809aaa5c89cb540927?branch=rawhide

            Log:
            Remove boringcrypto workarounds for go1.27

RHEL golang 1.27 includes a new native FIPS implementation which does not
use openssl.

https://gitlab.com/redhat/centos-stream/rpms/grafana/-/commit/5f4cc3f080647adfcdc326c53162d41a4dea3e40

---
diff --git a/1002-vendor-use-pbkdf2-from-OpenSSL.patch b/1002-vendor-use-pbkdf2-from-OpenSSL.patch
deleted file mode 100644
index f02355c..0000000
--- a/1002-vendor-use-pbkdf2-from-OpenSSL.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-use pbkdf2 from OpenSSL if FIPS mode is enabled
-
-This patch modifies the x/crypto/pbkdf2 function to use OpenSSL
-if FIPS mode is enabled.
-DEFINEFUNC is from /usr/lib/golang/src/vendor/github.com/golang-fips/openssl-fips/openssl/goopenssl.h
-
-diff --git a/vendor/modules.txt b/vendor/modules.txt
---- a/vendor/modules.txt
-+++ b/vendor/modules.txt
-@@ -1,2 +1,3 @@
- golang.org/x/crypto/internal/alias
-+golang.org/x/crypto/internal/boring
- golang.org/x/crypto/internal/poly1305
-diff --git a/vendor/golang.org/x/crypto/internal/boring/boring.go b/vendor/golang.org/x/crypto/internal/boring/boring.go
-new file mode 100644
-index 0000000000..5a06918832
---- /dev/null
-+++ b/vendor/golang.org/x/crypto/internal/boring/boring.go
-@@ -0,0 +1,74 @@
-+// Copyright 2017 The Go Authors. All rights reserved.
-+// Copyright 2021 Red Hat.
-+// Use of this source code is governed by a BSD-style
-+// license that can be found in the LICENSE file.
-+
-+// +build linux
-+// +build !android
-+// +build !no_openssl
-+// +build !cmd_go_bootstrap
-+// +build !msan
-+
-+package boring
-+
-+// #include "/usr/lib/golang/src/vendor/github.com/golang-fips/openssl/v2/goopenssl.h"
-+// #cgo LDFLAGS: -ldl
-+import "C"
-+import (
-+	"bytes"
-+	"crypto/sha1"
-+	"crypto/sha256"
-+	"hash"
-+	"unsafe"
-+)
-+
-+var (
-+	emptySha1   = sha1.Sum([]byte{})
-+	emptySha256 = sha256.Sum256([]byte{})
-+)
-+
-+func hashToMD(h hash.Hash) C.GO_EVP_MD_PTR {
-+	emptyHash := h.Sum([]byte{})
-+
-+	switch {
-+	case bytes.Equal(emptyHash, emptySha1[:]):
-+		return C.go_openssl_EVP_sha1()
-+	case bytes.Equal(emptyHash, emptySha256[:]):
-+		return C.go_openssl_EVP_sha256()
-+	}
-+	return nil
-+}
-+
-+// charptr returns the address of the underlying array in b,
-+// being careful not to panic when b has zero length.
-+func charptr(b []byte) *C.char {
-+	if len(b) == 0 {
-+		return nil
-+	}
-+	return (*C.char)(unsafe.Pointer(&b[0]))
-+}
-+
-+// ucharptr returns the address of the underlying array in b,
-+// being careful not to panic when b has zero length.
-+func ucharptr(b []byte) *C.uchar {
-+	if len(b) == 0 {
-+		return nil
-+	}
-+	return (*C.uchar)(unsafe.Pointer(&b[0]))
-+}
-+
-+func Pbkdf2Key(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte {
-+	// println("[debug] using pbkdf2 from OpenSSL")
-+	ch := h()
-+	md := hashToMD(ch)
-+	if md == nil {
-+		return nil
-+	}
-+
-+	out := make([]byte, keyLen)
-+	ok := C.go_openssl_PKCS5_PBKDF2_HMAC(charptr(password), C.int(len(password)), ucharptr(salt), C.int(len(salt)), C.int(iter), md, C.int(keyLen), ucharptr(out))
-+	if ok != 1 {
-+		panic("boringcrypto: PKCS5_PBKDF2_HMAC failed")
-+	}
-+	return out
-+}
-diff --git a/vendor/golang.org/x/crypto/internal/boring/notboring.go b/vendor/golang.org/x/crypto/internal/boring/notboring.go
-new file mode 100644
-index 0000000000..e244fb5663
---- /dev/null
-+++ b/vendor/golang.org/x/crypto/internal/boring/notboring.go
-@@ -0,0 +1,16 @@
-+// Copyright 2017 The Go Authors. All rights reserved.
-+// Copyright 2021 Red Hat.
-+// Use of this source code is governed by a BSD-style
-+// license that can be found in the LICENSE file.
-+
-+// +build !linux !cgo android cmd_go_bootstrap msan no_openssl
-+
-+package boring
-+
-+import (
-+	"hash"
-+)
-+
-+func Pbkdf2Key(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte {
-+	panic("boringcrypto: not available")
-+}
-diff --git a/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go b/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go
-index 593f653008..799a611f94 100644
---- a/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go
-+++ b/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go
-@@ -19,8 +19,11 @@ pbkdf2.Key.
- package pbkdf2
- 
- import (
-+	"crypto/boring"
- 	"crypto/hmac"
- 	"hash"
-+
-+	xboring "golang.org/x/crypto/internal/boring"
- )
- 
- // Key derives a key from the password, salt and iteration count, returning a
-@@ -40,6 +43,10 @@ import (
- // Using a higher iteration count will increase the cost of an exhaustive
- // search but will also make derivation proportionally slower.
- func Key(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte {
-+	if boring.Enabled() {
-+		return xboring.Pbkdf2Key(password, salt, iter, keyLen, h)
-+	}
-+
- 	prf := hmac.New(h, password)
- 	hashLen := prf.Size()
- 	numBlocks := (keyLen + hashLen - 1) / hashLen

diff --git a/grafana.spec b/grafana.spec
index d61f2c7..315c7ee 100644
--- a/grafana.spec
+++ b/grafana.spec
@@ -1,9 +1,3 @@
-%if 0%{?rhel}
-%define enable_fips_mode 1
-%else
-%define enable_fips_mode 0
-%endif
-
 %global grafana_arches %{go_arches}
 
 %global gomodulesmode GO111MODULE=auto
@@ -14,7 +8,7 @@
 
 Name:             grafana
 Version:          12.4.3
-Release:          6%{?dist}
+Release:          7%{?dist}
 Summary:          Metrics dashboard and graph editor
 License:          AGPL-3.0-only
 URL:              https://grafana.org
@@ -65,7 +59,6 @@ Patch10:          0010-use-npm-as-package-manager.patch
 
 # Patches affecting the vendor tarball
 Patch1001:        1001-vendor-patch-removed-backend-crypto.patch
-Patch1002:        1002-vendor-use-pbkdf2-from-OpenSSL.patch
 Patch1003:        1003-vendor-skip-goldenfiles-tests.patch
 
 # Intersection of go_arches and nodejs_arches
@@ -82,10 +75,6 @@ BuildRequires:    /usr/bin/node
 BuildRequires:    /usr/bin/npm
 %endif
 
-%if %{enable_fips_mode}
-BuildRequires:    openssl-devel
-%endif
-
 %global           GRAFANA_USER %{name}
 %global           GRAFANA_GROUP %{name}
 
@@ -905,9 +894,6 @@ Built from source on x86_64 and installable on all architectures.
 %patch -P 10 -p1
 
 %patch -P 1001 -p1
-%if %{enable_fips_mode}
-%patch -P 1002 -p1
-%endif
 %ifarch s390x i686 armv7hl
 %patch -P 1003 -p1
 %endif
@@ -936,9 +922,6 @@ export PATH=$(pwd)/.nodejs_bin:$PATH
 
 # see grafana-X.Y.Z/pkg/build/cmd.go
 export LDFLAGS="-X main.version=%{version} -X main.buildstamp=${SOURCE_DATE_EPOCH}"
-%if %{enable_fips_mode}
-export GOEXPERIMENT=boringcrypto
-%endif
 for cmd in grafana grafana-cli grafana-server; do
     %gobuild -o %{_builddir}/bin/${cmd} ./pkg/cmd/${cmd}
 done
@@ -1076,17 +1059,10 @@ chmod 640 %{_sysconfdir}/%{name}/ldap.toml
 # which is usually true except if the daylight saving time change falls into the last 10 days, then it's either 239 or 241 hours...
 # let's set the time zone to a time zone without daylight saving time
 export TZ=GMT
-%if %{enable_fips_mode}
-export GOEXPERIMENT=boringcrypto
-%endif
 
 # comment out temporarily while intermittent ngalert tests are investigated
 # % gotest ./pkg/...
 
-# %if %{enable_fips_mode}
-# OPENSSL_FORCE_FIPS_MODE=1 GOLANG_FIPS=1 go test -v ./pkg/util -run TestEncryption
-# %endif
-
 %files
 # binaries and wrappers
 %{_sbindir}/%{name}-server
@@ -1182,6 +1158,9 @@ done
 %endif
 
 %changelog
+* Wed Oct 28 2026 Yaakov Selkowitz <yselkowi@redhat.com> - 12.4.3-7
+- Remove boringcrypto workarounds for RHEL golang 1.27
+
 * Thu Aug 27 2026 Yaakov Selkowitz <yselkowi@redhat.com> - 12.4.3-6
 - Build with latest nodejs
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-06 15:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 15:49 [rpms/grafana] rawhide: Remove boringcrypto workarounds for go1.27 Yaakov Selkowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox