Skip to content

Latest commit

 

History

History
52 lines (32 loc) · 884 Bytes

GUID-10763C36-E98E-46CB-BFA0-66DC81C54B6E.md

File metadata and controls

52 lines (32 loc) · 884 Bytes

CRYPT_AES_GCM_SetKey Function

Parent topic:MPLAB® Harmony Crypto Library

C

int CRYPT_AES_GCM_SetKey(
    CRYPT_AES_CTX* aes, 
    const unsigned char* key, 
    unsigned int len
);

Description

This function sets the key that AES will later perform.

Preconditions

None.

Parameters

Parameters Description
aes Pointer to context which saves state between calls.
key Pointer to buffer holding the key itself.
len Length of key in bytes.

Returns

  • BAD_FUNC_ARG - An invalid pointer was passed to the function.

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

Remarks

None.

Example

CRYPT_AES_CTX mcAes;
int           ret;

strncpy((char*)key, "1234567890abcdefghijklmnopqrstuv", 32);

ret = CRYPT_AES_GCM_SetKey(&mcAes, key, 16);