]> git.proxmox.com Git - efi-boot-shim.git/log
efi-boot-shim.git
10 years agoRemove grubpath in generate_path()
Gary Ching-Pang Lin [Mon, 26 May 2014 08:49:10 +0000 (16:49 +0800)]
Remove grubpath in generate_path()

The variable is not used anymore.

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
10 years agoCheck the first 4 bytes of the certificate
Gary Ching-Pang Lin [Tue, 27 May 2014 09:42:00 +0000 (17:42 +0800)]
Check the first 4 bytes of the certificate

A non-DER encoding x509 certificate may be mistakenly enrolled into
db or MokList. This commit checks the first 4 bytes of the certificate
to ensure that it's DER encoding.

This commit also removes the iteration of the x509 signature list.
Per UEFI SPEC, each x509 signature list contains only one x509 certificate.
Besides, the size of certificate is incorrect. The size of the header must
be substracted from the signature size.

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
10 years agoFetch the netboot image from the same device
Gary Ching-Pang Lin [Tue, 27 May 2014 06:12:32 +0000 (14:12 +0800)]
Fetch the netboot image from the same device

The previous strategy is to locate the first available PXE_BASE_CODE
protocol and to fetch the second stage image from it, and this may
cause shim to fetch the wrong second stage image, i.e. grub.efi.

Consider the machine with the following boot order:
1. PXE Boot
2. Hard Drive

Assume that the EFI image, e.g. bootx64.efi, in the PXE server is
broken, then "PXE Boot" will fail and fallback to "Hard Drive". While
shim.efi in "Hard Drive" is loaded, it will find the PXE protocol is
available and fetch grub.efi from the PXE server, not grub.efi in the
disk.

This commit checks the DeviceHandle from Loaded Image. If the device
supports PXE, then shim fetches grub.efi with the PXE protocol. Otherwise,
shim loads grub.efi from the disk.

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
10 years ago[fallback] Try to boot the first boot option anyway
Gary Ching-Pang Lin [Wed, 5 Mar 2014 10:14:09 +0000 (18:14 +0800)]
[fallback] Try to boot the first boot option anyway

Some UEFI implementations never care the boot options, so the
restored boot options could be just ignored and this results in
endless reboot. To avoid this situation, this commit makes
fallback.efi to load the first matched boot option even if there
is no boot option to be restored. It may not be perfect, but at
least the bootloader is loaded...

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
10 years ago[fallback] Fix the data size for boot option comparison
Gary Ching-Pang Lin [Thu, 6 Mar 2014 02:57:02 +0000 (10:57 +0800)]
[fallback] Fix the data size for boot option comparison

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
10 years ago[fallback] Avoid duplicate old BootOrder
Gary Ching-Pang Lin [Thu, 6 Mar 2014 03:58:36 +0000 (11:58 +0800)]
[fallback] Avoid duplicate old BootOrder

set_boot_order() already copies the old BootOrder to the variable,
bootorder. Besides, we can adjust BootOrder when adding the newly
generated boot option. So, we don't have to copy the old one again
in update_boot_order(). This avoid the duplicate entries in BootOrder.

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
10 years agoGet rid of SectionCache in generate_hash(), it is unused.
Peter Jones [Fri, 11 Apr 2014 19:07:45 +0000 (15:07 -0400)]
Get rid of SectionCache in generate_hash(), it is unused.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoKees' patch missed the offset adjustment to PEHdr.
Peter Jones [Fri, 11 Apr 2014 19:05:24 +0000 (15:05 -0400)]
Kees' patch missed the offset adjustment to PEHdr.

In read_header, we adjust context->PEHdr's address by doshdr->e_lfanew.
If we're going to recompute that address, we have to adjust it here
too.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoadditional bounds-checking on section sizes
Kees Cook [Mon, 3 Dec 2012 23:52:48 +0000 (15:52 -0800)]
additional bounds-checking on section sizes

This adds additional bounds-checking on the section sizes. Also adds
-Wsign-compare to the Makefile and replaces some signed variables with
unsigned counteparts for robustness.

Signed-off-by: Kees Cook <kees@ubuntu.com>
10 years agoAllow fallback to use the system's LoadImage/StartImage .
Peter Jones [Fri, 14 Feb 2014 20:38:25 +0000 (15:38 -0500)]
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>
10 years agoAdd a failure case to the test plan and fix an ordering error.
Peter Jones [Fri, 14 Feb 2014 19:44:31 +0000 (14:44 -0500)]
Add a failure case to the test plan and fix an ordering error.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoAdd a preliminary test plan.
Peter Jones [Fri, 14 Feb 2014 19:06:45 +0000 (14:06 -0500)]
Add a preliminary test plan.

Because you know you wanted a test plan.  You feel it deeply inside.

Note that none of the /negative/ cases are tested yet.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years ago[fallback] Attempt to re-use existing entries when possible.
Peter Jones [Fri, 31 Jan 2014 15:31:10 +0000 (10:31 -0500)]
[fallback] Attempt to re-use existing entries when possible.

Some firmwares seem to ignore our boot entries and put their fallback
entries back on top.  Right now that results in a lot of boot entries
for our stuff, a la https://bugzilla.redhat.com/show_bug.cgi?id=995834 .

Instead of that happening, if we simply find existing entries that match
the entry we would create and move them to the top of the boot order,
the machine will continue to operate in failure mode (which we can't
avoid), but at least we won't create thousands of extra entries.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years ago[fallback] For HD() device paths, use just the media node and later.
Peter Jones [Fri, 31 Jan 2014 15:30:24 +0000 (10:30 -0500)]
[fallback] For HD() device paths, use just the media node and later.

UEFI 2.x section 3.1.2 provides for "short-form device path", where the
first element specified is a "hard drive media device path", so that you
can move a disk around on different buses without invalidating your
device path.  Fallback has not been using this option, though in most
cases efibootmgr has.

Note that we still keep the full device path, because LoadImage()
isn't necessarily the layer where HD() works - one some systems BDS is
responsible for resolving the full path and passes that to LoadImage()
instead.  So we have to do LoadImage() with the full path.

10 years agoError check the right thing in get_variable_attr() when allocating.
Peter Jones [Fri, 15 Nov 2013 15:55:37 +0000 (10:55 -0500)]
Error check the right thing in get_variable_attr() when allocating.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoRewrite directory traversal allocation path so coverity can grok it.
Peter Jones [Fri, 15 Nov 2013 14:38:41 +0000 (09:38 -0500)]
Rewrite directory traversal allocation path so coverity can grok it.

The things we do for our tools.  In this case, make the AllocatePool()
happen outside of a conditional, even though that conditional will
always bee satisfied.  This way coverity won't think we're setting fi
to NULL and passing it to StrCaseCmp.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoInitialize entries before we pass it to another function.
Peter Jones [Fri, 15 Nov 2013 14:24:01 +0000 (09:24 -0500)]
Initialize entries before we pass it to another function.

Coverity scan noticed that entries is uninitialized when we pass its
location to another function.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix wrong sizeof().
Peter Jones [Fri, 15 Nov 2013 14:21:53 +0000 (09:21 -0500)]
Fix wrong sizeof().

CHAR16* vs CHAR16**, so the result is the same on all platforms.

Detected by coverity.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoLengths that might be -1 can't be unsigned, Peter.
Peter Jones [Thu, 21 Nov 2013 16:26:08 +0000 (11:26 -0500)]
Lengths that might be -1 can't be unsigned, Peter.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix path generation for Dhcpv4 bootloader.
Peter Jones [Wed, 20 Nov 2013 17:20:23 +0000 (12:20 -0500)]
Fix path generation for Dhcpv4 bootloader.

Right now we always look for e.g. "\grubx64.efi", which is completely
wrong.  This makes it look for the path shim was loaded from and modify
that to end in a sanitized version of our default loader name.

Resolves: rhbz#1032583

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoDon't hook system services if shim has no built-in keys
Matthew Garrett [Tue, 19 Nov 2013 15:15:55 +0000 (10:15 -0500)]
Don't hook system services if shim has no built-in keys

Shim should only need to enforce its security policy when its launching
binaries signed with its built-in key. Binaries signed by keys in db or
Mokdb should be able to rely on their own security policy.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
10 years agoClarify meaning of insecure_mode
Matthew Garrett [Tue, 19 Nov 2013 15:09:13 +0000 (10:09 -0500)]
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>
10 years agoshim: improve error messages
Andrew Boie [Tue, 12 Nov 2013 01:29:06 +0000 (17:29 -0800)]
shim: improve error messages

%r when used in Print() will show a string representation of
an EFI_STATUS code.

Change-Id: I6db47f5213454603bd66177aca378ad01e9f0bd4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
10 years agoallow 32-bit compilation with 64-bit compiler
Andrew Boie [Tue, 12 Nov 2013 00:17:20 +0000 (16:17 -0800)]
allow 32-bit compilation with 64-bit compiler

Also removed unused LIB_PATH from some Makefiles.

Change-Id: I7d28d18f7531b51b6121a2ffb88bcaedec57c467
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
10 years agopropagate some path variables
Andrew Boie [Tue, 12 Nov 2013 00:15:39 +0000 (16:15 -0800)]
propagate some path variables

If these are overridden on the command line, pass them along to
the sub-makes.

Change-Id: I531ccb5d2f5e4be8e99d4892cdcfffffc1ad9877
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
10 years agofix fallback.so build dependency
Andrew Boie [Tue, 12 Nov 2013 00:14:22 +0000 (16:14 -0800)]
fix fallback.so build dependency

Exposed during parallel builds

Change-Id: I9867858166dcafd69438f37ee5da14a267ace8f4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
10 years agofallback.c: fix 32-bit compilation
Andrew Boie [Tue, 12 Nov 2013 00:12:23 +0000 (16:12 -0800)]
fallback.c: fix 32-bit compilation

fh->Read expects pointer to 32-bit int, use UINTN

Change-Id: If1a728efd51a9a24dfcd8123e84bf4c0713491fe
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
10 years agoproperly compile OpenSSL in 32-bit mode
Andrey Petrov [Mon, 11 Nov 2013 21:46:42 +0000 (13:46 -0800)]
properly compile OpenSSL in 32-bit mode

Change-Id: Iff3ee5ae0f0b95b282b99a23e465723b4e9f6104
Signed-off-by: Andrey Petrov <andrey.petrov@intel.com>
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
10 years agonetboot.h: fix build error on 32-bit systems
Andrew Boie [Thu, 31 Oct 2013 20:56:56 +0000 (13:56 -0700)]
netboot.h: fix build error on 32-bit systems

Function prototype/implementation mismatch.

Change-Id: I89aaae1b49d0372d3aed76fc21c194e0ae55f72e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
10 years agoshim.c: Add support for hashing/relocation of 32-bit binaries
Mohanraj S [Tue, 27 Aug 2013 16:27:00 +0000 (09:27 -0700)]
shim.c: Add support for hashing/relocation of 32-bit binaries

Change-Id: Ib93305f7f1691d1b142567507df1058de62dde06
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
10 years agofix verify_mok()
Andrew Boie [Mon, 15 Apr 2013 21:11:17 +0000 (14:11 -0700)]
fix verify_mok()

() Fix the return value semantics. If the MokList doesn't
exist, we are OK. If the MokList was compromised but we
were able to erase it, that is OK too. Only if the list
can't be nuked do we return an error.

() Fix use of potentially uninitialized attribute variable

() Actually use the return value when called from verify_buffer.

Change-Id: If16df21d79c52a1726928df96d133390cde4cb7e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
10 years agoBump version to 0.7.
Peter Jones [Wed, 6 Nov 2013 19:07:05 +0000 (14:07 -0500)]
Bump version to 0.7.

Do not use 0.6; on some machines it misunderstands the SetupMode
variable.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix check logic for SetupMode variable.
Peter Jones [Wed, 6 Nov 2013 18:59:02 +0000 (13:59 -0500)]
Fix check logic for SetupMode variable.

After going back and inspecting this further, the logic for "SetupMode"
being present at all was incorrect.  Also initialize our state earlier
so it's sure to always be set.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMake tag its own make target, and make it sign tags.
Peter Jones [Thu, 31 Oct 2013 15:16:32 +0000 (11:16 -0400)]
Make tag its own make target, and make it sign tags.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoBump version to 0.6
Peter Jones [Thu, 31 Oct 2013 15:12:24 +0000 (11:12 -0400)]
Bump version to 0.6

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoDon't free GetVariable() return data without checking the status code.
Peter Jones [Wed, 30 Oct 2013 20:36:01 +0000 (16:36 -0400)]
Don't free GetVariable() return data without checking the status code.

This breaks every machine from before Secure Boot was a thing.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoWe should be checking both mok and the system's SB settings
Peter Jones [Mon, 28 Oct 2013 14:41:03 +0000 (10:41 -0400)]
We should be checking both mok and the system's SB settings

When we call hook_system_services(), we're currently only checking mok's
setting.  We should use secure_mode() instead so it'll check both.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoRevert "additional bounds-checking on section sizes"
Peter Jones [Wed, 23 Oct 2013 14:50:36 +0000 (10:50 -0400)]
Revert "additional bounds-checking on section sizes"

This reverts commit 21e40f0174814b3d91836e38c7cf95c8f2f1f3a4.

In principle I like the idea of what's going on here, but
generate_hash() really does need to have the expected result.

10 years agoDon't reject all binaries without a certificate database.
Peter Jones [Tue, 22 Oct 2013 17:36:54 +0000 (13:36 -0400)]
Don't reject all binaries without a certificate database.

If a binary isn't signed, but its hash is enrolled in db, it won't have
a certificate database.  So in those cases, don't check it against
certificate databases in db/dbx/etc, but we don't need to reject it
outright.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoadditional bounds-checking on section sizes
Kees Cook [Mon, 3 Dec 2012 23:52:48 +0000 (15:52 -0800)]
additional bounds-checking on section sizes

This adds additional bounds-checking on the section sizes. Also adds
-Wsign-compare to the Makefile and replaces some signed variables with
unsigned counteparts for robustness.

Signed-off-by: Kees Cook <kees@ubuntu.com>
10 years agoBump version to 0.5
Peter Jones [Fri, 4 Oct 2013 21:04:12 +0000 (17:04 -0400)]
Bump version to 0.5

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoUnhook system services as we exit.
Peter Jones [Fri, 4 Oct 2013 19:29:29 +0000 (15:29 -0400)]
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>
10 years agoPut SHIM_VERBOSE under shim's guid, not global.
Peter Jones [Fri, 4 Oct 2013 17:54:35 +0000 (13:54 -0400)]
Put SHIM_VERBOSE under shim's guid, not global.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoTry to actually make debug printing look reasonable.
Peter Jones [Fri, 4 Oct 2013 14:22:46 +0000 (10:22 -0400)]
Try to actually make debug printing look reasonable.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoDo more strict checking on PE Headers.
Peter Jones [Fri, 4 Oct 2013 14:05:43 +0000 (10:05 -0400)]
Do more strict checking on PE Headers.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoReapply patches lost in the update
Matthew Garrett [Thu, 3 Oct 2013 17:24:43 +0000 (13:24 -0400)]
Reapply patches lost in the update

10 years agoUpdate to current Tiano Cryptlib
Matthew Garrett [Thu, 3 Oct 2013 17:19:32 +0000 (13:19 -0400)]
Update to current Tiano Cryptlib

10 years agoAdd Tiano patch e98e59c237e17f064a4ecffb39d45499f89720a1
Matthew Garrett [Thu, 3 Oct 2013 16:56:27 +0000 (12:56 -0400)]
Add Tiano patch e98e59c237e17f064a4ecffb39d45499f89720a1

This is:
    Fix a bug in OpensslLib that PKCS7_verify will use over 8k stack space.

Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Dong Guo <guo.dong@intel.com>
from upstream.

10 years agoImprove PE image bounds checking.
Peter Jones [Thu, 3 Oct 2013 21:04:30 +0000 (17:04 -0400)]
Improve PE image bounds checking.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoAdd ident-like blobs to shim.efi for version checking.
Peter Jones [Thu, 3 Oct 2013 15:01:36 +0000 (11:01 -0400)]
Add ident-like blobs to shim.efi for version checking.

I feel dirty.

10 years agoUpdate for Josh's changes.
Peter Jones [Wed, 2 Oct 2013 17:32:35 +0000 (13:32 -0400)]
Update for Josh's changes.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoAdd support for disabling db for verification
Josh Boyer [Tue, 1 Oct 2013 15:49:22 +0000 (11:49 -0400)]
Add support for disabling db for verification

Provide a mechanism for a physically present end user to disable the use
of db when doing signature verification.  This is handled by the OS passing
down a variable that contains a UINT32 and a SHA256 hash.  If this variable
is present, MokManager prompts the user to choose whether to enable or
disable the use of db for verification purposes (depending on the value of
the UINT32).  They are then asked to type the passphrase that matches the
hash.  This then saves a boot services variable which is checked by shim,
and if set will cause shim to not use db for verification purposes.  If
db is to be ignored, shim will export a runtime variable called
'MokIgnoreDB' for the OS to query at runtime.

Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
11 years agoRemove "shim.cer" on "make clean".
Peter Jones [Wed, 2 Oct 2013 14:48:41 +0000 (10:48 -0400)]
Remove "shim.cer" on "make clean".

If we don't do this, an old key winds up being reused and
MokManager.efi.signed is signed with a different key than shim_cert
reflects.

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoUse CHAR8 not UINT8 for character work.
Peter Jones [Wed, 2 Oct 2013 14:38:08 +0000 (10:38 -0400)]
Use CHAR8 not UINT8 for character work.

This gets rid of a lot of type casting that we don't need, and helps
reduce warnings when I switch a bunch of gnu-efi stuff to taking const
arguments.

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoCompareMem expects void * and gcc complains.
Peter Jones [Wed, 2 Oct 2013 14:02:01 +0000 (10:02 -0400)]
CompareMem expects void * and gcc complains.

Sorry about that.

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoFix wrong type on console_error() call.
Peter Jones [Wed, 2 Oct 2013 13:52:42 +0000 (09:52 -0400)]
Fix wrong type on console_error() call.

Stupid L"".

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoIf we fail to install our protocol, don't continue.
Peter Jones [Tue, 1 Oct 2013 20:32:54 +0000 (16:32 -0400)]
If we fail to install our protocol, don't continue.

This shouldn't be exploitable unless you've got a way to make
InstallProtocol fail and still, for example, have memory free to
actually load and run something.

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoClean up warnings.
Peter Jones [Tue, 1 Oct 2013 18:35:18 +0000 (14:35 -0400)]
Clean up warnings.

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoConditionalize overriding the security policy.
Peter Jones [Tue, 1 Oct 2013 17:55:27 +0000 (13:55 -0400)]
Conditionalize overriding the security policy.

Make OVERRIDE_SECURITY_POLICY a build option.

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoMerge console_control.h and console.h
Peter Jones [Tue, 1 Oct 2013 17:43:25 +0000 (13:43 -0400)]
Merge console_control.h and console.h

Since these are topically the same thing, they can live together.

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoMake verbose stuff use console_notify
Peter Jones [Fri, 27 Sep 2013 15:32:49 +0000 (11:32 -0400)]
Make verbose stuff use console_notify

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoMokManager needs to disable the graphics console.
Peter Jones [Thu, 26 Sep 2013 13:44:50 +0000 (09:44 -0400)]
MokManager needs to disable the graphics console.

Without this patch, on some machines we never see MokManager's UI.  This
protocol has never (I think?) been officially published, and yet I still
have new hardware that needs it.

If you're looking for a reference, look at:

EdkCompatibilityPkg/Foundation/Protocol/ConsoleControl/ConsoleControl.c

in the edk2 tree from Tiano.

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoInclude shim's vendor_cert in MokListRT
Peter Jones [Thu, 5 Sep 2013 20:56:03 +0000 (16:56 -0400)]
Include shim's vendor_cert in MokListRT

There needs to be some way to communicate to the kernel that it's a
trusted key, and since this mechanism already exists, it's by far the
easiest.

11 years agoHarden shim against non-participating bootloaders.
Peter Jones [Mon, 9 Sep 2013 16:37:50 +0000 (12:37 -0400)]
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.

11 years agoMake vendor_cert/vendor_dbx actually replaceable by an external tool.
Peter Jones [Mon, 9 Sep 2013 18:43:04 +0000 (14:43 -0400)]
Make vendor_cert/vendor_dbx actually replaceable by an external tool.

This moves them both to be computed at runtime from a pointer+offset
rather than just a pointer, so that their real address can be entirely
derived from the section they're in.

This means you can replace the whole .vendor_cert section with a new one
with certs that don't have the same size.

11 years agoRemove TODO items fixed by merging lf_merge and lcp/lf-security-override.
Peter Jones [Tue, 1 Oct 2013 18:01:52 +0000 (14:01 -0400)]
Remove TODO items fixed by merging lf_merge and lcp/lf-security-override.

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoDon't use LibGetVariable(), since it doesn't give us real error codes.
Peter Jones [Thu, 26 Sep 2013 15:42:34 +0000 (11:42 -0400)]
Don't use LibGetVariable(), since it doesn't give us real error codes.

11 years agointegrate security override
Gary Ching-Pang Lin [Thu, 1 Aug 2013 10:21:53 +0000 (18:21 +0800)]
integrate security override

11 years agoClean up tarballs in "make clean"
Peter Jones [Thu, 26 Sep 2013 15:01:42 +0000 (11:01 -0400)]
Clean up tarballs in "make clean"

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoMerge variable retrieving functions
Gary Ching-Pang Lin [Thu, 4 Jul 2013 10:25:24 +0000 (18:25 +0800)]
Merge variable retrieving functions

11 years agoMerge signature.h into efiauthenticated.h and guid.h
Gary Ching-Pang Lin [Thu, 4 Jul 2013 09:41:51 +0000 (17:41 +0800)]
Merge signature.h into efiauthenticated.h and guid.h

Conflicts:
shim.c

11 years agoMerge two PeImage.h into one
Peter Jones [Thu, 26 Sep 2013 15:09:16 +0000 (11:09 -0400)]
Merge two PeImage.h into one

Conflicts:
Makefile

11 years agoFree unused memory space
Gary Ching-Pang Lin [Fri, 5 Jul 2013 02:57:16 +0000 (10:57 +0800)]
Free unused memory space

11 years agoAdjust the result of gmtime() to fit the definition
Gary Ching-Pang Lin [Tue, 9 Jul 2013 09:30:02 +0000 (17:30 +0800)]
Adjust the result of gmtime() to fit the definition

11 years agoRand: check the status of the pseudorandom number generator
Gary Ching-Pang Lin [Thu, 4 Jul 2013 08:12:30 +0000 (16:12 +0800)]
Rand: check the status of the pseudorandom number generator

11 years agoMokManager: check the suffix of the key file
Gary Ching-Pang Lin [Fri, 26 Jul 2013 07:44:49 +0000 (15:44 +0800)]
MokManager: check the suffix of the key file

11 years agoMokManager: fetch more info from X509 name
Gary Ching-Pang Lin [Fri, 26 Jul 2013 04:44:42 +0000 (12:44 +0800)]
MokManager: fetch more info from X509 name

11 years agoMokManager: reboot the system after clearing MOK password
Gary Ching-Pang Lin [Wed, 24 Jul 2013 06:39:39 +0000 (14:39 +0800)]
MokManager: reboot the system after clearing MOK password

11 years agoMokManager: enhance the password prompt for SB state
Gary Ching-Pang Lin [Thu, 27 Jun 2013 07:04:07 +0000 (15:04 +0800)]
MokManager: enhance the password prompt for SB state

11 years agoMokManager: rearrange the output of MOK info
Gary Ching-Pang Lin [Thu, 27 Jun 2013 04:28:08 +0000 (12:28 +0800)]
MokManager: rearrange the output of MOK info

11 years agoDisable floating points in b_print
Gary Ching-Pang Lin [Thu, 27 Jun 2013 04:03:14 +0000 (12:03 +0800)]
Disable floating points in b_print

The long double declaration will enable SSE and cause a compilation
error. Disabling everything related to floating points avoids the
error.

11 years agoEnable openssl bio_printf()
Gary Ching-Pang Lin [Thu, 27 Jun 2013 03:59:09 +0000 (11:59 +0800)]
Enable openssl bio_printf()

bio_printf() was replaced with a dummy function and this made
several openssl functions useless. This commit adds the print
functions back, so that we don't have to implement our own
ASN1 time print function.

11 years agoMokManager: enhance the password prompt
Gary Ching-Pang Lin [Wed, 26 Jun 2013 07:21:35 +0000 (15:21 +0800)]
MokManager: enhance the password prompt

11 years agoMokManager: remove the duplicate get_keystroke()
Gary Ching-Pang Lin [Wed, 26 Jun 2013 04:23:26 +0000 (12:23 +0800)]
MokManager: remove the duplicate get_keystroke()

11 years agoMokManager: draw the countdown screen
Gary Ching-Pang Lin [Thu, 18 Apr 2013 09:13:12 +0000 (17:13 +0800)]
MokManager: draw the countdown screen

11 years agoMokManager: Remove the unnecessary string duplication
Gary Ching-Pang Lin [Thu, 30 May 2013 06:22:43 +0000 (14:22 +0800)]
MokManager: Remove the unnecessary string duplication

11 years agoCorrect the certificate count of the signature list
Gary Ching-Pang Lin [Fri, 8 Mar 2013 06:44:50 +0000 (14:44 +0800)]
Correct the certificate count of the signature list

11 years agoSince different distros name grub*.efi differently, make it compile-time.
Peter Jones [Tue, 24 Sep 2013 15:48:32 +0000 (11:48 -0400)]
Since different distros name grub*.efi differently, make it compile-time.

Basically, if you don't want grub.efi, you do:

make 'DEFAULT_LOADER=\\\\grubx64.efi'

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoDefine the PXE 2nd stage loader in the beginning of the file
Gary Ching-Pang Lin [Thu, 7 Mar 2013 03:59:44 +0000 (11:59 +0800)]
Define the PXE 2nd stage loader in the beginning of the file

Make it easier to change the PXE 2nd stage loader.

Conflicts:
netboot.c

11 years agoRemove double-separators from the bootpath
Gary Ching-Pang Lin [Fri, 1 Mar 2013 10:04:06 +0000 (18:04 +0800)]
Remove double-separators from the bootpath

11 years agoFix the broken bootpath
Gary Ching-Pang Lin [Thu, 21 Feb 2013 09:49:29 +0000 (17:49 +0800)]
Fix the broken bootpath

- The file path from DevicePathToStr may use slash as the file
  seperator. Change all slashes to backslashes to avoid the strange
  bootpath.
- Remove the redundant backslashes.
- ImagePath no longer requires the leading backslash.
- Fix a memory leak

Based on the patch from Michal Marek <mmarek@suse.com>

11 years agoMokManager: support Tradition DES hash
Gary Ching-Pang Lin [Tue, 29 Jan 2013 09:10:10 +0000 (17:10 +0800)]
MokManager: support Tradition DES hash

11 years agoMokManager: support MD5-based crypt() hash
Gary Ching-Pang Lin [Tue, 29 Jan 2013 04:09:34 +0000 (12:09 +0800)]
MokManager: support MD5-based crypt() hash

11 years agoMokManager: support blowfish-based crypt() hash
Gary Ching-Pang Lin [Fri, 17 May 2013 07:10:57 +0000 (15:10 +0800)]
MokManager: support blowfish-based crypt() hash

Conflicts:
Makefile

11 years agoMokManager: support SHA512-based crypt() hash
Gary Ching-Pang Lin [Thu, 24 Jan 2013 10:24:49 +0000 (18:24 +0800)]
MokManager: support SHA512-based crypt() hash

11 years agoMokManager: support crypt() password hash
Gary Ching-Pang Lin [Tue, 15 Jan 2013 10:01:41 +0000 (18:01 +0800)]
MokManager: support crypt() password hash

The password format is introduced for the password hash generated by crypt(),
so that the user can import the password hash from /etc/shadow. The packager,
especially those who packages 3rd party drivers, can utilize this feature to
import a 3rd party certificate without interfering the package installation.

This commit implements the sha256-based crypt() hash function.

Conflicts:
Makefile
MokManager.c

11 years agoMake EFI_PATH easily resettable from the build command line.
Peter Jones [Wed, 29 May 2013 09:56:45 +0000 (17:56 +0800)]
Make EFI_PATH easily resettable from the build command line.

Signed-off-by: Peter Jones <pjones@redhat.com>
11 years agoClean lib/, too
Gary Ching-Pang Lin [Thu, 30 May 2013 06:10:56 +0000 (14:10 +0800)]
Clean lib/, too

11 years agosimple_file: Allocate buffers for file entries
Gary Ching-Pang Lin [Thu, 30 May 2013 06:05:59 +0000 (14:05 +0800)]
simple_file: Allocate buffers for file entries

The dir filter appends L'/' to the directory entries without
allocating a new buffer, and this could crash the whole program.

11 years agoPort MokManager to Linux Foundation loader UI code
Matthew Garrett [Sun, 19 May 2013 17:13:01 +0000 (18:13 +0100)]
Port MokManager to Linux Foundation loader UI code

This is the first stage of porting the MokManager UI to the UI code used
by the Linux Foundation UEFI loader.