tfCryptoEngineRegister

Jump to: navigation, search

Table of Contents >> Optional Protocols >> Cryptography


#include <trsecapi.h>


int tfCryptoEngineRegister (
unsigned int engineId,
ttUserVoidPtr initParamPtr,
ttCryptoEnginePtrPtr newEnginePtrPtr,
ttCryptoEngineInitFuncPtr engineInitFuncPtr,
ttCryptoGetRandomWordFuncPtr randomFuncPtr,
ttCryptoSessionOpenFuncPtr sessionOpenFuncPtr,
ttCryptoSessionFuncPtr sessionProcessFuncPtr,
ttCryptoSessionFuncPtr sessionCloseFuncPtr
);


Function Description

This function registers a new crypto engine. If TM_IPSEC_USE_SOFTWARE_CRYPTOENGINE is defined, the Treck IPsec initialization will automatically register a crypto engine whose 'engineId' is TM_CRYPTO_ENGINE_SOFTWARE.


Parameters

  • engineId
    The name (ID) of the crypto engine. Currently supported values are:
  • TM_CRYPTO_ENGINE_SOFTWARE: Treck's software crypto library.
  • TM_CRYPTO_ENGINE_HIFN7951: The HIFN7951 hardware crypto accelerator.
  • TM_CRYPTO_ENGINE_MCF5235: The Freescale MCF5235 hardware crypto accelerator.
  • initParamPtr
    Initialization parameter for the to-be-registered crypto engine. This argument may be NULL if no parameter is needed to initialize the crypto engine.
  • newEnginePtrPtr
    Pointer to the new engine pointer. Upon successful return of this call, 'newEnginePtrPtr' should store the new engine pointer.
  • engineInitFuncPtr
    The function pointer to crypto engine initialization function. This function will take only one argument: 'initParamPtr'. It could be NULL if no initialization function required.
  • randomFuncPtr
    Random function of this crypto engine. If this function is NULL, we will use a default software implementation (tfCryptoDefaultGetRandomWord()) to obtain a random number.
  • sessionOpenFuncPtr
    The function pointer to open a crypto session. A session, in Treck's implementation, means the environment in which any crypto action uses the same algorithm(s) and same key material. An unexpired IPsec SA is an active session, when you create a new IPsec SA, you open a new session.
  • sessionProcessFuncPtr
    The function pointer to process any crypto request to this crypto engine.
  • sessionCloseFuncPtr
    The function pointer to close a crypto session. For example, when you close an IPsec SA or rekey an IPsec SA, you need to close the old crypto session.


Returns

  • TM_ENOERROR
    Success.
  • TM_EINVAL
    The user has not called tfUseIpsec() or tfUsePki() yet. This must be done before making this call.
  • -1
    The engine ID is invalid or has been previously registered.
  • TM_ENOBUFS
    Insufficient memory to complete the operation.
  • (Other)
    As returned from the 'engineInitFuncPtr'.


Table of Contents >> Optional Protocols >> Cryptography