Compare commits
21 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd8477a2eb | ||
|
|
0fec26534d | ||
| d06a6e72e4 | |||
|
|
93c64f2a0d | ||
|
|
8b1bcf2332 | ||
|
|
c938656c12 | ||
|
|
df4c12aec8 | ||
|
|
58d5697b85 | ||
|
|
74685e918a | ||
|
|
634e808893 | ||
|
|
04f02e8cd7 | ||
|
|
0b14fad476 | ||
|
|
bb3aaa1ba2 | ||
|
|
4b458cfe9f | ||
|
|
c2da1bf6da | ||
|
|
f1d5690e2e | ||
|
|
fbf8f35ae7 | ||
|
|
3bf806fd9f | ||
|
|
1d2597d20d | ||
|
|
c324cc0c6c | ||
|
|
b201f43f63 |
10 changed files with 270 additions and 37 deletions
27
0001-cms_common-Fixed-Segmentation-fault.patch
Normal file
27
0001-cms_common-Fixed-Segmentation-fault.patch
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Frayer <nfrayer@redhat.com>
|
||||
Date: Mon, 20 Feb 2023 15:26:20 +0100
|
||||
Subject: [PATCH] cms_common: Fixed Segmentation fault
|
||||
|
||||
When running efikeygen, the binary crashes with a segfault due
|
||||
to dereferencing a **ptr instead of a *ptr.
|
||||
|
||||
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
|
||||
(cherry picked from commit 227435af461f38fc4abeafe02884675ad4b1feb4)
|
||||
---
|
||||
src/cms_common.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cms_common.c b/src/cms_common.c
|
||||
index 24576f2..89d946a 100644
|
||||
--- a/src/cms_common.c
|
||||
+++ b/src/cms_common.c
|
||||
@@ -956,7 +956,7 @@ find_certificate_by_issuer_and_sn(cms_context *cms,
|
||||
if (!ias)
|
||||
cnreterr(-1, cms, "invalid issuer and serial number");
|
||||
|
||||
- return find_certificate_by_callback(cms, match_issuer_and_serial, &ias, cert);
|
||||
+ return find_certificate_by_callback(cms, match_issuer_and_serial, ias, cert);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Robbie Harwood <rharwood@redhat.com>
|
||||
Date: Tue, 8 Mar 2022 12:59:34 -0500
|
||||
Subject: [PATCH] daemon: remove always-true comparison
|
||||
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
---
|
||||
src/daemon.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/daemon.c b/src/daemon.c
|
||||
index 0a66deb..ff88210 100644
|
||||
--- a/src/daemon.c
|
||||
+++ b/src/daemon.c
|
||||
@@ -221,8 +221,7 @@ malformed:
|
||||
if (!ctx->cms->tokenname)
|
||||
goto oom;
|
||||
|
||||
- if (!tp->value)
|
||||
- pin = strndup((char *)tp->value, tp->size);
|
||||
+ pin = strndup((char *)tp->value, tp->size);
|
||||
if (!pin)
|
||||
goto oom;
|
||||
|
||||
41
0002-Fix-reversed-calloc-arguments.patch
Normal file
41
0002-Fix-reversed-calloc-arguments.patch
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
From 1f9e2fa0b4d872fdd01ca3ba81b04dfb1211a187 Mon Sep 17 00:00:00 2001
|
||||
From: Stephen Gallagher <sgallagh@redhat.com>
|
||||
Date: Fri, 2 Feb 2024 09:32:48 -0500
|
||||
Subject: [PATCH] Fix reversed calloc() arguments
|
||||
|
||||
The prototype is "void *calloc(size_t nelem, size_t elsize);"
|
||||
|
||||
These two instances had them reversed, almost certainly leading to
|
||||
buffer overflow issues. This was detected by
|
||||
-Werror=calloc-transposed-args on gcc.
|
||||
|
||||
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
|
||||
---
|
||||
src/pesigcheck.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/pesigcheck.c b/src/pesigcheck.c
|
||||
index 6dc67f76a81..8119cf10a7b 100644
|
||||
--- a/src/pesigcheck.c
|
||||
+++ b/src/pesigcheck.c
|
||||
@@ -240,7 +240,7 @@ check_signature(pesigcheck_context *ctx, int *nreasons,
|
||||
|
||||
cert_iter iter;
|
||||
|
||||
- reasonps = calloc(sizeof(struct reason), 512);
|
||||
+ reasonps = calloc(512, sizeof(struct reason));
|
||||
if (!reasonps)
|
||||
err(1, "check_signature");
|
||||
|
||||
@@ -281,7 +281,7 @@ check_signature(pesigcheck_context *ctx, int *nreasons,
|
||||
|
||||
num_reasons += 16;
|
||||
|
||||
- new_reasons = calloc(sizeof(struct reason), num_reasons);
|
||||
+ new_reasons = calloc(num_reasons, sizeof(struct reason));
|
||||
if (!new_reasons)
|
||||
err(1, "check_signature");
|
||||
reasonps = new_reasons;
|
||||
--
|
||||
2.41.0
|
||||
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
From dc17b1d248c705073a5160e7c871a52aa9ce6e99 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 21 Nov 2024 13:58:05 -0500
|
||||
Subject: [PATCH] Work around OpenSC changing token names on fedora builders
|
||||
*again*.
|
||||
|
||||
Once again OpenSC has changed how token names work in an incompatible
|
||||
way, and we need to work around it even harder on the Fedora kernel
|
||||
builders.
|
||||
|
||||
Reviewed-by: Kevin Fenzi <kevin@fedoraproject.org>
|
||||
Reviewed-by: Justin Forbes <jforbes@fedoraproject.org>
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
src/macros.pesign | 3 ++-
|
||||
src/pesign-rpmbuild-helper.in | 15 ++++++++++++++-
|
||||
2 files changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/macros.pesign b/src/macros.pesign
|
||||
index b7d6af1f6f5..47e3f19f8ed 100644
|
||||
--- a/src/macros.pesign
|
||||
+++ b/src/macros.pesign
|
||||
@@ -9,7 +9,8 @@
|
||||
%__pesign_token %{nil}%{?pe_signing_token:--token "%{pe_signing_token}"}
|
||||
%__pesign_cert %{!?pe_signing_cert:"Red Hat Test Certificate"}%{?pe_signing_cert:"%{pe_signing_cert}"}
|
||||
|
||||
-%__pesign_client_token %{!?pe_signing_token:"OpenSC Card (Fedora Signer)"}%{?pe_signing_token:"%{pe_signing_token}"}
|
||||
+# See the comment in pesign-rpmbuild-helper.in about the token name here.
|
||||
+%__pesign_client_token %{!?pe_signing_token:"OpenSC Card"}%{?pe_signing_token:"%{pe_signing_token}"}
|
||||
%__pesign_client_cert %{!?pe_signing_cert:"/CN=Fedora Secure Boot Signer"}%{?pe_signing_cert:"%{pe_signing_cert}"}
|
||||
|
||||
%_pesign /usr/bin/pesign
|
||||
diff --git a/src/pesign-rpmbuild-helper.in b/src/pesign-rpmbuild-helper.in
|
||||
index 30d5441207b..42de1a1e002 100644
|
||||
--- a/src/pesign-rpmbuild-helper.in
|
||||
+++ b/src/pesign-rpmbuild-helper.in
|
||||
@@ -214,7 +214,20 @@ main() {
|
||||
rm -rf "${sattrs}" "${sattrs}.sig" "${nssdir}"
|
||||
elif [[ -n "${socket}" ]] ; then
|
||||
### welcome haaaaack city
|
||||
- if [[ "${client_token[1]}" = "OpenSC Card (Fedora Signer)" ]] ; then
|
||||
+ ### different versions of the opensc library name the token different
|
||||
+ ### things, and as of this commit:
|
||||
+ ### https://github.com/OpenSC/OpenSC/commit/259decf656a77a6d1bd3e944d6f198ed70832ff5
|
||||
+ ### that includes just not including the token label unless there's
|
||||
+ ### more than one token. Unfortunately this is both for the displayed
|
||||
+ ### info and for the token name you specify to /use/ the token, so we
|
||||
+ ### have to handle all of those options here, and change the name to
|
||||
+ ### match whatever the current version of opensc is using in the rpm
|
||||
+ ### macro where we're setting it. Thankfully this is just a "is this
|
||||
+ ### Fedora" check for us, and if it's RHEL we're not using OpenSC at
|
||||
+ ### all.
|
||||
+ if [[ "${client_token[1]}" = "OpenSC Card (Fedora Signer)" ]] \
|
||||
+ || [[ "${client_token[1]}" = "Fedora Signer" ]] \
|
||||
+ || [[ "${client_token[1]}" = "OpenSC Card" ]] ; then
|
||||
if [[ "${input[1]}" =~ (/|^)vmlinuz($|[_.-]) ]] \
|
||||
|| [[ "${input[1]}" =~ (/|^)bzImage($|[_.-]) ]] ; then
|
||||
if [[ "${rhelcertfile}" =~ redhatsecureboot501.* ]] \
|
||||
--
|
||||
2.47.0
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
From 616ec5f25adbde1a4bd78cdcacd6dcd7ecfa5a5c Mon Sep 17 00:00:00 2001
|
||||
From: Gary Lin <glin@suse.com>
|
||||
Date: Thu, 22 Dec 2022 13:49:34 +0800
|
||||
Subject: [PATCH] cms_common: skip authentication on the 'Friendly' slot
|
||||
|
||||
When finding a certificate in a 'Friendly' slot without the need of the
|
||||
private key, it is not necessary to authenticate the slot.
|
||||
|
||||
For example, when the signed attributes and the raw signature are
|
||||
created in a server and the user has the certificate, signkey.x509, and
|
||||
tries to import them into myapp.efi:
|
||||
|
||||
$ certutil -N -d nssdb -f passwd
|
||||
$ certutil -A -d nssdb -f passwd -n signkey -t CT,CT,CT \
|
||||
-i signkey.x509
|
||||
$ pesign -n nssdb -c signkey -i myapp.efi -o myapp.efi.signed \
|
||||
-d sha256 -I myapp.sattr -R myapp.sig
|
||||
|
||||
Since the "signkey" is 'Friendly', i.e. publicly readable, and the
|
||||
private key is not needed, we can just skip the authentication and find
|
||||
"signkey" in the slot.
|
||||
|
||||
Signed-off-by: Gary Lin <glin@suse.com>
|
||||
---
|
||||
src/cms_common.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cms_common.c b/src/cms_common.c
|
||||
index cf572ca..44e5cca 100644
|
||||
--- a/src/cms_common.c
|
||||
+++ b/src/cms_common.c
|
||||
@@ -628,7 +628,8 @@ find_certificate(cms_context *cms, int needs_private_key)
|
||||
|
||||
int errnum;
|
||||
SECStatus status;
|
||||
- if (PK11_NeedLogin(psle->slot) && !PK11_IsLoggedIn(psle->slot, cms)) {
|
||||
+ if ((needs_private_key || !PK11_IsFriendly(psle->slot)) &&
|
||||
+ (PK11_NeedLogin(psle->slot) && !PK11_IsLoggedIn(psle->slot, cms))) {
|
||||
status = PK11_Authenticate(psle->slot, PR_TRUE, cms);
|
||||
if (status != SECSuccess) {
|
||||
save_port_err() {
|
||||
25
0005-Add-const-qualifier-to-variable.patch
Normal file
25
0005-Add-const-qualifier-to-variable.patch
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Frayer <nfrayer@redhat.com>
|
||||
Date: Mon, 22 Jun 2026 20:58:03 +0200
|
||||
Subject: [PATCH] Add const qualifier to variable
|
||||
|
||||
Add const to a variable initialized with using strrchr.
|
||||
|
||||
Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
|
||||
---
|
||||
src/pesum.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/pesum.c b/src/pesum.c
|
||||
index e4ddaf86d7fa..5d7dcb929eec 100644
|
||||
--- a/src/pesum.c
|
||||
+++ b/src/pesum.c
|
||||
@@ -141,7 +141,7 @@ main(int argc, char *argv[])
|
||||
while ((infile = poptGetArg(optCon)) != NULL) {
|
||||
pesign_context *ctxp = NULL;
|
||||
|
||||
- char *ext = strrchr(infile, '.');
|
||||
+ const char *ext = strrchr(infile, '.');
|
||||
if (ext && strcmp(ext, ".ko") == 0)
|
||||
fmt = FORMAT_KERNEL_MODULE;
|
||||
|
||||
0
noautobuild
Normal file
0
noautobuild
Normal file
5
pesign.patches
Normal file
5
pesign.patches
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Patch0001: 0001-cms_common-Fixed-Segmentation-fault.patch
|
||||
Patch0002: 0002-Fix-reversed-calloc-arguments.patch
|
||||
Patch0003: 0003-Work-around-OpenSC-changing-token-names-on-fedora-bu.patch
|
||||
Patch0004: 0004-cms_common-skip-authentication-on-the-Friendly-slot.patch
|
||||
Patch0005: 0005-Add-const-qualifier-to-variable.patch
|
||||
81
pesign.spec
81
pesign.spec
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
Name: pesign
|
||||
Summary: Signing utility for UEFI binaries
|
||||
Version: 115
|
||||
Release: 1%{?dist}
|
||||
Version: 116
|
||||
Release: 9%{?dist}
|
||||
License: GPL-2.0-only
|
||||
URL: https://github.com/rhboot/pesign
|
||||
|
||||
|
|
@ -37,8 +37,7 @@ Requires: nss-tools >= 3.53
|
|||
Requires: nss-util
|
||||
Requires: popt
|
||||
Requires: rpm
|
||||
Requires(pre): shadow-utils
|
||||
ExclusiveArch: %{ix86} x86_64 ia64 aarch64 %{arm}
|
||||
ExclusiveArch: %{ix86} x86_64 ia64 aarch64 %{arm} riscv64
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: rh-signing-tools >= 1.20-2
|
||||
%endif
|
||||
|
|
@ -46,8 +45,10 @@ BuildRequires: rh-signing-tools >= 1.20-2
|
|||
Source0: https://github.com/rhboot/pesign/releases/download/%{version}/pesign-%{version}.tar.bz2
|
||||
Source1: certs.tar.xz
|
||||
Source2: pesign.py
|
||||
Source3: pesign.patches
|
||||
|
||||
Patch0001: 0001-daemon-remove-always-true-comparison.patch
|
||||
# generate with tool
|
||||
%include %{SOURCE3}
|
||||
|
||||
%description
|
||||
This package contains the pesign utility for signing UEFI binaries as
|
||||
|
|
@ -65,6 +66,11 @@ git am %{patches} </dev/null
|
|||
git config --unset user.email
|
||||
git config --unset user.name
|
||||
|
||||
# Create a sysusers.d config file
|
||||
cat >pesign.sysusers.conf <<EOF
|
||||
u pesign - 'Group for the pesign signing daemon' /run/pesign -
|
||||
EOF
|
||||
|
||||
%build
|
||||
make PREFIX=%{_prefix} LIBDIR=%{_libdir}
|
||||
|
||||
|
|
@ -99,12 +105,8 @@ cp -av libdpe/*.[ch] src/
|
|||
install -d -m 0755 %{buildroot}%{python3_sitelib}/mockbuild/plugins/
|
||||
install -m 0755 %{SOURCE2} %{buildroot}%{python3_sitelib}/mockbuild/plugins/
|
||||
|
||||
%pre
|
||||
getent group pesign >/dev/null || groupadd -r pesign
|
||||
getent passwd pesign >/dev/null || \
|
||||
useradd -r -g pesign -d /run/pesign -s /sbin/nologin \
|
||||
-c "Group for the pesign signing daemon" pesign
|
||||
exit 0
|
||||
install -m0644 -D pesign.sysusers.conf %{buildroot}%{_sysusersdir}/pesign.conf
|
||||
|
||||
|
||||
%if 0%{?rhel} >= 7 || 0%{?fedora} >= 17
|
||||
%post
|
||||
|
|
@ -130,12 +132,13 @@ certutil -d %{_sysconfdir}/pki/pesign/ -X -L > /dev/null
|
|||
%files
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING
|
||||
%doc README TODO
|
||||
%doc README.md TODO
|
||||
%{_bindir}/authvar
|
||||
%{_bindir}/efikeygen
|
||||
%{_bindir}/pesigcheck
|
||||
%{_bindir}/pesign
|
||||
%{_bindir}/pesign-client
|
||||
%{_bindir}/pesum
|
||||
%dir %{_libexecdir}/pesign/
|
||||
%dir %attr(0770,pesign,pesign) %{_sysconfdir}/pki/pesign/
|
||||
%config(noreplace) %attr(0660,pesign,pesign) %{_sysconfdir}/pki/pesign/*
|
||||
|
|
@ -157,8 +160,62 @@ certutil -d %{_sysconfdir}/pki/pesign/ -X -L > /dev/null
|
|||
%endif
|
||||
%{python3_sitelib}/mockbuild/plugins/*/pesign.*
|
||||
%{python3_sitelib}/mockbuild/plugins/pesign.*
|
||||
%{_sysusersdir}/pesign.conf
|
||||
|
||||
%changelog
|
||||
* Mon Jun 22 2026 Nicolas Frayer <nfrayer@redhat.com> - 116-9
|
||||
- Fix a FTBFS issue caused by a missing const qualifier
|
||||
- Resolves: #2491392
|
||||
|
||||
* Tue Feb 11 2025 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
||||
- Add sysusers.d config file to allow rpm to create users/groups automatically
|
||||
|
||||
* Wed Jan 29 2025 Nicolas Frayer <nfrayer@redhat.com> - 116-7
|
||||
- Backport patch to skip auth on friendly slot
|
||||
|
||||
* Thu Nov 21 2024 Peter Jones <pjones@redhat.com> - 116-6
|
||||
- Work around OpenSC token name changes
|
||||
|
||||
* Tue Nov 12 2024 Kevin Fenzi <kevin@scrye.com> - 116-5
|
||||
- Rebuild to pick up riscv64 change
|
||||
|
||||
* Tue Mar 05 2024 Liu Yang <Yang.Liu.sn@gmail.com> - 116-4
|
||||
- Add riscv64.
|
||||
|
||||
* Fri Feb 02 2024 Peter Jones <pjones@redhat.com> - 116-3
|
||||
- Fix incorrect calloc() invocations caught by -Wcalloc-transposed-args
|
||||
|
||||
* Mon Feb 20 2023 Nicolas Frayer <nfrayer@redhat.com> - 116-2
|
||||
- cms_common: Fixed Segmentation fault
|
||||
|
||||
* Tue Jan 31 2023 Robbie Harwood <rharwood@redhat.com> - 116-1
|
||||
- New upstream release (116)
|
||||
- Resolves: CVE-2022-3560
|
||||
|
||||
* Wed Aug 31 2022 Robbie Harwood <rharwood@redhat.com> - 115-9
|
||||
- Roll up to pjones's smartcard/cms fixes
|
||||
|
||||
* Tue Aug 02 2022 Robbie Harwood <rharwood@redhat.com> - 115-8
|
||||
- Rebuild for python bytecode change
|
||||
- See-also: #2107826
|
||||
|
||||
* Thu Jul 07 2022 Robbie Harwood <rharwood@redhat.com> - 115-6
|
||||
- Fix formatting of man pages
|
||||
- Resolves: #2104778
|
||||
|
||||
* Mon Apr 04 2022 Robbie Harwood <rharwood@redhat.com> - 115-5
|
||||
- Detect presence of rpm-sign when checking for rhel-ness
|
||||
|
||||
* Fri Apr 01 2022 Robbie Harwood <rharwood@redhat.com> - 115-4
|
||||
- Correctly handle rhel and centos macros
|
||||
|
||||
* Fri Mar 25 2022 Robbie Harwood <rharwood@redhat.com> - 115-3
|
||||
- Add -D_GLIBCXX_ASSERTIONS to CPPFLAGS
|
||||
|
||||
* Thu Mar 24 2022 Robbie Harwood <rharwood@redhat.com> - 115-2
|
||||
- Add support for non-koji signing in macros
|
||||
- Resolves: #1880858
|
||||
|
||||
* Tue Mar 08 2022 Robbie Harwood <rharwood@redhat.com> - 115-1
|
||||
- New upstream version (115)
|
||||
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1,2 +1,2 @@
|
|||
SHA512 (certs.tar.xz) = ddac535c786d1a23074534323c4ce89f907d4f82b19c5d3a9c814b145fbac1599cd2386cf20c28d22aee7d5c4db441f052bab9ee655de756117a0a0bc99b525f
|
||||
SHA512 (pesign-115.tar.bz2) = 0091d70e286326b1ed74418ca8c5a2a63d42e6aa3eccdfc4f09a34241b2addfe878af17d1d74648b7da79d6cd7158fcca0f3a52f4a82a57cacae4617b42b1faa
|
||||
SHA512 (pesign-116.tar.bz2) = be3e1083f5e9f889cb8f7c50a8ebe723542fb2f6d1de8de9b04a9f21526ebaa8ab1efc7d4be11bcb0bc9862fa4bc6f78ee35e4d3496dd3b8927170b97795d25c
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue