Skip to content

Latest commit

 

History

History
51 lines (32 loc) · 1.23 KB

GUID-7F0C0AFA-092D-4251-8C0F-BF9AB01B52E0.md

File metadata and controls

51 lines (32 loc) · 1.23 KB

CRYPT_SHA384_Finalize Function

Parent topic:MPLAB® Harmony Crypto Library

C

int CRYPT_SHA384_Finalize(
    CRYPT_SHA384_CTX* sha384, 
    unsigned char* digest
);

Description

This function finalizes the hash and puts the result into digest.

Preconditions

The SHA384 context must be initialized prior to calling this function. The context must not be modified by code outside of this function.

Parameters

Parameters Description
sha384 Pointer to CRYPT_SHA384_CTX structure which holds the hash values.
digest Pointer to byte array to store hash result.

Returns

  • BAD_FUNC_ARG - An invalid pointer was passed to the function, either in sha384 or digest.

  • 0 - An invalid pointer was not passed to the function.

Remarks

In order to preserve the validity of the SHA384 hash, nothing must modify the context holding variable between calls to CRYPT_SHA384_DataAdd and CRYPT_SHA384_Finalize.

Example

CRYPT_SHA384_CTX sha384;
uint8_t buffer[1024];
uint8_t shaSum[SHA384_DIGEST_SIZE];

CRYPT_SHA384_Initialize(&sha384);
CRYPT_SHA384_DataAdd(&sha384, buffer, sizeof(buffer));
CRYPT_SHA384_Finalize(&sha384, shaSum);