![]() |
TrustCore SDK Crypto Interface API reference
version 2.0
|
Cryptographic Interface header file for declaring AES-GCM functions. More...
Go to the source code of this file.
Functions | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_AES_GCM_decrypt (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 nonceLen, ubyte *pAad, ubyte4 aadLen, ubyte *pData, ubyte4 dataLen, ubyte4 tagLen) |
Decrypt and verify a buffer of data via the AES-GCM algorithm. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_AES_GCM_deleteCtx (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *ppCtx) |
Deletes and frees memory associated with an AES-GCM context of type AES_GCM_CTX . More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_AES_GCM_encrypt (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 *pNonceLen, intBoolean *pWasNonceUsed, ubyte *pAad, ubyte4 aadLen, ubyte *pData, ubyte4 dataLen, ubyte4 tagLen) |
Encrypt and tags a buffer of data via the AES-GCM algorithm. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_AES_GCM_newCtx (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *ppNewCtx, ubyte4 tableSizeMode, ubyte *pKeyMaterial, sbyte4 keyMaterialLen, sbyte4 encrypt) |
Create a new AES-GCM context of type AES_GCM_CTX for Authenticated Encrypt Authenticated Decrypt (AEAD) operations. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_cipher_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 nonceLen, ubyte *pAaData, ubyte4 aadLen, ubyte *pData, ubyte4 dataLen, ubyte4 tagLen, sbyte4 encrypt) |
Perform an AES-GCM cipher operation in one step. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_cipher_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 nonceLen, ubyte *pAaData, ubyte4 aadLen, ubyte *pData, ubyte4 dataLen, ubyte4 tagLen, sbyte4 encrypt) |
Perform an AES-GCM cipher operation in one step. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_cipher_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 nonceLen, ubyte *pAaData, ubyte4 aadLen, ubyte *pData, ubyte4 dataLen, ubyte4 tagLen, sbyte4 encrypt) |
Perform an AES-GCM cipher operation in one step. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_clone_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, BulkCtx *ppNewCtx) |
Clone a AES-GCM context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_clone_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, BulkCtx *ppNewCtx) |
Clone a AES-GCM context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_clone_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, BulkCtx *ppNewCtx) |
Clone a AES-GCM context. More... | |
MOC_EXTERN BulkCtx | CRYPTO_INTERFACE_GCM_createCtx_256b (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyData, sbyte4 keyLen, sbyte4 encrypt) |
Create a new AES-GCM context for Authenticated Encrypt Authenticated Decrypt (AEAD) operations. More... | |
MOC_EXTERN BulkCtx | CRYPTO_INTERFACE_GCM_createCtx_4k (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyData, sbyte4 keyLen, sbyte4 encrypt) |
Create a new AES-GCM context for Authenticated Encrypt Authenticated Decrypt (AEAD) operations. More... | |
MOC_EXTERN BulkCtx | CRYPTO_INTERFACE_GCM_createCtx_64k (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyData, sbyte4 keyLen, sbyte4 encrypt) |
Create a new AES-GCM context for Authenticated Encrypt Authenticated Decrypt (AEAD) operations. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_deleteCtx_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *pCtx) |
Delete an AES-GCM context previously created with CRYPTO_INTERFACE_GCM_createCtx_256b. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_deleteCtx_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *pCtx) |
Delete an AES-GCM context previously created with CRYPTO_INTERFACE_GCM_createCtx_4k. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_deleteCtx_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *pCtx) |
Delete an AES-GCM context previously created with CRYPTO_INTERFACE_GCM_createCtx_64k. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_final_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte pTag[]) |
Finish an AES-GCM operation to recieve the computed tag. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_final_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte pTag[]) |
Finish an AES-GCM operation to recieve the computed tag. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_final_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte pTag[]) |
Finish an AES-GCM operation to recieve the computed tag. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_final_ex_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pTag, ubyte4 tagLen) |
Finalizes an AES-GCM context and verifies or outputs the tag. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_final_ex_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pTag, ubyte4 tagLen) |
Finalizes an AES-GCM context and verifies or outputs the tag. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_final_ex_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pTag, ubyte4 tagLen) |
Finalizes an AES-GCM context and verifies or outputs the tag. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_init_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 nonceLen, ubyte *pAaData, ubyte4 aadLen) |
Initialize an AES-GCM context for a cipher operation. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_init_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 nonceLen, ubyte *pAaData, ubyte4 aadLen) |
Initialize an AES-GCM context for a cipher operation. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_init_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 nonceLen, ubyte *pAaData, ubyte4 aadLen) |
Initialize an AES-GCM context for a cipher operation. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_aad_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pAadData, ubyte4 aadDataLen) |
Updates an AES-GCM context with additional authenticated data. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_aad_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pAadData, ubyte4 aadDataLen) |
Updates an AES-GCM context with additional authenticated data. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_aad_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pAadData, ubyte4 aadDataLen) |
Updates an AES-GCM context with additional authenticated data. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_data_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, ubyte4 dataLen) |
Updates an AES-GCM context with data to be encrypted or decrypted. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_data_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, ubyte4 dataLen) |
Updates an AES-GCM context with data to be encrypted or decrypted. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_data_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, ubyte4 dataLen) |
Updates an AES-GCM context with data to be encrypted or decrypted. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_decrypt_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pCipherText, ubyte4 cipherTextLen) |
Update an encryption operation. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_decrypt_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pCipherText, ubyte4 cipherTextLen) |
Update an encryption operation. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_decrypt_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pCipherText, ubyte4 cipherTextLen) |
Update an encryption operation. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_encrypt_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, ubyte4 dataLen) |
Update an encryption operation. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_encrypt_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, ubyte4 dataLen) |
Update an encryption operation. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_encrypt_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, ubyte4 dataLen) |
Update an encryption operation. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_nonce_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 nonceLen) |
Sets the nonce in a previously created AES-GCM Context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_nonce_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 nonceLen) |
Sets the nonce in a previously created AES-GCM Context. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_GCM_update_nonce_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pNonce, ubyte4 nonceLen) |
Sets the nonce in a previously created AES-GCM Context. More... | |
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_AES_GCM_decrypt | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 | nonceLen, | ||
ubyte * | pAad, | ||
ubyte4 | aadLen, | ||
ubyte * | pData, | ||
ubyte4 | dataLen, | ||
ubyte4 | tagLen | ||
) |
pCtx | Pointer to a context of type AES_GCM_CTX to use for this cipher operation. |
pNonce | Buffer to hold nonce input to the cipher operation. |
nonceLen | The length of the nonce in bytes. |
pAad | Optional additional authentication data to use. |
aadLen | Length in bytes of the additional authentication data. |
pData | Data to decrypt and verify. The tag should be appended to the ciphertext. |
dataLen | Length in bytes of the data to process. This length does not include the tag. |
tagLen | Length in bytes of the tag. Must be one of {4,8,12,13,14,15,16}. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_AES_GCM_deleteCtx | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx * | ppCtx | ) |
ppCtx | Location holding a pointer to the context to be deleted. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_AES_GCM_encrypt | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 * | pNonceLen, | ||
intBoolean * | pWasNonceUsed, | ||
ubyte * | pAad, | ||
ubyte4 | aadLen, | ||
ubyte * | pData, | ||
ubyte4 | dataLen, | ||
ubyte4 | tagLen | ||
) |
The underlying implementation may or may not use the nonce that is passed in.
pCtx | Pointer to a context of type AES_GCM_CTX to use for this cipher operation. |
pNonce | Buffer to hold nonce input to the cipher operation, or buffer that will hold the resulting nonce. |
pNonceLen | Contents should be the length of the nonce passed in, in bytes. If the underlying implementation creates the nonce this will be set to its length in bytes. |
pWasNonceUsed | Contenets will be set to TRUE if the underlying implementation used the nonce passed in and FALSE if it created its own. |
pAad | Optional additional authentication data to use. |
aadLen | Length in bytes of the additional authentication data. |
pData | Data to encrypt and teg. Note for encryption this buffer must be large enough for the output ciphertext and tag. |
dataLen | Length in bytes of the data to process. |
tagLen | Length in bytes of the tag. Must be one of {4,8,12,13,14,15,16}. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_AES_GCM_newCtx | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx * | ppNewCtx, |
ubyte4 | tableSizeMode, | ||
ubyte * | pKeyMaterial, | ||
sbyte4 | keyMaterialLen, | ||
sbyte4 | encrypt | ||
) |
It is the callers responsibilty to delete this context after use by calling CRYPTO_INTERFACE_AES_GCM_deleteCtx.
ppNewCtx | Location that will recieve a pointer to the newly allocated context. |
tableSizeMode | The GCM internal table size, one of the macros GCM_MODE_256B , GCM_MODE_4K , GCM_MODE_64K , GCM_MODE_GENERAL . This must be provided even |
pKeyMaterial | Buffer holding the key material. |
keyMaterialLen | Length of the key material in bytes. Should be 16, 24, or 32.... |
encrypt | Enter non-zero or TRUE to prepare a context for encrpytion and FALSE for decryption. This is not used for GCM_MODE_GENERAL . |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_cipher_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 | nonceLen, | ||
ubyte * | pAaData, | ||
ubyte4 | aadLen, | ||
ubyte * | pData, | ||
ubyte4 | dataLen, | ||
ubyte4 | tagLen, | ||
sbyte4 | encrypt | ||
) |
If all of the data to process is available at one time, this is the recommended function to use. When encrypting, the pData buffer MUST have space for both the data to encrypt and the resulting tag. The tag will be appended to the end of the buffer. When decrypting, this function expects to find a tag of tagLen bytes appended to the pData buffer.
// Encrypting
MSTATUS status;
BulkCtx pCtx = NULL;
sbyte4 keyLen = 32;
ubyte4 nonceLen = 12;
ubyte4 tagLen = 16;
ubyte4 dataLen = 20;
ubyte pData[36] = {...}; // Enough space for data + tag
ubyte pNonce[12] = {...};
ubyte pKeyData[32] = {...};
pCtx = CRYPTO_INTERFACE_GCM_createCtx_256b(pKeyData, keyLen, TRUE);
if (NULL == pCtx)
{
status = ERR_NULL_POINTER;
goto exit;
}
// After this call, the pData buffer will contain the 20 bytes of ciphertext
// followed by a 16 byte tag.
status = CRYPTO_INTERFACE_GCM_cipher_256b (
pCtx, pNonce, nonceLen, NULL, 0, pData, dataLen, tagLen, TRUE);
if (OK != status)
goto exit;
// Always delete the context when finished
status = CRYPTO_INTERFACE_GCM_deleteCtx_256b(&pCtx);
if (OK != status)
goto exit;
exit:
return status;
// Decrypting
MSTATUS status;
BulkCtx pCtx = NULL;
sbyte4 keyLen = 32;
ubyte4 nonceLen = 12;
ubyte4 tagLen = 16;
ubyte4 dataLen = 20; // Note this is (cipherTextLen - tagLen)
ubyte pCipherText[36] = {...}; // Start with ciphertext from encryption process
ubyte pNonce[12] = {...};
ubyte pKeyData[32] = {...};
pCtx = CRYPTO_INTERFACE_GCM_createCtx_256b(pKeyData, keyLen, FALSE);
if (NULL == pCtx)
{
status = ERR_NULL_POINTER;
goto exit;
}
// After this call, the pData buffer will contain the 20 bytes of plaintext
status = CRYPTO_INTERFACE_GCM_cipher_256b (
pCtx, pNonce, nonceLen, NULL, 0, pData, dataLen, tagLen, FALSE);
if (OK != status)
goto exit;
// Always delete the context when finished
status = CRYPTO_INTERFACE_GCM_deleteCtx_256b(&pCtx);
if (OK != status)
goto exit;
exit:
return status;
pCtx | Context to use for this cipher operation. |
pNonce | The nonce data to use for this cipher operation. |
nonceLen | Length in bytes of the nonce material. 12 is the default length. |
pAaData | Optional additional authentication data to use. |
aadLen | Length in bytes of the additional authentication data. |
pData | Data to encrypt or decrypt. Note for encryption this buffer must be large enough for the output ciphertext and tag. |
dataLen | Length in bytes of the data to process. When decrypting this value does not include the tag bytes. |
tagLen | Length in bytes of the tag. Must be one of {4,8,12,13,14,15,16}. |
encrypt | /c TRUE to encrypt, /c FALSE to decrypt. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_cipher_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 | nonceLen, | ||
ubyte * | pAaData, | ||
ubyte4 | aadLen, | ||
ubyte * | pData, | ||
ubyte4 | dataLen, | ||
ubyte4 | tagLen, | ||
sbyte4 | encrypt | ||
) |
If all of the data to process is available at one time, this is the recommended function to use. When encrypting, the pData buffer MUST have space for both the data to encrypt and the resulting tag. The tag will be appended to the end of the buffer. When decrypting, this function expects to find a tag of tagLen bytes appended to the pData buffer.
// Encrypting
MSTATUS status;
BulkCtx pCtx = NULL;
sbyte4 keyLen = 32;
ubyte4 nonceLen = 12;
ubyte4 tagLen = 16;
ubyte4 dataLen = 20;
ubyte pData[36] = {...}; // Enough space for data + tag
ubyte pNonce[12] = {...};
ubyte pKeyData[32] = {...};
pCtx = CRYPTO_INTERFACE_GCM_createCtx_4k(pKeyData, keyLen, TRUE);
if (NULL == pCtx)
{
status = ERR_NULL_POINTER;
goto exit;
}
// After this call, the pData buffer will contain the 20 bytes of ciphertext
// followed by a 16 byte tag.
status = CRYPTO_INTERFACE_GCM_cipher_4k (
pCtx, pNonce, nonceLen, NULL, 0, pData, dataLen, tagLen, TRUE);
if (OK != status)
goto exit;
// Always delete the context when finished
status = CRYPTO_INTERFACE_GCM_deleteCtx_4k(&pCtx);
if (OK != status)
goto exit;
exit:
return status;
// Decrypting
MSTATUS status;
BulkCtx pCtx = NULL;
sbyte4 keyLen = 32;
ubyte4 nonceLen = 12;
ubyte4 tagLen = 16;
ubyte4 dataLen = 20; // Note this is (cipherTextLen - tagLen)
ubyte pCipherText[36] = {...}; // Start with ciphertext from encryption process
ubyte pNonce[12] = {...};
ubyte pKeyData[32] = {...};
pCtx = CRYPTO_INTERFACE_GCM_createCtx_4k(pKeyData, keyLen, FALSE);
if (NULL == pCtx)
{
status = ERR_NULL_POINTER;
goto exit;
}
// After this call, the pData buffer will contain the 20 bytes of plaintext
status = CRYPTO_INTERFACE_GCM_cipher_4k (
pCtx, pNonce, nonceLen, NULL, 0, pData, dataLen, tagLen, FALSE);
if (OK != status)
goto exit;
// Always delete the context when finished
status = CRYPTO_INTERFACE_GCM_deleteCtx_4k(&pCtx);
if (OK != status)
goto exit;
exit:
return status;
pCtx | Context to use for this cipher operation. |
pNonce | The nonce data to use for this cipher operation. |
nonceLen | Length in bytes of the nonce material. 12 is the default length. |
pAaData | Optional additional authentication data to use. |
aadLen | Length in bytes of the additional authentication data. |
pData | Data to encrypt or decrypt. Note for encryption this buffer must be large enough for the output ciphertext and tag. |
dataLen | Length in bytes of the data to process. When decrypting this value does not include the tag bytes. |
tagLen | Length in bytes of the tag. Must be one of {4,8,12,13,14,15,16}. |
encrypt | /c TRUE to encrypt, /c FALSE to decrypt. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_cipher_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 | nonceLen, | ||
ubyte * | pAaData, | ||
ubyte4 | aadLen, | ||
ubyte * | pData, | ||
ubyte4 | dataLen, | ||
ubyte4 | tagLen, | ||
sbyte4 | encrypt | ||
) |
If all of the data to process is available at one time, this is the recommended function to use. When encrypting, the pData buffer MUST have space for both the data to encrypt and the resulting tag. The tag will be appended to the end of the buffer. When decrypting, this function expects to find a tag of tagLen bytes appended to the pData buffer.
// Encrypting
MSTATUS status;
BulkCtx pCtx = NULL;
sbyte4 keyLen = 32;
ubyte4 nonceLen = 12;
ubyte4 tagLen = 16;
ubyte4 dataLen = 20;
ubyte pData[36] = {...}; // Enough space for data + tag
ubyte pNonce[12] = {...};
ubyte pKeyData[32] = {...};
pCtx = CRYPTO_INTERFACE_GCM_createCtx_64k(pKeyData, keyLen, TRUE);
if (NULL == pCtx)
{
status = ERR_NULL_POINTER;
goto exit;
}
// After this call, the pData buffer will contain the 20 bytes of ciphertext
// followed by a 16 byte tag.
status = CRYPTO_INTERFACE_GCM_cipher_64k (
pCtx, pNonce, nonceLen, NULL, 0, pData, dataLen, tagLen, TRUE);
if (OK != status)
goto exit;
// Always delete the context when finished
status = CRYPTO_INTERFACE_GCM_deleteCtx_64k(&pCtx);
if (OK != status)
goto exit;
exit:
return status;
// Decrypting
MSTATUS status;
BulkCtx pCtx = NULL;
sbyte4 keyLen = 32;
ubyte4 nonceLen = 12;
ubyte4 tagLen = 16;
ubyte4 dataLen = 20; // Note this is (cipherTextLen - tagLen)
ubyte pCipherText[36] = {...}; // Start with ciphertext from encryption process
ubyte pNonce[12] = {...};
ubyte pKeyData[32] = {...};
pCtx = CRYPTO_INTERFACE_GCM_createCtx_64k(pKeyData, keyLen, FALSE);
if (NULL == pCtx)
{
status = ERR_NULL_POINTER;
goto exit;
}
// After this call, the pData buffer will contain the 20 bytes of plaintext
status = CRYPTO_INTERFACE_GCM_cipher_64k (
pCtx, pNonce, nonceLen, NULL, 0, pData, dataLen, tagLen, FALSE);
if (OK != status)
goto exit;
// Always delete the context when finished
status = CRYPTO_INTERFACE_GCM_deleteCtx_64k(&pCtx);
if (OK != status)
goto exit;
exit:
return status;
pCtx | Context to use for this cipher operation. |
pNonce | The nonce data to use for this cipher operation. |
nonceLen | Length in bytes of the nonce material. 12 is the default length. |
pAaData | Optional additional authentication data to use. |
aadLen | Length in bytes of the additional authentication data. |
pData | Data to encrypt or decrypt. Note for encryption this buffer must be large enough for the output ciphertext and tag. |
dataLen | Length in bytes of the data to process. When decrypting this value does not include the tag bytes. |
tagLen | Length in bytes of the tag. Must be one of {4,8,12,13,14,15,16}. |
encrypt | /c TRUE to encrypt, /c FALSE to decrypt. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_clone_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
BulkCtx * | ppNewCtx | ||
) |
pCtx | Pointer to an instantiated BulkCtx. |
ppNewCtx | Double pointer to the BulkCtx to be created and populated with the key data from the source key. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_clone_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
BulkCtx * | ppNewCtx | ||
) |
pCtx | Pointer to an instantiated BulkCtx. |
ppNewCtx | Double pointer to the BulkCtx to be created and populated with the key data from the source key. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_clone_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
BulkCtx * | ppNewCtx | ||
) |
pCtx | Pointer to an instantiated BulkCtx. |
ppNewCtx | Double pointer to the BulkCtx to be created and populated with the key data from the source key. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN BulkCtx CRYPTO_INTERFACE_GCM_createCtx_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) ubyte * | pKeyData, |
sbyte4 | keyLen, | ||
sbyte4 | encrypt | ||
) |
It is the callers responsibilty to delete this context after use by calling CRYPTO_INTERFACE_GCM_deleteCtx_256b.
pKeyData | Key material to use. |
keyLen | Length in bytes of the key material. Must be one of {16, 24, 32}. |
encrypt | TRUE to initialize for encryption, /c FALSE to initialize for decryption. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN BulkCtx CRYPTO_INTERFACE_GCM_createCtx_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) ubyte * | pKeyData, |
sbyte4 | keyLen, | ||
sbyte4 | encrypt | ||
) |
It is the callers responsibilty to delete this context after use by calling CRYPTO_INTERFACE_GCM_deleteCtx_4k.
pKeyData | Key material to use. |
keyLen | Length in bytes of the key material. Must be one of {16, 24, 32}. |
encrypt | TRUE to initialize for encryption, /c FALSE to initialize for decryption. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN BulkCtx CRYPTO_INTERFACE_GCM_createCtx_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) ubyte * | pKeyData, |
sbyte4 | keyLen, | ||
sbyte4 | encrypt | ||
) |
It is the callers responsibilty to delete this context after use by calling CRYPTO_INTERFACE_GCM_deleteCtx_64k.
pKeyData | Key material to use. |
keyLen | Length in bytes of the key material. Must be one of {16, 24, 32}. |
encrypt | TRUE to initialize for encryption, /c FALSE to initialize for decryption. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_deleteCtx_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx * | pCtx | ) |
pCtx | Pointer to a BulkCtx returned by CRYPTO_INTERFACE_GCM_createCtx_256b. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_deleteCtx_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx * | pCtx | ) |
pCtx | Pointer to a BulkCtx returned by CRYPTO_INTERFACE_GCM_createCtx_4k. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_deleteCtx_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx * | pCtx | ) |
pCtx | Pointer to a BulkCtx returned by CRYPTO_INTERFACE_GCM_createCtx_64k. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_final_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte | pTag[] | ||
) |
In general this should only be used if the caller needs to stream their data to encrypt/decrypt. If all of the data is available at once, using CRYPTO_INTERFACE_GCM_cipher_256b is recommended.
Note that when using this to finalize a decryption operation the caller MUST perform the tag comparison in constant time. Failure to do so could leave the application vulnerable to timing attacks.
pCtx | Context used for the cipher operation. |
pTag | Buffer to place the computed tag value. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_final_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte | pTag[] | ||
) |
In general this should only be used if the caller needs to stream their data to encrypt/decrypt. If all of the data is available at once, using CRYPTO_INTERFACE_GCM_cipher_4k is recommended.
Note that when using this to finalize a decryption operation the caller MUST perform the tag comparison in constant time. Failure to do so could leave the application vulnerable to timing attacks.
pCtx | Context used for the cipher operation. |
pTag | Buffer to place the computed tag value. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_final_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte | pTag[] | ||
) |
In general this should only be used if the caller needs to stream their data to encrypt/decrypt. If all of the data is available at once, using CRYPTO_INTERFACE_GCM_cipher_64k is recommended.
Note that when using this to finalize a decryption operation the caller MUST perform the tag comparison in constant time. Failure to do so could leave the application vulnerable to timing attacks.
pCtx | Context used for the cipher operation. |
pTag | Buffer to place the computed tag value. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_final_ex_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pTag, | ||
ubyte4 | tagLen | ||
) |
Finalizes an AES-GCM context and verifies or outputs the tag. If the context was created for encryption the tag will be output. If the context was created for decryption the tag will be verified and a negative error code will be returned for an invalid tag.
pCtx | Pointer to a previously allocated and updated context. |
pTag | For encrypt the resulting tag will be placed in this buffer. For decrypt this buffer should contain the input tag. |
tagLen | For encrypt this is the length of the tag requested in bytes (at most 16 bytes). For decrypt this is the length of the input tag in bytes. |
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 CRYPTO_INTERFACE_GCM_final_ex_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pTag, | ||
ubyte4 | tagLen | ||
) |
Finalizes an AES-GCM context and verifies or outputs the tag. If the context was created for encryption the tag will be output. If the context was created for decryption the tag will be verified and a negative error code will be returned for an invalid tag.
pCtx | Pointer to a previously allocated and updated context. |
pTag | For encrypt the resulting tag will be placed in this buffer. For decrypt this buffer should contain the input tag. |
tagLen | For encrypt this is the length of the tag requested in bytes (at most 16 bytes). For decrypt this is the length of the input tag in bytes. |
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 CRYPTO_INTERFACE_GCM_final_ex_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pTag, | ||
ubyte4 | tagLen | ||
) |
Finalizes an AES-GCM context and verifies or outputs the tag. If the context was created for encryption the tag will be output. If the context was created for decryption the tag will be verified and a negative error code will be returned for an invalid tag.
pCtx | Pointer to a previously allocated and updated context. |
pTag | For encrypt the resulting tag will be placed in this buffer. For decrypt this buffer should contain the input tag. |
tagLen | For encrypt this is the length of the tag requested in bytes (at most 16 bytes). For decrypt this is the length of the input tag in bytes. |
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 CRYPTO_INTERFACE_GCM_init_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 | nonceLen, | ||
ubyte * | pAaData, | ||
ubyte4 | aadLen | ||
) |
pCtx | Context returned by CRYPTO_INTERFACE_GCM_createCtx_256b. |
pNonce | The nonce to use for this operation. |
nonceLen | Length in bytes of the nonce material. |
pAaData | Optional additional authentication data. |
aadLen | Length in bytes of the additional authentication data. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_init_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 | nonceLen, | ||
ubyte * | pAaData, | ||
ubyte4 | aadLen | ||
) |
pCtx | Context returned by CRYPTO_INTERFACE_GCM_createCtx_4k. |
pNonce | The nonce to use for this operation. |
nonceLen | Length in bytes of the nonce material. |
pAaData | Optional additional authentication data. |
aadLen | Length in bytes of the additional authentication data. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_init_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 | nonceLen, | ||
ubyte * | pAaData, | ||
ubyte4 | aadLen | ||
) |
pCtx | Context returned by CRYPTO_INTERFACE_GCM_createCtx_64k. |
pNonce | The nonce to use for this operation. |
nonceLen | Length in bytes of the nonce material. |
pAaData | Optional additional authentication data. |
aadLen | Length in bytes of the additional authentication data. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_update_aad_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pAadData, | ||
ubyte4 | aadDataLen | ||
) |
Updates an AES-GCM context with additional authenticated data. This method may be called as many times as necessary.
pCtx | Pointer to a previously allocated context. |
pAadData | Buffer holding the additional authenticated data. |
aadDataLen | The length of the aad in bytes. |
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 CRYPTO_INTERFACE_GCM_update_aad_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pAadData, | ||
ubyte4 | aadDataLen | ||
) |
Updates an AES-GCM context with additional authenticated data. This method may be called as many times as necessary.
pCtx | Pointer to a previously allocated context. |
pAadData | Buffer holding the additional authenticated data. |
aadDataLen | The length of the aad in bytes. |
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 CRYPTO_INTERFACE_GCM_update_aad_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pAadData, | ||
ubyte4 | aadDataLen | ||
) |
Updates an AES-GCM context with additional authenticated data. This method may be called as many times as necessary.
pCtx | Pointer to a previously allocated context. |
pAadData | Buffer holding the additional authenticated data. |
aadDataLen | The length of the aad in bytes. |
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 CRYPTO_INTERFACE_GCM_update_data_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pData, | ||
ubyte4 | dataLen | ||
) |
Updates an AES-GCM context with data to be encrypted or decrypted. Which direction depends on the encrypt
flag passed into the context creation GCM_createCtx_64k
method. The GCM_update_data_64k
method may be called as many times as necessary.
pCtx | Pointer to a previously allocated context. |
pData | Buffer holding the data to be encrypted or decrypted. It will be processed in place, ie this buffer will also hold the resulting ciphertext or plaintext. |
dataLen | The length of the data in bytes. |
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 CRYPTO_INTERFACE_GCM_update_data_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pData, | ||
ubyte4 | dataLen | ||
) |
Updates an AES-GCM context with data to be encrypted or decrypted. Which direction depends on the encrypt
flag passed into the context creation GCM_createCtx_64k
method. The GCM_update_data_64k
method may be called as many times as necessary.
pCtx | Pointer to a previously allocated context. |
pData | Buffer holding the data to be encrypted or decrypted. It will be processed in place, ie this buffer will also hold the resulting ciphertext or plaintext. |
dataLen | The length of the data in bytes. |
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 CRYPTO_INTERFACE_GCM_update_data_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pData, | ||
ubyte4 | dataLen | ||
) |
Updates an AES-GCM context with data to be encrypted or decrypted. Which direction depends on the encrypt
flag passed into the context creation GCM_createCtx_64k
method. The GCM_update_data_64k
method may be called as many times as necessary.
pCtx | Pointer to a previously allocated context. |
pData | Buffer holding the data to be encrypted or decrypted. It will be processed in place, ie this buffer will also hold the resulting ciphertext or plaintext. |
dataLen | The length of the data in bytes. |
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 CRYPTO_INTERFACE_GCM_update_decrypt_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pCipherText, | ||
ubyte4 | cipherTextLen | ||
) |
Note that AES-GCM is a stream cipher so both the overall input length and the input length to any one update call does not need to be a multiple of the AES block size. This function operates on data in place, so the resulting ciphertext will be in the provided data buffer after the encryption process is complete.
pCtx | Context to use for the encryption operation. |
pCipherText | Data to encrypt. |
cipherTextLen | Length in bytes of the data to encrypt. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_update_decrypt_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pCipherText, | ||
ubyte4 | cipherTextLen | ||
) |
Note that AES-GCM is a stream cipher so both the overall input length and the input length to any one update call does not need to be a multiple of the AES block size. This function operates on data in place, so the resulting ciphertext will be in the provided data buffer after the encryption process is complete.
pCtx | Context to use for the encryption operation. |
pCipherText | Data to encrypt. |
cipherTextLen | Length in bytes of the data to encrypt. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_update_decrypt_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pCipherText, | ||
ubyte4 | cipherTextLen | ||
) |
Note that AES-GCM is a stream cipher so both the overall input length and the input length to any one update call does not need to be a multiple of the AES block size. This function operates on data in place, so the resulting ciphertext will be in the provided data buffer after the encryption process is complete.
pCtx | Context to use for the encryption operation. |
pCipherText | Data to encrypt. |
cipherTextLen | Length in bytes of the data to encrypt. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_update_encrypt_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pData, | ||
ubyte4 | dataLen | ||
) |
Note that AES-GCM is a stream cipher so both the overall input length and the input length to any one update call does not need to be a multiple of the AES block size. This function operates on data in place, so the resulting ciphertext will be in the provided data buffer after the encryption process is complete.
pCtx | Context to use for the encryption operation. |
pData | Data to encrypt. |
dataLen | Length in bytes of the data to encrypt. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_update_encrypt_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pData, | ||
ubyte4 | dataLen | ||
) |
Note that AES-GCM is a stream cipher so both the overall input length and the input length to any one update call does not need to be a multiple of the AES block size. This function operates on data in place, so the resulting ciphertext will be in the provided data buffer after the encryption process is complete.
pCtx | Context to use for the encryption operation. |
pData | Data to encrypt. |
dataLen | Length in bytes of the data to encrypt. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_update_encrypt_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pData, | ||
ubyte4 | dataLen | ||
) |
Note that AES-GCM is a stream cipher so both the overall input length and the input length to any one update call does not need to be a multiple of the AES block size. This function operates on data in place, so the resulting ciphertext will be in the provided data buffer after the encryption process is complete.
pCtx | Context to use for the encryption operation. |
pData | Data to encrypt. |
dataLen | Length in bytes of the data to encrypt. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_GCM_update_nonce_256b | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 | nonceLen | ||
) |
Sets the nonce in a previously created AES-GCM Context.
pCtx | Pointer to a previously allocated context. |
pNonce | Buffer holding the input nonce value. |
nonceLen | The length of the nonce in bytes. |
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 CRYPTO_INTERFACE_GCM_update_nonce_4k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 | nonceLen | ||
) |
Sets the nonce in a previously created AES-GCM Context.
pCtx | Pointer to a previously allocated context. |
pNonce | Buffer holding the input nonce value. |
nonceLen | The length of the nonce in bytes. |
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 CRYPTO_INTERFACE_GCM_update_nonce_64k | ( | MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx | pCtx, |
ubyte * | pNonce, | ||
ubyte4 | nonceLen | ||
) |
Sets the nonce in a previously created AES-GCM Context.
pCtx | Pointer to a previously allocated context. |
pNonce | Buffer holding the input nonce value. |
nonceLen | The length of the nonce in bytes. |
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.