<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openbsd/src/lib/libcrypto/bn/bn_prime.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-11-08T16:27:33+00:00</updated>
<entry>
<title>bn_prime.c: fix includes</title>
<updated>2025-11-08T16:27:33+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-11-08T16:27:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=286cd02a2b95cd94707d1ae63155b59302dfefc7'/>
<id>urn:sha1:286cd02a2b95cd94707d1ae63155b59302dfefc7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Use BN_ULONG in probable_prime_dh()</title>
<updated>2025-11-06T09:04:14+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-11-06T09:04:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=6ed58e3a351fdb740941af76336021fa436f2fda'/>
<id>urn:sha1:6ed58e3a351fdb740941af76336021fa436f2fda</id>
<content type='text'>
This was the last user of BN_LONG in code. It had no reason to do so.
BN_mod_word() returns a BN_ULONG and since the largest prime in the
small primes table primes[] is well below 20000, the only return value
that could cause 'mod' to be negative was the error sentinel (BN_ULONG)-1.

ok jsing kenjiro
</content>
</entry>
<entry>
<title>Use err_local.h rather than err.h in most places</title>
<updated>2025-05-10T05:54:39+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2025-05-10T05:54:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=41e8f99dd1625a9f0c80ce9d4383e95b18e85709'/>
<id>urn:sha1:41e8f99dd1625a9f0c80ce9d4383e95b18e85709</id>
<content type='text'>
ok jsing
</content>
</entry>
<entry>
<title>Cap the size of numbers we check for primality</title>
<updated>2023-07-20T06:26:27+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-07-20T06:26:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=56d542857440491347766bf6ba84a87a30bd89d5'/>
<id>urn:sha1:56d542857440491347766bf6ba84a87a30bd89d5</id>
<content type='text'>
We refuse to generate RSA keys larger than 16k and DH keys larger than 10k.
Primality checking with adversarial input is a DoS vector, so simply don't
do this. Introduce a cap of 32k for numbers we try to test for primality,
which should be more than large enough for use withing a non-toolkit crypto
library. This is one way of mitigating the DH_check()/EVP_PKEY_param_check()
issue.

ok jsing miod
</content>
</entry>
<entry>
<title>Hide symbols in bn</title>
<updated>2023-07-08T12:21:58+00:00</updated>
<author>
<name>beck</name>
<email></email>
</author>
<published>2023-07-08T12:21:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=1dad5f352903aa46e83f0b1265298f7e1d4a9633'/>
<id>urn:sha1:1dad5f352903aa46e83f0b1265298f7e1d4a9633</id>
<content type='text'>
ok tb@
</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>Remove the deprecated API from BN</title>
<updated>2023-04-25T19:57:59+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-04-25T19:57:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=6ac0e3f4bfac557d01cfe3db37f290043cb40fcb'/>
<id>urn:sha1:6ac0e3f4bfac557d01cfe3db37f290043cb40fcb</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Remove comment referencing bn_depr.c.</title>
<updated>2023-01-28T17:13:26+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2023-01-28T17:13:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=17386415d55771d67a68ba313efc023da600305f'/>
<id>urn:sha1:17386415d55771d67a68ba313efc023da600305f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Move the three functions that are in bn_depr.c back to bn_prime.c.</title>
<updated>2023-01-28T17:09:00+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2023-01-28T17:09:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=4da20c782e375b6949d9395de699d6cc4071721b'/>
<id>urn:sha1:4da20c782e375b6949d9395de699d6cc4071721b</id>
<content type='text'>
They should go away, but they have not yet disappeared and this
consolidates the source files.

Discussed with tb@
</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>
</feed>
