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

Header file for the Nanocrypto GCM API. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS GCM_cipher_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *nonce, ubyte4 nlen, ubyte *adata, ubyte4 alen, ubyte *data, ubyte4 dlen, ubyte4 verifyLen, sbyte4 encrypt)
 AES-GCM encrypt or decrypt a data buffer. More...
 
MOC_EXTERN MSTATUS GCM_cipher_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *nonce, ubyte4 nlen, ubyte *adata, ubyte4 alen, ubyte *data, ubyte4 dlen, ubyte4 verifyLen, sbyte4 encrypt)
 AES-GCM encrypt or decrypt a data buffer. More...
 
MOC_EXTERN MSTATUS GCM_cipher_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *nonce, ubyte4 nlen, ubyte *adata, ubyte4 alen, ubyte *data, ubyte4 dlen, ubyte4 verifyLen, sbyte4 encrypt)
 AES-GCM encrypt or decrypt a data buffer. More...
 
MOC_EXTERN MSTATUS GCM_clone_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, BulkCtx *ppNewCtx)
 Clone a AES-GCM context. More...
 
MOC_EXTERN MSTATUS GCM_clone_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, BulkCtx *ppNewCtx)
 Clone a AES-GCM context. More...
 
MOC_EXTERN MSTATUS GCM_clone_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, BulkCtx *ppNewCtx)
 Clone a AES-GCM context. More...
 
MOC_EXTERN BulkCtx GCM_createCtx_256b (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *key, sbyte4 keylen, sbyte4 encrypt)
 Create and return a context data structure for AES-GCM operations. More...
 
MOC_EXTERN BulkCtx GCM_createCtx_4k (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *key, sbyte4 keylen, sbyte4 encrypt)
 Create and return a context data structure for AES-GCM operations. More...
 
MOC_EXTERN BulkCtx GCM_createCtx_64k (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *key, sbyte4 keylen, sbyte4 encrypt)
 Create and return a context data structure for AES-GCM operations. More...
 
MOC_EXTERN MSTATUS GCM_deleteCtx_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *ctx)
 Delete an AES-GCM context. More...
 
MOC_EXTERN MSTATUS GCM_deleteCtx_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *ctx)
 Delete an AES-GCM context. More...
 
MOC_EXTERN MSTATUS GCM_deleteCtx_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *ctx)
 Delete an AES-GCM context. More...
 
MOC_EXTERN MSTATUS GCM_final_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte tag[])
 Write authentication tag after message encryption. More...
 
MOC_EXTERN MSTATUS GCM_final_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte tag[])
 Write authentication tag after message encryption. More...
 
MOC_EXTERN MSTATUS GCM_final_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte tag[])
 Write authentication tag after message encryption. More...
 
MOC_EXTERN MSTATUS 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 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 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 GCM_init_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *nonce, ubyte4 nlen, ubyte *adata, ubyte4 alen)
 Initialize nonce and authentication data for AES-GCM context. More...
 
MOC_EXTERN MSTATUS GCM_init_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *nonce, ubyte4 nlen, ubyte *adata, ubyte4 alen)
 Initialize nonce and authentication data for AES-GCM context. More...
 
MOC_EXTERN MSTATUS GCM_init_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *nonce, ubyte4 nlen, ubyte *adata, ubyte4 alen)
 Initialize nonce and authentication data for AES-GCM context. More...
 
MOC_EXTERN MSTATUS 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 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 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 GCM_update_data_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, ubyte4 dataLen)
 Finalizes an AES-GCM context and verifies or outputs the tag. More...
 
MOC_EXTERN MSTATUS GCM_update_data_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, ubyte4 dataLen)
 Finalizes an AES-GCM context and verifies or outputs the tag. More...
 
MOC_EXTERN MSTATUS 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 GCM_update_decrypt_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *ct, ubyte4 ctlen)
 Decrypt data buffer and perform authentication. More...
 
MOC_EXTERN MSTATUS GCM_update_decrypt_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *ct, ubyte4 ctlen)
 Decrypt data buffer and perform authentication. More...
 
MOC_EXTERN MSTATUS GCM_update_decrypt_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *ct, ubyte4 ctlen)
 Decrypt data buffer and perform authentication. More...
 
MOC_EXTERN MSTATUS GCM_update_encrypt_256b (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *data, ubyte4 dlen)
 Encrypt a data buffer and perform authentication. More...
 
MOC_EXTERN MSTATUS GCM_update_encrypt_4k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *data, ubyte4 dlen)
 Encrypt a data buffer and perform authentication. More...
 
MOC_EXTERN MSTATUS GCM_update_encrypt_64k (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx ctx, ubyte *data, ubyte4 dlen)
 Encrypt a data buffer and perform authentication. More...
 
MOC_EXTERN MSTATUS 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 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 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...
 

Detailed Description

Header file for the Nanocrypto GCM API.

Function Documentation

◆ GCM_cipher_256b()

MOC_EXTERN MSTATUS GCM_cipher_256b ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  nonce,
ubyte4  nlen,
ubyte *  adata,
ubyte4  alen,
ubyte *  data,
ubyte4  dlen,
ubyte4  verifyLen,
sbyte4  encrypt 
)

This function AES-GCM encrypts or AES-GCM decrypts a data buffer. Before calling this function, your application must call the GCM_createCtx_256b() function to dynamically create a valid AES-GCM context.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_256B__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_256b().
nonceNonce.
nlenLength of (nonce) in octets.
adataAdditional authenticated data.
alenLength of additional authenticated data (aData) in octets.
dataData to encrypt and protect.
dlenLength of data to encrypt and protect (data).
verifyLenLength of the authentication tag.
encryptTRUE if context for encryption; otherwise FALSE (context is for decryption).
Returns
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.

gcm.h

◆ GCM_cipher_4k()

MOC_EXTERN MSTATUS GCM_cipher_4k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  nonce,
ubyte4  nlen,
ubyte *  adata,
ubyte4  alen,
ubyte *  data,
ubyte4  dlen,
ubyte4  verifyLen,
sbyte4  encrypt 
)

This function AES-GCM encrypts or AES-GCM decrypts a data buffer. Before calling this function, your application must call the GCM_createCtx_4k() function to dynamically create a valid AES-GCM context.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_4K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_4k().
nonceNonce.
nlenLength of (nonce) in octets.
adataAdditional authenticated data.
alenLength of additional authenticated data (aData) in octets.
dataData to encrypt and protect.
dlenLength of data to encrypt and protect (data).
verifyLenLength of the authentication tag.
encryptTRUE if context for encryption; otherwise FALSE (context is for decryption).
Returns
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.

gcm.h

◆ GCM_cipher_64k()

MOC_EXTERN MSTATUS GCM_cipher_64k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  nonce,
ubyte4  nlen,
ubyte *  adata,
ubyte4  alen,
ubyte *  data,
ubyte4  dlen,
ubyte4  verifyLen,
sbyte4  encrypt 
)

This function AES-GCM encrypts or AES-GCM decrypts a data buffer. Before calling this function, your application must call the GCM_createCtx_64k() function to dynamically create a valid AES-GCM context.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_64k().
nonceNonce.
nlenLength of (nonce) in octets.
adataAdditional authenticated data.
alenLength of additional authenticated data (aData) in octets.
dataData to encrypt and protect.
dlenLength of data to encrypt and protect (data).
verifyLenLength of the authentication tag.
encryptTRUE if context for encryption; otherwise FALSE (context is for decryption).
Returns
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.

gcm.h

◆ GCM_clone_256b()

MOC_EXTERN MSTATUS GCM_clone_256b ( 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 key data from the source key.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ GCM_clone_4k()

MOC_EXTERN MSTATUS GCM_clone_4k ( 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 key data from the source key.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ GCM_clone_64k()

MOC_EXTERN MSTATUS GCM_clone_64k ( 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 key data from the source key.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ GCM_createCtx_256b()

MOC_EXTERN BulkCtx GCM_createCtx_256b ( MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *  key,
sbyte4  keylen,
sbyte4  encrypt 
)

This function creates and returns a context data structure for AES-GCM 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 DoAES() functions.

The AES-GCM context data structure holds information such as key length, key schedule, and mode of operation. To avoid memory leaks, your application code must call GCM_deleteCtx_256b() after completing AES-GCM related operations (because the AES-GCM context is dynamically allocated by this function during context creation).

Warning
If NULL is returned for the context pointer, you cannot use it as input to any subsequent AES functions.
FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_256B__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
keyKey material.
keylenLength of key material (key).
encryptTRUE if context for encryption; otherwise FALSE (context is for decryption).
Returns
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.

gcm.h

◆ GCM_createCtx_4k()

MOC_EXTERN BulkCtx GCM_createCtx_4k ( MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *  key,
sbyte4  keylen,
sbyte4  encrypt 
)

This function creates and returns a context data structure for AES-GCM 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 DoAES() functions.

The AES-GCM context data structure holds information such as key length, key schedule, and mode of operation. To avoid memory leaks, your application code must call GCM_deleteCtx_4k() after completing AES-GCM related operations (because the AES-GCM context is dynamically allocated by this function during context creation).

Warning
If NULL is returned for the context pointer, you cannot use it as input to any subsequent AES functions.
FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_4K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
keyKey material.
keylenLength of key material (key).
encryptTRUE if context for encryption; otherwise FALSE (context for decryption).
Returns
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.

gcm.h

◆ GCM_createCtx_64k()

MOC_EXTERN BulkCtx GCM_createCtx_64k ( MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *  key,
sbyte4  keylen,
sbyte4  encrypt 
)

This function creates and returns a context data structure for AES-GCM 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 DoAES() functions.

The AES-GCM context data structure holds information such as key length, key schedule, and mode of operation. To avoid memory leaks, your application code must call GCM_deleteCtx_64k() after completing AES-GCM related operations (because the AES-GCM context is dynamically allocated by this function during context creation).

Warning
If NULL is returned for the context pointer, you cannot use it as input to any subsequent AES function calls.
FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
keyKey material.
keylenLength of key material (key).
encryptTRUE if context for encryption; otherwise FALSE (context is for decryption).
Returns
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.

gcm.h

◆ GCM_deleteCtx_256b()

MOC_EXTERN MSTATUS GCM_deleteCtx_256b ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *  ctx)

This function deletes an AES-GCM context previously created by GCM_createCtx_256b(). To avoid memory leaks, your application must call this function after completing AES-related operations for a given context.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_256B__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxPointer to AES-GCM context to free.
Returns
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.

gcm.h

◆ GCM_deleteCtx_4k()

MOC_EXTERN MSTATUS GCM_deleteCtx_4k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *  ctx)

This function deletes an AES-GCM context previously created by GCM_createCtx_4k(). To avoid memory leaks, your application must call this function after completing AES-related operations for a given context.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_4K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxPointer to AES-GCM context to free.
Returns
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.

gcm.h

◆ GCM_deleteCtx_64k()

MOC_EXTERN MSTATUS GCM_deleteCtx_64k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *  ctx)

This function deletes an AES-GCM context previously created by GCM_createCtx_64k(). To avoid memory leaks, your application must call this function after completing AES-related operations for a given context.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxPointer to AES-GCM context to free.
Returns
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.

gcm.h

◆ GCM_final_256b()

MOC_EXTERN MSTATUS GCM_final_256b ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte  tag[] 
)

This function writes the authentication tag upon completion of encrypting a message.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_256B__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_256b().
tagPointer to write authentication tag of AES_BLOCK_SIZE octets.
Returns
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.

gcm.h

◆ GCM_final_4k()

MOC_EXTERN MSTATUS GCM_final_4k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte  tag[] 
)

This function writes the authentication tag upon completion of encrypting a message.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_4K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_4k().
tagPointer to write authentication tag of AES_BLOCK_SIZE octets.
Returns
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.

gcm.h

◆ GCM_final_64k()

MOC_EXTERN MSTATUS GCM_final_64k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte  tag[] 
)

This function writes the authentication tag upon completion of encrypting a message.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_64k().
tagPointer to write authentication tag of AES_BLOCK_SIZE octets.
Returns
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.

gcm.h

◆ GCM_final_ex_256b()

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

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated and updated context.
pTagFor encrypt the resulting tag will be placed in this buffer. For decrypt this buffer should contain the input tag.
tagLenFor 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.
Returns
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.

gcm.h

◆ GCM_final_ex_4k()

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

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated and updated context.
pTagFor encrypt the resulting tag will be placed in this buffer. For decrypt this buffer should contain the input tag.
tagLenFor 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.
Returns
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.

gcm.h

◆ GCM_final_ex_64k()

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

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated and updated context.
pTagFor encrypt the resulting tag will be placed in this buffer. For decrypt this buffer should contain the input tag.
tagLenFor 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.
Returns
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.

gcm.h

◆ GCM_init_256b()

MOC_EXTERN MSTATUS GCM_init_256b ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  nonce,
ubyte4  nlen,
ubyte *  adata,
ubyte4  alen 
)

This function initializes nonce and authentication data for an AES-GCM context.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_256B__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_256b().
nonceNonce.
nlenLength of (nonce) in octets.
adataAdditional authenticated data.
alenLength of additional authenticated data (aData) in octets.
Returns
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.

gcm.h

◆ GCM_init_4k()

MOC_EXTERN MSTATUS GCM_init_4k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  nonce,
ubyte4  nlen,
ubyte *  adata,
ubyte4  alen 
)

This function initializes nonce and authentication data for an AES-GCM context.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_4K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_4k().
nonceNonce.
nlenLength of (nonce) in octets.
adataAdditional authenticated data.
alenLength of additional authenticated data (aData) in octets.
Returns
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.

gcm.h

◆ GCM_init_64k()

MOC_EXTERN MSTATUS GCM_init_64k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  nonce,
ubyte4  nlen,
ubyte *  adata,
ubyte4  alen 
)

This function initializes nonce and authentication data for an AES-GCM context.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_64k().
nonceNonce.
nlenLength of (nonce) in octets.
adataAdditional authenticated data.
alenLength of additional authenticated data (aData) in octets.
Returns
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.

gcm.h

◆ GCM_update_aad_256b()

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

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated context.
pAadDataBuffer holding the additional authenticated data.
aadDataLenThe length of the aad in bytes.
Returns
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.

gcm.h

◆ GCM_update_aad_4k()

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

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated context.
pAadDataBuffer holding the additional authenticated data.
aadDataLenThe length of the aad in bytes.
Returns
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.

gcm.h

◆ GCM_update_aad_64k()

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

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated context.
pAadDataBuffer holding the additional authenticated data.
aadDataLenThe length of the aad in bytes.
Returns
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.

gcm.h

◆ GCM_update_data_256b()

MOC_EXTERN MSTATUS GCM_update_data_256b ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  pCtx,
ubyte *  pData,
ubyte4  dataLen 
)

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.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated and updated context.
pTagFor encrypt the resulting tag will be placed in this buffer. For decrypt this buffer should contain the input tag.
tagLenFor 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.
Returns
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.

gcm.h

◆ GCM_update_data_4k()

MOC_EXTERN MSTATUS GCM_update_data_4k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  pCtx,
ubyte *  pData,
ubyte4  dataLen 
)

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.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated and updated context.
pTagFor encrypt the resulting tag will be placed in this buffer. For decrypt this buffer should contain the input tag.
tagLenFor 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.
Returns
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.

gcm.h

◆ GCM_update_data_64k()

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

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated context.
pDataBuffer 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.
dataLenThe length of the data in bytes.
Returns
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.

gcm.h

◆ GCM_update_decrypt_256b()

MOC_EXTERN MSTATUS GCM_update_decrypt_256b ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  ct,
ubyte4  ctlen 
)

This function AES-GCM decrypts a data buffer and authenticates. Before calling this function, your application must call the GCM_createCtx_256b() function to dynamically create a valid AES context, and optionally call GCM_init_256b() to set a nonce or additional authentication data.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_256B__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_256b().
ctCipher text to decrypt and authenticate.
ctlenLength of cipher text to decrypt and authenticate (data).
Returns
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.

gcm.h

◆ GCM_update_decrypt_4k()

MOC_EXTERN MSTATUS GCM_update_decrypt_4k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  ct,
ubyte4  ctlen 
)

This function AES-GCM decrypts a data buffer and authenticates. Before calling this function, your application must call the GCM_createCtx_4k() function to dynamically create a valid AES context, and optionally call GCM_init_4k() to set a nonce or additional authentication data.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_4K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_4k().
ctCipher text to decrypt and authenticate.
ctlenLength of cipher text to decrypt and authenticate (data).
Returns
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.

gcm.h

◆ GCM_update_decrypt_64k()

MOC_EXTERN MSTATUS GCM_update_decrypt_64k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  ct,
ubyte4  ctlen 
)

This function AES-GCM decrypts a data buffer and authenticates. Before calling this function, your application must call the GCM_createCtx_64k() function to dynamically create a valid AES context, and optionally call GCM_init_64k() to set a nonce or additional authentication data.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_64k().
ctCipher text to decrypt and authenticate.
ctlenLength of cipher text to decrypt and authenticate (data).
Returns
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.

gcm.h

◆ GCM_update_encrypt_256b()

MOC_EXTERN MSTATUS GCM_update_encrypt_256b ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  data,
ubyte4  dlen 
)

This function AES-GCM encrypts a data buffer and authenticates. Before calling this function, your application must call the GCM_createCtx_256b() function to dynamically create a valid AES context, and optionally call GCM_init_256b() to set a nonce or additional authentication data.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_256B__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_256b().
dataData to encrypt and protect.
dlenLength of data to encrypt and protect (data).
Returns
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.

gcm.h

◆ GCM_update_encrypt_4k()

MOC_EXTERN MSTATUS GCM_update_encrypt_4k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  data,
ubyte4  dlen 
)

This function AES-GCM encrypts a data buffer and authenticates. Before calling this function, your application must call the GCM_createCtx_4k() function to dynamically create a valid AES context, and optionally call GCM_init_4k() to set a nonce or additional authentication data.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_4K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_4k().
dataData to encrypt and protect.
dlenLength of data to encrypt and protect (data).
Returns
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.

gcm.h

◆ GCM_update_encrypt_64k()

MOC_EXTERN MSTATUS GCM_update_encrypt_64k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  ctx,
ubyte *  data,
ubyte4  dlen 
)

This function AES-GCM encrypts a data buffer and authenticates. Before calling this function, your application must call the GCM_createCtx_64k() function to dynamically create a valid AES context, and optionally call GCM_init_64k() to set a nonce or additional authentication data.

FIPS Approved
check-green.gif
Suite B Algorithm
check-green.gif

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
ctxAES-GCM context, previously created by GCM_createCtx_64k().
dataData to encrypt and protect.
dlenLength of data to encrypt and protect (data).
Returns
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.

gcm.h

◆ GCM_update_nonce_256b()

MOC_EXTERN MSTATUS GCM_update_nonce_256b ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  pCtx,
ubyte *  pNonce,
ubyte4  nonceLen 
)

Sets the nonce in a previously created AES-GCM Context.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated context.
pNonceBuffer holding the input nonce value.
nonceLenThe length of the nonce in bytes.
Returns
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.

gcm.h

◆ GCM_update_nonce_4k()

MOC_EXTERN MSTATUS GCM_update_nonce_4k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  pCtx,
ubyte *  pNonce,
ubyte4  nonceLen 
)

Sets the nonce in a previously created AES-GCM Context.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated context.
pNonceBuffer holding the input nonce value.
nonceLenThe length of the nonce in bytes.
Returns
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.

gcm.h

◆ GCM_update_nonce_64k()

MOC_EXTERN MSTATUS GCM_update_nonce_64k ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  pCtx,
ubyte *  pNonce,
ubyte4  nonceLen 
)

Sets the nonce in a previously created AES-GCM Context.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_GCM_64K__
  • __ENABLE_MOCANA_GCM__

gcm.h

Parameters
pCtxPointer to a previously allocated context.
pNonceBuffer holding the input nonce value.
nonceLenThe length of the nonce in bytes.
Returns
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.

gcm.h