<feed xmlns='http://www.w3.org/2005/Atom'>
<title>efi-boot-shim.git/Cryptlib, branch vyos/current</title>
<subtitle> (mirror of https://github.com/vyos/efi-boot-shim.git)
</subtitle>
<id>https://git.amelek.net/vyos/efi-boot-shim.git/atom?h=vyos%2Fcurrent</id>
<link rel='self' href='https://git.amelek.net/vyos/efi-boot-shim.git/atom?h=vyos%2Fcurrent'/>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/'/>
<updated>2025-02-05T14:18:45+00:00</updated>
<entry>
<title>Optionally enabling codesign EKU check in compiling time.</title>
<updated>2025-02-05T14:18:45+00:00</updated>
<author>
<name>Dennis Tseng</name>
<email>dennis.tseng@suse.com</email>
</author>
<published>2024-06-05T14:33:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=eb02afc6f822576b73b7added3966ad7e72fd342'/>
<id>urn:sha1:eb02afc6f822576b73b7added3966ad7e72fd342</id>
<content type='text'>
This commit also supersedes PR#232 which was closed on Jul 1, 2021.
So that original codesign EKU codes cannot be bothered.

To enable the codesign check, ENABLE_CODESIGN_EKU can be set to 1.
To disable the codesign check, ENABLE_CODESIGN_EKU can be set to 0
or just omit this flag.

For example:
make xxxx ENABLE_CODESIGN_EKU=1 xxxx shim.efi

Signed-off-by: Dennis Tseng &lt;dennis.tseng@suse.com&gt;
</content>
</entry>
<entry>
<title>Implement the CodeSign EKU check to fulfill the requirements of NIAP OS_PP.</title>
<updated>2025-02-05T14:18:45+00:00</updated>
<author>
<name>Gary Lin</name>
<email>glin@suse.com</email>
</author>
<published>2024-06-05T07:31:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=15c1a9a310645ceb958587fe000d5f60ed3bc4bd'/>
<id>urn:sha1:15c1a9a310645ceb958587fe000d5f60ed3bc4bd</id>
<content type='text'>
Also modify the ModSign EKU check to use VerifyEKUsInPkcs7Signature() to
check the signer certificate instead of the certificate directly from the
key database.

This commit supersedes the PR#232 and PR#661 (Apply the EKU checks) so
that author's original codes can be quite independent of other modification.

To answer the question in PR#232, author also changed the conditional
statement to EFI_Status != EFI_SUCCESS right after VerifyEKUsInPkcs7Signature()
in Cryptlib/Pk/CryptPkcs7Verify.c

Signed-off-by: Dennis Tseng &lt;dennis.tseng@suse.com&gt;
Signed-off-by: Gary Lin &lt;glin@suse.com&gt;
</content>
</entry>
<entry>
<title>Suppress some warnings even harder in Cryptlib and OpenSSL.</title>
<updated>2024-12-17T18:35:41+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2024-12-17T18:07:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=0c9249d13bced071986ada03846e2241143a1ad4'/>
<id>urn:sha1:0c9249d13bced071986ada03846e2241143a1ad4</id>
<content type='text'>
In some cases the -Werror / -Wfoo / -Wno-foo / -Wno-error=foo bits
aren't propagating in a way that clang is happy with, so we get errors
about unused variables and the like in Cryptlib and OpenSSL.

We're never going to fix those nits in this tree, so this patch tries
even harder to make the compiler ignore them, or at least not end the
build with a benign error.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Use -Wno-unused-but-set-variable for Cryptlib and OpenSSL</title>
<updated>2023-06-21T19:04:38+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2023-06-14T20:04:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=243f12589dbb5e9549d0e08760a03f3a41cd82a2'/>
<id>urn:sha1:243f12589dbb5e9549d0e08760a03f3a41cd82a2</id>
<content type='text'>
Cryptlib and OpenSSL both currently throw warnings with some compilers
using -Wunused-but-set-variable:

  clang -std=gnu11 -ggdb -ffreestanding -fmacro-prefix-map=/home/pjones/devel/github.com/shim/main/= -fno-stack-protector -fno-strict-aliasing -fpic -fshort-wchar -nostdinc -m64 -mno-mmx -mno-sse -mno-red-zone  -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Werror -I/home/pjones/devel/github.com/shim/main/Cryptlib -I/home/pjones/devel/github.com/shim/main/Cryptlib/Include -I/home/pjones/devel/github.com/shim/main/gnu-efi/inc -I/home/pjones/devel/github.com/shim/main/gnu-efi/inc/x86_64 -I/home/pjones/devel/github.com/shim/main/gnu-efi/inc/protocol -isystem /home/pjones/devel/github.com/shim/main/include/system -isystem /usr/lib64/clang/16/include -DMDE_CPU_X64   -c -o Pk/CryptX509.o Pk/CryptX509.c
Pk/CryptX509.c:94:19: error: variable 'Index' set but not used [-Werror,-Wunused-but-set-variable]
    UINTN           Index;
                    ^
  clang -std=gnu11 -ggdb -ffreestanding -fmacro-prefix-map=/home/pjones/devel/github.com/shim/main/= -fno-stack-protector -fno-strict-aliasing -fpic -fshort-wchar -nostdinc -m64 -mno-mmx -mno-sse -mno-red-zone  -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-empty-body -Wno-implicit-fallthrough   -Wno-unused-parameter -Werror -I/home/pjones/devel/github.com/shim/main/Cryptlib/OpenSSL -I/home/pjones/devel/github.com/shim/main/Cryptlib -I/home/pjones/devel/github.com/shim/main/Cryptlib/OpenSSL/Include/ -I/home/pjones/devel/github.com/shim/main/Cryptlib/OpenSSL/crypto -I/home/pjones/devel/github.com/shim/main/Cryptlib/Include -I/home/pjones/devel/github.com/shim/main/gnu-efi/inc -I/home/pjones/devel/github.com/shim/main/gnu-efi/inc/x86_64 -I/home/pjones/devel/github.com/shim/main/gnu-efi/inc/protocol -I/home/pjones/devel/github.com/shim/main/Cryptlib/OpenSSL/crypto/asn1 -I/home/pjones/devel/github.com/shim/main/Cryptlib/OpenSSL/crypto/evp -I/home/pjones/devel/github.com/shim/main/Cryptlib/OpenSSL/crypto/modes -I/home/pjones/devel/github.com/shim/main/Cryptlib/OpenSSL/crypto/include -isystem /home/pjones/devel/github.com/shim/main/include/system -isystem /usr/lib64/clang/16/include -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_SMALL_FOOTPRINT -DPEDANTIC -DMDE_CPU_X64   -c -o crypto/asn1/t_x509.o crypto/asn1/t_x509.c
crypto/asn1/t_x509.c:504:18: error: variable 'l' set but not used [-Werror,-Wunused-but-set-variable]
      int ret = 0, l, i;
                   ^

Since we normally build with -Werror, these cause builds to fail in
these cases.  While the bad code should be addressed, it appears
generally safe, so we should solve it upstream.

This patch adds -Wno-unused-but-set-variable to the Cryptlib Makefile,
and removes the conditionalization on gcc in the OpenSSL Makefile, as
clang now has this argument, and since we don't support building with
clang for the final build, it's useful to have clang-based tools
working.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>CryptoPkg/BaseCryptLib: Fix buffer overflow issue in realloc wrapper</title>
<updated>2023-01-27T19:15:14+00:00</updated>
<author>
<name>Long Qin</name>
<email>qin.long@intel.com</email>
</author>
<published>2017-11-01T08:10:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=89972ae25c133df31290f394413c19ea903219ad'/>
<id>urn:sha1:89972ae25c133df31290f394413c19ea903219ad</id>
<content type='text'>
There is one long-standing problem in CRT realloc wrapper, which will
cause the obvious buffer overflow issue when re-allocating one bigger
memory block:
    void *realloc (void *ptr, size_t size)
    {
      //
      // BUG: hardcode OldSize == size! We have no any knowledge about
      // memory size of original pointer ptr.
      //
      return ReallocatePool ((UINTN) size, (UINTN) size, ptr);
    }
This patch introduces one extra header to record the memory buffer size
information when allocating memory block from malloc routine, and re-wrap
the realloc() and free() routines to remove this BUG.

Cc: Laszlo Ersek &lt;lersek@redhat.com&gt;
Cc: Ting Ye &lt;ting.ye@intel.com&gt;
Cc: Jian J Wang &lt;jian.j.wang@intel.com&gt;
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long &lt;qin.long@intel.com&gt;
Reviewed-by: Jian J Wang &lt;jian.j.wang@intel.com&gt;
Validated-by: Jian J Wang &lt;jian.j.wang@intel.com&gt;

Cherry picked from https://github.com/tianocore/edk2.git, commit
cf8197a39d07179027455421a182598bd6989999. Changes:
* `SIGNATURE_32` -&gt; `EFI_SIGNATURE_32`
* Added definition of `MIN`

Fixes https://github.com/rhboot/shim/issues/538

Signed-off-by: Nicholas Bishop &lt;nicholasbishop@google.com&gt;
</content>
</entry>
<entry>
<title>CryptoPkg/BaseCryptLib: fix NULL dereference</title>
<updated>2022-11-15T18:07:29+00:00</updated>
<author>
<name>Jian J Wang</name>
<email>jian.j.wang@intel.com</email>
</author>
<published>2019-04-25T15:42:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=53509eaf2253e23bfb552e9386fd0877abe592b4'/>
<id>urn:sha1:53509eaf2253e23bfb552e9386fd0877abe592b4</id>
<content type='text'>
AuthenticodeVerify() calls OpenSSLs d2i_PKCS7() API to parse asn encoded
signed authenticode pkcs#7 data. when this successfully returns, a type
check is done by calling PKCS7_type_is_signed() and then
Pkcs7-&gt;d.sign-&gt;contents-&gt;type is used. It is possible to construct an asn1
blob that successfully decodes and have d2i_PKCS7() return a valid pointer
and have PKCS7_type_is_signed() also return success  but have Pkcs7-&gt;d.sign
be a NULL pointer.

Looking at how PKCS7_verify() [inside of OpenSSL] implements checking for
pkcs7 structs it does the following:
- call PKCS7_type_is_signed()
- call PKCS7_get_detached()
Looking into how PKCS7_get_detatched() is implemented, it checks to see if
p7-&gt;d.sign is NULL or if p7-&gt;d.sign-&gt;contents-&gt;d.ptr is NULL.

As such, the fix is to do the same as OpenSSL after calling d2i_PKCS7().
- Add call to PKS7_get_detached() to existing error handling

Cc: Chao Zhang &lt;chao.b.zhang@intel.com&gt;
Cc: Jiewen Yao &lt;jiewen.yao@intel.com&gt;
Signed-off-by: Jian J Wang &lt;jian.j.wang@intel.com&gt;
Cherry-picked-from: https://github.com/tianocore/edk2/commit/26442d11e620a9e81c019a24a4ff38441c64ba10
</content>
</entry>
<entry>
<title>Make CopyMem() work with EFI's declaration</title>
<updated>2021-09-07T21:05:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-08-04T17:24:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=e13ac7386ea425c9222e05a2f9879d5af5cb91f6'/>
<id>urn:sha1:e13ac7386ea425c9222e05a2f9879d5af5cb91f6</id>
<content type='text'>
EFI_BOOT_SERVICES includes CopyMem() and SetMem() functions which are
marked EFIAPI, and in the case of CopyMem() does not mark the source
argument as CONST.

This patch makes all our invocations work with that, so (once gnu-efi's
implementation is fixed to match) we can use the existing implementation
as the implementation in a mock EFI_BOOT_SERVICES.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>More va_* work</title>
<updated>2021-03-12T09:15:01+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-03-11T21:48:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=4457d79ce0ea638e7732f5529bf13849e290940d'/>
<id>urn:sha1:4457d79ce0ea638e7732f5529bf13849e290940d</id>
<content type='text'>
Be much more explicit about exactly which va_* stuff comes from which
ABI in both shim and gnu-efi.  This fixes the problem where we see:

| (null):0:(null)() v-&gt;name:"(null)" v-&gt;rtname:"(null)"
| (null):0:(null)() v-&gt;data_size:0 v-&gt;data:0x0

and similar messages where everything is NULL.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>openssl: nerf some -W flags for clang.</title>
<updated>2021-03-12T09:15:01+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-03-11T16:40:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=df74fff124a84428c9717a89ff00ca0931d09c52'/>
<id>urn:sha1:df74fff124a84428c9717a89ff00ca0931d09c52</id>
<content type='text'>
Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>make: use -Wextra (minus some obnoxious bits)</title>
<updated>2021-03-10T20:54:20+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-03-09T22:15:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=1bc4bf063adf57a17e5d6d8dc6399f03080a0566'/>
<id>urn:sha1:1bc4bf063adf57a17e5d6d8dc6399f03080a0566</id>
<content type='text'>
gcc -Wextra, has a lot of good, useful checks, a few obnoxious checks,
and a few absolutely insane checks.

This enables -Wextra, but disables -Wmissing-field-initializers, because
it is irrational nonsense that just leads to worse code.  It also
disables some specific things in the Cryptlib and Cryptlib/OpenSSL
trees:

Both:
-Wno-unused-parameter
 - there are a fair number of functions that have to conform to some API
   or another but have arguments that are unused, but haven't been
   marked with UNUSED; we don't need to see warnings about them.

Cryptlib/OpenSSL:
-Wno-empty-body
 - functions that exist merely to populate some API
-Wno-implicit-fallthrough
 - these probably should get fixed someday, but I bet upstream will do
   it and rebasing will solve it
-Wno-old-style-declaration
 - this gripes if you write "const static" instead of "static const".
   Again I expect rebasing will fix it at some point.
-Wno-unused-but-set-variable
 - self explanatory, and again, I expect a rebase to solve it someday.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
</feed>
