mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 12:05:38 +01:00
Improve documentation of SHA-512 parameter preconditions
This commit is contained in:
parent
ff1052e6b0
commit
b5c99f5c72
@ -71,25 +71,26 @@ mbedtls_sha512_context;
|
|||||||
/**
|
/**
|
||||||
* \brief This function initializes a SHA-512 context.
|
* \brief This function initializes a SHA-512 context.
|
||||||
*
|
*
|
||||||
* \param ctx The SHA-512 context to initialize.
|
* \param ctx The SHA-512 context to initialize. This must
|
||||||
* Must not be \c NULL.
|
* not be \c NULL.
|
||||||
*/
|
*/
|
||||||
void mbedtls_sha512_init( mbedtls_sha512_context *ctx );
|
void mbedtls_sha512_init( mbedtls_sha512_context *ctx );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function clears a SHA-512 context.
|
* \brief This function clears a SHA-512 context.
|
||||||
*
|
*
|
||||||
* \param ctx The SHA-512 context to clear.
|
* \param ctx The SHA-512 context to clear. This may be \c NULL,
|
||||||
|
* in which case this function does nothing. If it
|
||||||
|
* is not \c NULL, it must point to an initialized
|
||||||
|
* SHA-512 context.
|
||||||
*/
|
*/
|
||||||
void mbedtls_sha512_free( mbedtls_sha512_context *ctx );
|
void mbedtls_sha512_free( mbedtls_sha512_context *ctx );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function clones the state of a SHA-512 context.
|
* \brief This function clones the state of a SHA-512 context.
|
||||||
*
|
*
|
||||||
* \param dst The destination context.
|
* \param dst The destination context. This must be initialized.
|
||||||
* Must not be \c NULL.
|
* \param src The context to clone. This must be initialized.
|
||||||
* \param src The context to clone.
|
|
||||||
* Must not be \c NULL.
|
|
||||||
*/
|
*/
|
||||||
void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
|
void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
|
||||||
const mbedtls_sha512_context *src );
|
const mbedtls_sha512_context *src );
|
||||||
@ -98,12 +99,12 @@ void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
|
|||||||
* \brief This function starts a SHA-384 or SHA-512 checksum
|
* \brief This function starts a SHA-384 or SHA-512 checksum
|
||||||
* calculation.
|
* calculation.
|
||||||
*
|
*
|
||||||
* \param ctx The SHA-512 context to initialize.
|
* \param ctx The SHA-512 context to use. This must be initialized.
|
||||||
* Must not be \c NULL.
|
* \param is384 Determines which function to use. This must be
|
||||||
* \param is384 Determines which function to use:
|
* either \c for SHA-512, or \c 1 for SHA-384.
|
||||||
* 0: Use SHA-512, or 1: Use SHA-384.
|
|
||||||
*
|
*
|
||||||
* \return \c 0 on success.
|
* \return \c 0 on success.
|
||||||
|
* \return A negative error code on failure.
|
||||||
*/
|
*/
|
||||||
int mbedtls_sha512_starts_ret( mbedtls_sha512_context *ctx, int is384 );
|
int mbedtls_sha512_starts_ret( mbedtls_sha512_context *ctx, int is384 );
|
||||||
|
|
||||||
@ -111,13 +112,15 @@ int mbedtls_sha512_starts_ret( mbedtls_sha512_context *ctx, int is384 );
|
|||||||
* \brief This function feeds an input buffer into an ongoing
|
* \brief This function feeds an input buffer into an ongoing
|
||||||
* SHA-512 checksum calculation.
|
* SHA-512 checksum calculation.
|
||||||
*
|
*
|
||||||
* \param ctx The SHA-512 context.
|
* \param ctx The SHA-512 context. This must be initialized
|
||||||
* Must not be \c NULL.
|
* and have a hash operation started.
|
||||||
* \param input The buffer holding the input data.
|
* \param input The buffer holding the input data. This must
|
||||||
* Must not be \c NULL if \p ilen is greater than 0.
|
* be a readable buffer of length \p ilen Bytes.
|
||||||
* \param ilen The length of the input data.
|
* It must not be \c NULL.
|
||||||
|
* \param ilen The length of the input data \p input in Bytes.
|
||||||
*
|
*
|
||||||
* \return \c 0 on success.
|
* \return \c 0 on success.
|
||||||
|
* \return A negative error code on failure.
|
||||||
*/
|
*/
|
||||||
int mbedtls_sha512_update_ret( mbedtls_sha512_context *ctx,
|
int mbedtls_sha512_update_ret( mbedtls_sha512_context *ctx,
|
||||||
const unsigned char *input,
|
const unsigned char *input,
|
||||||
@ -128,12 +131,13 @@ int mbedtls_sha512_update_ret( mbedtls_sha512_context *ctx,
|
|||||||
* the result to the output buffer. This function is for
|
* the result to the output buffer. This function is for
|
||||||
* internal use only.
|
* internal use only.
|
||||||
*
|
*
|
||||||
* \param ctx The SHA-512 context.
|
* \param ctx The SHA-512 context. This must be initialized
|
||||||
* Must not be \c NULL.
|
* and have a hash operation started.
|
||||||
* \param output The SHA-384 or SHA-512 checksum result.
|
* \param output The SHA-384 or SHA-512 checksum result.
|
||||||
* Must not be \c NULL.
|
* This must be a writable buffer of length \c 64 Bytes.
|
||||||
*
|
*
|
||||||
* \return \c 0 on success.
|
* \return \c 0 on success.
|
||||||
|
* \return A negative error code on failure.
|
||||||
*/
|
*/
|
||||||
int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx,
|
int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx,
|
||||||
unsigned char output[64] );
|
unsigned char output[64] );
|
||||||
@ -142,12 +146,13 @@ int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx,
|
|||||||
* \brief This function processes a single data block within
|
* \brief This function processes a single data block within
|
||||||
* the ongoing SHA-512 computation.
|
* the ongoing SHA-512 computation.
|
||||||
*
|
*
|
||||||
* \param ctx The SHA-512 context.
|
* \param ctx The SHA-512 context. This must be initialized
|
||||||
* Must not be \c NULL.
|
* and have a hash operation started.
|
||||||
* \param data The buffer holding one block of data.
|
* \param data The buffer holding one block of data. This
|
||||||
* Must not be \c NULL.
|
* must be a readable buffer of length \c 128 Bytes.
|
||||||
*
|
*
|
||||||
* \return \c 0 on success.
|
* \return \c 0 on success.
|
||||||
|
* \return A negative error code on failure.
|
||||||
*/
|
*/
|
||||||
int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx,
|
int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx,
|
||||||
const unsigned char data[128] );
|
const unsigned char data[128] );
|
||||||
@ -163,10 +168,9 @@ int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx,
|
|||||||
*
|
*
|
||||||
* \deprecated Superseded by mbedtls_sha512_starts_ret() in 2.7.0
|
* \deprecated Superseded by mbedtls_sha512_starts_ret() in 2.7.0
|
||||||
*
|
*
|
||||||
* \param ctx The SHA-512 context to initialize.
|
* \param ctx The SHA-512 context to use. This must be initialized.
|
||||||
* Must not be \c NULL.
|
* \param is384 Determines which function to use. This must be either
|
||||||
* \param is384 Determines which function to use:
|
* \c 0 for SHA-512 or \c 1 for SHA-384.
|
||||||
* 0: Use SHA-512, or 1: Use SHA-384.
|
|
||||||
*/
|
*/
|
||||||
MBEDTLS_DEPRECATED void mbedtls_sha512_starts( mbedtls_sha512_context *ctx,
|
MBEDTLS_DEPRECATED void mbedtls_sha512_starts( mbedtls_sha512_context *ctx,
|
||||||
int is384 );
|
int is384 );
|
||||||
@ -177,11 +181,11 @@ MBEDTLS_DEPRECATED void mbedtls_sha512_starts( mbedtls_sha512_context *ctx,
|
|||||||
*
|
*
|
||||||
* \deprecated Superseded by mbedtls_sha512_update_ret() in 2.7.0.
|
* \deprecated Superseded by mbedtls_sha512_update_ret() in 2.7.0.
|
||||||
*
|
*
|
||||||
* \param ctx The SHA-512 context.
|
* \param ctx The SHA-512 context. This must be initialized
|
||||||
* Must not be \c NULL.
|
* and have a hash operation started.
|
||||||
* \param input The buffer holding the data.
|
* \param input The buffer holding the data. This must be a readable
|
||||||
* Must not be \c NULL if \p ilen is greater than 0.
|
* buffer of length \p ilen Bytes. It must not be \c NULL.
|
||||||
* \param ilen The length of the input data.
|
* \param ilen The length of the input data \p input in Bytes.
|
||||||
*/
|
*/
|
||||||
MBEDTLS_DEPRECATED void mbedtls_sha512_update( mbedtls_sha512_context *ctx,
|
MBEDTLS_DEPRECATED void mbedtls_sha512_update( mbedtls_sha512_context *ctx,
|
||||||
const unsigned char *input,
|
const unsigned char *input,
|
||||||
@ -193,10 +197,10 @@ MBEDTLS_DEPRECATED void mbedtls_sha512_update( mbedtls_sha512_context *ctx,
|
|||||||
*
|
*
|
||||||
* \deprecated Superseded by mbedtls_sha512_finish_ret() in 2.7.0.
|
* \deprecated Superseded by mbedtls_sha512_finish_ret() in 2.7.0.
|
||||||
*
|
*
|
||||||
* \param ctx The SHA-512 context.
|
* \param ctx The SHA-512 context. This must be initialized
|
||||||
* Must not be \c NULL.
|
* and have a hash operation started.
|
||||||
* \param output The SHA-384 or SHA-512 checksum result.
|
* \param output The SHA-384 or SHA-512 checksum result. This must
|
||||||
* Must not be \c NULL.
|
* be a writable buffer of size \c 64 Bytes.
|
||||||
*/
|
*/
|
||||||
MBEDTLS_DEPRECATED void mbedtls_sha512_finish( mbedtls_sha512_context *ctx,
|
MBEDTLS_DEPRECATED void mbedtls_sha512_finish( mbedtls_sha512_context *ctx,
|
||||||
unsigned char output[64] );
|
unsigned char output[64] );
|
||||||
@ -208,10 +212,10 @@ MBEDTLS_DEPRECATED void mbedtls_sha512_finish( mbedtls_sha512_context *ctx,
|
|||||||
*
|
*
|
||||||
* \deprecated Superseded by mbedtls_internal_sha512_process() in 2.7.0.
|
* \deprecated Superseded by mbedtls_internal_sha512_process() in 2.7.0.
|
||||||
*
|
*
|
||||||
* \param ctx The SHA-512 context.
|
* \param ctx The SHA-512 context. This must be initialized and
|
||||||
* Must not be \c NULL.
|
* have a hash operation started.
|
||||||
* \param data The buffer holding one block of data.
|
* \param data The buffer holding one block of data. This must be
|
||||||
* Must not be \c NULL.
|
* a readable buffer of length \c 128 Bytes.
|
||||||
*/
|
*/
|
||||||
MBEDTLS_DEPRECATED void mbedtls_sha512_process(
|
MBEDTLS_DEPRECATED void mbedtls_sha512_process(
|
||||||
mbedtls_sha512_context *ctx,
|
mbedtls_sha512_context *ctx,
|
||||||
@ -230,15 +234,17 @@ MBEDTLS_DEPRECATED void mbedtls_sha512_process(
|
|||||||
* The SHA-512 result is calculated as
|
* The SHA-512 result is calculated as
|
||||||
* output = SHA-512(input buffer).
|
* output = SHA-512(input buffer).
|
||||||
*
|
*
|
||||||
* \param input The buffer holding the input data.
|
* \param input The buffer holding the input data. This must be
|
||||||
* Must not be \c NULL if \p ilen is greater than 0.
|
* a readable buffer of length \p ilen Bytes. It
|
||||||
* \param ilen The length of the input data.
|
* must not be \c NULL.
|
||||||
|
* \param ilen The length of the input data \p input in Bytes.
|
||||||
* \param output The SHA-384 or SHA-512 checksum result.
|
* \param output The SHA-384 or SHA-512 checksum result.
|
||||||
* Must not be \c NULL.
|
* This must be a writable buffer of length \c 64 Bytes.
|
||||||
* \param is384 Determines which function to use:
|
* \param is384 Determines which function to use. This must be either
|
||||||
* 0: Use SHA-512, or 1: Use SHA-384.
|
* \c 0 for SHA-512, or \c 1 for SHA-384.
|
||||||
*
|
*
|
||||||
* \return \c 0 on success.
|
* \return \c 0 on success.
|
||||||
|
* \return A negative error code on failure.
|
||||||
*/
|
*/
|
||||||
int mbedtls_sha512_ret( const unsigned char *input,
|
int mbedtls_sha512_ret( const unsigned char *input,
|
||||||
size_t ilen,
|
size_t ilen,
|
||||||
@ -263,13 +269,14 @@ int mbedtls_sha512_ret( const unsigned char *input,
|
|||||||
*
|
*
|
||||||
* \deprecated Superseded by mbedtls_sha512_ret() in 2.7.0
|
* \deprecated Superseded by mbedtls_sha512_ret() in 2.7.0
|
||||||
*
|
*
|
||||||
* \param input The buffer holding the data.
|
* \param input The buffer holding the data. This must be a
|
||||||
* Must not be \c NULL if \p ilen is greater than 0.
|
* readable buffer of length \p ilen Bytes. It
|
||||||
* \param ilen The length of the input data.
|
* must not be \c NULL.
|
||||||
* \param output The SHA-384 or SHA-512 checksum result.
|
* \param ilen The length of the input data \p input in Bytes.
|
||||||
* Must not be \c NULL.
|
* \param output The SHA-384 or SHA-512 checksum result. This must
|
||||||
* \param is384 Determines which function to use:
|
* be a writable buffer of length \c 64 Bytes.
|
||||||
* 0: Use SHA-512, or 1: Use SHA-384.
|
* \param is384 Determines which function to use. This must be eiher
|
||||||
|
* \c 0 for SHA-512, or \c 1 for SHA-384.
|
||||||
*/
|
*/
|
||||||
MBEDTLS_DEPRECATED void mbedtls_sha512( const unsigned char *input,
|
MBEDTLS_DEPRECATED void mbedtls_sha512( const unsigned char *input,
|
||||||
size_t ilen,
|
size_t ilen,
|
||||||
|
Loading…
Reference in New Issue
Block a user