Commit Graph

245 Commits

Author SHA1 Message Date
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
Gary Ching-Pang Lin
3c5b49ec5a 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.
2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
5326c090be MokManager: enhance the password prompt 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
44d7d0e668 MokManager: remove the duplicate get_keystroke() 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
9a86568e19 MokManager: draw the countdown screen 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
8371c49ce7 MokManager: Remove the unnecessary string duplication 2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
d71240bfff Correct the certificate count of the signature list 2013-09-26 11:58:02 -04:00
Peter Jones
e053c22701 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>
2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
bd145c6082 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
2013-09-26 11:58:02 -04:00
Gary Ching-Pang Lin
436afcc276 Remove double-separators from the bootpath 2013-09-26 11:58:01 -04:00
Gary Ching-Pang Lin
f9f81a22dd 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>
2013-09-26 11:58:01 -04:00
Gary Ching-Pang Lin
908eacc225 MokManager: support Tradition DES hash 2013-09-26 11:58:01 -04:00
Gary Ching-Pang Lin
be5c35e1ac MokManager: support MD5-based crypt() hash 2013-09-26 11:58:01 -04:00
Gary Ching-Pang Lin
114dad494c MokManager: support blowfish-based crypt() hash
Conflicts:
	Makefile
2013-09-26 11:58:01 -04:00
Gary Ching-Pang Lin
5a89835189 MokManager: support SHA512-based crypt() hash 2013-09-26 11:58:01 -04:00
Gary Ching-Pang Lin
3a838b14f0 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
2013-09-26 11:58:01 -04:00
Peter Jones
5e9fee2158 Make EFI_PATH easily resettable from the build command line.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-09-26 11:58:01 -04:00
Gary Ching-Pang Lin
cdd2dc9132 Clean lib/, too 2013-09-26 11:58:01 -04:00
Gary Ching-Pang Lin
b1a00240ab 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.
2013-09-26 11:58:01 -04:00
Matthew Garrett
17857eb8b5 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.
2013-09-26 11:57:59 -04:00
Peter Jones
2aa2ddd8a8 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.

Conflicts:
	MokManager.c
2013-09-26 11:57:51 -04:00
Peter Jones
227d13a2d9 We have to declare SHIM_LOCK_GUID here as well.
Signed-off-by: Peter Jones <pjones@redhat.com>

Conflicts:
	MokManager.c
2013-09-26 11:56:52 -04:00
Peter Jones
ebda1052c9 Ignore tarballs.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-09-26 09:56:32 -04:00
Peter Jones
a869915a1d 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-09-26 09:56:26 -04:00
Steve Langasek
5ccacd3a48 Fix a memory leak 2013-09-24 12:05:51 -04:00