![]() |
TrustCore SDK NanoCrypto API reference
version 7.0
|
Header file for the NanoCrypto AES-ECB API. More...
Go to the source code of this file.
Functions | |
MOC_EXTERN BulkCtx | CreateAESECBCtx (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *keyMaterial, sbyte4 keyLength, sbyte4 encrypt) |
Get a new AES-ECB context data structure and prepare the key schedule. More... | |
MOC_EXTERN MSTATUS | DeleteAESECBCtx (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *ctx) |
Delete AES-ECB context data structure. More... | |
MOC_EXTERN MSTATUS | DoAESECB (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *data, sbyte4 dataLength, sbyte4 encrypt) |
AES-encrypt or AES-decrypt a data buffer. More... | |
Header file for the NanoCrypto AES-ECB API.
MOC_EXTERN BulkCtx CreateAESECBCtx | ( | MOC_SYM(hwAccelDescr hwAccelCtx) ubyte * | keyMaterial, |
sbyte4 | keyLength, | ||
sbyte4 | encrypt | ||
) |
This function creates and returns a context data structure for AES operations, and prepares the key schedule (intermediate key material). This is the first function your application calls when performing AES operations (encryption or decryption). Your application uses the returned structure in subsequent DoAESECB() function calls.
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | AES-ECB |
The AES-ECB context is an opaque data structure that holds information such as key length, key schedule, and mode of operation. To avoid memory leaks, your application code must call the DeleteAESECBCtx() function after completing AES-related operations (because the AES-ECB context is dynamically allocated by this function during context creation).
NULL
is returned for the context pointer, you cannot use it as input to any subsequent AES function calls.To enable this function, the following flag must not be defined:
__DISABLE_AES_CIPHERS__
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. But... what does the user specify? In the 5.3.1 docs, we just said that this was "Reserved for future use." Ditto this for all aes_ecb.{c,h} functions. |
keyMaterial | AES key to use for encryption or decryption. |
keyLength | Number of bytes in AES key; valid key lengths are: 128, 192, and 256. |
encrypt | TRUE to prepare the key schedule for encryption; FALSE to prepare the key schedule for decryption. |
NULL
if any error; otherwise pointer to created AES-ECB context.MOC_EXTERN MSTATUS DeleteAESECBCtx | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx * | ctx | ) |
This function deletes an AES-ECB context previously created by CreateAESECBCtx(). To avoid memory leaks, your application must call this function after completing AES-related operations for a given context.
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | AES-ECB |
To enable this function, the following flag must not be defined:
__DISABLE_AES_CIPHERS__
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
ctx | Pointer to the AES-ECB context to delete. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.MOC_EXTERN MSTATUS DoAESECB | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | ctx, |
ubyte * | data, | ||
sbyte4 | dataLength, | ||
sbyte4 | encrypt | ||
) |
This function AES-encrypts or AES-decrypts a data buffer. Before calling this function, your application must call the CreateAESECBCtx() function to dynamically create a valid AES-ECB context.
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | AES-ECB |
To enable this function, the following flag must not be defined:
__DISABLE_AES_CIPHERS__
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
ctx | AES-ECB context, previously created by CreateAESECBCtx(). |
data | Data to be encrypted or decrypted. |
dataLength | Number of bytes of data to be encrypted or decrypted (data ). |
encrypt | TRUE to encrypt the data; FALSE to decrypt the data. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.