mbedtls_sha512() 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).
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 for SHA-512, \c 48 bytes for SHA-384.
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
is384 must be defined accordingly with the supported symbols in the config file. If: - is384 is 0, but \c MBEDTLS_SHA384_C is not defined, or - is384 is 1, but \c MBEDTLS_SHA512_C is not defined then the function will return #MBEDTLS_ERR_SHA512_BAD_INPUT_DATA.
mbedtls_sha512() is called by 1 function and calls 5 functions:
![]()
mbedtls_sha512()
mbedtls_sha512():
![]()
mbedtls_sha512()