<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openbsd/src/lib/libcrypto/evp, branch OPENBSD_7_4</title>
<subtitle>A mirror of https://github.com/libressl/openbsd.git
</subtitle>
<id>https://git.lua4.win/openbsd/atom?h=OPENBSD_7_4</id>
<link rel='self' href='https://git.lua4.win/openbsd/atom?h=OPENBSD_7_4'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/'/>
<updated>2023-09-28T11:29:10+00:00</updated>
<entry>
<title>Fix EVP_CIPHER_CTX_iv_length()</title>
<updated>2023-09-28T11:29:10+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-09-28T11:29:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=51b553d9a746433693f625d3f21184da15e95972'/>
<id>urn:sha1:51b553d9a746433693f625d3f21184da15e95972</id>
<content type='text'>
In today's episode of "curly nonsense from EVP land" we deal with a quite
harmless oversight and a not too bad suboptimal fix, relatively speaking.

At some point EVP_CIPHER_{CCM,GCM}_SET_IVLEN was added. It modified some
object hanging off of EVP_CIPHER. However, EVP_CIPHER_CTX_iv_length() wasn't
taught about this and kept returning the hardcoded default value on the
EVP_CIPHER. Once it transpired that a doc fix isn't going to cut it, this
was fixed. And of course it's easy to fix: you only have to dive through
about three layers of EVP, test and set a flag and handle a control in a
couple methods.

The upstream fix was done poorly and we begrudgingly have to match the API:
the caller is expected to pass a raw pointer next to a 0 length along with
EVP_CIPHER_GET_IV_LENGTH and the control handler goes *(int *)ptr = length
in full YOLO mode. That's never going to be an issue because of course the
caller will always pass a properly aligned pointer backing a sufficient
amount of memory. Yes, unlikely to be a real issue, but it could have been
done with proper semantics and checks without complicating the code. But
why do I even bother to complain? We're used to this.

Of note here is that there was some pushback painting other corners of a
bikeshed until the reviewer gave up with a resigned

  That kind of changes the semantics and is one extra complexity level,
  but [shrug] ok...

Anyway, the reason this matters now after so many years is that rust-openssl
has an assert, notably added in a +758 -84 commit with the awesome message
"Docs" that gets triggered by recent tests added to py-cryptography.

Thanks to Alex Gaynor for reporting this. Let me take the opportunity to
point out that pyca contributed to improve rust-openssl, in particular its
libressl support, quite a bit. That's much appreciated and very noticeable.

Regress coverage to follow in subsequent commits.

Based on OpenSSL PR #9499 and issue #8330.

ok beck jsing

PS: A few macros were kept internal for now to avoid impact on the release
cycle that is about to finish. They will be exposed after release.
</content>
</entry>
<entry>
<title>Make EVP_PKEY_get1_$TYPE a wrapper of EVP_PKEY_get0_$TYPE</title>
<updated>2023-09-10T17:32:17+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-09-10T17:32:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=b7a8e409d32c3b850139a36fc6775d3ab49d4982'/>
<id>urn:sha1:b7a8e409d32c3b850139a36fc6775d3ab49d4982</id>
<content type='text'>
Avoids a bit of code duplication and reduces the probability of a fix being
applied to only one of get0 and get1 (which happend in p_lib.c r1.35).

ok jsing
</content>
</entry>
<entry>
<title>EVP_CipherInit(): use EVP_CIPHER_CTX_cleanup()</title>
<updated>2023-09-10T16:53:56+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-09-10T16:53:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=eb5f3505c1f509bbb3b4862c95831d1b83de62f4'/>
<id>urn:sha1:eb5f3505c1f509bbb3b4862c95831d1b83de62f4</id>
<content type='text'>
Before EVP_CIPHER_CTX was opaque, callers could pass an uninitialized
ctx into EVP_CipherInit() and calling EVP_CIPHER_CTX_cleanup() on such
a ctx would end in tears.

The only way to initialize a ctx is by way of EVP_CIPHER_CTX_new(), on
which we can call EVP_CIPHER_CTX_cleanup() and avoid silly leaks on ctx
reuse. This also allows some simplifications in the documentation.

There are more changes of this kind that should be done all over libcrypto.
They will be tackled in subsequent commits.

"makes a lot of sense" schwarze
ok jsing
</content>
</entry>
<entry>
<title>whitespace</title>
<updated>2023-09-02T04:55:18+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-09-02T04:55:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=4b210b7655b0a5564a24d107204d8fd02d25b575'/>
<id>urn:sha1:4b210b7655b0a5564a24d107204d8fd02d25b575</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Align EVP_PKEY_get1_RSA() with EVP_PKEY_get0_RSA()</title>
<updated>2023-09-02T04:15:39+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-09-02T04:15:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=c21bcda27a7a4156b86b76c9a405c274f3f79254'/>
<id>urn:sha1:c21bcda27a7a4156b86b76c9a405c274f3f79254</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix EVP_PKEY_get0_RSA() for RSA-PSS</title>
<updated>2023-09-01T17:12:19+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-09-01T17:12:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=a49f74c21adee71abf506e87b32dcbdbe1b10bb7'/>
<id>urn:sha1:a49f74c21adee71abf506e87b32dcbdbe1b10bb7</id>
<content type='text'>
It currently returns NULL. This is OpenSSL 4088b926 + De Morgan.

ok jsing
</content>
</entry>
<entry>
<title>Remove two unnecessary local variables</title>
<updated>2023-08-26T02:59:13+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-08-26T02:59:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=e0edfeef79dcc000b3f1d29f0e2b1774d9d82d56'/>
<id>urn:sha1:e0edfeef79dcc000b3f1d29f0e2b1774d9d82d56</id>
<content type='text'>
</content>
</entry>
<entry>
<title>KNF, no assembly change</title>
<updated>2023-08-25T12:37:33+00:00</updated>
<author>
<name>schwarze</name>
<email></email>
</author>
<published>2023-08-25T12:37:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=5858a3e6cde0036b94090a94427298e8fa512fcd'/>
<id>urn:sha1:5858a3e6cde0036b94090a94427298e8fa512fcd</id>
<content type='text'>
OK tb@ jsing@
</content>
</entry>
<entry>
<title>Update references from RFC 7539 to RFC 8439</title>
<updated>2023-08-24T04:33:08+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-08-24T04:33:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=41881d1899bdc5c08e89d538fcff40cd5ce959cf'/>
<id>urn:sha1:41881d1899bdc5c08e89d538fcff40cd5ce959cf</id>
<content type='text'>
RFC 7539 was superseded by RFC 8439, incorporating errata and making
editorial improvements. Very little of substance changed, in particular
section numbers remain the same.

Prompted by a question from schwarze
</content>
</entry>
<entry>
<title>Clarify how the EVP IV is used with ChaCha</title>
<updated>2023-08-24T04:20:57+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-08-24T04:20:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=84529cf7cbe8501ca650938dae3d29ffd8cfda99'/>
<id>urn:sha1:84529cf7cbe8501ca650938dae3d29ffd8cfda99</id>
<content type='text'>
EVP_chacha20() was aligned to follow OpenSSL's nonconformant implementation
during a2k20 by djm and myself in an effort to allow OpenSSH to use the
OpenSSL 1.1 API. Some corresponding OpenSSL 1.1 documentation was imported
at the same time. A comment attempted to translate between implementation
and the incorrect documentation, which was necessarily gibberish. Improve
the situation by rephrasing and dropping nonsensical bits.

Prompted by a question of schwarze
</content>
</entry>
</feed>
