arrfab / rpms / shim

Forked from rpms/shim 4 years ago
Clone

Blame SPECS/shim.spec

e22f8f
Name:           shim
e22f8f
Version:        0.7
e97c83
Release:        8%{?dist}
e22f8f
Summary:        First-stage UEFI bootloader
e22f8f
e22f8f
License:        BSD
e22f8f
URL:            http://www.codon.org.uk/~mjg59/shim/
e97c83
Source0:	https://github.com/mjg59/shim/releases/download/%{version}/shim-%{version}.tar.bz2
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
# currently here's what's in our dbx:
e22f8f
# nothing.
e22f8f
#Source3:	dbx.esl
e97c83
Source4:	rhtest.cer
e97c83
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
e97c83
Patch0020: 0020-Add-a-preliminary-test-plan.patch
e97c83
Patch0021: 0021-Add-a-failure-case-to-the-test-plan-and-fix-an-order.patch
e97c83
Patch0022: 0022-Allow-fallback-to-use-the-system-s-LoadImage-StartIm.patch
e97c83
Patch0023: 0023-additional-bounds-checking-on-section-sizes.patch
e97c83
Patch0024: 0024-Kees-patch-missed-the-offset-adjustment-to-PEHdr.patch
e97c83
Patch0025: 0025-Get-rid-of-SectionCache-in-generate_hash-it-is-unuse.patch
e97c83
Patch0026: 0026-fallback-Avoid-duplicate-old-BootOrder.patch
e97c83
Patch0027: 0027-fallback-Fix-the-data-size-for-boot-option-compariso.patch
e97c83
Patch0028: 0028-fallback-Try-to-boot-the-first-boot-option-anyway.patch
e97c83
Patch0029: 0029-Fetch-the-netboot-image-from-the-same-device.patch
e97c83
Patch0030: 0030-Check-the-first-4-bytes-of-the-certificate.patch
e97c83
Patch0031: 0031-Remove-grubpath-in-generate_path.patch
e97c83
Patch0032: 0032-MokManager-delete-the-BS-NV-variables-the-right-way.patch
e97c83
Patch0033: 0033-MokManager-handle-the-error-status-from-ReadKeyStrok.patch
e97c83
Patch0034: 0034-Exclude-ca.crt-while-signing-EFI-images.patch
e97c83
Patch0035: 0035-No-newline-for-console_notify.patch
e97c83
Patch0036: 0036-Remove-the-duplicate-calls-in-lib-console.c.patch
e97c83
Patch0037: 0037-Silence-the-functions-of-shim-protocol.patch
e97c83
Patch0038: 0038-Free-the-string-from-DevicePathToStr.patch
e97c83
Patch0039: 0039-Explain-the-logic-in-secure_mode-better.patch
e97c83
Patch0040: 0040-Check-the-secure-variables-with-the-lib-functions.patch
e97c83
Patch0041: 0041-Make-sure-we-default-to-assuming-we-re-locked-down.patch
e97c83
Patch0042: 0042-Simplify-the-checking-of-SB-and-DB-states.patch
e97c83
Patch0043: 0043-Update-openssl-to-0.9.8za.patch
e97c83
Patch0044: 0044-Replace-build-instructions-in-README-with-something-.patch
e97c83
Patch0045: 0045-CryptLib-undefine-va_arg-and-friends-before-redefini.patch
e97c83
Patch0046: 0046-unhook_system_services-bail-on-systab-NULL.patch
e97c83
Patch0047: 0047-Factor-out-x86-isms-and-add-cross-compile-support.patch
e97c83
Patch0048: 0048-Add-support-for-64-bit-ARM-AArch64.patch
e97c83
Patch0049: 0049-Add-support-for-32-bit-ARM.patch
e97c83
Patch0050: 0050-Update-openssl-to-0.9.8zb.patch
e97c83
Patch0051: 0051-Fix-typo-from-Ard-s-old-tree-32-bit-ARM-patch.patch
e97c83
Patch0052: 0052-Handle-empty-.reloc-section-in-PE-COFF-loader.patch
e97c83
Patch0053: 0053-Don-t-name-something-exit.patch
e97c83
Patch0054: 0054-Make-sure-we-don-t-try-to-load-a-binary-from-a-diffe.patch
e97c83
Patch0055: 0055-Actually-refer-to-the-base-relocation-table-of-our-l.patch
e97c83
Patch0056: 0056-Make-64-on-32-maybe-work-on-x86_64.patch
e97c83
Patch0057: 0057-Validate-computed-hash-bases-hash-sizes-more-thoroug.patch
e97c83
Patch0058: 0058-Don-t-call-AuthenticodeVerify-if-vendor_cert_size-is.patch
e97c83
Patch0059: 0059-Fix-our-in_protocol-printing.patch
e97c83
Patch0060: 0060-Generate-a-sane-PE-header-on-shim-fallback-and-MokMa.patch
e97c83
Patch0061: 0061-Do-the-same-for-ia32.patch
e97c83
Patch0062: 0062-Make-list_keys-index-variables-all-be-signed.patch
e97c83
Patch0063: 0063-Revert-header-changes.patch
e97c83
Patch0064: 0064-Actually-find-the-relocations-correctly-and-process-.patch
e97c83
Patch0065: 0065-Don-t-append-an-empty-cert-list-to-MokListRT-if-vend.patch
e97c83
Patch0066: 0066-Fix-some-minor-testplan-errors.patch
e97c83
Patch0067: 0067-Don-t-verify-images-with-the-empty-build-key.patch
e97c83
Patch0068: 0068-Cryptlib-remove-the-unused-files.patch
e97c83
Patch0069: 0069-Another-testplan-error.patch
e97c83
Patch0070: 0070-shim-buffer-overflow-on-ipv6-option-parsing.patch
e97c83
Patch0071: 0071-OOB-access-when-parsing-MOK-List-Certificates-on-MOK.patch
e97c83
Patch0072: 0072-Make-another-integer-compare-be-signed-unsigned-safe.patch
e97c83
Patch0073: 0073-Use-Werror-sign-compare.patch
e97c83
Patch0074: 0074-Correctly-reject-bad-tftp-addresses-earlier-rather-t.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
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
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
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
e22f8f
%build
e22f8f
MAKEFLAGS=""
e97c83
%ifarch aarch64
e97c83
if [ -f "%{SOURCE4}" ]; then
e97c83
	MAKEFLAGS="VENDOR_CERT_FILE=%{SOURCE4}"
e97c83
fi
e97c83
%else
e22f8f
if [ -f "%{SOURCE1}" ]; then
e22f8f
	MAKEFLAGS="VENDOR_CERT_FILE=%{SOURCE1}"
e22f8f
fi
e97c83
%endif
e22f8f
# MAKEFLAGS="$MAKEFLAGS VENDOR_DBX_FILE=%{SOURCE3}"
e97c83
make 'DEFAULT_LOADER=\\\\grub%{efiarch}.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
e97c83
* Tue Sep 30 2014 Peter Jones <pjones@redhat.com> - 0.7-8
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