e22f8f
Name:           shim
e22f8f
Version:        0.7
f2fa6b
Release:        5%{?dist}
e22f8f
Summary:        First-stage UEFI bootloader
e22f8f
e22f8f
License:        BSD
e22f8f
URL:            http://www.codon.org.uk/~mjg59/shim/
e22f8f
Source0:	https://github.com/mjg59/shim/archive/%{version}.tar.gz
e22f8f
Source1:	securebootca.cer
e22f8f
e22f8f
# incorporate mokutil for packaging simplicity
e22f8f
%global mokutilver 0.2.0
f2fa6b
Source2:	https://github.com/lcp/mokutil/archive/mokutil-%{mokutilver}.tar.gz
e22f8f
e22f8f
# currently here's what's in our dbx:
e22f8f
# nothing.
e22f8f
#Source3:	dbx.esl
f2fa6b
Patch0001: 0001-fix-verify_mok.patch
f2fa6b
Patch0002: 0002-shim.c-Add-support-for-hashing-relocation-of-32-bit-.patch
f2fa6b
Patch0003: 0003-netboot.h-fix-build-error-on-32-bit-systems.patch
f2fa6b
Patch0004: 0004-properly-compile-OpenSSL-in-32-bit-mode.patch
f2fa6b
Patch0005: 0005-fallback.c-fix-32-bit-compilation.patch
f2fa6b
Patch0006: 0006-fix-fallback.so-build-dependency.patch
f2fa6b
Patch0007: 0007-propagate-some-path-variables.patch
f2fa6b
Patch0008: 0008-allow-32-bit-compilation-with-64-bit-compiler.patch
f2fa6b
Patch0009: 0009-shim-improve-error-messages.patch
f2fa6b
Patch0010: 0010-Clarify-meaning-of-insecure_mode.patch
f2fa6b
Patch0011: 0011-Don-t-hook-system-services-if-shim-has-no-built-in-k.patch
f2fa6b
Patch0012: 0012-Fix-path-generation-for-Dhcpv4-bootloader.patch
f2fa6b
Patch0013: 0013-Lengths-that-might-be-1-can-t-be-unsigned-Peter.patch
f2fa6b
Patch0014: 0014-Fix-wrong-sizeof.patch
f2fa6b
Patch0015: 0015-Initialize-entries-before-we-pass-it-to-another-func.patch
f2fa6b
Patch0016: 0016-Rewrite-directory-traversal-allocation-path-so-cover.patch
f2fa6b
Patch0017: 0017-Error-check-the-right-thing-in-get_variable_attr-whe.patch
f2fa6b
Patch0018: 0018-fallback-For-HD-device-paths-use-just-the-media-node.patch
f2fa6b
Patch0019: 0019-fallback-Attempt-to-re-use-existing-entries-when-pos.patch
f2fa6b
Patch0020: 0001-Add-a-preliminary-test-plan.patch
f2fa6b
Patch0021: 0002-Fix-a-part-of-the-test-plan-that-was-out-of-order.patch
f2fa6b
Patch0022: 0003-Allow-fallback-to-use-the-system-s-LoadImage-StartIm.patch
f2fa6b
Patch0023: 0001-Actually-reflect-the-upstream-commit-this-patchset-g.patch
e22f8f
e22f8f
BuildRequires: git openssl-devel openssl
e22f8f
BuildRequires: pesign >= 0.106-1
e22f8f
BuildRequires: gnu-efi = 3.0u, gnu-efi-devel = 3.0u
e22f8f
e22f8f
# for xxd
e22f8f
BuildRequires: vim-common
e22f8f
f2fa6b
# for mokutil's configure
f2fa6b
BuildRequires: autoconf automake
f2fa6b
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.
e22f8f
# BuildRequires: OpenSSL
e22f8f
Provides: bundled(openssl) = 0.9.8w
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.
e22f8f
ExclusiveArch: x86_64
e22f8f
e22f8f
# Figure out the right file path to use
e22f8f
%if 0%{?rhel}
e22f8f
%global efidir redhat
e22f8f
%endif
e22f8f
%if 0%{?fedora}
e22f8f
%global efidir fedora
e22f8f
%endif
e22f8f
e22f8f
%description
e22f8f
Initial UEFI bootloader that handles chaining to a trusted full bootloader
e22f8f
under secure boot environments.
e22f8f
e22f8f
%package -n shim-unsigned
e22f8f
Summary: First-stage UEFI bootloader (unsigned data)
e22f8f
e22f8f
%description -n shim-unsigned
e22f8f
Initial UEFI bootloader that handles chaining to a trusted full bootloader
e22f8f
under secure boot environments.
e22f8f
e22f8f
%package -n mokutil
e22f8f
Summary: Utilities for managing Secure Boot/MoK keys.
e22f8f
e22f8f
%description -n mokutil
e22f8f
Utilities for managing the "Machine's Own Keys" list.
e22f8f
e22f8f
%prep
e22f8f
%setup -q
e22f8f
%setup -q -a 2 -D -T
e22f8f
e22f8f
git init
e22f8f
git config user.email "shim-owner@fedoraproject.org"
e22f8f
git config user.name "Fedora Ninjas"
e22f8f
git add .
e22f8f
git commit -a -q -m "%{version} baseline."
e22f8f
git am %{patches} 
e22f8f
e22f8f
%build
e22f8f
MAKEFLAGS=""
e22f8f
if [ -f "%{SOURCE1}" ]; then
e22f8f
	MAKEFLAGS="VENDOR_CERT_FILE=%{SOURCE1}"
e22f8f
fi
e22f8f
# MAKEFLAGS="$MAKEFLAGS VENDOR_DBX_FILE=%{SOURCE3}"
e22f8f
make 'DEFAULT_LOADER=\\\\grubx64.efi' ${MAKEFLAGS} shim.efi MokManager.efi fallback.efi
e22f8f
cd mokutil-%{mokutilver}
f2fa6b
./autogen.sh
e22f8f
%configure
e22f8f
make %{?_smp_mflags}
e22f8f
e22f8f
%install
e22f8f
rm -rf $RPM_BUILD_ROOT
e22f8f
pesign -h -P -i shim.efi -h > shim.hash
e22f8f
install -D -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/shim/
e22f8f
install -m 0644 shim.efi $RPM_BUILD_ROOT%{_datadir}/shim/shim.efi
e22f8f
install -m 0644 shim.hash $RPM_BUILD_ROOT%{_datadir}/shim/shim.hash
e22f8f
install -m 0644 fallback.efi $RPM_BUILD_ROOT%{_datadir}/shim/fallback.efi
e22f8f
install -m 0644 MokManager.efi $RPM_BUILD_ROOT%{_datadir}/shim/MokManager.efi
e22f8f
cd mokutil-%{mokutilver}
e22f8f
make PREFIX=%{_prefix} LIBDIR=%{_libdir} DESTDIR=%{buildroot} install
e22f8f
e22f8f
%files -n shim-unsigned
e22f8f
%doc
e22f8f
%dir %{_datadir}/shim
e22f8f
%{_datadir}/shim/*
e22f8f
e22f8f
%files -n mokutil
e22f8f
/usr/bin/mokutil
e22f8f
/usr/share/man/man1/mokutil.1.gz
e22f8f
e22f8f
%changelog
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