Documentation  |   Table of Contents   |  < Previous   |  Next >   |  Index

11    CPM Library Provider

Security and Cryptography

Exploring Palm OS

CPM Library Provider Structures and Types
CPM Library Provider Function Argument Structures
CPM Library Provider Constants
Application-Defined Functions

The header file CPMLibProvider.h declares the API that this chapter describes.

CPM Library Provider Structures and Types ^TOP^

CPMCallerInfoType Struct ^TOP^

Purpose

This structure is passed to the provider's dispatcher. It contains all the information necessary for the provider to call back into the CPM framework and use the CPM's resources.

Declared In

CPMLibProvider.h

Prototype

typedef struct _CPMCallerInfoType {
   void *appContext;
   CPMDebugOutProcPtr debugout;
   CPMDispatcherProcPtr dispatcher;
   CPMGenerateRandomBytesProcPtr generateRandom;
   CPMAddRandomSeedProcPtr addSeed;
} CPMCallerInfoType
typedef CPMCallerInfoType *CPMCallerInfoPtr;

Fields

appContext
Pointer to a structure containing the provider-specific application context to be used in future CPM calls. This structure is normally created and initialized when the library is opened.
debugout
Pointer to a function that outputs a debug message to the debug device. See CPMDebugOutProcPtr()
dispatcher
Pointer to the CPM function dispatcher. See CPMDispatcherProcPtr().
generateRandom
Pointer to a function that can return a requested number of random bytes. See CPMGenerateRandomBytesProcPtr().
addSeed
Pointer to a function that puts a number of seed bytes into the pseudo-random number generator maintained by the CPM. See CPMAddRandomSeedProcPtr()

CPM Library Provider Function Argument Structures ^TOP^

APCmdPBType Struct ^TOP^

Purpose

Declares the algorithm provider interface command parameter blocks.

Declared In

CPMLibProvider.h

Prototype

typedef union APCmdPBType {
   ...
} APCmdPBType, *APCmdPBPtr

Fields

Various structures. Each structure is documented separately within this section.

APDecrypt Struct ^TOP^

Purpose

The command paramater block for the Decrypt call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APCipherInfoType *cipherInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APDecrypt;

Fields

keyInfoP
The key to be used for the operation.
cipherInfoP
Avalid context for this operation initialized by the initialization operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by bufOut. Also returns the actual number of bytes placed in bufOut on return.

Comments

The cipherInfoP field specifies an initialized context which was created in the initialization of this class of functions.

bufInLen may not be zero and bufIn must be valid.

The provider performs a complete decryption operation using the data in bufIn of length bufInLen and puts the results in bufOut. The actual number of bytes placed in bufOut is placed in bufOutLenP.

APDecryptFinal Struct ^TOP^

Purpose

The command paramater block for the DecryptFinal call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APCipherInfoType *cipherInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APDecryptFinal;

Fields

keyInfoP
The key to be used for the operation.
cipherInfoP
Avalid context for this operation initialized by the initialization operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by bufOut. Also returns the actual number of bytes placed in bufOut on return.

Comments

The cipherInfoP field specifies an initialized context which was created in the initialization of this class of functions.

bufInLen may not be zero and bufIn must be valid.

The provider performs a complete decryption operation using the data in bufIn of length bufInLen and puts the results in bufOut. The actual number of bytes placed in bufOut is placed in bufOutLenP.

APDecryptInit Struct ^TOP^

Purpose

The command paramater block for the DecryptInit call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APCipherInfoType *cipherInfoP;
   } APDecryptInit;

Fields

keyInfoP
The key to be used for the operation.
cipherInfoP
A handle to a context to pass to the other members of the Decrypt functions.

Comments

The provider is responsible for initializing a context of the appropriate type with the specified keyInfoP for the operation and saving it in cipherInfoP. This Init operation must be concluded with a single finalization operation with zero or more update operations in between.

APDecryptUpdate Struct ^TOP^

Purpose

The command paramater block for the DecryptUpdate call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APCipherInfoType *cipherInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APDecryptUpdate;

Fields

keyInfoP
The key to be used for the operation.
cipherInfoP
Avalid context for this operation initialized by the initialization operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by bufOut. Also returns the actual number of bytes placed in bufOut on return.

Comments

The cipherInfoP field specifies an initialized context which was created in the initialization of this class of functions.

If bufInLen is non-zero, the provider uses cipherInfoP to update the operation with the data in bufIn of length bufInLen.

The provider finalizes the operation which was initialized by the Init operation and places the results of the operation in bufOut. The provider updates bufOutLenP with the actual number of bytes placed in bufOut. The provider is responsible for cleaning up the cipherInfoP parameter.

APDeriveKeyData Struct ^TOP^

Purpose

The command paramater block for the DeriveKeyData call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyDerivationEnum kdType;
      APKeyDerivationUsageEnum kdUsage;
      uint8_t *saltP;
      uint32_t saltLen;
      uint32_t iterationCount;
      void *kdInfo;
      uint8_t *keyDataP;
      uint32_t *keyDataLenP;
   } APDeriveKeyData;

Fields

kdType
The type of key derivation to be performed. One of the values specified by APKeyDerivationEnum.
kdUsage
The allowed usage of the subsequently derived key. One of the values specified by APKeyDerivationUsageEnum.
saltP
Cryptographic salt to be used for the derivation function.
saltLen
The length, in bytes, of the salt.
iterationCount
The number of iterations for this particular derivation operation.
kdInfo
Other derivation-function-specific parameters as defined by both the provider handling the derivation and the derivation function itself.
keyDataP
Pointer to a buffer into which the derived key data is written. Pass NULL to determine how large this buffer should be.
keyDataLenP
When calling DeriveKeyData, set the variable to which this parameter points to the size of the keyDataP buffer. Upon return, the variable will be set to the number of bytes written to keyDataP. If you set keyDataP to NULL, set this variable to 0.

APEncrypt Struct ^TOP^

Purpose

The command paramater block for the Encrypt call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APCipherInfoType *cipherInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APEncrypt;

Fields

keyInfoP
The key to be used for the operation.
cipherInfoP
A valid context for this operation initialized by the initialization operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by the bufOut parameter. Also returns the actual number of bytes placed in bufOut on return.

Comments

The cipherInfoP parameter specifies an initialized context which was created during the initialization of this class of functions.

The parameter bufInLen may not be zero and bufIn must be valid.

The provider performs a complete encryption operation using the data in bufIn of length bufInLen and puts the results in bufOut. The actual number of bytes placed in bufOut is placed in bufOutLenP.

APEncryptFinal Struct ^TOP^

Purpose

The command paramater block for the EncryptFinal call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APCipherInfoType *cipherInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APEncryptFinal;

Fields

keyInfoP
The key to be used for the operation.
cipherInfoP
A valid context for this operation initialized by the initialization operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by the bufOut parameter. Also returns the actual number of bytes placed in bufOut on return

Comments

The cipherInfoP parameter specifies an initialized context which was created in the Init of this class of functions.

If the bufInLen is non-zero, the provider uses the cipherInfoP to update the operation with the data in bufIn of length bufInLen.

The provider finalizes the operation which was initialized by the Init operation and places the results of the operation in bufOut. The provider updates bufOutLenP with the actual number of bytes placed in bufOut. The provider is responsible for cleaning up the cipherInfoP parameter.

APEncryptInit Struct ^TOP^

Purpose

The command paramater block for the EncryptInit call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APCipherInfoType *cipherInfoP;
   } APEncryptInit;

Fields

keyInfoP
The key to be used for the operation.
cipherInfoP
A handle to a context to pass to the other members of the Encrypt functions.

Comments

The provider is responsible for initializing a context of the appropriate type with the specified keyInfoP for the operation and saving it in cipherInfoP. This initialization operation must be concluded with a single finalization operation with zero or more update operations in between.

APEncryptUpdate Struct ^TOP^

Purpose

The command paramater block for the EncryptUpdate call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APCipherInfoType *cipherInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APEncryptUpdate;

Fields

keyInfoP
The key to be used for the operation.
cipherInfoP
A valid context for this operation initialized by the initialization operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by the bufOut parameter. Also returns the actual number of bytes placed in bufOut on return

Comments

The cipherInfoP parameter specifies an initialized context which was created by the initialization of this class of functions. The provider uses cipherInfoP to update the operation with the data in bufIn of length bufInLen. The provider also updates cipherInfoP to reflect the update. Any number of update operations (including zero) may occur between an initialization and a finalization operation. The parameters bufIn and bufInLen must be valid for the operation or an error is returned.

APExportCipherInfo Struct ^TOP^

Purpose

The command paramater block for the ExportCipherInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *exportDataP;
      uint32_t *dataLenP;
      APCipherInfoType *cipherInfoP;
   } APExportCipherInfo;

Fields

encoding
The encoding of the data being exported.
exportDataP
The data for the export operation.
dataLenP
Length of the exported data.
cipherInfoP
A valid context for this operation initialized by the initialization operation.

APExportHashInfo Struct ^TOP^

Purpose

The command paramater block for the ExportHashInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *exportDataP;
      uint32_t *dataLenP;
      APHashInfoType *hashInfoP;
   } APExportHashInfo;

Fields

encoding
The encoding of the data being exported.
exportDataP
The data for the export operation.
dataLenP
Length of the exported data.
hashInfoP
An APHashInfoType structure, allocated by the application, that holds information about the hashing operation.

APExportKeyInfo Struct ^TOP^

Purpose

The command paramater block for the ExportKey call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      APKeyInfoType *keyInfoP;
      uint8_t *exportDataP;
      uint32_t *dataLenP;
   } APExportKeyInfo;

Fields

encoding
The encoding desired for the export data.
keyInfoP
Pointer to the key being exported.
exportDataP
The data for the export operation.
dataLenP
Length of the exported data.

APExportKeyPairInfo Struct ^TOP^

Purpose

The command paramater block for the ExportKeyPair call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *exportDataP;
      uint32_t *dataLenP;
      APKeyInfoType *privateKeyInfoP;
      APKeyInfoType *publicKeyInfoP;
   } APExportKeyPairInfo;

Fields

encoding
The encoding of the data being exported.
exportDataP
The data for the export operation.
dataLenP
Length of the exported data.
privateKeyInfoP
Pointer to the APKeyInfoType structure for the private key.
publicKeyInfoP
Pointer to the APKeyInfoType structure for the public key.

APExportMacInfo Struct ^TOP^

Purpose

The command paramater block for the ExportMAC call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *exportDataP;
      uint32_t *dataLenP;
      APMACInfoType *macInfoP;
   } APExportMACInfo;

Fields

encoding
The encoding of the data being exported.
exportDataP
The data for the export operation.
dataLenP
Length of the exported data.
macInfoP
Pointer to an APMACInfoType structure.

APExportSignInfo Struct ^TOP^

Purpose

The command paramater block for the ExportSignInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *exportDataP;
      uint32_t *dataLenP;
      APSignInfoType *signInfoP;
   } APExportSignInfo;

Fields

encoding
The encoding of the data being exported.
exportDataP
The data for the export operation.
dataLenP
Length of the exported data.
signInfoP
A valid context for this operation initialized by the initialization operation.

APExportVerifyInfo Struct ^TOP^

Purpose

The command paramater block for the ExportVerifyInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *exportDataP;
      uint32_t *dataLenP;
      APVerifyInfoType *verifyInfoP;
   } APExportVerifyInfo;

Fields

encoding
The encoding of the data being exported.
exportDataP
The data for the export operation.
dataLenP
Length of the exported data.
verifyInfoP
A valid context for this operation initialized by the initialization operation.

APGenerateKey Struct ^TOP^

Purpose

The command paramater block for the GenerateKey call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t *keyDataP;
      uint32_t dataLen;
      APKeyInfoType *keyInfoP;
   } APGenerateKey;

Fields

keyDataP
Pointer to a buffer of seed bytes to be used by the pseudo-random number generator, or NULL to have the pseudo-random number generator use the seed data it already has.
dataLen
Length of the keyDataP data.
keyInfoP
An opaque handle to the key generated by the provider.

Comments

If the newly-generated key is utilized for any cryptographic operations, it must be exported and saved in order to be used again. It is statistically improbably that a generated key could be regenerated.

The provider generates a key of the specified type and returns an opaque handle the key in keyInfoP.

APGenerateKeyPair Struct ^TOP^

Purpose

The command paramater block for the GenerateKeyPair call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t *keyDataP;
      uint32_t dataLen;
      APKeyInfoType *privateKeyInfoP;
      APKeyInfoType *publicKeyInfoP;
   } APGenerateKeyPair;

Fields

keyDataP
Pointer to a buffer of seed bytes to be used by the pseudo-random number generator, or NULL to have the pseudo-random number generator use the seed data it already has.
dataLen
Length of the keyDataP data.
privateKeyInfoP
Pointer to the APKeyInfoType structure for the private key.
publicKeyInfoP
Pointer to the APKeyInfoType structure for the public key.

Comments

If the newly-generated key pair is utilized for any cryptographic operations, the pair must be exported and saved in order to be used again. It is statistically improbably that a generated key pair could be regenerated.

APGetProviderInfo Struct ^TOP^

Purpose

The command paramater block for the GetProviderInfo call. The info field is filled in with appropriate information. The provider is responsible for filling the correct information.

Declared In

CPMLibProvider.h

Prototype

struct {
   APProviderInfoType *infoP;
} APGetProviderInfo;

Fields

infoP
pointer to the APProviderInfoType structure.

APHash Struct ^TOP^

Purpose

The command paramater block for the Hash call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APHashEnum type;
      APHashInfoType *hashInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APHash;

Fields

type
The type of hash requested for this operation.
hashInfoP
The hash context information for this operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer into which the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by the bufOut parameter. Returns the actual number of bytes placed in bufOut.

Comments

The hashInfoP parameter specifies an initialized context which was created in the initialization of this class of functions.

The parameter bufInLen may not be zero and bufIn must be valid.

The provider performs a complete operation of type using the data in bufIn of length bufInLen and puts the results in bufOut. The actual number of bytes placed in bufOut is placed in bufOutLenP.

APHashFinal Struct ^TOP^

Purpose

The command paramater block for the HashFinal call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APHashInfoType *hashInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APHashFinal;

Fields

hashInfoP
A valid context for this operation initialized by the HashInit operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are placed.
bufOutLenP
The size of the buffer specified by the bufOut parameter. Returns the actual number of bytes placed in bufOut.

Comments

The hashInfoP parameter specifies an initialized context which was created in the Init of this class of functions.

If the bufInLen is non-zero, the provider uses the hashInfoP to update the operation with the data in bufIn of length bufInLen.

The provider finalizes the operation which was initialized by the Init operation and places the results of the operation in bufOut. The provider updates bufOutLenP with the actual number of bytes placed in bufOut. The provider is responsible for cleaning up the hashInfoP parameter.

APHashInit Struct ^TOP^

Purpose

The command paramater block for the HashInit call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APHashInfoType *hashInfoP;
   } APHashInit;

Fields

hashInfoP
A pointer to a hash info structure to pass to the other members of the Hash functions.

Comments

The provider is responsible for initializing a context of the appropriate for the operation and saving it in *hashInfoP. This initialization operation must be concluded with a single HashFinal operation with zero or more HashUpdate operations in between.

APHashUpdate Struct ^TOP^

Purpose

The command paramater block for the HashUpdate call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APHashInfoType *hashInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
   } APHashUpdate;

Fields

hashInfoP
A valid context for this operation initialized by the HashInit operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.

Comments

The hashInfoP parameter specifies an initialized context which was created during the initialization of this class of functions. The provider uses the hashInfoP to update the operation with the data in bufIn of length bufInLen. The provider also updates the hashInfoP to reflect the update. Any number of update operations (including zero) may occur between an intialization and a finalization operation. The parameters bufIn and bufInLen must be valid for the operation or an error is returned.

APImportCipherInfo Struct ^TOP^

Purpose

The command paramater block for the ImportCipherInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *importDataP;
      uint32_t dataLen;
      APCipherInfoType *cipherInfoP;
   } APImportCipherInfo;

Fields

encoding
The encoding of the data being imported.
importDataP
The data for the import operation.
dataLen
Length of the importDataP block.
cipherInfoP
A valid context for this operation initialized by the initialization operation.

APImportHashInfo Struct ^TOP^

Purpose

The command paramater block for the ImportHashInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *importDataP;
      uint32_t dataLen;
      APHashInfoType *hashInfoP;
   } APImportHashInfo;

Fields

encoding
The encoding of the data being imported.
importDataP
The data for the import operation.
dataLen
Length of the importDataP block.
hashInfoP
Pointer to an APHashInfoType structure that holds information about the hashing operation.

APImportKeyInfo Struct ^TOP^

Purpose

The command paramater block for the ImportKey call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *importDataP;
      uint32_t dataLen;
      APKeyInfoType *keyInfoP;
   } APImportKeyInfo;

Fields

encoding
The encoding of the data being imported.
importDataP
The data for the import operation.
dataLen
Length of the importDataP block.
keyInfoP
An opaque handle to the key generated by the provider.

Comments

The provider imports a key as specified by the data in importDataP and returns an opaque handle the key in keyInfoP.

APImportKeyPairInfo Struct ^TOP^

Purpose

The command paramater block for the ImportKeyPair call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *importDataP;
      uint32_t dataLen;
      APKeyInfoType *privateKeyInfoP;
      APKeyInfoType *publicKeyInfoP;
   } APImportKeyPairInfo;

Parameters

encoding
The encoding of the data being imported.
importDataP
The data for the import operation.
dataLen
Length of the import data.
privateKeyInfoP
Pointer to the APKeyInfoType structure for the private key.
publicKeyInfoP
Pointer to the APKeyInfoType structure for the public key.

APImportMacInfo Struct ^TOP^

Purpose

The command paramater block for the ImportMAC call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *importDataP;
      uint32_t dataLen;
      APMACInfoType *macInfoP;
   } APImportMACInfo;

Fields

encoding
The encoding of the data being imported.
importDataP
The data for the import operation.
dataLen
Length of the importDataP block.
macInfoP
Pointer to an APMACInfoType structure.

APImportSignInfo Struct ^TOP^

Purpose

The command paramater block for the ImportSignInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *importDataP;
      uint32_t dataLen;
      APSignInfoType *signInfoP;
   } APImportSignInfo;

Fields

encoding
The encoding of the data being imported.
importDataP
The data for the import operation.
dataLen
Length of the importDataP block.
signInfoP
A valid context for this operation initialized by the initialization operation.

APImportVerifyInfo Struct ^TOP^

Purpose

The command paramater block for the ImportVerifyInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      uint8_t encoding;
      uint8_t *importDataP;
      uint32_t dataLen;
      APVerifyInfoType *verifyInfoP;
   } APImportVerifyInfo;

Fields

encoding
The encoding of the data being imported.
importDataP
The data for the import operation.
dataLen
Length of the importDataP block.
verifyInfoP
A valid context for this operation initialized by the initialization operation.

APMac Struct ^TOP^

Purpose

The command paramater block for the Mac call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APHashInfoType *hashInfoP;
      APMACEnum type;
      APMACInfoType *macInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APMac;

Fields

keyInfoP
Pointer to an APKeyInfoType structure, allocated by the application, containing the key to be used for the operation.
hashInfoP
Pointer to an APHashInfoType structure, allocated by the application, that holds information about the hashing operation to be used for the operation.
type
One of the values declared by the APMACEnum enum.
macInfoP
Pointer to an APMACInfoType structure, allocated by the application, to be used in subsequent calls to the same class of operations.
bufIn
Pointer to a buffer containing the data for the operation. This parameter must not be NULL.
bufInLen
The size, in bytes, of the buffer specified by bufIn. This value must be greater than zero.
bufOut
Pointer to a buffer, allocated by the application, to receive the output of the operation.
bufOutLenP
The size, in bytes, of the buffer specified by the bufOut parameter.

APMacFinal Struct ^TOP^

Purpose

The command paramater block for the MacFinal call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APMACInfoType *macInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APMacFinal;

Fields

macInfoP
Pointer to the APMACInfoType structure that was initialized during the call to CPMLibMACInit().
bufIn
Pointer to a buffer containing the data for the operation, or NULL if there is no additional data.
bufInLen
The size, in bytes, of the buffer specified by bufIn.
bufOut
Pointer to a buffer, allocated by the application, to receive the output of the operation.
bufOutLenP
The size, in bytes, of the buffer specified by the bufOut parameter.

APMacInit Struct ^TOP^

Purpose

The command paramater block for the MacInit call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType keyInfoP;
      APHashInfoType hashInfoP;
      APMACInfoType *macInfoP;
   } APMacInit;

Parameters

keyInfoP
Pointer to an APKeyInfoType structure, allocated by the application, containing the key to be used in the subsequent calls to CPMLibMACUpdate() and CPMLibMACFinal().
hashInfoP
Pointer to an APHashInfoType structure, allocated by the application, that holds information about the hashing operation for use in the subsequent calls to CPMLibMACUpdate() and CPMLibMACFinal().
macInfoP
Pointer to an APMACInfoType structure, allocated by the application, to be used in subsequent calls to the same class of operations.

APMacUpdate Struct ^TOP^

Purpose

The command paramater block for the MacUpdate call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APMACInfoType *macInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
   } APMacUpdate;

Fields

macInfoP
Pointer to the APMACInfoType structure that was initialized during the call to CPMLibMACInit().
bufIn
Pointer to a buffer containing the data for the operation. This parameter must not be NULL.
bufInLen
The size, in bytes, of the buffer specified by bufIn. This value must be greater than zero.
bufOut
Pointer to a buffer, allocated by the application, to receive the output of the operation.
bufOutLenP
The size, in bytes, of the buffer specified by the bufOut parameter.

APReleaseCipherInfo Struct ^TOP^

Purpose

The command paramater block for the ReleaseCipherInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APCipherInfoType *cipherInfoP;
   } APReleaseCipherInfo;

Parameters

cipherInfoP
A valid context for this operation initialized by the initialization operation.

APReleaseHashInfo Struct ^TOP^

Purpose

The command paramater block for the ReleaseHashInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APHashInfoType *hashInfoP;
   } APReleaseHashInfo;

Fields

hashInfoP
Pointer to the APHashInfoType structure.

APReleaseKeyInfo Struct ^TOP^

Purpose

The command paramater block for the ReleaseKey call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
   } APReleaseKeyInfo;

Fields

keyInfoP
Pointer to the key data to be released.

Comments

The provider releases the key specified by keyInfoP. After this call, keyInfoP is no longer valid for any operations.

APReleaseMACInfo Struct ^TOP^

Purpose

The command paramater block for the ReleaseMACInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APMACInfoType *macInfoP;
   } APReleaseMACInfo;

Fields

macInfoP
Pointer to an APMACInfoType structure.

APReleaseSignInfo Struct ^TOP^

Purpose

The command paramater block for the ReleaseSignInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APSignInfoType *signInfoP;
   } APReleaseSignInfo;

Fields

signInfoP
A valid context for this operation initialized by the initialization operation.

APReleaseVerifyInfo Struct ^TOP^

Purpose

The command paramater block for the ReleaseVerifyInfo call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APVerifyInfoType *verifyInfoP;
   } APReleaseVerifyInfo;

Fields

verifyInfoP
A valid context for this operation initialized by the initialization operation.

APSign Struct ^TOP^

Purpose

The command paramater block for the Sign call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APSignInfoType *signInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
      uint8_t *signature;
      uint32_t *signatureLenP;
   } APSign;

Fields

keyInfoP
The key to be used for the operation.
signInfoP
A valid context for this operation initialized by the initialization operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by the bufOut parameter. Also returns the actual number of bytes placed in bufOut on return.
signature
Pointer to a buffer, allocated by the application, to receive the calculated signature.
signatureLenP
The size, in bytes, of the buffer specified by the signature parameter.

Comments

The signInfoP parameter specifies an initialized context which was created in the Init of this class of functions.

The parameter bufInLen may not be zero and bufIn must be valid.

The provider performs a complete operation using the data in bufIn of length bufInLen and puts the results in bufOut. The actual number of bytes placed in bufOut is placed in bufOutLenP.

APSignFinal Struct ^TOP^

Purpose

The command paramater block for the SignFinal call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APSignInfoType *signInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
      uint8_t *signature;
      uint32_t *signatureLenP;
   } APSignFinal;

Fields

keyInfoP
The key to be used for the operation.
signInfoP
A valid context for this operation initialized by the initialization operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by the bufOut parameter. Also returns the actual number of bytes placed in bufOut on return.
signature
Pointer to a buffer, allocated by the application, to receive the calculated signature.
signatureLenP
The size, in bytes, of the buffer specified by the signature parameter.

APSignInit Struct ^TOP^

Purpose

The command paramater block for the SignInit call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APSignInfoType *signInfoP;
   } APSignInit;

Fields

keyInfoP
The key to be used for the operation.
signInfoP
A handle to a context to pass to the other members of the Sign functions.

Comments

The provider is responsible for initializing a context with the specified keyInfoP for the operation and saving it in signInfoP. This initialization operation must be concluded with a single finalization operation with zero or more update operations in between.

APSignUpdate Struct ^TOP^

Purpose

The command paramater block for the SignUpdate call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APSignInfoType *signInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
   } APSignUpdate;

Fields

keyInfoP
The key to be used for the operation.
signInfoP
A valid context for this operation initialized by the initialization operation.
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.

Comments

The signInfoP parameter specifies an initialized context which was during in the initialization of this class of functions. The provider uses signInfoP to update the operation with the data in bufIn of length bufInLen. The provider also updates the signInfoP to reflect the update. Any number of update operations (including zero) may occur between an initialization and a finalization operation. The parameters bufIn and bufInLen must be valid for the operation or an error is returned.

APVerify Struct ^TOP^

Purpose

The command paramater block for the Verify call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APVerifyInfoType *verifyInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
      uint8_t *signature;
      uint32_t signatureLen;
      VerifyResultType *verifyResultP;
   } APVerify;

Fields

keyInfoP
The key to be used for the operation.
verifyInfoP
A valid context for this operation initialized by the intialization operation
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by the bufOut parameter. Also returns the actual number of bytes placed in bufOut on return.
signature
Pointer to a buffer containing the previously calculated signature that is being verified.
signatureLen
The length, in bytes, of the buffer specified by signature.
verifyResultP
Value that should be set by the provider to zero if the signature verifies or 1 if the signature did not verify.

Comments

The verifyInfoP parameter specifies an initialized context which was created during the initialization of this class of functions.

The parameter bufInLen may not be zero and bufIn must be valid.

The provider performs a complete verification operation using the data in bufIn of length bufInLen and puts the results in bufOut. The actual number of bytes placed in bufOut is placed in bufOutLenP.

APVerifyFinal Struct ^TOP^

Purpose

The command paramater block for the VerifyFinal call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APVerifyInfoType *verifyInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
      uint8_t *bufOut;
      uint32_t *bufOutLenP;
      uint8_t *signature;
      uint32_t signatureLen;
      VerifyResultType *verifyResultP;
   } APVerifyFinal;

Fields

keyInfoP
The key to be used for the operation.
verifyInfoP
A valid context for this operation initialized by the intialization operation
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.
bufOut
The buffer where the results of the operation are to be placed.
bufOutLenP
The size of the buffer specified by the bufOut parameter. Also returns the actual number of bytes placed in bufOut on return.
signature
Pointer to a buffer containing the previously calculated signature that is being verified.
signatureLen
The length, in bytes, of the buffer specified by signature.
verifyResultP
Value that should be set by the provider to zero if the signature verifies or 1 if the signature did not verify.

Comments

The verifyInfoP parameter specifies an initialized context which was created during the initialization of this class of functions.

If bufInLen is non-zero, the provider uses verifyInfoP to update the operation with the data in bufIn of length bufInLen.

The provider finalizes the operation which was initialized by the initialize operation and places the results of the operation in bufOut. The provider updates bufOutLenP with the actual number of bytes placed in bufOut. The provider is responsible for cleaning up the verifyInfoP parameter.

APVerifyInit Struct ^TOP^

Purpose

The command paramater block for the VerifyInit call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APVerifyInfoType *verifyInfoP;
   } APVerifyInit;

Fields

keyInfoP
The key to be used for the operation.
verifyInfoP
A handle to a context to pass to the other members of the Verify functions.

Comments

The provider is responsible for initializing a context with the specified keyInfoP for the operation and saving it in verifyInfoP. This initialization operation must be concluded with a single finalize operation with zero or more update operations in between.

APVerifyUpdate Struct ^TOP^

Purpose

The command paramater block for the VerifyUpdate call.

Declared In

CPMLibProvider.h

Prototype

   struct {
      APKeyInfoType *keyInfoP;
      APVerifyInfoType *verifyInfoP;
      uint8_t *bufIn;
      uint32_t bufInLen;
   } APVerifyUpdate;

Fields

keyInfoP
The key to be used for the operation.
verifyInfoP
A valid context for this operation initialized by the intialization operation
bufIn
The data to add to the operation.
bufInLen
The length of the data to add to this operation.

Comments

The verifyInfoP parameter specifies an initialized context which was created during the initialization of this class of functions. The provider uses the verifyInfoP to update the operation with the data in bufIn of length bufInLen. The provider also updates the verifyInfoP to reflect the update. Any number of update operations (including zero) may occur between an initialization and a finalization operation. The parameters bufIn and bufInLen must be valid for the operation or an error is returned.

CPM Library Provider Constants ^TOP^

APCmdType Enum ^TOP^

Purpose

Algorithm provider command selectors.

Declared In

CPMLibProvider.h

Constants

apClose
Handles the closing of the library.
apDecrypt
Performs a decryption operation in one pass. Parameters are passed to this function using an APDecrypt structure.
apDecryptFinal
Finalizes a multi-part decryption operation. Parameters are passed to this function using an APDecryptFinal structure.
apDecryptInit
Begins a multi-part decryption operation with the specified key and returns the context of the decrypt operation. Parameters are passed to this function using an APDecryptInit structure.
apDecryptUpdate
Updates a multi-part decryption operation with more data. Parameters are passed to this function using an APDecryptUpdate structure.
apDeriveKeyData
Derives a key from the supplied input data. Parameters are passed to this function using an APDeriveKeyData structure.
apEncrypt
Performs an encryption operation in one pass. Parameters are passed to this function using an APEncrypt structure.
apEncryptFinal
Finalizes a multi-part encryption operation. Parameters are passed to this function using an APEncryptFinal structure.
apEncryptInit
Begins a multi-part encryption operation with the specified key and returns the context of the encrypt operation. Parameters are passed to this function using an APEncryptInit structure.
apEncryptUpdate
Updates a multi-part encryption operation with more data. Parameters are passed to this function using an APEncryptUpdate structure.
apExportCipherInfo
Creates a storable instance of an APCipherInfoType structure. Parameters are passed to this function using an APExportCipherInfo structure.
apExportHashInfo
Creates a storable instance of an APHashInfoType structure. Parameters are passed to this function using an APExportHashInfo structure.
apExportKeyInfo
Creates a storable instance of a key that is already familiar to the CPM framework. Parameters are passed to this function using an APExportKeyInfo structure.
apExportKeyPairInfo
Creates a storable instance of a set of APKeyInfoType structures representing a private key and a public key. Parameters are passed to this function using an APExportKeyPairInfo structure.
apExportMACInfo
Creates a storable instance of an APMACInfoType structure. Parameters are passed to this function using an APExportMacInfo structure.
apExportSignInfo
Creates a storable instance of an APSignInfoType structure. Parameters are passed to this function using an APExportSignInfo structure.
apExportVerifyInfo
Creates a storable instance of an APVerifyInfoType structure. Parameters are passed to this function using an APExportVerifyInfo structure.
apGenerateKey
Generates a new key. Parameters are passed to this function using an APGenerateKey structure.
apGenerateKeyPair
Generates a new public/private key pair. Parameters are passed to this function using an APGenerateKeyPair structure.
apGetInfo
Not used.
apGetProviderInfo
Gets information about the requested provider. Information returned includes the name of the provider, some additional text about the provider, the "algorithms" supported, and so on. Parameters are passed to this function using an APGetProviderInfo structure.
apHash
Performs the hashing operation in one pass. Parameters are passed to this function using an APHash structure.
apHashFinal
Finalizes a multi-part hash operation. Parameters are passed to this function using an APHashFinal structure.
apHashInit
Begins a multi-part hash operation of a specified type and returns the context of the hash operation. Parameters are passed to this function using an APHashInit structure.
apHashUpdate
Updates a multi-part hash operation with more data. Parameters are passed to this function using an APHashUpdate structure.
apImportCipherInfo
Initialize the contents of an APCipherInfoType structure based upon a storable instance of that structure. Parameters are passed to this function using an APImportCipherInfo structure.
apImportHashInfo
Initialize the contents of an APHashInfoType structure based upon a storable instance of that structure. Parameters are passed to this function using an APImportHashInfo structure.
apImportKeyInfo
Introduces an existing key to the CPM framework. Parameters are passed to this function using an APImportKeyInfo structure.
apImportKeyPairInfo
Introduces an existing public/private key pair to the CPM framework. Parameters are passed to this function using an APImportKeyPairInfo structure.
apImportMACInfo
Initialize the contents of an APMACInfoType structure based upon a storable instance of that structure. Parameters are passed to this function using an APImportMacInfo structure.
apImportSignInfo
Initialize the contents of an APSignInfoType structure based upon a storable instance of that structure. Parameters are passed to this function using an APImportSignInfo structure.
apImportVerifyInfo
Initialize the contents of an APVerifyInfoType structure based upon a storable instance of that structure. Parameters are passed to this function using an APImportVerifyInfo structure.
apMAC
Performs the message authentication operation in one pass. Parameters are passed to this function using an APMac structure.
apMACFinal
Finalizes a multi-part message authentication operation. Parameters are passed to this function using an APMacFinal structure.
apMACInit
Begins a multi-part message authentication operation with the specified key and hash info and returns the context of the operation. Parameters are passed to this function using an APMacInit structure.
apMACUpdate
Updates a multi-part message authentication operation with more data. Parameters are passed to this function using an APMacUpdate structure.
apOpen
Handles the opening of the library.
apReleaseCipherInfo
Allows the CPM and the provider(s) to clean up before the application frees the APICipherInfoType structure. Parameters are passed to this function using an APReleaseCipherInfo structure.
apReleaseHashInfo
Allows the CPM and the provider(s) to clean up before the application frees the APIHashInfoType structure. Parameters are passed to this function using an APReleaseHashInfo structure.
apReleaseKeyInfo
Allows the CPM and the provider(s) to clean up before the application frees the APKeyInfoType structure. Parameters are passed to this function using an APReleaseKeyInfo structure.
apReleaseMACInfo
Allows the CPM and the provider(s) to clean up before the application frees the APMACInfoType structure. Parameters are passed to this function using an APReleaseMACInfo structure.
apReleaseSignInfo
Allows the CPM and the provider(s) to clean up before the application frees the APSignInfoType structure. Parameters are passed to this function using an APReleaseSignInfo structure.
apReleaseVerifyInfo
Allows the CPM and the provider(s) to clean up before the application frees the APVerifyInfoType structure. Parameters are passed to this function using an APReleaseVerifyInfo structure.
apSign
Performs the signing operation in one pass. Parameters are passed to this function using an APSign structure.
apSignFinal
Finalizes a multi-part signing operation. Parameters are passed to this function using an APSignFinal structure.
apSignInit
Begins a multi-part signing operation with the specified key and returns the context of the signing operation. Parameters are passed to this function using an APSignInit structure.
apSignUpdate
Updates a multi-part signing operation with more data. Parameters are passed to this function using an APSignUpdate structure.
apStatus
apVerify
Performs the verify operation in one pass. Parameters are passed to this function using an APVerify structure.
apVerifyFinal
Finalizes a multi-part verification operation. Parameters are passed to this function using an APVerifyFinal structure.
apVerifyInit
Begins a multi-part verification operation with the specified key and returns the context of the verification operation. Parameters are passed to this function using an APVerifyInit structure.
apVerifyUpdate
Updates a multi-part verification operation with more data. Parameters are passed to this function using an APVerifyUpdate structure.
apLast
Not a value that represents an actual function, this is one greater than the final function selector value.
apZero

Miscellaneous CPM Library Provider Constants ^TOP^

Purpose

The CPMLibProvider.h file also declares the following constants.

Declared In

CPMLibProvider.h

Constants

#define cpmProviderResourceID 0
Defines the resource ID of the code resource.
#define cpmProviderResourceType 'cpmp'
Defines the type (creator/type) of the provider.

Application-Defined Functions ^TOP^

APDispatchProcPtr Function ^TOP^

Purpose

Pointer to the provider's command dispatch function. Each provider must export a function matching this signature as a dispatcher for the commands and command parameter blocks that will be sent to the provider by the CPM.

Declared In

CPMLibProvider.h

Prototype

status_t (
   *APDispatchProcPtr
) (
   CPMCallerInfoPtr info,
   APCmdType cmd,
   APCmdPBPtr pbP
)

Parameters

info
Pointer to a CPMCallerInfoType structure that contains all the information necessary for the provider to call back into the CPM's framework and use the CPM's resources.
cmd
One of the values listed under "CPM Library Provider Constants."
pbP
Pointer to the appropriate parameter block structure for the command. The documentation for each command identifies the parameter block structure to use with that command.

Returns

errNone if the operation completed successfully, or an appropriate error code (usually, one of the codes listed under "CPM Library Error Codes").

See Also

CPMDispatcherProcPtr()

CPMAddRandomSeedProcPtr Function ^TOP^

Purpose

Pointer to a function that puts a number of seed bytes into the pseudo-random number generator maintained by the CPM.

Declared In

CPMLibProvider.h

Prototype

status_t (
   *CPMAddRandomSeedProcPtr
) (
   void *appContext,
   uint8_t *buffer,
   uint32_t buflen
)

Parameters

appContext
Pointer to a structure containing the provider-specific application context to be used in future CPM calls. This structure is normally created and initialized when the library is opened.
buffer
Pointer to a buffer of seed bytes.
buflen
The number of bytes in buffer.

Returns

errNone if the operation completed successfully, or one of the error codes listed under "CPM Library Error Codes" otherwise.

See Also

CPMAddRandomSeedProcPtr()

CPMDebugOutProcPtr Function ^TOP^

Purpose

Pointer to a function that sends a null-terminated string to the current debug device, if the level set using CPMLibSetDebugLevel() is less than or equal to the message's debug output level.

Declared In

CPMLibProvider.h

Prototype

status_t (
   *CPMDebugOutProcPtr
) (
   void *appContext,
   uint8_t level,
   char *fmtstring,
   ...
)

Parameters

appContext
Pointer to a structure containing the provider-specific application context to be used in future CPM calls. This structure is normally created and initialized when the library is opened.
level
The debug output level of the message. One of the values listed under "Debug Output Levels."
fmtstring
A printf-style format string for the debug message being sent.
...
Zero or more arguments to be substituted as appropriate in the format string.

Returns

errNone.

See Also

CPMLibSetDebugLevel()

CPMDispatcherProcPtr Function ^TOP^

Purpose

Pointer to the Cryptographic Provider Manager's function dispatcher. This function attempts to locate a provider that implements the supplied command. If it is successful, it directs the command and parameter block to that provider.

Declared In

CPMLibProvider.h

Prototype

status_t (
   *CPMDispatcherProcPtr
) (
   void *appContext,
   APCmdType cmd,
   APCmdPBType *cmdPB,
   uint32_t *id
)

Parameters

appContext
Pointer to a structure containing the provider-specific application context to be used. This structure is normally created and initialized when the library is opened.
cmd
One of the values listed under "CPM Library Provider Constants."
cmdPB
Pointer to the appropriate parameter block structure for the command. The documentation for each command identifies the parameter block structure to use with that command.
id
Pointer to a uint32_t containing the ID of a specific provider to which the command is to be directed. If *id is 0, the CPM directs the command to the first provider that implements the requested functionality.

Returns

The return value passed back from the provider (which may be cpmErrUnimplemented if the provider recognizes but does not implement the supplied command), or one of the following if the command couldn't be directed to a provider:

cpmErrProviderNotFound
A provider ID was supplied, but the CPM couldn't find a provider with the supplied ID.
cpmErrNoProviders
Given the supplied application context, the CPM is unaware of any providers.
cpmErrNoAppContext
The appContext parameter is NULL.
cpmErrParamErr
The supplied command isn't a valid command.
cpmErrUnsupported
The supplied command isn't supported.

Comments

If *id is 0, the CPM's function dispatcher attempts to locate a provider that implements cmd. If it finds one, that provider's dispatch function (an APDispatchProcPtr) is called with the specified command and command parameters.

See Also

APDispatchProcPtr

CPMGenerateRandomBytesProcPtr Function ^TOP^

Purpose

Pointer to a function that returns a requested number of random bytes.

Declared In

CPMLibProvider.h

Prototype

status_t (
   *CPMGenerateRandomBytesProcPtr
) (
   void *appContext,
   uint8_t *buffer,
   uint32_t *buflenP
)

Parameters

appContext
Pointer to a structure containing the provider-specific application context to be used in future CPM calls. This structure is normally created and initialized when the library is opened.
buffer
Pointer to a buffer, allocated by the application, into which the random bytes are written.
buflenP
When this function is called, the variable pointed to by this parameter is set to the size of buffer. Upon return, the variable contains the number of random bytes written to buffer.

errNone if the operation completed successfully, or one of the error codes listed under "CPM Library Error Codes" otherwise.

Comments

If there are not bufLenP random bytes available, this function returns the available random bytes and returns the number of available bytes in bufLenP.

See Also

CPMAddRandomSeedProcPtr()