<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openbsd/src/lib/libcrypto/bn/bn_mod.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-05-10T05:54:39+00:00</updated>
<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>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>Disallow aliasing of return value and modulus</title>
<updated>2023-06-13T09:28:13+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-06-13T09:28:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=97b300721913624967af4405071db409292eccee'/>
<id>urn:sha1:97b300721913624967af4405071db409292eccee</id>
<content type='text'>
All the functions changed in this commit would silently misbehave if the
return value aliases the modulus, most of the time they would succeed and
return an incorrect result of 0 in that situation. This adjusts all the
functions in BN_mod.c, others and documentation will follow later.

Prompted by a bug report about BN_mod_inverse() by Guido Vranken.

ok jsing
</content>
</entry>
<entry>
<title>Convert BN_copy() with explicit comparison against NULL to bn_copy()</title>
<updated>2023-03-27T10:21:23+00:00</updated>
<author>
<name>tb</name>
<email></email>
</author>
<published>2023-03-27T10:21:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=a81a8ccd42d8aec45ab93fd62a292dc1d27c0db6'/>
<id>urn:sha1:a81a8ccd42d8aec45ab93fd62a292dc1d27c0db6</id>
<content type='text'>
ok jsing
</content>
</entry>
<entry>
<title>Clean up and simplify BN_mod_lshift{,_quick}().</title>
<updated>2023-02-03T05:15:40+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2023-02-03T05:15:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=ba26b03fd32705c4a038e9d1f6210d5676b9d200'/>
<id>urn:sha1:ba26b03fd32705c4a038e9d1f6210d5676b9d200</id>
<content type='text'>
BN_mod_lshift() already has a BN_CTX available, make use of it rather than
calling BN_dup() and BN_free().

In BN_mod_lshift_quick(), BN_copy() already handles dst == src, so avoid
checking this before the call. The max_shift == 0 case can also be handled
without code duplication. And as with other *_quick() functions, use
BN_ucmp() and BN_usub() directly given the 0 &lt;= a &lt; m constraint.

ok tb@
</content>
</entry>
<entry>
<title>Clean up BN_mod_mul() and simplify BN_mod_sqr().</title>
<updated>2023-02-03T05:10:57+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2023-02-03T05:10:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=32ac52a956aaf1824ef75d5eb466402227074a5b'/>
<id>urn:sha1:32ac52a956aaf1824ef75d5eb466402227074a5b</id>
<content type='text'>
Use the same naming/code pattern in BN_mod_mul() as is used in BN_mul().
Note that the 'rr' allocation is unnecessary, since both BN_mul() and
BN_sqr() handle the case where r == a || r == b. However, it avoids a
potential copy on the exit from BN_mul()/BN_sqr(), so leave it in place
for now.

Turn BN_mod_sqr() into a wrapper that calls BN_mod_mul(), since it already
calls BN_sqr() in the a == b. The supposed gain of calling BN_mod_ct()
instead of BN_nnmod() does not really exist.

ok tb@
</content>
</entry>
<entry>
<title>Simplify BN_mod_{lshift1,sub}_quick().</title>
<updated>2023-02-03T05:06:20+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2023-02-03T05:06:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=9b5bdc5a2c900891ed84604e8f1dc4031ce86c5b'/>
<id>urn:sha1:9b5bdc5a2c900891ed84604e8f1dc4031ce86c5b</id>
<content type='text'>
The BN_mod_.*_quick() functions require that their inputs are non-negative
and are already reduced. As such, they can and should use BN_ucmp() and
BN_usub() instead of BN_cmp() and BN_add()/BN_sub() (which internally call
BN_uadd()/BN_usub() and potentially BN_cmp()).

ok tb@
</content>
</entry>
<entry>
<title>Simplify BN_nnmod().</title>
<updated>2023-02-03T04:55:13+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2023-02-03T04:55:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=f870a43c7d4f6107102f51cfb8ab3ceed8174aec'/>
<id>urn:sha1:f870a43c7d4f6107102f51cfb8ab3ceed8174aec</id>
<content type='text'>
In the case that the result is negative (i.e. one of a or m is negative),
the positive result can be achieved via a single BN_usub(). This simplifies
BN_nnmod() and avoids indirection via BN_add()/BN_sub(), which do BN_cmp()
and then call into BN_uadd()/BN_usub().

ok tb@
</content>
</entry>
<entry>
<title>Turn BN_mod_{ct,nonct}() into symbols.</title>
<updated>2023-02-03T04:47:59+00:00</updated>
<author>
<name>jsing</name>
<email></email>
</author>
<published>2023-02-03T04:47:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/openbsd/commit/?id=8b10be91597fd302cf722f7134d12c80cb64e83f'/>
<id>urn:sha1:8b10be91597fd302cf722f7134d12c80cb64e83f</id>
<content type='text'>
Also use accurate/useful variables names.

ok 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>
