arrfab / rpms / shim

Forked from rpms/shim 5 years ago
Clone
Blob Blame History Raw
Name:           shim
Version:        0.9
Release:        1%{?dist}
Summary:        First-stage UEFI bootloader

License:        BSD
URL:            http://www.codon.org.uk/~mjg59/shim/
Source0:	https://github.com/mjg59/shim/releases/download/%{version}/shim-%{version}.tar.bz2
Source1:	securebootca.cer
# currently here's what's in our dbx: # nothing.
#Source2:	dbx.esl
Source3:	shim-find-debuginfo.sh

Patch0001:	0001-Typo-on-aarch64.patch

BuildRequires: git openssl-devel openssl
BuildRequires: pesign >= 0.106-1
BuildRequires: gnu-efi >= 1:3.0.2, gnu-efi-devel >= 1:3.0.2

# for xxd
BuildRequires: vim-common

# Shim uses OpenSSL, but cannot use the system copy as the UEFI ABI is not
# compatible with SysV (there's no red zone under UEFI) and there isn't a
# POSIX-style C library.
# BuildRequires: OpenSSL
Provides: bundled(openssl) = 0.9.8w

# Shim is only required on platforms implementing the UEFI secure boot
# protocol. The only one of those we currently wish to support is 64-bit x86.
# Adding further platforms will require adding appropriate relocation code.
ExclusiveArch: x86_64 aarch64

%ifarch x86_64
%global efiarch x64
%endif
%ifarch aarch64
%global efiarch aa64
%endif

# Figure out the right file path to use
%global efidir %(eval echo $(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/'))

%define debug_package %{nil}
%global __debug_package 1

%description
Initial UEFI bootloader that handles chaining to a trusted full bootloader
under secure boot environments.

%package -n shim-unsigned
Summary: First-stage UEFI bootloader (unsigned data)

%description -n shim-unsigned
Initial UEFI bootloader that handles chaining to a trusted full bootloader
under secure boot environments.

%package -n shim-unsigned-%{efiarch}-debuginfo
Obsoletes: shim-debuginfo < 0.9
Summary: Debug information for package %{name}
Group: Development/Debug
AutoReqProv: 0
BuildArch: noarch

%description -n shim-unsigned-%{efiarch}-debuginfo
This package provides debug information for package %{name}.
Debug information is useful when developing applications that use this
package or when debugging this package.

%prep
%setup -n %{name}-%{version}-%{efiarch} -T -c
cd %{_builddir}
%{__tar} -xo -f %{SOURCE0}
mv %{name}-%{version} %{name}-%{version}-%{efiarch}
%setup -q -D -T -n %{name}-%{version}-%{efiarch}/%{name}-%{version}
git init
git config user.email "example@example.com"
git config user.name "rpmbuild -bp"
git add .
git commit -a -q -m "%{version} baseline."
git am --ignore-whitespace %{patches} </dev/null
git config --unset user.email
git config --unset user.name

%build
MAKEFLAGS="VENDOR_CERT_FILE=%{SOURCE1}"
# MAKEFLAGS="$MAKEFLAGS VENDOR_DBX_FILE=%{SOURCE2}"
MAKEFLAGS="$MAKEFLAGS RELEASE=%{release}"
make 'DEFAULT_LOADER=\\\\grub%{efiarch}.efi' ${MAKEFLAGS} shim.efi MokManager.efi fallback.efi

%install
rm -rf $RPM_BUILD_ROOT
pesign -h -P -i shim.efi -h > shim.hash
install -D -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/
install -m 0644 shim.hash $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/shim.hash
for x in shim fallback MokManager ; do
	install -m 0644 $x.efi $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/
	install -m 0644 $x.so $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/
done

%global __debug_install_post						\
	bash %{SOURCE3}							\\\
		%{?_missing_build_ids_terminate_build:--strict-build-id}\\\
		%{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"	\
	rm -f $RPM_BUILD_ROOT%{_datadir}/shim/%{efiarch}-%{version}-%{release}/*.so		\
	%{nil}

%files -n shim-unsigned
%dir %{_datadir}/shim
%dir %{_datadir}/shim/%{efiarch}-%{version}-%{release}/
%{_datadir}/shim/%{efiarch}-%{version}-%{release}/*.efi
%{_datadir}/shim/%{efiarch}-%{version}-%{release}/*.hash

%files -n shim-unsigned-%{efiarch}-debuginfo -f debugfiles.list
%defattr(-,root,root)

%changelog
* Mon Jun 22 2015 Peter Jones <pjones@redhat.com> - 0.9-1
- Update to 0.9-1
- Fix early call to BS->Exit()
  Resolves: rhbz#1115843
- Implement shim on aarch64
  Resolves: rhbz#1100048
  Resolves: rhbz#1190191

* Mon Jun 22 2015 Peter Jones <pjones@redhat.com> - 0.7-14
- Excise mokutil.
  Related: rhbz#1100048

* Mon Jun 22 2015 Peter Jones <pjones@redhat.com> - 0.7-13
- Do a build for Aarch64 to make the tree composable.
  Related: rhbz#1100048

* Wed Feb 25 2015 Peter Jones <pjones@redhat.com> - 0.7-10
- Fix a couple more minor bugs aavmf has found in fallback.
  Related: rhbz#1190191
- Build lib/ with the right CFLAGS
  Related: rhbz#1190191

* Tue Feb 24 2015 Peter Jones <pjones@redhat.com> - 0.7-9
- Fix aarch64 section loading.
  Related: rhbz#1190191

* Tue Sep 30 2014 Peter Jones <pjones@redhat.com> - 0.7-8
- Build -8 for arm as well.
  Related: rhbz#1100048
- out-of-bounds memory read flaw in DHCPv6 packet processing
  Resolves: CVE-2014-3675
- heap-based buffer overflow flaw in IPv6 address parsing
  Resolves: CVE-2014-3676
- memory corruption flaw when processing Machine Owner Keys (MOKs)
  Resolves: CVE-2014-3677

* Tue Sep 23 2014 Peter Jones <pjones@redhat.com> - 0.7-7
- Use the right key for ARM Aarch64.

* Sun Sep 21 2014 Peter Jones <pjones@redhat.com> - 0.7-6
- Preliminary build for ARM Aarch64.

* Tue Feb 18 2014 Peter Jones <pjones@redhat.com> - 0.7-5
- Update for production signing
  Resolves: rhbz#1064424
  Related: rhbz#1064449

* Thu Nov 21 2013 Peter Jones <pjones@redhat.com> - 0.7-4
- Make dhcpv4 paths work better when netbooting.
  Resolves: rhbz#1032583

* Thu Nov 14 2013 Peter Jones <pjones@redhat.com> - 0.7-3
- Make lockdown include UEFI and other KEK/DB entries.
  Resolves: rhbz#1030492

* Fri Nov 08 2013 Peter Jones <pjones@redhat.com> - 0.7-2
- Update lockdown to reflect SetupMode better as well
  Related: rhbz#996863

* Wed Nov 06 2013 Peter Jones <pjones@redhat.com> - 0.7-1
- Fix logic to handle SetupMode efi variable.
  Related: rhbz#996863

* Thu Oct 31 2013 Peter Jones <pjones@redhat.com> - 0.6-1
- Fix a FreePool(NULL) call on machines too old for SB

* Fri Oct 04 2013 Peter Jones <pjones@redhat.com> - 0.5-1
- Update to 0.5

* Tue Aug 06 2013 Peter Jones <pjones@redhat.com> - 0.4-3
- Build with early RHEL test keys.
  Related: rhbz#989442

* Thu Jul 25 2013 Peter Jones <pjones@redhat.com> - 0.4-2
- Fix minor RHEL 7.0 build issues
  Resolves: rhbz#978766
- Be less verbose by default

* Tue Jun 11 2013 Peter Jones <pjones@redhat.com> - 0.4-1
- Update to 0.4

* Fri Jun 07 2013 Peter Jones <pjones@redhat.com> - 0.3-2
- Require gnu-efi-3.0q for now.
- Don't allow mmx or sse during compilation.
- Re-organize this so all real signing happens in shim-signed instead.
- Split out mokutil

* Wed Dec 12 2012 Peter Jones <pjones@redhat.com> - 0.2-3
- Fix mokutil's idea of signature sizes.

* Wed Nov 28 2012 Matthew Garrett <mjg59@srcf.ucam.org> - 0.2-2
- Fix secure_mode() always returning true

* Mon Nov 26 2012 Matthew Garrett <mjg59@srcf.ucam.org> - 0.2-1
- Update shim
- Include mokutil
- Add debuginfo package since mokutil is a userspace executable

* Mon Oct 22 2012 Peter Jones <pjones@redhat.com> - 0.1-4
- Produce an unsigned shim

* Tue Aug 14 2012 Peter Jones <pjones@redhat.com> - 0.1-3
- Update how embedded cert and signing work.

* Mon Aug 13 2012 Josh Boyer <jwboyer@redhat.com> - 0.1-2
- Add patch to fix image size calculation

* Mon Aug 13 2012 Matthew Garrett <mjg@redhat.com> - 0.1-1
- initial release