github.com/gridfinity/goc25519sm (go): Package goc25519sm provides an implementation of scalar multiplication on the elliptic curve known as Curve25519.  This library provides functions mostly backwards-compatible with the implementations of 'ScalarBaseMult' and 'ScalarMult' provided in Google's "x/crypto/curve25519" library.  These functions, named 'OldScalarBaseMult' and 'OldScalarMult', provide for additional error checking with input and output validation, intended to provide equivalence and full compatibility with the implementation found in libsodium. These functions implement an API which is compatible with the original Go "x/crypto/curve25519" functions, but with the addition of returning errors, and are intended to provide an alternative to the X25519 function, future-proofed against possible changes to X25519. The goal is a "safer" library for certain specific classes of software, such as distributed consensus systems, which may be sensitive to behavior changes.  While these functions provide an API that is mostly backwards-compatible with the original ScalarMult and ScalarBaseMult, the added validation checks introduce the possibility that unchecked errors may result in additional and unintended cases of apparent zero or null output when processing malformed inputs, when compared to the original functions. However, these extra checks provide parity with the libsodium implementation. For this reason, it is very important that the return value is always checked for errors by the caller.  While not specific to this implementation, it should also be noted that users must be aware of the implications of copying into fixed size arrays, such as the possibility of truncation via unintended short copies, and must ensure the correctness of any code which makes use of these functions.  Users of this library should familiar with the nuances of working with Curve25519. Please review RFC-7748, RFC-8422, and https://cr.yp.to/ecdh.html.  For further details. It must also be acknowledged that verification and validation checks, as performed by this and other libraries, such as libsodium, are extremely controversial. For background, please review https://research.kudelskisecurity.com/2017/04/25/should-ecdh-keys-be-validated/, https://moderncrypto.org/mail-archive/curves/2017/000896.html, https://vnhacker.blogspot.com/2016/08/the-internet-of-broken-protocols.html, https://vnhacker.blogspot.com/2015/09/why-not-validating-curve25519-public.html, and https://moderncrypto.org/mail-archive/noise/2017/000971.html.
Keywords: 25519|ecc|scalarmult