mbedtls_sha512_ret() function
This function calculates the SHA-512 or SHA-384 checksum of a buffer. The function allocates the context, performs the calculation, and frees the context. The SHA-512 result is calculated as output = SHA-512(input buffer).
Syntax
int mbedtls_sha512_ret(const unsigned char *input,
size_t ilen,
unsigned char output[64],
int is384);
Arguments
input
The buffer holding the input data. This must be a readable buffer of length \p ilen Bytes.
ilen
The length of the input data in Bytes.
output
The SHA-384 or SHA-512 checksum result. This must be a writable buffer of length \c 64 Bytes.
is384
Determines which function to use. This must be either \c 0 for SHA-512, or \c 1 for SHA-384.
Return value
\c 0 on success. A negative error code on failure.
Notes
When \c MBEDTLS_SHA512_NO_SHA384 is defined, \p is384 must be \c 0, or the function will return #MBEDTLS_ERR_SHA512_BAD_INPUT_DATA.