Clarify all functions operate modulo N

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
Werner Lewis 2022-12-14 17:08:43 +00:00
parent a306886b3a
commit 1d89ebf548
2 changed files with 14 additions and 14 deletions

View File

@ -46,15 +46,15 @@
* sizes. Most functions will not check that input values are in canonical * sizes. Most functions will not check that input values are in canonical
* form (i.e. that \p A < \p N), this is only checked during setup of a * form (i.e. that \p A < \p N), this is only checked during setup of a
* residue structure. * residue structure.
* - **Modular representatives**: functions that operate modulo \p N expect * - **Modular representatives**: all functions expect inputs to be in the
* all modular inputs to be in the range [0, \p N - 1] and guarantee outputs * range [0, \p N - 1] and guarantee outputs in the range [0, \p N - 1].
* in the range [0, \p N - 1]. Residues are setup with an associated modulus, * Residues are set up with an associated modulus, and operations are only
* and operations are only guaranteed to work if the modulus is associated * guaranteed to work if the modulus is associated with all residue
* with all residue parameters. If a residue is passed with a modulus other * parameters. If a residue is passed with a modulus other than the one it
* than the one it is associated with, then it may be out of range. If an * is associated with, then it may be out of range. If an input is out of
* input is out of range, outputs are fully unspecified, though bignum values * range, outputs are fully unspecified, though bignum values out of range
* out of range should not cause buffer overflows (beware that this is not * should not cause buffer overflows (beware that this is not extensively
* extensively tested). * tested).
*/ */
/* /*

View File

@ -51,11 +51,11 @@
* modulus may lead to buffer overflows. Some functions which allocate * modulus may lead to buffer overflows. Some functions which allocate
* memory or handle reading/writing of bignums will return an error if * memory or handle reading/writing of bignums will return an error if
* memory allocation fails or if buffer sizes are invalid. * memory allocation fails or if buffer sizes are invalid.
* - **Modular representatives**: functions that operate modulo \p N expect * - **Modular representatives**: all functions expect inputs to be in the
* all modular inputs to be in the range [0, \p N - 1] and guarantee outputs * range [0, \p N - 1] and guarantee outputs in the range [0, \p N - 1]. If
* in the range [0, \p N - 1]. If an input is out of range, outputs are * an input is out of range, outputs are fully unspecified, though bignum
* fully unspecified, though bignum values out of range should not cause * values out of range should not cause buffer overflows (beware that this is
* buffer overflows (beware that this is not extensively tested). * not extensively tested).
*/ */
/* /*