arrfab / rpms / shim

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