summaryrefslogtreecommitdiff
path: root/src/usr.bin
diff options
context:
space:
mode:
authortb <>2023-04-11 10:08:44 +0000
committertb <>2023-04-11 10:08:44 +0000
commit2389f1d8a42806b852cf81082f3eb70ecbfdd8ae (patch)
tree1a8331f19d48335fd135b93854c36f2ea3244918 /src/usr.bin
parented39abf2dcf0e5422ecdb755974b914bf9225ed6 (diff)
downloadopenbsd-2389f1d8a42806b852cf81082f3eb70ecbfdd8ae.tar.gz
openbsd-2389f1d8a42806b852cf81082f3eb70ecbfdd8ae.tar.bz2
openbsd-2389f1d8a42806b852cf81082f3eb70ecbfdd8ae.zip
Add a new implementation of BN_mod_sqrt()
This is a reimplementation from scratch of the Tonelli-Shanks algorithm based on Henri Cohen "A Course in Computational Algebraic Number Theory", Springer GTM 138, section 1.5.1. It is API compatible with the previous implementation, so no documentation change is required. Contrary to the old implementation, this does not have any infinite loops and has various additional sanity checks to prevent misbehavior in case the input modulus is not a prime. It contains extensive comments and the individual parts of the algorithm are split into digestible chunks instead of having one huge function. One difference of note is that it BN_mod_sqrt() now always returns the smaller of the two possible answers. In other words, while its core is non-deterministic, its answer is not. ok jsing
Diffstat (limited to 'src/usr.bin')
0 files changed, 0 insertions, 0 deletions