TrustCore SDK NanoCrypto API reference  version 7.0
aes_eax.h File Reference

Header file for the NanoCrypto AES-EAX mode APIs. More...

Go to the source code of this file.

Functions

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...
 

Detailed Description

Header file for the NanoCrypto AES-EAX mode APIs.

aes_eax.h

Function Documentation

◆ 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
pCtxPointer 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
msgDataBuffer holding the message data to be decrypted in place.
msgLenThe length of the message data in bytes.
pCtxPointer 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
msgDataBuffer holding the message data to be encrypted in place.
msgLenThe length of the message data in bytes.
pCtxPointer 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
tagBuffer that will hold the resulting tag.
tagLenThe desired tag length in bytes. This cannot be more than 16.
pCtxPointer 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
cipherTextBuffer holding the input ciphertext.
cipherLenThe length of the ciphertext in bytes.
headerOptional. Buffer holding the header as a byte array.
headerLenThe length of the header in bytes.
tagBuffer that will hold the resulting tag.
tagLenThe desired tag length in bytes. This cannot be more than 16.
pCtxPointer 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
cipherTextBuffer holding the input ciphertext.
cipherLenThe length of the ciphertext in bytes.
pCtxPointer 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
keyMaterialBuffer holding an AES key.
keyLengthThe length of the key in bytes. This must be 16, 24, or 32.
nonceOptional. Buffer holding the nonce as a byte array.
nonceLengthThe length of the nonce in bytes.
pCtxPointer 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
headerDataBuffer holding the header data as a byte array.
dataLengthThe length of the header data in bytes.
pCtxPointer to the context to be updated.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

aes_eax.h