arrfab / rpms / shim

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