Toshaan Bharvani
1 year ago
commit
fd275b9fe0
2 changed files with 237 additions and 0 deletions
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
From 5b8c9d205a59932ce4e1894dbf09f5df4cfbb907 Mon Sep 17 00:00:00 2001 |
||||
From: Stefan Berger <stefanb@linux.ibm.com> |
||||
Date: Thu, 10 Nov 2022 14:20:53 -0500 |
||||
Subject: [PATCH] swtpm_setup: Initialized **argv to NULL (Fedore Rawhide) |
||||
|
||||
gcc 12.2.1 on Fedora Rawhide emits this message: |
||||
|
||||
In file included from /usr/include/glib-2.0/glib.h:116, |
||||
from swtpm_setup.c:26: |
||||
In function 'g_autoptr_cleanup_generic_gfree', |
||||
inlined from 'get_swtpm_capabilities.constprop.0' at swtpm_setup.c:940:24: |
||||
/usr/include/glib-2.0/glib/glib-autocleanups.h:30:3: error: 'argv' may be used uninitialized [-Werror=maybe-uninitialized] |
||||
30 | g_free (*pp); |
||||
| ^~~~~~~~~~~~ |
||||
swtpm_setup.c: In function 'get_swtpm_capabilities.constprop.0': |
||||
swtpm_setup.c:940:24: note: 'argv' was declared here |
||||
940 | g_autofree gchar **argv; |
||||
| ^~~~ |
||||
cc1: all warnings being treated as errors |
||||
|
||||
This makes little sense since the variable is then first used like this: |
||||
|
||||
argv = concat_arrays(swtpm_prg_l, my_argv, FALSE); |
||||
|
||||
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> |
||||
--- |
||||
src/swtpm_setup/swtpm_setup.c | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
diff --git a/src/swtpm_setup/swtpm_setup.c b/src/swtpm_setup/swtpm_setup.c |
||||
index 1b528c8..3570235 100644 |
||||
--- a/src/swtpm_setup/swtpm_setup.c |
||||
+++ b/src/swtpm_setup/swtpm_setup.c |
||||
@@ -937,7 +937,7 @@ static int get_swtpm_capabilities(gchar **swtpm_prg_l, gboolean is_tpm2, |
||||
gchar *my_argv[] = { "--print-capabilities", is_tpm2 ? "--tpm2" : NULL, NULL }; |
||||
g_autofree gchar *logop = NULL; |
||||
g_autoptr(GError) error = NULL; |
||||
- g_autofree gchar **argv; |
||||
+ g_autofree gchar **argv = NULL; |
||||
int exit_status = 0; |
||||
gboolean success; |
||||
int ret = 1; |
||||
-- |
||||
2.38.0 |
||||
|
@ -0,0 +1,192 @@
@@ -0,0 +1,192 @@
|
||||
%bcond_without gnutls |
||||
|
||||
%global gitdate 20221110 |
||||
%global gitcommit 2ae7b019370760e17f4f2675195a91ca53950eda |
||||
%global gitshortcommit %(c=%{gitcommit}; echo ${c:0:7}) |
||||
|
||||
# Macros needed by SELinux |
||||
%global selinuxtype targeted |
||||
%global moduletype contrib |
||||
%global modulename swtpm |
||||
|
||||
|
||||
Name: swtpm |
||||
Version: 0.8.0 |
||||
Release: 1%{?dist} |
||||
License: BSD |
||||
Summary: TPM Emulator |
||||
Url: http://github.com/stefanberger/swtpm |
||||
Source0: %{url}/archive/%{gitcommit}/%{name}-%{gitshortcommit}.tar.gz |
||||
Patch0001: 0001-swtpm_setup-Initialized-argv-to-NULL-Fedore-Rawhide.patch |
||||
BuildRequires: make |
||||
BuildRequires: git-core |
||||
BuildRequires: automake |
||||
BuildRequires: autoconf |
||||
BuildRequires: libtool |
||||
BuildRequires: libtpms-devel >= 0.6.0 |
||||
BuildRequires: expect |
||||
BuildRequires: net-tools |
||||
BuildRequires: openssl-devel |
||||
BuildRequires: socat |
||||
BuildRequires: trousers >= 0.3.9 |
||||
BuildRequires: softhsm |
||||
BuildRequires: json-glib-devel |
||||
%if %{with gnutls} |
||||
BuildRequires: gnutls >= 3.4.0 |
||||
BuildRequires: gnutls-devel |
||||
BuildRequires: gnutls-utils |
||||
BuildRequires: libtasn1-devel |
||||
BuildRequires: libtasn1 |
||||
%endif |
||||
BuildRequires: selinux-policy-devel |
||||
BuildRequires: gcc |
||||
BuildRequires: libseccomp-devel |
||||
BuildRequires: tpm2-pkcs11 tpm2-pkcs11-tools tpm2-tools tpm2-abrmd |
||||
BuildRequires: python3-devel |
||||
Requires: %{name}-libs = %{version}-%{release} |
||||
Requires: libtpms >= 0.6.0 |
||||
%if ! 0%{?flatpak} |
||||
%{?selinux_requires} |
||||
%endif |
||||
|
||||
|
||||
%description |
||||
TPM emulator built on libtpms providing TPM functionality for QEMU VMs |
||||
|
||||
|
||||
%package libs |
||||
Summary: Private libraries for swtpm TPM emulators |
||||
License: BSD |
||||
%description libs |
||||
A private library with callback functions for libtpms based swtpm TPM emulator |
||||
|
||||
|
||||
%package devel |
||||
Summary: Include files for the TPM emulator's CUSE interface for usage by clients |
||||
License: BSD |
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release} |
||||
%description devel |
||||
Include files for the TPM emulator's CUSE interface. |
||||
|
||||
|
||||
%package tools |
||||
Summary: Tools for the TPM emulator |
||||
License: BSD |
||||
Requires: swtpm = %{version}-%{release} |
||||
# trousers: for tss account |
||||
Requires: trousers >= 0.3.9 bash gnutls-utils |
||||
%description tools |
||||
Tools for the TPM emulator from the swtpm package |
||||
|
||||
|
||||
%package tools-pkcs11 |
||||
Summary: Tools for creating a local CA based on a TPM pkcs11 device |
||||
License: BSD |
||||
Requires: swtpm-tools = %{version}-%{release} |
||||
Requires: tpm2-pkcs11 tpm2-pkcs11-tools tpm2-tools tpm2-abrmd |
||||
Requires: expect gnutls-utils trousers >= 0.3.9 |
||||
%description tools-pkcs11 |
||||
Tools for creating a local CA based on a pkcs11 device |
||||
|
||||
|
||||
%prep |
||||
%autosetup -S git -n %{name}-%{gitcommit} -p1 |
||||
|
||||
|
||||
%build |
||||
NOCONFIGURE=1 ./autogen.sh |
||||
%configure \ |
||||
%if %{with gnutls} |
||||
--with-gnutls \ |
||||
%endif |
||||
--without-cuse |
||||
|
||||
%make_build |
||||
|
||||
|
||||
%check |
||||
make %{?_smp_mflags} check VERBOSE=1 |
||||
|
||||
|
||||
%install |
||||
%make_install |
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/*.{a,la,so} |
||||
|
||||
|
||||
%post |
||||
for pp in /usr/share/selinux/packages/swtpm.pp \ |
||||
/usr/share/selinux/packages/swtpm_svirt.pp; do |
||||
%selinux_modules_install -s %{selinuxtype} ${pp} |
||||
done |
||||
restorecon %{_bindir}/swtpm |
||||
%postun |
||||
if [ $1 -eq 0 ]; then |
||||
for p in swtpm swtpm_svirt; do |
||||
%selinux_modules_uninstall -s %{selinuxtype} $p |
||||
done |
||||
fi |
||||
%posttrans |
||||
%selinux_relabel_post -s %{selinuxtype} |
||||
|
||||
|
||||
%ldconfig_post libs |
||||
%ldconfig_postun libs |
||||
|
||||
|
||||
%files |
||||
%license LICENSE |
||||
%doc README |
||||
%{_bindir}/swtpm |
||||
%{_mandir}/man8/swtpm.8* |
||||
%{_datadir}/selinux/packages/swtpm.pp |
||||
%{_datadir}/selinux/packages/swtpm_svirt.pp |
||||
|
||||
|
||||
%files libs |
||||
%license LICENSE |
||||
%doc README |
||||
%dir %{_libdir}/%{name} |
||||
%{_libdir}/%{name}/libswtpm_libtpms.so.0 |
||||
%{_libdir}/%{name}/libswtpm_libtpms.so.0.0.0 |
||||
|
||||
|
||||
%files devel |
||||
%dir %{_includedir}/%{name} |
||||
%{_includedir}/%{name}/*.h |
||||
%{_mandir}/man3/swtpm_ioctls.3* |
||||
|
||||
|
||||
%files tools |
||||
%doc README |
||||
%{_bindir}/swtpm_bios |
||||
%if %{with gnutls} |
||||
%{_bindir}/swtpm_cert |
||||
%endif |
||||
%{_bindir}/swtpm_setup |
||||
%{_bindir}/swtpm_ioctl |
||||
%{_bindir}/swtpm_localca |
||||
%{_mandir}/man5/swtpm-localca.conf.5* |
||||
%{_mandir}/man5/swtpm-localca.options.5* |
||||
%{_mandir}/man5/swtpm_setup.conf.5* |
||||
%{_mandir}/man8/swtpm_bios.8* |
||||
%{_mandir}/man8/swtpm_cert.8* |
||||
%{_mandir}/man8/swtpm_ioctl.8* |
||||
%{_mandir}/man8/swtpm-localca.8* |
||||
%{_mandir}/man8/swtpm_localca.8* |
||||
%{_mandir}/man8/swtpm_setup.8* |
||||
%exclude %{_mandir}/man8/swtpm_cuse.8.gz |
||||
%config(noreplace) %{_sysconfdir}/swtpm_setup.conf |
||||
%config(noreplace) %{_sysconfdir}/swtpm-localca.options |
||||
%config(noreplace) %{_sysconfdir}/swtpm-localca.conf |
||||
%dir %{_datadir}/swtpm |
||||
%{_datadir}/swtpm/swtpm-localca |
||||
%{_datadir}/swtpm/swtpm-create-user-config-files |
||||
%attr( 750, tss, root) %{_localstatedir}/lib/swtpm-localca |
||||
|
||||
|
||||
%files tools-pkcs11 |
||||
%{_mandir}/man8/swtpm-create-tpmca.8* |
||||
%{_datadir}/swtpm/swtpm-create-tpmca |
||||
|
||||
|
||||
%changelog |
Loading…
Reference in new issue