Bignum Mod: improve documentation
Signed-off-by: Janos Follath <janos.follath@arm.com> Co-authored-by: Tom Cosgrove <tom.cosgrove@arm.com> Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
41427dee80
commit
fc6fbb4e96
1 changed files with 15 additions and 15 deletions
|
@ -74,30 +74,30 @@ typedef struct {
|
||||||
|
|
||||||
/** Setup a residue structure.
|
/** Setup a residue structure.
|
||||||
*
|
*
|
||||||
* The residue will be set up with the \p p buffer \p m modulus.
|
* The residue will be set up with the buffer \p p and modulus \p m.
|
||||||
*
|
*
|
||||||
* The memory pointed by \p p will be used by the resulting residue structure.
|
* The memory pointed to by \p p will be used by the resulting residue structure.
|
||||||
* The value at the pointed memory will be the initial value of \p r and must
|
* The value at the pointed-to memory will be the initial value of \p r and must
|
||||||
* hold a value that is less than the modulus. This value will be used as it is
|
* hold a value that is less than the modulus. This value will be used as-is
|
||||||
* and interpreted according to the value of the `m->int_rep` field.
|
* and interpreted according to the value of the `m->int_rep` field.
|
||||||
*
|
*
|
||||||
* The modulus \p m will be the modulus associated with \p r. The residue \p r
|
* The modulus \p m will be the modulus associated with \p r. The residue \p r
|
||||||
* should only be used in operations where the modulus is \p m or a modulus
|
* should only be used in operations where the modulus is \p m or a modulus
|
||||||
* equivalent to \p m (in the sense that all their fields or memory pointed by
|
* equivalent to \p m (in the sense that all their fields or memory pointed to by
|
||||||
* their fields hold the same value).
|
* their fields hold the same value).
|
||||||
*
|
*
|
||||||
* \param[out] r The address of residue to setup. The resulting structure's
|
* \param[out] r The address of the residue to setup. The resulting structure's
|
||||||
* size is determined by \p m.
|
* size is determined by \p m.
|
||||||
* \param[in] m The address of the modulus related to \p r.
|
* \param[in] m The address of the modulus related to \p r.
|
||||||
* \param[in] p The address of the limb array storing the value of \p r.
|
* \param[in] p The address of the limb array containing the value of \p r.
|
||||||
* The memory pointed to by \p p will be used by \p r and must
|
* The memory pointed to by \p p will be used by \p r and must
|
||||||
* not be modified in any way until after
|
* not be modified in any way until after
|
||||||
* mbedtls_mpi_mod_residue_release() is called. The data
|
* mbedtls_mpi_mod_residue_release() is called. The data
|
||||||
* pointed by \p p should be less than the modulus (the value
|
* pointed to by \p p must be less than the modulus (the value
|
||||||
* pointed by `m->p`) and already in the representation
|
* pointed to by `m->p`) and already in the representation
|
||||||
* indicated by `m->int_rep`.
|
* indicated by `m->int_rep`.
|
||||||
* \param p_limbs The number of limbs of \p p. It must have at most as
|
* \param p_limbs The number of limbs of \p p. Must be <= the number of
|
||||||
* many limbs as the modulus \p m.)
|
* limbs in the modulus \p m.)
|
||||||
*
|
*
|
||||||
* \return \c 0 if successful.
|
* \return \c 0 if successful.
|
||||||
* \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p p_limbs is less than the
|
* \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p p_limbs is less than the
|
||||||
|
@ -186,15 +186,15 @@ void mbedtls_mpi_mod_modulus_free( mbedtls_mpi_mod_modulus *m );
|
||||||
/** Read a residue from a byte buffer.
|
/** Read a residue from a byte buffer.
|
||||||
*
|
*
|
||||||
* The residue will be automatically converted to the internal representation
|
* The residue will be automatically converted to the internal representation
|
||||||
* based on the value of `m->int_rep` field.
|
* based on the value of the `m->int_rep` field.
|
||||||
*
|
*
|
||||||
* The modulus \p m will be the modulus associated with \p r. The residue \p r
|
* The modulus \p m will be the modulus associated with \p r. The residue \p r
|
||||||
* should only be used in operations where the modulus is \p m or a modulus
|
* should only be used in operations where the modulus is \p m or a modulus
|
||||||
* equivalent to \p m (in the sense that all their fields or memory pointed by
|
* equivalent to \p m (in the sense that all their fields or memory pointed by
|
||||||
* their fields hold the same value).
|
* their fields hold the same value).
|
||||||
*
|
*
|
||||||
* \param r The address of the residue. It must have as many limbs as
|
* \param r The address of the residue. It must have exactly the same
|
||||||
* the modulus \p m.
|
* number of limbs as the modulus \p m.
|
||||||
* \param m The address of the modulus.
|
* \param m The address of the modulus.
|
||||||
* \param buf The input buffer to import from.
|
* \param buf The input buffer to import from.
|
||||||
* \param buflen The length in bytes of \p buf.
|
* \param buflen The length in bytes of \p buf.
|
||||||
|
@ -237,7 +237,7 @@ int mbedtls_mpi_mod_read( mbedtls_mpi_mod_residue *r,
|
||||||
* \return #MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL if \p buf isn't
|
* \return #MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL if \p buf isn't
|
||||||
* large enough to hold the value of \p r (without leading
|
* large enough to hold the value of \p r (without leading
|
||||||
* zeroes).
|
* zeroes).
|
||||||
* \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if of \p ext_rep is invalid.
|
* \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p ext_rep is invalid.
|
||||||
*/
|
*/
|
||||||
int mbedtls_mpi_mod_write( const mbedtls_mpi_mod_residue *r,
|
int mbedtls_mpi_mod_write( const mbedtls_mpi_mod_residue *r,
|
||||||
const mbedtls_mpi_mod_modulus *m,
|
const mbedtls_mpi_mod_modulus *m,
|
||||||
|
|
Loading…
Reference in a new issue