Commit Graph

1510 Commits

Author SHA1 Message Date
Mathieu Trudel-Lapierre
926d947690 debian/control: add Breaks: for the previous shim-signed builds given that shim will now build and ship BOOT.CSV by itself. 2017-09-27 12:54:05 -04:00
Mathieu Trudel-Lapierre
52b46c08f6 Ignore unused-variable errors. 2017-09-27 12:46:14 -04:00
Mathieu Trudel-Lapierre
21fbf908f7 New upstream snapshot: 13~git1505328971.0780644a 2017-09-27 12:45:29 -04:00
Peter Jones
23ce039c43 Use iconv for UCS-2 encoding.
Cyphermox discovered that when you run this:

  ( printf "\xff\x00\xfe\x00" ; echo "shimx64.efi,foo,,This is the boot entry for foo" ) | sed -z 's/./&\x00/g'

on some debian machines, printf(1) doesn't interpret the \x.. characters,
and that results in this being the encoded text:

00000000  5c 78 66 66 5c 78 66 65  73 00 68 00 69 00 6d 00  |\xff\xfes.h.i.m.|
00000010  78 00 36 00 34 00 2e 00  65 00 66 00 69 00 2c 00  |x.6.4...e.f.i.,.|
00000020  66 00 6f 00 6f 00 2c 00  2c 00 54 00 68 00 69 00  |f.o.o.,.,.T.h.i.|

which... yeah, that's wrong.  So instead, use iconv instead of
printf+sed to encode it in UCS-2.  Unfortunately, that means we don't
get endian markers, because for some reason iconv(1) doesn't have any way
to say it should include them.  But that's okay; fallback already
handles not having them and just assumes the second byte being \x00
means UCS-2LE.

Signed-off-by: Peter Jones <pjones@redhat.com>
2017-09-26 11:16:45 -04:00
Peter Jones
49e9775e07 Fix an LDFLAGS issue on arm and aarch64
Commit 1e71734992 inadvertantly switched ARM's
LDFLAGS+=--defsym=EFI_SUBSYSTEM=$(SUBSYSTEM) to be before LDFLAGS is set,
and so it got clobbered away.

Signed-off-by: Peter Jones <pjones@redhat.com>
2017-09-19 14:58:51 -04:00
Peter Jones
51c497b8db Try to do a slightly better job at 'make clean'
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-09-19 14:58:51 -04:00
Mathieu Trudel-Lapierre
51d5bbcb24 New upstream version 13~git1505328971.0780644a 2017-09-14 17:48:49 -07:00
Mathieu Trudel-Lapierre
695f919503 Updated version 13~git1505328971.0780644a from 'upstream/13_git1505328971.0780644a'
with Debian dir 8d0dcc2dc4
2017-09-14 17:48:49 -07:00
Mathieu Trudel-Lapierre
35fd2c170c Don't build shim_cert.h in parallel with other targets.
shim_cert.h is required by other pieces (such as netboot.o, cert.o) and
might not be built by the time these targets are reached. In that case the
build would fail as it can't find a required header.

Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2017-09-14 18:07:10 -04:00
Mathieu Trudel-Lapierre
b71838a35a Clean up after BOOT$(ARCH).CSV.
It should not be left around after clean since it's a generated file.

Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2017-09-14 18:07:10 -04:00
Peter Jones
25f6fd08cd try to show errors more usefully.
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-09-13 15:18:28 -04:00
Peter Jones
00753a0a28 Add some debugging data to the last malformed binary check...
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-09-13 15:16:43 -04:00
Mathieu Trudel-Lapierre
1bb5cf18d0 New upstream snapshot: 13~git1505328970.9c1c35c5 2017-09-13 12:12:27 -07:00
Mathieu Trudel-Lapierre
544696f3ad Drop PHONY fix patch; merged upstream. 2017-09-13 12:11:21 -07:00
Mathieu Trudel-Lapierre
b6f94dbeac New upstream version 13~git1505328970.9c1c35c5 2017-09-13 12:09:40 -07:00
Mathieu Trudel-Lapierre
8de1d1dc3a Updated version 13~git1505328970.9c1c35c5 from 'upstream/13_git1505328970.9c1c35c5'
with Debian dir 676fec75f5
2017-09-13 12:09:40 -07:00
Peter Jones
19a7e1bcd5 Add some defaults and a syntastic file so vim helps more.
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-09-13 15:00:22 -04:00
Peter Jones
1dc35a4fe0 Work around some annoying compiler grievances
I'm still having some trouble with the offsetof() definition, so just
nerf it to what stddef.h would say anyway.

Signed-off-by: Peter Jones <pjones@redhat.com>
2017-09-08 14:49:31 -04:00
Peter Jones
9802023c13 Some things went weird with the openssl revert...
I think this works around most of them.

Signed-off-by: Peter Jones <pjones@redhat.com>
2017-09-08 14:48:57 -04:00
Gary Lin
e992a913cf Cryptlib: remove DES
Disable DES completely since it's already old and insecure.
This makes MokManager not support the DES based password hash but
probably no one is using it.

Signed-off-by: Gary Lin <glin@suse.com>
2017-09-08 14:47:09 -04:00
Gary Lin
70d49e332d Cryptlib: Remove MD4
MD4 is known to be insecure and shim never uses it.

Signed-off-by: Gary Lin <glin@suse.com>
2017-09-08 14:47:09 -04:00
Gary Lin
80a5aa9d1b Cryptlib: amend the headers and fix signness
- Declare some functions in the proper headers
  + We missed them for a long time...

- Cast offsetof to UINTN
  + The original casting triggers the gcc warning since int can not
    present the offset for the 64bit machines.

- Cast the "char" array to "CHAR8 *" to avoid the gcc warnings

- Implement atoi correctly

Signed-off-by: Gary Lin <glin@suse.com>
2017-09-08 14:47:09 -04:00
Mathieu Trudel-Lapierre
a97c265499
changelog: ~test3 wasn't released; prepare for another test upload.
Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2017-08-31 19:11:13 -04:00
Mathieu Trudel-Lapierre
c3fa729980 debian/rules, debian/shim.install: make sure the 'make install' step does what it's meant to do by upstream: we can easily make use of the end result to have the files we need. 2017-08-31 19:10:10 -04:00
Mathieu Trudel-Lapierre
0e7f9a71d6 debian/patches/buildid_write_return.patch: workaround our strict compile rules failing the build: make sure write calls check the return value. 2017-08-31 19:08:49 -04:00
Mathieu Trudel-Lapierre
b37fef5204 debian/control: add a Build-Depends on libelf-dev. 2017-08-31 19:07:19 -04:00
Mathieu Trudel-Lapierre
2fdba73012 Fix build with ENABLE_SHIM_CERT and ENABLE_SBSIGN: shim.key is created by the shim.crt target
Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2017-08-31 15:28:17 -04:00
Gary Lin
e06765ae0d Cryptlib: implement strcmp() and strcasecmp()
strcmp() and strcasecmp() are widely used in openssl. Implement those
two functions to eliminate the gcc warnings and the potential crash.

Signed-off-by: Gary Lin <glin@suse.com>
2017-08-31 15:14:20 -04:00
Gary Lin
1b5dbc4b4d Cryptlib: Include stddef.h in CrtLibSupport.h
The changes in the openssl headers cause the inclusion of
CrtLibSupport.h eariler than the inclusion of stddef.h, so "offsetof"
was defined twice and this caused the followling build error:

In file included from Cryptlib/Include/openssl/buffer.h:23:0,
                 from Cryptlib/Include/openssl/x509.h:22,
                 from shim.c:56:
/usr/lib64/gcc/x86_64-suse-linux/6/include/stddef.h:417:0: error: "offsetof" redefined [-Werror]
 #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)

In file included from Cryptlib/Include/limits.h:15:0,
                 from Cryptlib/Include/openssl/ossl_typ.h:13,
                 from Cryptlib/Include/openssl/x509.h:20,
                 from shim.c:56:
Cryptlib/Include/CrtLibSupport.h:192:0: note: this is the location of the previous definition
 #define offsetof(type, member) ( (int) & ((type*)0) -> member )

We can lower the priority of the gcc include path or just remove the
path, but this might cause problem since the path was introduced on
purpose(*). Instead, including stddef.h first is more feasible.

(*) d51739a416

Signed-off-by: Gary Lin <glin@suse.com>
2017-08-31 15:14:20 -04:00
Peter Jones
1d39ada8cb Revert lots of Cryptlib updates.
OpenSSL changes quite a bit of the key validation, and most of the keys
I can find in the wild aren't marked as trusted by the new checker.

Intel noticed this too: https://github.com/vathpela/edk2/commit/f536d7c3ed
but instead of fixing the compatibility error, they switched their test
data to match the bug.

So that's pretty broken.

For now, I'm reverting OpenSSL 1.1.0e, because we need those certs in
the wild to work.

This reverts commit 513cbe2aea.
This reverts commit e9cc33d6f2.
This reverts commit 80d49f758e.
This reverts commit 9bc647e2b2.
This reverts commit ae75df6232.
This reverts commit e883479f35.
This reverts commit 97469449fd.
This reverts commit e39692647f.
This reverts commit 0f3dfc01e2.
This reverts commit 4da6ac8195.
This reverts commit d064bd7eef.
This reverts commit 9bc86cfd6f.
This reverts commit ab9a05a10f.

Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-31 15:13:58 -04:00
Peter Jones
eae64276ff Drain the OpenSSL error stack and report crypto verification errors
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-31 15:13:46 -04:00
Peter Jones
36d20ac0aa Init openssl so we can use its debug facilities.
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-31 15:13:45 -04:00
Peter Jones
96b347c200 Add a mechanism to print openssl errors
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-31 15:13:45 -04:00
Peter Jones
aaf8049c39 Fix a missing OpenSSL error message point
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-31 15:13:45 -04: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
Mathieu Trudel-Lapierre
7d562b4949 debian/shim.install: update paths in light of using shim's upstream install target. 2017-08-29 22:45:27 -04:00
Mathieu Trudel-Lapierre
3f5806e428 Set EFIDIR=ubuntu for dh_auto_install; that will let files be installed in the "right" final directories, and makes boot.csv for us. 2017-08-29 22:38:38 -04:00
Mathieu Trudel-Lapierre
f841331ca3 Update dh_auto_build/dh_auto_clean/dh_auto_install for new upstream options: set MAKELEVEL. 2017-08-29 22:21:11 -04:00
Mathieu Trudel-Lapierre
ee22d4255d debian/rules: clean up after *.signed files. 2017-08-29 21:33:03 -04:00
Mathieu Trudel-Lapierre
2993c0ee31 debian/patches/fix_makefile_phony.patch: fix a makefile bug causing shim to fail to build, because it gets confused about the .signed efi files. 2017-08-29 21:23:41 -04:00
Mathieu Trudel-Lapierre
402fafb475 Set ENABLE_SBSIGN, to use sbsign instead of pesign for signing fallback and MokManager.
Also drop debian/patches/sbsigntool-no-pesign: with this change from upstream
it is no longer needed..
2017-08-29 13:58:39 -04:00
Mathieu Trudel-Lapierre
661d3ea1dc Set ENABLE_SHIM_CERT, to keep using ephemeral self-signed certs built at compile-time for MokManager and fallback. 2017-08-29 13:57:47 -04:00
Mathieu Trudel-Lapierre
cff1facf80 debian/patches/second-stage-path: dropped; the default loader path now includes an arch suffix. 2017-08-29 13:57:22 -04:00
Mathieu Trudel-Lapierre
0123496a8a New upstream snapshot: 12+1503074702.5202f80. 2017-08-29 13:56:15 -04:00
Mathieu Trudel-Lapierre
c224bb09d2 Updated version 12+1503074702.5202f80 from 'upstream/12+1503074702.5202f80'
with Debian dir 08243b332b
2017-08-29 13:55:31 -04:00
Mathieu Trudel-Lapierre
ab881f03a3 New upstream version 12+1503074702.5202f80 2017-08-29 13:55:31 -04:00
Mathieu Trudel-Lapierre
5202f80c32 Rework looping in enter_mok_menu(), to allow multiple MOK changes
Rather than looping once through the possible actions (MokNew, MokDel, etc.),
revise the logic so that instead of rebooting immediately we get back to the
main menu setting a flag to replace "Continue booting" with a proper reboot.

Getting back to the menu means we can go make other changes before rebooting.
For instance, you might want to enable validation, but beforehand you also
need to enroll a MOK. You can already do so from userland; except the requests
were cleared as soon as one of them was processed.

This involves some extra cleanup of the states to avoid running the same
request more than once, removing the option from the menu once it's done, and
changing prompting functions to return an EFI_STATUS so we can better track
whether the process has succeeded.

Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2017-08-18 12:45:02 -04:00
Peter Jones
81b28b7e95 Add ENABLE_SHIM_HASH and make install-as-data know how to install it.
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-11 15:46:43 -04:00
Peter Jones
eadb00b4b3 Update TODO with some stuff
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-11 15:18:39 -04:00
Peter Jones
82c3e007cc Make better debuginfo and install it reasonably.
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-11 15:18:39 -04:00