RSA Security logo

RSA BSAFE Cert-C
API Reference

cryptspi.h

Go to the documentation of this file.
00001 /*
00002 * Copyright (c) RSA Security Inc., 1999-2002.  All rights reserved.
00003 * This work contains proprietary, confidential, and trade secret
00004 * information of RSA Security Inc.  Use, disclosure or reproduction
00005 * without the express written authorization of RSA Security Inc. is
00006 * prohibited.
00007 */
00008 
00009 #ifndef _CRYPTSPI_H_
00010 #define _CRYPTSPI_H_ 1
00011 
00023 #include "basetype.h"
00024 #include "bsafe.h"
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00049 typedef ITEM CRYPTO_PARAMS;       /* contains seed for random number object */
00050 
00051 /*
00052  * Use this type only when S_InitializeDefaultCSP2
00053  * is the provider initialization routine.
00054  * (B_PKCS11_SESSION is defined by Crypto-C)
00055  */
00082 typedef struct PKCS11_CRYPTO_PARAMS {
00083   CRYPTO_PARAMS     randomSeed;    /* contains seed for random number object */
00084   B_PKCS11_SESSION *pSessionInfo;  /* ptr to first entry in array of PKCS #11 info */
00085   unsigned int      sessionCount;  /* Must be 1                              */
00086 } PKCS11_CRYPTO_PARAMS;
00087 
00088 
00100 typedef struct crypto_funcs {
00110   void (*Finalize) (
00111     CERTC_CTX       ctx,                /* Cert-C context */
00112     POINTER         handle);            /* provider handle */
00113 
00114   /* This function returns the crypto service-provider's Crypto-C "chooser."
00115      Typically this will be a session chooser created during provider
00116      initialization by calling B_CreateSessionChooser.
00117   */
00159   int (*GetChooser) (
00160     CERTC_CTX            ctx,           /* Cert-C context */
00161     POINTER              handle,        /* provider handle */
00162     B_ALGORITHM_CHOOSER *chooser);      /* Crypto-C chooser */
00163 
00164   /* This function returns an initialized random object. The application
00165      can call B_GenerateRandomBytes immediately. */
00224   int (*GetRandomObject) (
00225     CERTC_CTX       ctx,                /* Cert-C context */
00226     POINTER         handle,             /* provider handle */
00227     B_ALGORITHM_OBJ *randomObj);        /* Crypto-C random algorithm object */
00228 
00229   /* This function is called periodically by Cert-C. It gives the crypto
00230      service-provider an opportunity to gather "random" bits of information
00231      from the operating environment. A software emulation of a "harware" random
00232      number generator might add the collected "random" bits to an internal
00233      pool. A true hardware random number generator would probably ignore calls
00234      to this routine.
00235 
00236      This routine is called relatively frequently, and must return quickly. to
00237      avoid introducing undue overhead to Cert-C operations.
00238   */
00268   void (*UpdateRandom) (
00269     CERTC_CTX       ctx,                /* Cert-C context */
00270     POINTER         handle);            /* provider handle */
00271 
00272 } CRYPTO_FUNCS;
00273 
00274 #ifdef __cplusplus
00275 }
00276 #endif
00277 
00278 #endif  /* _CRYPTSPI_H_ */



RSA BSAFE® Cert-C 2.7 API Reference