Skip to content

Latest commit

 

History

History
53 lines (34 loc) · 1.29 KB

GUID-246308C1-09EB-4750-BD1E-15DDFE23BDC0.md

File metadata and controls

53 lines (34 loc) · 1.29 KB

CRYPT_SHA224_DataAdd Function

Parent topic:MPLAB® Harmony Crypto Library

C

int CRYPT_SHA224_DataAdd(
    CRYPT_SHA256_CTX* sha224, 
    const unsigned char* input, 
    unsigned int sz
);

Description

This function updates the hash with the data provided.

Preconditions

The SHA224 context must be initialized prior to the first call of this function. The context must not be modified by code outside of this function.

Parameters

Parameters Description
sha224 Pointer to CRYPT_SHA256_CTX structure which holds the hash values.
input Pointer to the data to use to update the hash.
sz Size of the data (in bytes) to use to update the hash.

Returns

  • BAD_FUNC_ARG - An invalid pointer was passed to the function, either sha224 or input.

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

Remarks

In order to preserve the validity of the SHA224 hash, nothing must modify the context holding variable between calls to CRYPT_SHA224_DataAdd.

Example

CRYPT_SHA256_CTX sha224;
uint8_t buffer[1024];
uint8_t shaSum[SHA224_DIGEST_SIZE];

CRYPT_SHA224_Initialize(&sha224);
CRYPT_SHA224_DataAdd(&sha224, buffer, sizeof(buffer));
CRYPT_SHA224_Finalize(&sha224, shaSum);