Commit Graph

32 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
Peter Jones
b9e81483bb Don't let openssl() try to call an external abort()
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-12-19 16:36:55 -05: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
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
Gary Lin
e9cc33d6f2 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-04-11 10:42:19 -04:00
Gary Lin
80d49f758e Cryptlib: Remove MD4
MD4 is known to be insecure and shim never uses it.

Signed-off-by: Gary Lin <glin@suse.com>
2017-04-11 10:42:19 -04:00
Gary Lin
9bc647e2b2 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-04-11 10:42:19 -04:00
Gary Lin
e883479f35 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-04-11 10:42:19 -04:00
Gary Lin
97469449fd 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-04-11 10:42:19 -04:00
Gary Lin
d064bd7eef Cryptlib: Update to the latest edk2 commit
- Update to edk2 commit 7c410b3d4180087020c7734bf67cdc4ad9fdb136
  CryptoPkg/BaseCryptLib: Adding NULL checking in time() wrapper.

- Update headers in Cryptlib/Include/openssl/ to 1.1.0e
  + Also copy the openssl internal headers

Signed-off-by: Gary Lin <glin@suse.com>
2017-04-11 10:42:18 -04:00
Gary Lin
ab9a05a10f Cryptlib: Rename OpenSslSupport.h as CrtLibSupport.h
Edk2 renamed OpenSslSupport.h, so we have to follow the change.
Also merge some changes from edk2 CrtLibSupport.h

Signed-off-by: Gary Lin <glin@suse.com>
2017-04-11 10:42:18 -04:00
Gary Lin
f48505bfb2 Update to openssl 1.0.2k
Signed-off-by: Gary Lin <glin@suse.com>
2017-03-24 18:28:30 -04:00
Gary Lin
b371a682fb Update to openssl 1.0.2j
Signed-off-by: Gary Lin <glin@suse.com>
2016-11-30 12:57:34 -05:00
Gary Lin
8dcfecc6c7 Update to openssl 1.0.2h
Signed-off-by: Gary Lin <glin@suse.com>
2016-09-06 15:05:36 -04:00
Gary Lin
0297aa3cf3 Update openssl to 1.0.2g
Signed-off-by: Gary Lin <glin@suse.com>
2016-09-06 15:05:36 -04:00
Gary Lin
e571428e21 Update to openssl to 1.0.2e
Also update Cryptlib to edk2 r19218
- Undefine NO_BUILTIN_VA_FUNCS in Cryptlib/OpenSSL/ for x86_64 to use
  the gcc builtins and remove all EFIAPI from the functions
- Move the most of defines into the headers instead of Makefile
- Remove the global variable 'timeval'
- Remove the unused code: crypto/pqueue/* and crypto/ts/*
- Include bn.h in MokManager.c due to the changes in openssl

Signed-off-by: Gary Lin <glin@suse.com>
2016-09-06 15:05:34 -04:00
Gary Ching-Pang Lin
5a49bad020 Cryptlib: Define the va functions for EFIAPI
It turned out that my previous crash fix(*) was wrong.
We actually always used the gcc built-in va functions instead of
the "real" va functions for EFIAPI, and we are just lucky that
ERR_add_error_data didn't crash before.

This commit copies the va functions from MdePkg/Include/Base.h
in edk2 and introdues NO_BUILTIN_VA_FUNCS for x86_64, so that all
the x86_64 build will adopt the new va functions. For safety,
I also added EFIAPI to all the functions which use va_* to avoid
the potential trouble.

(*) a7f4b26cc3

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
2015-11-09 09:50:50 -05:00
Gary Ching-Pang Lin
a7f4b26cc3 Openssl: Add EFIAPI for ERR_add_error_vdata
Without declaring EFIAPI for ERR_add_error_vdata, shim would crash
while verifying the loaded image.

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
2015-07-28 11:46:38 -04:00
Gary Ching-Pang Lin
4ac84f8673 Update openssl to 1.0.2d
Also update Cryptlib to edk2 r17731

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
2015-07-28 11:46:38 -04:00
Gary Ching-Pang Lin
3285f53941 Update Cryptlib and openssl
Update Cryptlib to r16559 and openssl to 0.9.8zf

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
2015-05-12 13:51:02 -04:00
Peter Jones
d51739a416 gcc 5.0 changes some include bits, so copy what arm does on x86.
Basically they messed around with stdarg some and now we need to do it
the other way.

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-04-13 19:55:25 -04:00
Ard Biesheuvel
a30276e095 CryptLib: undefine va_arg and friends before redefining them
Upstream GNU-EFI contains changes to efistdarg.h resulting in the va_start,
va_arg and va_end macros to be #defined unconditionally. Make sure we #undef
them before overriding the definitions.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2014-08-12 10:54:05 -04:00
Gary Ching-Pang Lin
76f8050ff6 Update openssl to 0.9.8za
Also update to Tiano Cryptlib r15638
2014-07-14 09:03:36 -04:00
Matthew Garrett
d259b14060 Update OpenSSL 2012-07-02 12:33:42 -04:00
Matthew Garrett
cfdefb0ebe Remove redundant header 2012-07-02 09:40:18 -04:00
Matthew Garrett
9579a36336 Add crypto libraries 2012-06-18 17:49:57 -04:00