<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openbsd/src/lib, branch tb_20220504</title>
<subtitle>A mirror of https://github.com/libressl/openbsd.git
</subtitle>
<id>https://git.lua4.win/openbsd/atom?h=tb_20220504</id>
<link rel='self' href='https://git.lua4.win/openbsd/atom?h=tb_20220504'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/'/>
<updated>2022-05-04T18:02:08+00:00</updated>
<entry>
<title>This commit was manufactured by cvs2git to create tag 'tb_20220504'.</title>
<updated>2022-05-04T18:02:08+00:00</updated>
<author>
<name>cvs2svn</name>
<email>admin@example.com</email>
</author>
<published>2022-05-04T18:02:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=3c94dc45dfb15483d76c47a128ec352cc0b655ac'/>
<id>urn:sha1:3c94dc45dfb15483d76c47a128ec352cc0b655ac</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Import HKDF code from OpenSSL 1.1.1o</title>
<updated>2022-05-04T18:02:07+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2022-05-04T18:02:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=f32cca700e59c0fd1ddd8f1fd4b35a5401be28fe'/>
<id>urn:sha1:f32cca700e59c0fd1ddd8f1fd4b35a5401be28fe</id>
<content type='text'>
This imports verbatim copies as of the OpenSSL_1_1_1o tag of

  crypto/kdf/hkdf.c
  crypto/kdf/hkdf_err.c
  include/openssl/kdf.h
  include/openssl/kdferr.h

from https://www.github.com/openssl/openssl.git into lib/libcrypto/kdf.

We only want the EVP interface to HKDF since some ports need them.  Not
yet linked to the build since it will not compile. Follow-on commits will
add KNF, clean up and make this compile.

Tests of an early draft version by abieber and Caspar Schutijser

ok jsing
</content>
</entry>
<entry>
<title>Rewrite asn1_collect() and asn1_find_end() with CBS.</title>
<updated>2022-05-04T10:57:48+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2022-05-04T10:57:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=c0d7276d07a10a7391d0f6d10b5975177e819cfe'/>
<id>urn:sha1:c0d7276d07a10a7391d0f6d10b5975177e819cfe</id>
<content type='text'>
Use more readable variable and arguments names in the process.

ok tb@
</content>
</entry>
<entry>
<title>Avoid special handling of definite length before calling asn1_find_end().</title>
<updated>2022-05-04T10:53:26+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2022-05-04T10:53:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=c7490c51699111407c7dbfb8d11418c22f1f7d4f'/>
<id>urn:sha1:c7490c51699111407c7dbfb8d11418c22f1f7d4f</id>
<content type='text'>
The asn1_find_end() function handles definite length ASN.1, which means
that there is no point in the only caller having code to explicitly handle
definite length - it can just call the function.

ok tb@
</content>
</entry>
<entry>
<title>Change asn1_check_tag_cbs() out_len from long to size_t.</title>
<updated>2022-05-04T10:47:36+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2022-05-04T10:47:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=2ee05a254753f47ff6538a8badb026ca82bc74a4'/>
<id>urn:sha1:2ee05a254753f47ff6538a8badb026ca82bc74a4</id>
<content type='text'>
The long vs size_t checks can be handled in the asn1_check_tag() wrapper
and this will help to avoid propagating long vs size_t issues into new
code.

ok tb@
</content>
</entry>
<entry>
<title>Rewrite asn1_check_tlen() using CBS.</title>
<updated>2022-04-28T18:30:57+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2022-04-28T18:30:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=05884faa77375103b83e2804adf80d2daadbca40'/>
<id>urn:sha1:05884faa77375103b83e2804adf80d2daadbca40</id>
<content type='text'>
Rather than calling asn1_get_object_cbs(), call asn1_get_identifier_cbs(),
then immediately proceed with the tag number and tag class check. Only if
that succeeds (or it is not required) do we call asn1_get_length_cbs().
This avoids incurring the overhead of decoding the length in the case where
the tag number and tag class do not match.

While here rename asn1_check_tlen() to asn1_check_tag() - while we decode
the length, what we are normally checking is the tag number and tag class.
Also rename the arguments for readability. For now the argument types
and encoding remain unchanged.

ok inoguchi@ tb@
</content>
</entry>
<entry>
<title>Refactor ASN1_TIME_adj_internal()</title>
<updated>2022-04-28T17:31:29+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2022-04-28T17:31:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=caf53398e438071d59fcb00cac3a6c9f153493a8'/>
<id>urn:sha1:caf53398e438071d59fcb00cac3a6c9f153493a8</id>
<content type='text'>
ASN1_TIME_adj_internal() does some strange dances with remembering
allocations in a boolean and using strlen(p) to deduce what happened
inside *_string_from_tm(). It also (mis)translates a NULL p to an
illegal time value error.

This can be streamlined by converting directly from a struct tm into an
ASN1_TIME and setting the errors when they occur instead of trying to
deduce them from a NULL return. This is made a bit uglier than necessary
due to the reuse-or-allocate semantics of the public API.

At the cost of a little code duplication, ASN1_TIME_adj_internal()
becomes very easy and ASN1_TIME_to_generalizedtime() is also simplified
somewhat.

ok inoguchi jsing
</content>
</entry>
<entry>
<title>Decode via c2i_ASN1_INTEGER_cbs() from asn1_ex_c2i().</title>
<updated>2022-04-27T17:56:13+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2022-04-27T17:56:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=9f0b8cd5903fa3dac8a3cf2e4123c4f95634cde7'/>
<id>urn:sha1:9f0b8cd5903fa3dac8a3cf2e4123c4f95634cde7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rewrite c2i_ASN1_INTEGER() using CBS.</title>
<updated>2022-04-27T17:42:08+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2022-04-27T17:42:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=1dab1c519c285b7655ab6fa3196fe83b7b110a56'/>
<id>urn:sha1:1dab1c519c285b7655ab6fa3196fe83b7b110a56</id>
<content type='text'>
This also makes validation stricter and inline with X.690 - we now reject
zero length inputs (rather than treating them as zero values) and enforce
minimal encoding.

ok tb@
</content>
</entry>
<entry>
<title>Remove the ASN.1 decoder tag/length cache (TLC).</title>
<updated>2022-04-27T17:28:34+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2022-04-27T17:28:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=a8d2bb1f6939a805dcd605eb24d943001c518eba'/>
<id>urn:sha1:a8d2bb1f6939a805dcd605eb24d943001c518eba</id>
<content type='text'>
Currently, every time an ASN.1 identifier and length is decoded it is
stored in a tag/length cache for potential reuse. However, the only time
this is actually of benefit is when decoding CHOICE or SEQUENCE with
OPTIONAL fields (or MSTRING and ANY due to less than ideal
implementation). For CHOICE and SEQUENCE with OPTIONAL fields the
current code attempts to decode the first option and if that fails, it
moves onto the next option and attempts to decode it, repeating until
it succeeds (or runs out of options).

There are a number of problems with the cache. Firstly, it adds complexity
to the ASN.1 decoder since it has to be passed up and down through the
various layers. Secondly, there is nothing that keeps the cached data in
synchronisation with the input stream. This makes it fragile and a
potential security risk. Thirdly, the type is in the public headers and
API, meaning that we cannot readily change the types or fields to improve
the code.

Testing also suggests that in typical decoding cases we actually get a
small performance increase by removing the cache. There are also several
other options that would improve decoding performance, which we can visit
once we have simpler and more robust code.

ok beck@ inoguchi@ tb@
</content>
</entry>
</feed>
