e22f8f
Name:           shim
ce8221
Version:        15
24a050
Release:        5%{?dist}
e22f8f
Summary:        First-stage UEFI bootloader
e22f8f
e22f8f
License:        BSD
e22f8f
URL:            http://www.codon.org.uk/~mjg59/shim/
ce8221
Source0:        https://github.com/mjg59/shim/releases/download/%{version}/shim-%{version}.tar.bz2
1bbb7a
#Source1:        centos.crt
7adeae
# currently here's what's in our dbx: # nothing.
ce8221
#Source2:       dbx-x64.esl
ce8221
#Source3:       dbx-aa64.esl
ce8221
Source4:        shim-find-debuginfo.sh
1bbb7a
Source5:	centos.esl
032365
24a050
Patch0001:      0001-Make-sure-that-MOK-variables-always-get-mirrored.patch
24a050
Patch0002:      0002-mok-fix-the-mirroring-of-RT-variables.patch
24a050
Patch0003:      0003-mok-consolidate-mirroring-code-in-a-helper-instead-o.patch
24a050
Patch0004:      0004-Make-VLogError-behave-as-expected.patch
24a050
Patch0005:      0005-Once-again-try-even-harder-to-get-binaries-without-t.patch
027045
Patch9998:      9998-MokListRT-Fatal.patch
1bbb7a
Patch9999:      9999-Add-vendor-esl.patch
e22f8f
e22f8f
BuildRequires: git openssl-devel openssl
e22f8f
BuildRequires: pesign >= 0.106-1
db3164
BuildRequires: gnu-efi >= 1:3.0.5-6.el7, gnu-efi-devel >= 1:3.0.5-6.el7
e22f8f
e22f8f
# for xxd
e22f8f
BuildRequires: vim-common
e22f8f
e22f8f
# Shim uses OpenSSL, but cannot use the system copy as the UEFI ABI is not
e22f8f
# compatible with SysV (there's no red zone under UEFI) and there isn't a
e22f8f
# POSIX-style C library.
db3164
Provides: bundled(openssl) = 1.0.2j
e22f8f
e22f8f
# Shim is only required on platforms implementing the UEFI secure boot
e22f8f
# protocol. The only one of those we currently wish to support is 64-bit x86.
e22f8f
# Adding further platforms will require adding appropriate relocation code.
7adeae
ExclusiveArch: x86_64 aarch64
e22f8f
e97c83
%ifarch x86_64
e97c83
%global efiarch x64
e97c83
%endif
e97c83
%ifarch aarch64
e97c83
%global efiarch aa64
e97c83
%endif
e97c83
e22f8f
# Figure out the right file path to use
7adeae
%global efidir %(eval echo $(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/'))
7adeae
7adeae
%define debug_package %{nil}
7adeae
%global __debug_package 1
e22f8f
db3164
%global _binaries_in_noarch_packages_terminate_build 0
db3164
e22f8f
%description
e22f8f
Initial UEFI bootloader that handles chaining to a trusted full bootloader
e22f8f
under secure boot environments.
e22f8f
db3164
%package -n shim-unsigned-%{efiarch}
e22f8f
Summary: First-stage UEFI bootloader (unsigned data)
e22f8f
db3164
%description -n shim-unsigned-%{efiarch}
e22f8f
Initial UEFI bootloader that handles chaining to a trusted full bootloader
e22f8f
under secure boot environments.
e22f8f
7adeae
%package -n shim-unsigned-%{efiarch}-debuginfo
7adeae
Obsoletes: shim-debuginfo < 0.9
7adeae
Summary: Debug information for package %{name}
7adeae
Group: Development/Debug
7adeae
AutoReqProv: 0
7adeae
BuildArch: noarch
e22f8f
7adeae
%description -n shim-unsigned-%{efiarch}-debuginfo
7adeae
This package provides debug information for package %{name}.
7adeae
Debug information is useful when developing applications that use this
7adeae
package or when debugging this package.
e22f8f
db3164
%ifarch x86_64
db3164
%package -n shim-unsigned-ia32
db3164
Summary: First-stage UEFI bootloader (unsigned data)
db3164
db3164
%description -n shim-unsigned-ia32
db3164
Initial UEFI bootloader that handles chaining to a trusted full bootloader
db3164
under secure boot environments.
db3164
db3164
%package -n shim-unsigned-ia32-debuginfo
db3164
Obsoletes: shim-debuginfo < 0.9
db3164
Summary: Debug information for package %{name}
db3164
Group: Development/Debug
db3164
AutoReqProv: 0
db3164
BuildArch: noarch
db3164
db3164
%description -n shim-unsigned-ia32-debuginfo
db3164
This package provides debug information for package %{name}.
db3164
Debug information is useful when developing applications that use this
db3164
package or when debugging this package.
db3164
%endif
db3164
e22f8f
%prep
db3164
%setup -T -n %{name}-%{version}-%{release} -c
7adeae
%{__tar} -xo -f %{SOURCE0}
7adeae
mv %{name}-%{version} %{name}-%{version}-%{efiarch}
db3164
cd %{name}-%{version}-%{efiarch}
e22f8f
git init
e97c83
git config user.email "example@example.com"
e97c83
git config user.name "rpmbuild -bp"
e22f8f
git add .
e22f8f
git commit -a -q -m "%{version} baseline."
e97c83
git am --ignore-whitespace %{patches} 
e97c83
git config --unset user.email
e97c83
git config --unset user.name
e22f8f
db3164
%ifarch x86_64
db3164
cd ..
db3164
%{__tar} -xo -f %{SOURCE0}
db3164
mv %{name}-%{version} %{name}-%{version}-ia32
db3164
cd %{name}-%{version}-ia32
db3164
git init
db3164
git config user.email "example@example.com"
db3164
git config user.name "rpmbuild -bp"
db3164
git add .
db3164
git commit -a -q -m "%{version} baseline."
db3164
git am --ignore-whitespace %{patches} 
db3164
git config --unset user.email
db3164
git config --unset user.name
db3164
%endif
db3164
e22f8f
%build
24a050
COMMIT_ID=$(cat %{name}-%{version}-%{efiarch}/commit)
24a050
MAKEFLAGS="RELEASE=%{release} ENABLE_HTTPBOOT=true COMMIT_ID=${COMMIT_ID}"
db3164
%ifarch aarch64
db3164
if [ -f "%{SOURCE1}" ]; then
ce8221
        MAKEFLAGS="$MAKEFLAGS VENDOR_CERT_FILE=%{SOURCE1}"
db3164
fi
db3164
if [ -f "%{SOURCE3}" ]; then
ce8221
        MAKEFLAGS="$MAKEFLAGS VENDOR_DBX_FILE=%{SOURCE3}"
67f27a
fi
1bbb7a
if [ -f "%{SOURCE5}" ]; then
1bbb7a
	MAKEFLAGS="$MAKEFLAGS VENDOR_ESL_FILE=%{SOURCE5}"
1bbb7a
fi
db3164
%else
db3164
if [ -f "%{SOURCE1}" ]; then
ce8221
        MAKEFLAGS="$MAKEFLAGS VENDOR_CERT_FILE=%{SOURCE1}"
db3164
fi
db3164
if [ -f "%{SOURCE2}" ]; then
ce8221
        MAKEFLAGS="$MAKEFLAGS VENDOR_DBX_FILE=%{SOURCE2}"
67f27a
fi
1bbb7a
if [ -f "%{SOURCE5}" ]; then
1bbb7a
	MAKEFLAGS="$MAKEFLAGS VENDOR_ESL_FILE=%{SOURCE5}"
1bbb7a
fi
db3164
%endif
db3164
cd %{name}-%{version}-%{efiarch}
db3164
make 'DEFAULT_LOADER=\\\\grub%{efiarch}.efi' ${MAKEFLAGS} shim%{efiarch}.efi mm%{efiarch}.efi fb%{efiarch}.efi
db3164
db3164
%ifarch x86_64
db3164
cd ../%{name}-%{version}-ia32
24a050
setarch linux32 make 'DEFAULT_LOADER=\\\\grubia32.efi' ARCH=ia32 ${MAKEFLAGS} shimia32.efi mmia32.efi fbia32.efi
db3164
cd ../%{name}-%{version}-%{efiarch}
db3164
%endif
e22f8f
e22f8f
%install
db3164
cd %{name}-%{version}-%{efiarch}
db3164
pesign -h -P -i shim%{efiarch}.efi -h > shim%{efiarch}.hash
7adeae
install -D -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/
db3164
install -m 0644 shim%{efiarch}.hash $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/shim%{efiarch}.hash
db3164
for x in shim%{efiarch} mm%{efiarch} fb%{efiarch} ; do
ce8221
        install -m 0644 $x.efi $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/
ce8221
        install -m 0644 $x.so $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/
7adeae
done
7adeae
db3164
%ifarch x86_64
db3164
cd ../%{name}-%{version}-ia32
db3164
pesign -h -P -i shimia32.efi -h > shimia32.hash
db3164
install -D -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/shim/ia32-%{version}-%{release}/
db3164
install -m 0644 shimia32.hash $RPM_BUILD_ROOT%{_datadir}/shim/ia32-%{version}-%{release}/shimia32.hash
db3164
for x in shimia32 mmia32 fbia32 ; do
ce8221
        install -m 0644 $x.efi $RPM_BUILD_ROOT%{_datadir}/shim/ia32-%{version}-%{release}/
ce8221
        install -m 0644 $x.so $RPM_BUILD_ROOT%{_datadir}/shim/ia32-%{version}-%{release}/
db3164
done
db3164
cd ../%{name}-%{version}-%{efiarch}
db3164
%endif
db3164
db3164
%ifarch x86_64
ce8221
%global __debug_install_post                                            \
ce8221
        bash %{SOURCE4}                                                 \\\
ce8221
                %{?_missing_build_ids_terminate_build:--strict-build-id}\\\
ce8221
                %{?_find_debuginfo_opts}                                \\\
ce8221
                "%{_builddir}/%{?buildsubdir}/%{name}-%{version}-%{efiarch}" \
ce8221
        rm -f $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/*.so \
ce8221
        mv debugfiles.list ../debugfiles-%{efiarch}.list                \
ce8221
        cd ..                                                           \
ce8221
        cd %{name}-%{version}-ia32                                      \
ce8221
        bash %{SOURCE4}                                                 \\\
ce8221
                %{?_missing_build_ids_terminate_build:--strict-build-id}\\\
ce8221
                %{?_find_debuginfo_opts}                                \\\
ce8221
                "%{_builddir}/%{?buildsubdir}/%{name}-%{version}-ia32"  \
ce8221
        rm -f $RPM_BUILD_ROOT%{_datadir}/shim/ia32-%{version}-%{release}/*.so \
ce8221
        mv debugfiles.list ../debugfiles-ia32.list                      \
ce8221
        cd ..                                                           \
ce8221
        %{nil}
db3164
%else
ce8221
%global __debug_install_post                                            \
ce8221
        bash %{SOURCE4}                                                 \\\
ce8221
                %{?_missing_build_ids_terminate_build:--strict-build-id}\\\
ce8221
                %{?_find_debuginfo_opts}                                \\\
ce8221
                "%{_builddir}/%{?buildsubdir}/%{name}-%{version}-%{efiarch}" \
ce8221
        rm -f $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/*.so \
ce8221
        mv debugfiles.list ../debugfiles-%{efiarch}.list                \
ce8221
        cd ..                                                           \
ce8221
        %{nil}
db3164
%endif
e22f8f
db3164
%files -n shim-unsigned-%{efiarch}
e22f8f
%dir %{_datadir}/shim
7adeae
%dir %{_datadir}/shim/%{efiarch}-%{version}-%{release}/
7adeae
%{_datadir}/shim/%{efiarch}-%{version}-%{release}/*.efi
7adeae
%{_datadir}/shim/%{efiarch}-%{version}-%{release}/*.hash
e22f8f
db3164
%files -n shim-unsigned-%{efiarch}-debuginfo -f debugfiles-%{efiarch}.list
7adeae
%defattr(-,root,root)
e22f8f
db3164
%ifarch x86_64
db3164
%files -n shim-unsigned-ia32
db3164
%dir %{_datadir}/shim
db3164
%dir %{_datadir}/shim/ia32-%{version}-%{release}/
db3164
%{_datadir}/shim/ia32-%{version}-%{release}/*.efi
db3164
%{_datadir}/shim/ia32-%{version}-%{release}/*.hash
db3164
db3164
%files -n shim-unsigned-ia32-debuginfo -f debugfiles-ia32.list
db3164
%defattr(-,root,root)
db3164
%endif
db3164
e22f8f
%changelog
1bbb7a
* Tue Sep 03 2019 Fabian Arrotin <arrfab@centos.org> - 15-5.el7.centos
027045
- Added 9999-Add-vendor-esl.patch (Patrick Uiterwijk)            
027045
- Added 9998-MokListRT-Fatal.patch (https://github.com/rhboot/shim/pull/157) (#15522)
1bbb7a
- Rebuilt with combined centos.esl (so new and previous crt) 
1bbb7a
24a050
* Mon Mar 18 2019 Peter Jones <pjones@redhat.com> - 15-5
24a050
- Fix a couple more things that are breaking reproducability, and thus
24a050
  breaking external review.
24a050
  Related: rhbz#1649270
24a050
24a050
* Fri Mar 15 2019 Peter Jones <pjones@redhat.com> - 15-4
24a050
- Fight with binutils to try to get a binary without timestamps in it.
24a050
  Again, but without breaking aarch64 this time.
24a050
  Related: rhbz#1649270
24a050
24a050
* Fri Mar 15 2019 Peter Jones <pjones@redhat.com> - 15-3
24a050
- Fight with binutils to try to get a binary without timestamps in it.  Again.
24a050
  Related: rhbz#1649270
24a050
24a050
* Tue Feb 12 2019 Peter Jones <pjones@redhat.com> - 15-2
24a050
- Fix MoK mirroring issue which breaks kdump without intervention
24a050
  Related: rhbz#1649270
032365
ce8221
* Mon Jun 18 2018 Peter Jones <pjones@redhat.com> - 15-1
ce8221
- Update to shim 15
ce8221
  Resolves: rhbz#1589961
67f27a
db3164
* Thu Apr 27 2017 Peter Jones <pjones@redhat.com> - 12-1
db3164
- Update to 12-1 to work around a signtool.exe bug
db3164
  Related: rhbz#1445393
db3164
db3164
* Mon Apr 03 2017 Peter Jones <pjones@redhat.com> - 11-1
db3164
- Update to 11-1
db3164
  Related: rhbz#1310766
db3164
- Fix regression in PE loader
db3164
  Related: rhbz#1310766
db3164
- Fix case where BDS invokes us wrong and we exec shim again as a result
db3164
  Related: rhbz#1310766
db3164
db3164
* Tue Mar 21 2017 Peter Jones <pjones@redhat.com> - 10-1
db3164
- Update to 10-1
db3164
- Support ia32
db3164
  Resolves: rhbz#1310766
db3164
- Handle various different load option implementation differences
db3164
- TPM 1 and TPM 2 support.
db3164
- Update to OpenSSL 1.0.2k
db3164
7adeae
* Mon Jun 22 2015 Peter Jones <pjones@redhat.com> - 0.9-1
7adeae
- Update to 0.9-1
7adeae
- Fix early call to BS->Exit()
7adeae
  Resolves: rhbz#1115843
7adeae
- Implement shim on aarch64
7adeae
  Resolves: rhbz#1100048
7adeae
  Resolves: rhbz#1190191
7adeae
7adeae
* Mon Jun 22 2015 Peter Jones <pjones@redhat.com> - 0.7-14
7adeae
- Excise mokutil.
7adeae
  Related: rhbz#1100048
7adeae
7adeae
* Mon Jun 22 2015 Peter Jones <pjones@redhat.com> - 0.7-13
7adeae
- Do a build for Aarch64 to make the tree composable.
7adeae
  Related: rhbz#1100048
7adeae
7adeae
* Wed Feb 25 2015 Peter Jones <pjones@redhat.com> - 0.7-10
7adeae
- Fix a couple more minor bugs aavmf has found in fallback.
7adeae
  Related: rhbz#1190191
7adeae
- Build lib/ with the right CFLAGS
7adeae
  Related: rhbz#1190191
7adeae
7adeae
* Tue Feb 24 2015 Peter Jones <pjones@redhat.com> - 0.7-9
7adeae
- Fix aarch64 section loading.
7adeae
  Related: rhbz#1190191
7adeae
e97c83
* Tue Sep 30 2014 Peter Jones <pjones@redhat.com> - 0.7-8
7adeae
- Build -8 for arm as well.
7adeae
  Related: rhbz#1100048
e97c83
- out-of-bounds memory read flaw in DHCPv6 packet processing
e97c83
  Resolves: CVE-2014-3675
e97c83
- heap-based buffer overflow flaw in IPv6 address parsing
e97c83
  Resolves: CVE-2014-3676
e97c83
- memory corruption flaw when processing Machine Owner Keys (MOKs)
e97c83
  Resolves: CVE-2014-3677
e97c83
e97c83
* Tue Sep 23 2014 Peter Jones <pjones@redhat.com> - 0.7-7
e97c83
- Use the right key for ARM Aarch64.
e97c83
e97c83
* Sun Sep 21 2014 Peter Jones <pjones@redhat.com> - 0.7-6
e97c83
- Preliminary build for ARM Aarch64.
e97c83
f2fa6b
* Tue Feb 18 2014 Peter Jones <pjones@redhat.com> - 0.7-5
f2fa6b
- Update for production signing
f2fa6b
  Resolves: rhbz#1064424
f2fa6b
  Related: rhbz#1064449
f2fa6b
e22f8f
* Thu Nov 21 2013 Peter Jones <pjones@redhat.com> - 0.7-4
e22f8f
- Make dhcpv4 paths work better when netbooting.
e22f8f
  Resolves: rhbz#1032583
e22f8f
e22f8f
* Thu Nov 14 2013 Peter Jones <pjones@redhat.com> - 0.7-3
e22f8f
- Make lockdown include UEFI and other KEK/DB entries.
e22f8f
  Resolves: rhbz#1030492
e22f8f
e22f8f
* Fri Nov 08 2013 Peter Jones <pjones@redhat.com> - 0.7-2
e22f8f
- Update lockdown to reflect SetupMode better as well
e22f8f
  Related: rhbz#996863
e22f8f
e22f8f
* Wed Nov 06 2013 Peter Jones <pjones@redhat.com> - 0.7-1
e22f8f
- Fix logic to handle SetupMode efi variable.
e22f8f
  Related: rhbz#996863
e22f8f
e22f8f
* Thu Oct 31 2013 Peter Jones <pjones@redhat.com> - 0.6-1
e22f8f
- Fix a FreePool(NULL) call on machines too old for SB
e22f8f
e22f8f
* Fri Oct 04 2013 Peter Jones <pjones@redhat.com> - 0.5-1
e22f8f
- Update to 0.5
e22f8f
e22f8f
* Tue Aug 06 2013 Peter Jones <pjones@redhat.com> - 0.4-3
e22f8f
- Build with early RHEL test keys.
e22f8f
  Related: rhbz#989442
e22f8f
e22f8f
* Thu Jul 25 2013 Peter Jones <pjones@redhat.com> - 0.4-2
e22f8f
- Fix minor RHEL 7.0 build issues
e22f8f
  Resolves: rhbz#978766
e22f8f
- Be less verbose by default
e22f8f
e22f8f
* Tue Jun 11 2013 Peter Jones <pjones@redhat.com> - 0.4-1
e22f8f
- Update to 0.4
e22f8f
e22f8f
* Fri Jun 07 2013 Peter Jones <pjones@redhat.com> - 0.3-2
e22f8f
- Require gnu-efi-3.0q for now.
e22f8f
- Don't allow mmx or sse during compilation.
e22f8f
- Re-organize this so all real signing happens in shim-signed instead.
e22f8f
- Split out mokutil
e22f8f
e22f8f
* Wed Dec 12 2012 Peter Jones <pjones@redhat.com> - 0.2-3
e22f8f
- Fix mokutil's idea of signature sizes.
e22f8f
e22f8f
* Wed Nov 28 2012 Matthew Garrett <mjg59@srcf.ucam.org> - 0.2-2
e22f8f
- Fix secure_mode() always returning true
e22f8f
e22f8f
* Mon Nov 26 2012 Matthew Garrett <mjg59@srcf.ucam.org> - 0.2-1
e22f8f
- Update shim
e22f8f
- Include mokutil
e22f8f
- Add debuginfo package since mokutil is a userspace executable
e22f8f
e22f8f
* Mon Oct 22 2012 Peter Jones <pjones@redhat.com> - 0.1-4
e22f8f
- Produce an unsigned shim
e22f8f
e22f8f
* Tue Aug 14 2012 Peter Jones <pjones@redhat.com> - 0.1-3
e22f8f
- Update how embedded cert and signing work.
e22f8f
e22f8f
* Mon Aug 13 2012 Josh Boyer <jwboyer@redhat.com> - 0.1-2
e22f8f
- Add patch to fix image size calculation
e22f8f
e22f8f
* Mon Aug 13 2012 Matthew Garrett <mjg@redhat.com> - 0.1-1
e22f8f
- initial release