<feed xmlns='http://www.w3.org/2005/Atom'>
<title>efi-boot-shim.git/lib/variables.c, branch rolling</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=rolling</id>
<link rel='self' href='https://git.amelek.net/vyos/efi-boot-shim.git/atom?h=rolling'/>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/'/>
<updated>2025-03-14T15:05:05+00:00</updated>
<entry>
<title>SetSecureVariable(): free Cert on failure</title>
<updated>2025-03-14T15:05:05+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2025-03-12T17:43:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=d45c610ba558c1b1673ff94590b71a156dd2fd3c'/>
<id>urn:sha1:d45c610ba558c1b1673ff94590b71a156dd2fd3c</id>
<content type='text'>
If variable_create_esl_with_one_signature() succeeds but
CreateTimeBasedPayload() fails, we leak the allocation for our
certificate.

This patch frees it.

Resolves: Coverity CID 457504
Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Minor coverity fixes</title>
<updated>2021-12-10T22:08:21+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-12-09T22:21:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=d0df9304c7a777557e1925dc9f75406ec00e6179'/>
<id>urn:sha1:d0df9304c7a777557e1925dc9f75406ec00e6179</id>
<content type='text'>
- one missing free
- one minor deadcode issue
- two unchecked allocations
- one debug hexdump of a variable we just freed

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</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>Make test cases link against libefi.a</title>
<updated>2021-07-20T13:44:25+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-07-15T14:07:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=f1ef8dffd374048fbf8dd584923c42e5a784bbf2'/>
<id>urn:sha1:f1ef8dffd374048fbf8dd584923c42e5a784bbf2</id>
<content type='text'>
This allows us to use library functions from libefi.a in our test
programs.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Fix boot failures due to variable size constraints</title>
<updated>2021-03-22T20:44:03+00:00</updated>
<author>
<name>Chris Coulson</name>
<email>chris.coulson@canonical.com</email>
</author>
<published>2021-03-19T16:50:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=f9294c2fa9feaf5353c0b7a4a7ce102a820c1a3f'/>
<id>urn:sha1:f9294c2fa9feaf5353c0b7a4a7ce102a820c1a3f</id>
<content type='text'>
There are multiple issues in the MOK variable mirroring code due
to volatile variable size constraints, which all result in boot
failures:

- If a signature is encountered which doesn't fit in to a single
variable, the code enters an infinite loop because the cursor
isn't advanced in mirror_mok_db() after the call to
mirror_one_esl().

- If an ESL is encountered which doesn't fit in to a single
variable, it looks like the intention is for the ESL to be split
across multiple variables. However, mirror_one_esl() will write
the maximum variable size on each call, regardless of how much
data is remaining for the current ESL. If the size of a ESL isn't
a multiple of the maximum variable size, the final call to
mirror_one_esl() will append data from the start of the next
ESL and the cursor in mirror_mok_db() will be advanced to an
arbitrary location in the next ESL. This either results in garbage
being mirrored (if you're lucky), or in my case - another infinite
loop as it appears to encounter a signature that doesn't fit in to
a single variable.

- If no signatures can be mirrored when mirror_mok_db() is called
with only_first=TRUE, it tries to create a variable with a single
SHA256 signature in it. But mirror_mok_db() returns an error
(EFI_INVALID_PARAMETER) regardless of whether this succeeds.
</content>
</entry>
<entry>
<title>Ensure that MOK variable mirroring creates well formed ESLs</title>
<updated>2021-03-19T02:47:43+00:00</updated>
<author>
<name>Chris Coulson</name>
<email>chris.coulson@canonical.com</email>
</author>
<published>2021-03-18T14:32:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=3dd40ade68c6ff63e776b5f9acbd811a3c345d01'/>
<id>urn:sha1:3dd40ade68c6ff63e776b5f9acbd811a3c345d01</id>
<content type='text'>
The MOK variable mirroring makes use of variable_create_esl, which
can only create a well-formed EFI_SIGNATURE_LIST containing a single
signature. Fix fill_esl and variable_create_esl to support creating
a EFI_SIGNATURE_LIST with one or more supplied EFI_SIGNATURE_DATA
structures.

Introduce variable_create_esl_with_one_signature and
fill_esl_with_one_signature for code that does want to create a
EFI_SIGNATURE_LIST containing a single signature constructed from
a supplied signature data buffer and owner GUID.
</content>
</entry>
<entry>
<title>get_variable_attr(): fix a nit scan-build found.</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:30:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=ed6265c567f7e5aaa0d326e8a5fc21f3499f3ffc'/>
<id>urn:sha1:ed6265c567f7e5aaa0d326e8a5fc21f3499f3ffc</id>
<content type='text'>
scan-build believes we can hit a situation where get_variable_attr() is
called with NULL data, in which case we're not correctly returning an
error.

This adds the error return.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Restructure our includes.</title>
<updated>2021-03-10T20:54:20+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-03-09T16:42:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=f033a1da9f4c3acf7e3dfef906d01e348b6fcf42'/>
<id>urn:sha1:f033a1da9f4c3acf7e3dfef906d01e348b6fcf42</id>
<content type='text'>
This re-structures our includes so we can be sure everything is always
including all the system headers in a uniform, predictable way.

Temporarily it also adds a bunch of junk at all the places we use
variadic functions to specifically pick either the MS (cdecl) or ELF
ABIs.

I'm not 100% sure that's all correct (see later patch) but it's enough
to allow this to build.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Add get_variable_size()/set_variable()del_variable() wrappers.</title>
<updated>2021-03-09T08:15:27+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-02-26T04:18:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=58cf755d5fd5b3d1f87a5936107a70705ccbb57b'/>
<id>urn:sha1:58cf755d5fd5b3d1f87a5936107a70705ccbb57b</id>
<content type='text'>
This get_variable_size() implementation success in either of two cases:
- EFI_SUCCESS with *lenp == 0 if the variable isn't found
- EFI_SUCCESS with *lenp &gt; 0 on success

In the event of other errors, it returns them to you.

There's nothing particularly interesting about the set_variable()
or del_variable() implementation here.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Make the variable name and pointer const in all of our efi vars functions</title>
<updated>2021-02-16T08:12:48+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-01-27T17:10:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=b54d1df1c1dfbfc2502b396d46db63b89970b66e'/>
<id>urn:sha1:b54d1df1c1dfbfc2502b396d46db63b89970b66e</id>
<content type='text'>
Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
</feed>
