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

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS AESXTSDecrypt (MOC_SYM(hwAccelDescr hwAccelCtx) aesXTSCipherContext *pCtx, ubyte pTweak[AES_BLOCK_SIZE], ubyte *pCipher, ubyte4 cipherLen)
 Decrypt some data using AES in XTS mode. More...
 
MOC_EXTERN MSTATUS AESXTSDecryptExt (MOC_SYM(hwAccelDescr hwAccelCtx) aesXTSCipherContext *pCtx, ubyte pTweak[AES_BLOCK_SIZE], ubyte *pCipher, ubyte4 cipherLen, void *pExtCtx)
 
MOC_EXTERN MSTATUS AESXTSEncrypt (MOC_SYM(hwAccelDescr hwAccelCtx) aesXTSCipherContext *pCtx, ubyte pTweak[AES_BLOCK_SIZE], ubyte *pPlain, ubyte4 plainLen)
 Encrypt some data using AES in XTS mode. More...
 
MOC_EXTERN MSTATUS AESXTSEncryptExt (MOC_SYM(hwAccelDescr hwAccelCtx) aesXTSCipherContext *pCtx, ubyte pTweak[AES_BLOCK_SIZE], ubyte *pPlain, ubyte4 plainLen, void *pExtCtx)
 
MOC_EXTERN MSTATUS AESXTSInit (MOC_SYM(hwAccelDescr hwAccelCtx) aesXTSCipherContext *pCtx, const ubyte *pKey1, const ubyte *pKey2, sbyte4 keyLength, sbyte4 encrypt)
 Initialize a previously allocated AES-XTS context. More...
 
MOC_EXTERN MSTATUS AESXTSInitExt (MOC_SYM(hwAccelDescr hwAccelCtx) aesXTSCipherContext *pCtx, const ubyte *pKey1, const ubyte *pKey2, sbyte4 keyLength, sbyte4 encrypt, void *pExtCtx)
 
MOC_EXTERN MSTATUS CloneAESXTSCtx (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, BulkCtx *ppNewCtx)
 Clone an AES-XTS context. More...
 
MOC_EXTERN BulkCtx CreateAESXTSCtx (MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *pKeyMaterial, sbyte4 keyLength, sbyte4 encrypt)
 Create a new AES-XTS context. More...
 
MOC_EXTERN BulkCtx CreateAESXTSCtxExt (MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *pKeyMaterial, sbyte4 keyLength, sbyte4 encrypt, void *pExtCtx)
 
MOC_EXTERN MSTATUS DeleteAESXTSCtx (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *pCtx)
 Delete an existing AES-XTS context. More...
 
MOC_EXTERN MSTATUS DeleteAESXTSCtxExt (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *pCtx, void *pExtCtx)
 
MOC_EXTERN MSTATUS DoAESXTS (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, sbyte4 dataLen, sbyte4 encrypt, ubyte *pTweak)
 Encrypt or decrypt data using AES in XTS mode. More...
 
MOC_EXTERN MSTATUS DoAESXTSExt (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, sbyte4 dataLen, sbyte4 encrypt, ubyte *pTweak, void *pExtCtx)
 

Detailed Description

AES developer API header. This header file contains definitions, enumerations, structures, and function declarations used for AES encryption and decryption.

Since
3.0.6
Version
5.0.5 and later

! Flags There are no flag dependencies to enable the functions in this header file.

! External Functions This file contains the following public ($extern$) function declarations:

  • CreateAESXTSCtx
  • DeleteAESXTSCtx
  • DoAESXTS

Function Documentation

◆ AESXTSDecrypt()

MOC_EXTERN MSTATUS AESXTSDecrypt ( MOC_SYM(hwAccelDescr hwAccelCtx) aesXTSCipherContext *  pCtx,
ubyte  pTweak[AES_BLOCK_SIZE],
ubyte *  pCipher,
ubyte4  cipherLen 
)

Note this operation is in place.

Parameters
pCtxThe AES-XTS context to use to decrypt the data.
pTweakThe tweak value for this decryption operation.
pCipherThe data to be decrypted.
cipherLenSize in bytes of the data to be decrypted.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

◆ AESXTSEncrypt()

MOC_EXTERN MSTATUS AESXTSEncrypt ( MOC_SYM(hwAccelDescr hwAccelCtx) aesXTSCipherContext *  pCtx,
ubyte  pTweak[AES_BLOCK_SIZE],
ubyte *  pPlain,
ubyte4  plainLen 
)

Note this operation is in place.

Parameters
pCtxThe AES-XTS context to use to encrypt the data.
pTweakThe tweak value for this encryption operation.
pPlainThe plaintext to be encrypted.
plainLenSize in bytes of the plaintext data.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

◆ AESXTSInit()

MOC_EXTERN MSTATUS AESXTSInit ( MOC_SYM(hwAccelDescr hwAccelCtx) aesXTSCipherContext *  pCtx,
const ubyte *  pKey1,
const ubyte *  pKey2,
sbyte4  keyLength,
sbyte4  encrypt 
)
Parameters
pCtxCaller allocated context to be keyed.
pKey1Key 1 to use for this operation.
pKey2Key 2 to use for this operation.
keyLengthLength of a single key, must be either 128 or 256.
encryptTRUE to encrypt data, FALSE to decrypt data.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

◆ CloneAESXTSCtx()

MOC_EXTERN MSTATUS CloneAESXTSCtx ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  pCtx,
BulkCtx *  ppNewCtx 
)
Parameters
pCtxPointer to an instantiated BulkCtx.
ppNewCtxDouble pointer to the BulkCtx to be created and populated with the data from the source context.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

◆ CreateAESXTSCtx()

MOC_EXTERN BulkCtx CreateAESXTSCtx ( MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *  pKeyMaterial,
sbyte4  keyLength,
sbyte4  encrypt 
)
Parameters
pKeyMaterialPointer to the buffer containing the concatenation of key1 and key2.
keyLengthThe total length of the keyMaterial, or the length of both key1 and key2. For AES-128 use 256, for AES-256 use 512, no other values will be accepted.
encryptTRUE to encrypt data, FALSE otherwise.
Returns
NULL if any error; otherwise pointer to created AES-XTS context.

◆ DeleteAESXTSCtx()

MOC_EXTERN MSTATUS DeleteAESXTSCtx ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *  pCtx)
Parameters
pCtxPointer to the AES-XTS context to delete.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

◆ DoAESXTS()

MOC_EXTERN MSTATUS DoAESXTS ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  pCtx,
ubyte *  pData,
sbyte4  dataLen,
sbyte4  encrypt,
ubyte *  pTweak 
)

Note this function operates on the data in place.

Parameters
pCtxAES-XTS to use for this operation.
pDataBuffer containing the data to encrypt or decrypt. The operation is in place so it will contain the result upon return.
dataLenThe number of bytes to encrypt or decrypt.
encryptTRUE to encrypt data, FALSE to decrypt data.
pTweakInitialization vector, ie tweak valuem, for the operation, must be exactly 16 bytes.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.