Header file for the NanoCrypto AES-EAX mode APIs.
More...
Go to the source code of this file.
|
MOC_EXTERN MSTATUS | AES_EAX_clear (MOC_SYM(hwAccelDescr hwAccelCtx) AES_EAX_Ctx *pCtx) |
| Zeros and frees memory allocated within an AES-EAX context. More...
|
|
MOC_EXTERN MSTATUS | AES_EAX_decryptMessage (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *msgData, sbyte4 msgLen, AES_EAX_Ctx *pCtx) |
| Decrypts in-place a buffer of data with an initialized AES-EAX context. More...
|
|
MOC_EXTERN MSTATUS | AES_EAX_encryptMessage (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *msgData, sbyte4 msgLen, AES_EAX_Ctx *pCtx) |
| Encrypts in-place a buffer of data with an initialized AES-EAX context. More...
|
|
MOC_EXTERN MSTATUS | AES_EAX_final (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte tag[], sbyte4 tagLen, AES_EAX_Ctx *pCtx) |
| Finalizes an AES-EAX encryption or decryption and outputs the tag for authentication. More...
|
|
MOC_EXTERN MSTATUS | AES_EAX_generateTag (MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *cipherText, sbyte4 cipherLen, const ubyte *header, sbyte4 headerLen, ubyte tag[], sbyte4 tagLen, AES_EAX_Ctx *pCtx) |
| Generates an AES-EAX tag from the ciphertext and header. More...
|
|
MOC_EXTERN MSTATUS | AES_EAX_getPlainText (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *cipherText, sbyte4 cipherLen, AES_EAX_Ctx *pCtx) |
| Decrypts ciphertext in-place from an initialized AES-EAX context. More...
|
|
MOC_EXTERN MSTATUS | AES_EAX_init (MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *keyMaterial, ubyte4 keyLength, const ubyte *nonce, ubyte4 nonceLength, AES_EAX_Ctx *pCtx) |
| Initializes an AES-EAX context with a key and nonce value. More...
|
|
MOC_EXTERN MSTATUS | AES_EAX_updateHeader (MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *headerData, sbyte4 dataLength, AES_EAX_Ctx *pCtx) |
| Updates the header portion of an AES-EAX context with a buffer of data. More...
|
|
Header file for the NanoCrypto AES-EAX mode APIs.
aes_eax.h
◆ AES_EAX_clear()
MOC_EXTERN MSTATUS AES_EAX_clear |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) AES_EAX_Ctx * |
pCtx | ) |
|
Zeros and frees memory allocated within an AES-EAX context.
- Parameters
-
pCtx | Pointer to the context to be cleared. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
aes_eax.h
◆ AES_EAX_decryptMessage()
MOC_EXTERN MSTATUS AES_EAX_decryptMessage |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) ubyte * |
msgData, |
|
|
sbyte4 |
msgLen, |
|
|
AES_EAX_Ctx * |
pCtx |
|
) |
| |
Decrypts in-place a buffer of data with an initialized AES-EAX context. This API can be used if you wish to verify the tag after decryption. If you need to verify the tag before performing any decryption, use the AES_EAX_generateTag
API first on an initialized context, and then AES_EAX_getPlainText
to get the plaintext.
- Parameters
-
msgData | Buffer holding the message data to be decrypted in place. |
msgLen | The length of the message data in bytes. |
pCtx | Pointer to a previously initialized context. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
aes_eax.h
◆ AES_EAX_encryptMessage()
MOC_EXTERN MSTATUS AES_EAX_encryptMessage |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) ubyte * |
msgData, |
|
|
sbyte4 |
msgLen, |
|
|
AES_EAX_Ctx * |
pCtx |
|
) |
| |
Encrypts in-place a buffer of data with an initialized AES-EAX context.
- Parameters
-
msgData | Buffer holding the message data to be encrypted in place. |
msgLen | The length of the message data in bytes. |
pCtx | Pointer to a previously initialized context. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
aes_eax.h
◆ AES_EAX_final()
MOC_EXTERN MSTATUS AES_EAX_final |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) ubyte |
tag[], |
|
|
sbyte4 |
tagLen, |
|
|
AES_EAX_Ctx * |
pCtx |
|
) |
| |
Finalizes an AES-EAX encryption or decryption and outputs the tag for authentication. If decrypting/verifying it is up to the user to verify that the tag output matches the expected tag. If you need to verify the tag before performing any decryption, use the AES_EAX_generateTag
API first on an initialized context, and then AES_EAX_getPlainText
to get the plaintext.
- Parameters
-
tag | Buffer that will hold the resulting tag. |
tagLen | The desired tag length in bytes. This cannot be more than 16. |
pCtx | Pointer to a previously initialized and updated context. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
aes_eax.h
◆ AES_EAX_generateTag()
MOC_EXTERN MSTATUS AES_EAX_generateTag |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte * |
cipherText, |
|
|
sbyte4 |
cipherLen, |
|
|
const ubyte * |
header, |
|
|
sbyte4 |
headerLen, |
|
|
ubyte |
tag[], |
|
|
sbyte4 |
tagLen, |
|
|
AES_EAX_Ctx * |
pCtx |
|
) |
| |
Generates an AES-EAX tag from the ciphertext and header. It is up to the user to verify that the tag output here matches the expected tag. This method should be used if you need to verify the tag before decrypting. You may use the AES_EAX_decryptMessage
and AES_EAX_final
APIs to decrypt and then verify a tag.
- Parameters
-
cipherText | Buffer holding the input ciphertext. |
cipherLen | The length of the ciphertext in bytes. |
header | Optional. Buffer holding the header as a byte array. |
headerLen | The length of the header in bytes. |
tag | Buffer that will hold the resulting tag. |
tagLen | The desired tag length in bytes. This cannot be more than 16. |
pCtx | Pointer to a previously initialized context. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
aes_eax.h
◆ AES_EAX_getPlainText()
MOC_EXTERN MSTATUS AES_EAX_getPlainText |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) ubyte * |
cipherText, |
|
|
sbyte4 |
cipherLen, |
|
|
AES_EAX_Ctx * |
pCtx |
|
) |
| |
Decrypts ciphertext in-place from an initialized AES-EAX context. This does not compute the tag. This API may be called as many times as neccessary. This API is provided for the case that the tag has already been computed and verified via AES_EAX_generateTag
. If you wish to verify the tag after decryption then you may also use the AES_EAX_decryptMessage
API to decrypt.
- Parameters
-
cipherText | Buffer holding the input ciphertext. |
cipherLen | The length of the ciphertext in bytes. |
pCtx | Pointer to a previously initialized context. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
aes_eax.h
◆ AES_EAX_init()
MOC_EXTERN MSTATUS AES_EAX_init |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte * |
keyMaterial, |
|
|
ubyte4 |
keyLength, |
|
|
const ubyte * |
nonce, |
|
|
ubyte4 |
nonceLength, |
|
|
AES_EAX_Ctx * |
pCtx |
|
) |
| |
Initializes an AES-EAX context with a key and nonce value. Memory is allocated within the AES-EAX context so be sure to call AES_EAX_clear
to free such memory when done with the context.
- Parameters
-
keyMaterial | Buffer holding an AES key. |
keyLength | The length of the key in bytes. This must be 16, 24, or 32. |
nonce | Optional. Buffer holding the nonce as a byte array. |
nonceLength | The length of the nonce in bytes. |
pCtx | Pointer to the context to be initialized. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
aes_eax.h
◆ AES_EAX_updateHeader()
MOC_EXTERN MSTATUS AES_EAX_updateHeader |
( |
MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte * |
headerData, |
|
|
sbyte4 |
dataLength, |
|
|
AES_EAX_Ctx * |
pCtx |
|
) |
| |
Updates the header portion of an AES-EAX context with a buffer of data. This method may be called as many times as necessary.
- Parameters
-
headerData | Buffer holding the header data as a byte array. |
dataLength | The length of the header data in bytes. |
pCtx | Pointer to the context to be updated. |
- Returns
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.
aes_eax.h