1.14 CRYPT_AES_DIRECT_Decrypt Function
C
int CRYPT_AES_DIRECT_Decrypt(
CRYPT_AES_CTX* aes,
unsigned char* out,
const unsigned char* in
);
Description
This function decrypts one block of data, equal to the AES block size.
Preconditions
Key and Initialization Vector (IV) must be set earlier with a call to CRYPT_AES_KeySet and CRYPT_AES_IvSet.
Parameters
Parameters | Description |
---|---|
aes | Pointer to context which saves state between calls. |
out | Pointer to buffer to store the results of the decryption. |
in | Pointer to buffer where the data to decrypt is located. |
Returns
BAD_FUNC_ARG - An invalid pointer was passed to the function.
0 - An invalid pointer was not passed to the function.
Remarks
Input and output buffers must be equal in size (CRYPT_AES_BLOCK_SIZE).
Example
CRYPT_AES_CTX mcAes;
int ret;
byte out1[CRYPT_AES_BLOCK_SIZE];
byte out2[CRYPT_AES_BLOCK_SIZE];
strncpy((char*)key, "1234567890abcdefghijklmnopqrstuv", 32);
strncpy((char*)iv, "1234567890abcdef", 16);
ret = CRYPT_AES_KeySet(&mcAes, key, 16, iv, CRYPT_AES_ENCRYPTION);
ret = CRYPT_AES_DIRECT_Decrypt(&mcAes, out2, out1);