Commit Graph

10 Commits

Author SHA1 Message Date
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
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
78f6b007e7 Make msleep() be a thing
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-31 15:13:34 -04:00
Peter Jones
7ad94952cd Ensure that apps launched by shim get correct BS->Exit() behavior
Right now applications run by shim get our wrapper for Exit(), but it
doesn't do as much cleanup as it should - shim itself also exits, but
currently is not doing all the cleanup it should be doing.

This changes it so all of shim's cleanup is also performed.

Based on a patch and lots of review from Gary Lin.

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-06-11 13:25:56 -04:00
Peter Jones
32f10548cd Don't name something exit().
On aarch64 due to some terrifying include chain we wind up with
Cryptlib's definition of exit here.  I'm not a glutton for punishment,
so I'm just changing the name so it's not coliding.

Signed-off-by: Peter Jones <pjones@redhat.com>
2014-08-27 16:40:57 -04:00
Ard Biesheuvel
77cdb40423 unhook_system_services: bail on systab == NULL
Prevent unhook_system_services() from dereferencing a NULL systab, which
may occur if hook_system_services() has never been called.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2014-08-12 10:54:05 -04:00
Peter Jones
06495f692f Allow fallback to use the system's LoadImage/StartImage .
Track use of the system's LoadImage(), and when the next StartImage()
call is for an image the system verified, allow that to count as
participating, since it has been verified by the system's db.

Signed-off-by: Peter Jones <pjones@redhat.com>
2014-02-14 17:48:01 -05:00
Matthew Garrett
d95b24bd02 Clarify meaning of insecure_mode
insecure_mode was intended to indicate that the user had explicity disabled
checks with mokutil, which means it wasn't the opposite of secure_mode().
Change the names to clarify this and don't show the insecure mode message
unless the user has explicitly enabled that mode.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-11-19 10:20:34 -05:00
Peter Jones
f95ccd0a7f Unhook system services as we exit.
If we never find a valid thing to boot, we need to undo the weird things
we've done.

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-04 15:31:48 -04:00
Peter Jones
39df41ceb5 Harden shim against non-participating bootloaders.
It works like this: during startup of shim, we hook into the system's
ExitBootServices() and StartImage().  If the system's StartImage() is
called, we automatically unhook, because we're chainloading to something
the system can verify.

When shim's verify is called, we record what kind of certificate the
image was verified against.  If the call /succeeds/, we remove our
hooks.

If ExitBootServices() is called, we check how the bootloader verified
whatever it is loading.  If it was verified by its hash, we unhook
everything and call the system's EBS().  If it was verified by
certificate, we check if it has called shim_verify().  If it has, we
unhook everything and call the system's EBS()

If the bootloader has not verified anything, and is itself verified by
a certificate, we display a security violation warning and halt the
machine.
2013-10-01 14:03:16 -04:00