1.18 CRYPT_AES_GCM_SetKey Function

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

ParametersDescription
aesPointer to context which saves state between calls.
keyPointer to buffer holding the key itself.
lenLength 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);