Commit Graph

1510 Commits

Author SHA1 Message Date
Peter Jones
4d70f10481 lib/variables.c: reformat CreateTimeBasedPayload()
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
324db6bbab Clean up efiauthenticated.h a lot.
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
1f1ec4cea8 Make sure all of our include files have proper guards.
... and make them all the same formatting too.

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
dc62a3c4dc Move includes around to clean the source tree up a bit.
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
1a44dbb8be Rename generate_path() because we have 2 of it.
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
3832428e02 Fix the declaration of find_httpboot() to match its implementation.
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
8c42b9389f Add "make scan-build" target.
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
71bc0a8c86 Add a model file for coverity.
This is useful to hide some false positives from the covscan results.
We never build it.

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
d184bf1075 Add 'make coverity' target.
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
b681123a87 Split makefiles up a bit
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
5f3adcc2c0 Document REQUIRE_TPM
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Hans de Goede
79cdb2a215 Fix failure to boot on systems without a TPM
This commit fixes 2 issues with the TPM support code:

1) Remove "REQUIRE_TPM ?=" line from the Makefile, further down the Makefile
checks if REQUIRE_TPM is undefined, but the above line sets it to an empty
string, which is not the same as undefined. Without this handle_image fails
after the tpm_log_pe() call even if REQUIRE_TPM=1 once was not set when
building the shim

2) When secure-boot is disabled then shim_verify() would exit with the
status of tpm_log_pe(), which on systems with a TPM is an error. Combined
with the recent change to always install the shim protocols, this causes
grub to refuse to boot any kernel since the verify() call now always fails.
This commit fixes this by explicitly setting status = EFI_SUCCESS when
secure-boot is disabled.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2018-03-08 11:18:33 -05:00
Peter Jones
6c8d08c0af shim: Ignore UEFI LoadOptions that are just NUL characters.
I don't know when or why we ever see this, but it's easy enough to
avoid.

Resolves github issue #95

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-06 15:28:00 -05:00
Tamas K Lengyel
e207388577 Install shim_lock protocol even when SecureBoot is off
Currently the shim_lock protocol is only installed when SecureBoot is enabled.
However, having Verify just measure into the TPM without SecureBoot is a useful
feature.

Signed-off-by: Tamas K Lengyel <lengyelt@ainfosec.com>
2018-03-06 14:42:32 -05:00
Tamas K Lengyel
571bfc95a6 Fall-back TPM2 measurement if it fails with PE_COFF_IMAGE flag
Signed-off-by: Tamas K Lengyel <lengyelt@ainfosec.com>
2018-03-06 14:42:32 -05:00
Tamas K Lengyel
ba06a4362d Add REQUIRE_TPM flag to treat TPM related errors as critical
Currently TPM related errors are being silently discarded.

Signed-off-by: Tamas K Lengyel <lengyelt@ainfosec.com>
2018-03-06 14:42:32 -05:00
Tamas K Lengyel
555ef92650 Measure into the TPM even if SecureBoot is off in shim_lock verify
Signed-off-by: Tamas K Lengyel <lengyelt@ainfosec.com>
2018-03-06 14:37:07 -05:00
Tamas K Lengyel
829d3c8265 Log measurements in PCR4 for applications being verified through shim_lock
Currently the only measurement the shim logs in the TPM is that of the EFI
application it directly loads. However, there are no measurements being taken
of application that are being verified through the shim_lock protocol. In this
patch we extend PCR4 for any binary for which Verify is being called through
the shim_lock protocol.

Signed-off-by: Tamas K Lengyel <lengyelt@ainfosec.com>
2018-03-06 14:37:07 -05:00
Tamas K Lengyel
3d93263198 Add -m64 compiler flag to allow cross-compiling to 64-bit version on 32-bit system
Signed-off-by: Tamas K Lengyel <lengyelt@ainfosec.com>
2018-03-06 14:33:19 -05:00
Peter Jones
0da5fb8c9d ident: We don't actually need the hostname or kernel version, and it makes the builds differ.
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-02-28 15:01:07 -05:00
cdadmin
5f4fd53641 Add proxy dhcp support 2018-02-28 14:56:10 -05:00
Gary Lin
bc3b6525d8 Cryptlib: replace CryptPem with CryptPemNull
We don't need the functions in CryptPem.c.

Signed-off-by: Gary Lin <glin@suse.com>
2018-02-28 14:47:18 -05:00
Gary Lin
62d8397202 httpboot: include console.h
in_protocol is declared in console.h, so httpboot.c has to include the
header.

Signed-off-by: Gary Lin <glin@suse.com>
2018-02-28 14:47:15 -05:00
Gary Lin
736af67122 httpboot: fix the infinite loop
We should get out of the loop once the uri node is not the last node in
the device path.

Signed-off-by: Gary Lin <glin@suse.com>
2018-02-28 14:47:12 -05:00
Gary Lin
a752290c38 httpboot: Amend the device path matching rule
Originally, we check if the last 2 nodes in the device path are
IPv4()/Uri() or IPv6()/Uri() to determine whether httpboot is used or
not. However, since UEFI 2.7, the DNS node will be inserted between the
IP node and the URI node if the server provides the DNS server address.
This commit changes the matching rule to search IP node and URI node
and ignore any node between those two nodes.

Signed-off-by: Gary Lin <glin@suse.com>
2018-02-28 14:47:12 -05:00
Mathieu Trudel-Lapierre
c8ca1c5696 Uninstall shim protocols before re-installing them
Make sure if we chainload things, a chainloaded bootloader will be able to use
the latest systab replacements and protocols. They need to match for things
to validate correctly.

Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2018-02-01 13:50:44 -05:00
Peter Jones
02e2fc61bd Bump the version to 14
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-12-19 16:52:01 -05:00
Peter Jones
0f50328189 Don't allow undefined symbols at all.
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-12-19 16:52:01 -05:00
Peter Jones
97a3f6cf94 "in_protocol" is used in more than shim.o; make it not static.
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-12-19 16:52:01 -05:00
Peter Jones
b9e81483bb Don't let openssl() try to call an external abort()
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-12-19 16:36:55 -05:00
Mathieu Trudel-Lapierre
d1d148eac9 releasing package shim version 13-0ubuntu2 2017-11-07 10:19:35 -05:00
Mathieu Trudel-Lapierre
d49114cbb9 Clean up old patches. 2017-11-07 10:18:58 -05:00
Mathieu Trudel-Lapierre
81b34c1631 debian/patches/abort_abort_abort.patch: signtool.exe isn't happy with some of the structure of our binary, partly because abort() is thought to be an external symbol, which causes some relocalisations to appear. 2017-11-06 09:18:08 -05:00
Mathieu Trudel-Lapierre
4a3efbe436 releasing package shim version 13-0ubuntu1 2017-09-29 15:11:42 -04:00
Mathieu Trudel-Lapierre
dbbe142c74 Don't need to clean after .signed files, upstream Makefile does it now.
Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2017-09-29 11:29:25 -04:00
Mathieu Trudel-Lapierre
560a356bc7 Drop buildid_write_return.patch; no longer needed.
Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2017-09-29 11:26:01 -04:00
Mathieu Trudel-Lapierre
04acbb3ee3 Don't need to set -Wno-error=unused-variable anymore
Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2017-09-29 11:24:56 -04:00
Mathieu Trudel-Lapierre
2f7a1c0b68 New upstream release: 13 2017-09-29 11:22:09 -04:00
Mathieu Trudel-Lapierre
6215e920e7 New upstream version 13 2017-09-29 11:20:57 -04:00
Mathieu Trudel-Lapierre
f9f6966262 Updated version 13 from 'upstream/13'
with Debian dir e38346a2ee
2017-09-29 11:20:57 -04:00
Mathieu Trudel-Lapierre
81250bb1a1 Updated version 13~z1 from 'upstream/13_z1'
with Debian dir e38346a2ee
2017-09-29 11:18:56 -04:00
Mathieu Trudel-Lapierre
6025103c25 New upstream version 13~z1 2017-09-29 11:18:56 -04:00
Peter Jones
5e827007b3 Bump the version to 13
shim 13:
- OpenSSL reverted to 1.0.2k to make the cert chaining of existing deployments stay working
- Better PCR usage for TPM
- TPM documentation in README.tpm
- More configurable build via make variables:
  ENABLE_SHIM_CERT
  ENABLE_SHIM_HASH
  ENABLE_SBSIGN
  LIBDIR
  EFIDIR
  VENDOR_CERT_FILE
  VENDOR_DB_FILE
- Better MoK documentation in MokVars.txt
- Better debuginfo generation
- Lots of minor bug fixes.

Signed-off-by: Peter Jones <pjones@redhat.com>
2017-09-29 11:10:49 -04:00
Mathieu Trudel-Lapierre
cc08ed0e28 buildid: Check the return values of write() calls
Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2017-09-29 11:10:32 -04:00
Peter Jones
dca65ca254 Make shim_cert.h able to be included more safely.
If you build with ENABLE_SHIM_CERT=1, the include chain right now winds
up meaning shim_cert is defined in a header that gets included in
netboot.c as well, which never uses it:

  In file included from shim.h:125:0,
                   from netboot.c:36:
  shim_cert.h:1:14: error: ‘shim_cert’ defined but not used [-Werror=unused-variable]
   static UINT8 shim_cert[] = {
                ^~~~~~~~~
  cc1: all warnings being treated as errors

So make that okay by adding __attribute__((__unused__)) to the variable
decl.

Signed-off-by: Peter Jones <pjones@redhat.com>
2017-09-29 11:10:32 -04:00
Peter Jones
d8f4773408 buildid: make 'make clean' remove it. 2017-09-29 11:10:32 -04:00
Mathieu Trudel-Lapierre
a9cd148a1e New upstream snapshot: 13~git1506531982.23ce039 2017-09-27 13:10:32 -04:00
Mathieu Trudel-Lapierre
77e5c6e480 Updated version 13~git1506531982.23ce039 from 'upstream/13_git1506531982.23ce039'
with Debian dir bc85d2ed9d
2017-09-27 13:09:42 -04:00
Mathieu Trudel-Lapierre
ecc2922605 New upstream version 13~git1506531982.23ce039 2017-09-27 13:09:42 -04:00
Mathieu Trudel-Lapierre
e85582f4ca We don't really need libnss3-tools. 2017-09-27 12:55:12 -04:00