<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openbsd/src/lib/libcrypto/pkcs7, branch OPENBSD_7_8_BASE</title>
<subtitle>A mirror of https://github.com/libressl/openbsd.git
</subtitle>
<id>https://git.lua4.win/openbsd/atom?h=OPENBSD_7_8_BASE</id>
<link rel='self' href='https://git.lua4.win/openbsd/atom?h=OPENBSD_7_8_BASE'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/'/>
<updated>2025-07-31T02:24:21+00:00</updated>
<entry>
<title>Rework PKCS7_simple_smimecap()</title>
<updated>2025-07-31T02:24:21+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-07-31T02:24:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=939b14b31a0ec57a91982f54dd055e000bf5f6ac'/>
<id>urn:sha1:939b14b31a0ec57a91982f54dd055e000bf5f6ac</id>
<content type='text'>
This is nearly identical to CMS_add_simple_smimecap(). We can reuse
its doc comment mutatis mutandis and use the same construction.

Maybe this wants deduplicating. Maybe not.

ok kenjiro
</content>
</entry>
<entry>
<title>Rework PKCS7_add1_attrib_digest()</title>
<updated>2025-07-31T02:21:01+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-07-31T02:21:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=0422dbe1ad1c175070e7cebc4bbb202b15ffea21'/>
<id>urn:sha1:0422dbe1ad1c175070e7cebc4bbb202b15ffea21</id>
<content type='text'>
There's nothing really wrong here (at least when compared to the rest of
this file an hour or so ago), but we can make this look somewhat more like
code. That there's no bug here is not really related to the fact that it's
an add1 function, not an add0 one. In fact, it's kind of surprising that
the author had an uncharacteristic moment of lucidity and remembered to
free the last argument passed to PKCS7_add_signed_attribute() on failure.

ok kenjiro
</content>
</entry>
<entry>
<title>Rewrite PKCS7_get_smimecap() to use d2i_X509_ALGORS()</title>
<updated>2025-07-31T02:10:55+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-07-31T02:10:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=4815d09a66fcc2a3ecabae72d77e841265da2451'/>
<id>urn:sha1:4815d09a66fcc2a3ecabae72d77e841265da2451</id>
<content type='text'>
Since we finally found a use for i2d_X509_ALGORS(), make use of its
sibling here. This avoids some ridiculous contortions in not quite
peak muppet code (obviously this was a first test run for the grand
finale in CMS).

ok kenjiro
</content>
</entry>
<entry>
<title>Plug leaks due to misuse of PKCS7_add_signed_attribute()</title>
<updated>2025-07-31T02:02:35+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-07-31T02:02:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=5c9cc2d0035cb59dfcacb47001ca9b8392b3732b'/>
<id>urn:sha1:5c9cc2d0035cb59dfcacb47001ca9b8392b3732b</id>
<content type='text'>
set0/add0 functions that can fail are the worst. Without fail this trips
up both users and authors (by and large these are two identical groups
consisting of a single person), resulting in leaks and double frees.

In today's episode of spelunking in the gruesome gore provided by the
PKCS#7 and Time-Stamp protocol "implementations", we fix a couple of
leaks in PKCS7_add_attrib_smimecap() and ESS_add_signing_cert().

We do so by recalling that there is i2d_X509_ALGORS(), so we might
as well put it to use instead of inlining it poorly (aka, without
error checking). Normalize said error checking and ensure ownership
is handled correctly in the usual single-exit idiom.

ESS_add_signing_cert() can also make use of proper i2d handling, so
it's simpler and correct and in the end looks pretty much the same
as PKCS7_add_attrib_smimecap().

ok kenjiro
</content>
</entry>
<entry>
<title>PKCS7_add0_attrib_signing_time: tweak comment</title>
<updated>2025-07-28T04:29:00+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-07-28T04:29:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=24f1a240459f5178954a0c2f54c2afdd8a6f6e2e'/>
<id>urn:sha1:24f1a240459f5178954a0c2f54c2afdd8a6f6e2e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix PKCS7_add0_attrib_signing_time()</title>
<updated>2025-07-27T07:11:36+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-07-27T07:11:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=33683d7f8034ad6ba3e6e873d6e5d5801cebba29'/>
<id>urn:sha1:33683d7f8034ad6ba3e6e873d6e5d5801cebba29</id>
<content type='text'>
If the caller passes in NULL, helpfully a new ASN1_TIME is allocated
with X509_gmtime_adj() and leaked if PKCS7_add0_attrib_signing_time()
fails afterward. Fix this. Also don't blindly set the signing time to
a UTCTime. Validate the usual RFC 5280 format before setting it, as
that's what RFC 5652, section 11.3 mandates.

ok kenjiro
</content>
</entry>
<entry>
<title>Fix incorrect ownership handling in add_attribute()</title>
<updated>2025-07-27T07:06:41+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-07-27T07:06:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=5d593caa4397fa2eafb4771d98476f5a53cecd1a'/>
<id>urn:sha1:5d593caa4397fa2eafb4771d98476f5a53cecd1a</id>
<content type='text'>
This little gem has a number of issues.

On failure, the caller can't know whether ownership of value was taken
or not, so to avoid a double free, the only option is to leak value on
failure. As X509_ATTRIBUTE_create() takes ownership on success, this
call must be the last one that can fail. This way ownership is only
taken on success.

Next, if X509_ATTRIBUTE_create() fails in the case that the input stack
already contains an attribute of type nid, that attr is freed and the
caller freeing the stack with pop_free() will double free.

So, rework this in a few ways. Make this transactional, so we don't fail
with a modified *in_sk, so work with a local sk as usual. Then walk the
stack and see if we have an attribute with the appropriate nid already.
If not, make sure there's room to place the new attribute. Create the
new attribute, free the old attribute if necessary and replace it with
the new one. Finally assign the local sk to *in_sk and return success.
On error unwind all we did.

The behavior now matches OpenSSL 3's new behavior, except that we don't
leave an empty stack around on error.

ok kenjiro
</content>
</entry>
<entry>
<title>pkcs7.h: remove whitespace before opening paren.</title>
<updated>2025-07-02T10:24:17+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-07-02T10:24:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=90aa4c4a99821aa2140aa91b15ab788fb21f5c61'/>
<id>urn:sha1:90aa4c4a99821aa2140aa91b15ab788fb21f5c61</id>
<content type='text'>
fixes in particular ./check_complete.pl pkcs7
</content>
</entry>
<entry>
<title>pk7_asn1: delete lines containing nothing but a tab</title>
<updated>2025-06-11T18:11:55+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-06-11T18:11:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=e8072ea25f6fbdb48e65889fec46a27e8f5e3ab1'/>
<id>urn:sha1:e8072ea25f6fbdb48e65889fec46a27e8f5e3ab1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>pkcs7.h: drop two spaces before a tab</title>
<updated>2025-06-05T07:50:30+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-06-05T07:50:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=fdfd3dad8e21a95f3e542d8d9648bc3c1eb4d5d3'/>
<id>urn:sha1:fdfd3dad8e21a95f3e542d8d9648bc3c1eb4d5d3</id>
<content type='text'>
</content>
</entry>
</feed>
