<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openbsd/src/lib/libcrypto/bn/bn_bpsw.c, branch OPENBSD_7_9</title>
<subtitle>A mirror of https://github.com/libressl/openbsd.git
</subtitle>
<id>https://git.lua4.win/openbsd/atom?h=OPENBSD_7_9</id>
<link rel='self' href='https://git.lua4.win/openbsd/atom?h=OPENBSD_7_9'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/'/>
<updated>2025-02-13T11:10:01+00:00</updated>
<entry>
<title>Convert BPSW to BN_MONT_CTX_create()</title>
<updated>2025-02-13T11:10:01+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-02-13T11:10:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=66f3a7d5a77ccfa87d46300c9b7cc772d4691dd4'/>
<id>urn:sha1:66f3a7d5a77ccfa87d46300c9b7cc772d4691dd4</id>
<content type='text'>
ok jsing
</content>
</entry>
<entry>
<title>Make the bn_rand_interval() API a bit more ergonomic</title>
<updated>2023-08-03T18:53:56+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-08-03T18:53:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=44ff07e01874ea8be0c72bf9d20cb7f13b76cca8'/>
<id>urn:sha1:44ff07e01874ea8be0c72bf9d20cb7f13b76cca8</id>
<content type='text'>
Provide bn_rand_in_range() which is a slightly tweaked version of what was
previously called bn_rand_range().

The way bn_rand_range() is called in libcrypto, the lower bound is always
expressible as a word. In fact, most of the time it is 1, the DH code uses
a 2, the MR tests in BPSW use 3 and an exceptinally high number appears in
the Tonelli-Shanks implementation where we use 32. Converting these lower
bounds to BIGNUMs on the call site is annoying so let bn_rand_interval()
do that internally and route that through bn_rand_in_range(). This way we
can avoid using BN_sub_word().

Adjust the bn_isqrt() test to use bn_rand_in_range() since that's the
only caller that uses actual BIGNUMs as lower bounds.

ok jsing
</content>
</entry>
<entry>
<title>Use is_pseudoprime instead of is_prime in bn_bpsw.c</title>
<updated>2023-05-10T21:05:24+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-05-10T21:05:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=a71a6115c0cd290f9e5dd15d6c84d8d3dde57b59'/>
<id>urn:sha1:a71a6115c0cd290f9e5dd15d6c84d8d3dde57b59</id>
<content type='text'>
This is more accurate and improves readability a bit. Apart from a comment
tweak this is sed + knfmt (which resulted in four wrapped lines).

Discussed with beck and jsing
</content>
</entry>
<entry>
<title>Add Miller-Rabin test for random bases to BPSW</title>
<updated>2023-05-10T12:21:55+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-05-10T12:21:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=536ed901af3f95bbdf5d437d3f0ad7d96659ee96'/>
<id>urn:sha1:536ed901af3f95bbdf5d437d3f0ad7d96659ee96</id>
<content type='text'>
The behavior of the BPSW primality test for numbers &gt; 2^64 is not very
well understood. While there is no known composite that passes the test,
there are heuristics that indicate that there are likely infinitely many.
Therefore it seems appropriate to harden the test. Having a settable
number of MR rounds before doing a version of BPSW is also the approach
taken by Go's primality check in math/big.

This adds a new implementation of the old MR test that runs before running
the strong Lucas test. I like to imagine that it's slightly cleaner code.
We're effectively at about twice the cost of what we had a year ago. In
addition, it adds some non-determinism in case there actually are false
positives for the BPSW test.

The implementation is straightforward. It could easily be tweaked to use
the additional gcds in the "enhanced" MR test of FIPS 186-5, but as long
as we are only going to throw away the additional info, that's not worth
much.

This is a first step towards incorporating some of the considerations in
"A performant misuse-resistant API for Primality Testing" by Massimo and
Paterson. Further work will happen in tree. In particular, there are plans
to crank the number of Miller-Rabin tests considerably so as to have a
guaranteed baseline. The manual will be updated shortly.

positive feedback beck
ok jsing
</content>
</entry>
<entry>
<title>Make internal header file names consistent</title>
<updated>2022-11-26T16:08:57+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2022-11-26T16:08:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=81d98bf600a381a625eb11b39a725b08c0ba547f'/>
<id>urn:sha1:81d98bf600a381a625eb11b39a725b08c0ba547f</id>
<content type='text'>
Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include &lt;ssl_locl.h&gt; was fixed manually.

discussed with jsing,
no objection bcook
</content>
</entry>
<entry>
<title>Add an empty line for consistency.</title>
<updated>2022-08-31T21:34:14+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2022-08-31T21:34:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=6d2b7349d4d2b2a2cda9c056a499da4cb8c64986'/>
<id>urn:sha1:6d2b7349d4d2b2a2cda9c056a499da4cb8c64986</id>
<content type='text'>
</content>
</entry>
<entry>
<title>missing period</title>
<updated>2022-08-29T18:54:06+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2022-08-29T18:54:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=1d9cee78ea462ea59903e576fe1b6ae3fc717afe'/>
<id>urn:sha1:1d9cee78ea462ea59903e576fe1b6ae3fc717afe</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Having a perfect square at this point is not an error. Rather it is</title>
<updated>2022-07-29T08:37:33+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2022-07-29T08:37:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=913491c1c23978164f1a30fec59f69cdd98ff366'/>
<id>urn:sha1:913491c1c23978164f1a30fec59f69cdd98ff366</id>
<content type='text'>
a shortcut bypassing expensive computation, so change goto err to
goto done. Bug introduced in last refactoring before commit.
</content>
</entry>
<entry>
<title>Tweak some comments and whitespace around comments</title>
<updated>2022-07-29T08:32:20+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2022-07-29T08:32:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=523c0c6c53509dfcd42a189b00dd3864cb9d524d'/>
<id>urn:sha1:523c0c6c53509dfcd42a189b00dd3864cb9d524d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Expand the comment explaining the for loop with bn_lucas_step() a bit.</title>
<updated>2022-07-15T06:19:27+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2022-07-15T06:19:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=2bc04a5c63b7594d7a7dfc9e582538e7a9267baf'/>
<id>urn:sha1:2bc04a5c63b7594d7a7dfc9e582538e7a9267baf</id>
<content type='text'>
</content>
</entry>
</feed>
