Commit Graph

269 Commits

Author SHA1 Message Date
Peter Jones
6ae4e4f946 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>
2013-11-06 14:07:05 -05:00
Peter Jones
0948ac0971 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>
2013-11-06 13:59:02 -05:00
Peter Jones
acac338094 Make tag its own make target, and make it sign tags.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-31 11:16:32 -04:00
Peter Jones
b2dd861413 Bump version to 0.6
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-31 11:12:24 -04:00
Peter Jones
6b1f8796ff 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>
2013-10-30 16:36:01 -04:00
Peter Jones
321797142e 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>
2013-10-28 10:41:03 -04:00
Peter Jones
cf718e1940 Revert "additional bounds-checking on section sizes"
This reverts commit 21e40f0174.

In principle I like the idea of what's going on here, but
generate_hash() really does need to have the expected result.
2013-10-23 10:50:36 -04:00
Peter Jones
8044a321f9 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>
2013-10-22 13:40:08 -04:00
Kees Cook
a0df78b73f 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>
2013-10-22 11:23:51 -04:00
Peter Jones
ee4deae045 Bump version to 0.5
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-04 17:04:21 -04:00
Peter Jones
98a9957866 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
29d9c7c327 Put SHIM_VERBOSE under shim's guid, not global.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-04 13:54:35 -04:00
Peter Jones
4ab978a369 Try to actually make debug printing look reasonable.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-04 11:51:09 -04:00
Peter Jones
7de74e6734 Do more strict checking on PE Headers.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-04 11:51:09 -04:00
Matthew Garrett
06caaf44f4 Reapply patches lost in the update 2013-10-04 11:51:09 -04:00
Matthew Garrett
36d13930ee Update to current Tiano Cryptlib 2013-10-04 11:51:09 -04:00
Matthew Garrett
4bf7fb2ef1 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.
2013-10-04 11:51:09 -04:00
Peter Jones
a3beb2a6f7 Improve PE image bounds checking.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-03 17:04:45 -04:00
Peter Jones
0fb089ee14 Add ident-like blobs to shim.efi for version checking.
I feel dirty.
2013-10-03 11:11:09 -04:00
Peter Jones
c50f5a2d4a Update for Josh's changes.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-02 13:33:52 -04:00
Josh Boyer
47ebeb6262 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>
2013-10-02 11:29:34 -04:00
Peter Jones
2892db7fda 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>
2013-10-02 10:48:41 -04:00
Peter Jones
cb89c25aeb 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>
2013-10-02 10:46:26 -04:00
Peter Jones
aed556c4ab CompareMem expects void * and gcc complains.
Sorry about that.

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-02 10:02:01 -04:00
Peter Jones
a847e33aaf Fix wrong type on console_error() call.
Stupid L"".

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-02 10:00:11 -04:00
Peter Jones
1d56305945 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>
2013-10-01 16:33:58 -04:00
Peter Jones
7076ec11b0 Clean up warnings.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-01 14:38:09 -04:00
Peter Jones
bb2fe4cfb3 Conditionalize overriding the security policy.
Make OVERRIDE_SECURITY_POLICY a build option.

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-01 14:03:16 -04:00
Peter Jones
417077f8de 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>
2013-10-01 14:03:16 -04:00
Peter Jones
bc71a15ed5 Make verbose stuff use console_notify
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-01 14:03:16 -04:00
Peter Jones
124a3c208e 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>
2013-10-01 14:03:16 -04:00
Peter Jones
4185c7d67e 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.
2013-10-01 14:03:16 -04:00
Peter Jones
cbef697a96 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
Peter Jones
a1f2863584 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.
2013-10-01 14:03:16 -04:00
Peter Jones
2efb269ba6 Remove TODO items fixed by merging lf_merge and lcp/lf-security-override.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-01 14:03:16 -04:00
Peter Jones
8317a1f0ad Don't use LibGetVariable(), since it doesn't give us real error codes. 2013-09-26 13:44:05 -04:00
Gary Ching-Pang Lin
59dcd9d1b8 integrate security override 2013-09-26 11:58:03 -04:00
Peter Jones
6d6aff1bab Clean up tarballs in "make clean"
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
7f0208a0f9 Merge variable retrieving functions 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
53862ddace Merge signature.h into efiauthenticated.h and guid.h
Conflicts:
	shim.c
2013-09-26 11:58:02 -04:00
Peter Jones
40375a8bea Merge two PeImage.h into one
Conflicts:
	Makefile
2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
ca2e00d067 Free unused memory space 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
87bcb40438 Adjust the result of gmtime() to fit the definition 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
744cb2109b Rand: check the status of the pseudorandom number generator 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
71e70c72df MokManager: check the suffix of the key file 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
913f33d366 MokManager: fetch more info from X509 name 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
2648d29f00 MokManager: reboot the system after clearing MOK password 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
5f7ade1950 MokManager: enhance the password prompt for SB state 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
7ed6b96365 MokManager: rearrange the output of MOK info 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
c34ed0ae2f 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.
2013-09-26 11:58:02 -04:00