TrustCore SDK Crypto Interface API reference  version 2.0
crypto_interface_blowfish.h File Reference

Cryptographic Interface header file for declaring Blowfish methods. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_CloneBlowfishCtx (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, BulkCtx *ppNewCtx)
 Clones a Blowfish context. More...
 
MOC_EXTERN BulkCtx CRYPTO_INTERFACE_CreateBlowfishCtx (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyMaterial, sbyte4 keyLen, sbyte4 encrypt)
 Creates and initializes a new Blowfish context. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DeleteBlowfishCtx (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *ppCtx)
 Deletes a Blowfish context. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DoBlowfish (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, sbyte4 dataLen, sbyte4 encrypt, ubyte *pIv)
 Performs the Blowfish cipher operation in CBC mode. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DoBlowfishEx (MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx pCtx, ubyte *pData, sbyte4 dataLen, sbyte4 encrypt, ubyte *pIv)
 Performs the Blowfish cipher operation in CBC mode. More...
 

Detailed Description

Add details here.

crypto_interface_blowfish.h

Function Documentation

◆ CRYPTO_INTERFACE_CloneBlowfishCtx()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_CloneBlowfishCtx ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx  pCtx,
BulkCtx *  ppNewCtx 
)

Be sure to free the new contex with a call to DeleteBlowfishCtx.

Parameters
pCtxSource Blowfish context.
ppNewCtxWill point to the newly allocated copy of the source context.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_CreateBlowfishCtx()

MOC_EXTERN BulkCtx CRYPTO_INTERFACE_CreateBlowfishCtx ( MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *  pKeyMaterial,
sbyte4  keyLen,
sbyte4  encrypt 
)

Note it is the callers responsibility to free this object after use by calling CRYPTO_INTERFACE_DeleteBlowfishCtx.

Parameters
pKeyMaterialKey material to use for the cipher operation.
keyLenLength in bytes of the key material.
encryptUNUSED.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ CRYPTO_INTERFACE_DeleteBlowfishCtx()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DeleteBlowfishCtx ( MOC_SYM(hwAccelDescr hwAccelCtx) BulkCtx *  ppCtx)
Parameters
ppCtxPointer to the BulkCtx to be deleted.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ CRYPTO_INTERFACE_DoBlowfish()

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

Pass in the initialization vector on the first call, but subsequent calls are not guaranteed to use the pIv field. Use CRYPTO_INTERFACE_DoBlowfishEx instead if you wish to use a modified iv. Note that this operation is in place, so the pData buffer will contain the result.

Parameters
pCtxA previously initialized context.
pDataData to encrypt or decrypt.
dataLenLength in bytes of the data to process. This must be a multiple of the block size of 8 bytes.
encryptTRUE to perform encryption; FALSE to perform decryption.
pIvThe 8 byte initialization vector.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_DoBlowfishEx()

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

This function can be used to stream data. Pass in the initialization vector and it will be updated in place. Continue to pass in new data and updated initialization vector on each subsequent call. The updated iv will be written to pIv upon method completion. Note that this operation is in place, so the pData buffer will contain the result.

Parameters
pCtxA previously initialized context.
pDataData to encrypt or decrypt.
dataLenLength in bytes of the data to process. This must be a multiple of the block size of 8 bytes.
encryptTRUE to perform encryption; FALSE to perform decryption.
pIvThe 8 byte initialization vector. Upon completion of the method it will be updated to the working IV.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h