Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
crsa.c File Reference
#include "ckcapi.h"
#include "secdert.h"

Go to the source code of this file.

Classes

struct  ckcapiInternalCryptoOperationRSAPrivStr

Defines

#define SSL3_SHAMD5_HASH_SIZE   36 /* LEN_MD5 (16) + LEN_SHA1 (20) */

Typedefs

typedef struct ckcapiInternalCryptoOperationRSAPrivStr

Functions

static char * putDecimalString (char *cstr, unsigned long value)
static char * nss_ckcapi_GetOidString (unsigned char *oidTag, int oidTagSize, CK_RV *pError)
static CK_RV ckcapi_GetRawHash (const NSSItem *input, NSSItem *hash, ALG_ID *hashAlg)
void ckcapi_ReverseData (NSSItem *item)
static NSSCKMDCryptoOperation * ckcapi_mdCryptoOperationRSAPriv_Create (const NSSCKMDCryptoOperation *proto, NSSCKMDMechanism *mdMechanism, NSSCKMDObject *mdKey, CK_RV *pError)
static CK_RV ckcapi_mdCryptoOperationRSAPriv_Destroy (NSSCKMDCryptoOperation *mdOperation, NSSCKFWCryptoOperation *fwOperation, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance)
static CK_ULONG ckcapi_mdCryptoOperationRSA_GetFinalLength (NSSCKMDCryptoOperation *mdOperation, NSSCKFWCryptoOperation *fwOperation, NSSCKMDSession *mdSession, NSSCKFWSession *fwSession, NSSCKMDToken *mdToken, NSSCKFWToken *fwToken, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, CK_RV *pError)
static CK_ULONG ckcapi_mdCryptoOperationRSADecrypt_GetOperationLength (NSSCKMDCryptoOperation *mdOperation, NSSCKFWCryptoOperation *fwOperation, NSSCKMDSession *mdSession, NSSCKFWSession *fwSession, NSSCKMDToken *mdToken, NSSCKFWToken *fwToken, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, const NSSItem *input, CK_RV *pError)
static CK_RV ckcapi_mdCryptoOperationRSADecrypt_UpdateFinal (NSSCKMDCryptoOperation *mdOperation, NSSCKFWCryptoOperation *fwOperation, NSSCKMDSession *mdSession, NSSCKFWSession *fwSession, NSSCKMDToken *mdToken, NSSCKFWToken *fwToken, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, const NSSItem *input, NSSItem *output)
static CK_RV ckcapi_mdCryptoOperationRSASign_UpdateFinal (NSSCKMDCryptoOperation *mdOperation, NSSCKFWCryptoOperation *fwOperation, NSSCKMDSession *mdSession, NSSCKFWSession *fwSession, NSSCKMDToken *mdToken, NSSCKFWToken *fwToken, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, const NSSItem *input, NSSItem *output)
static void ckcapi_mdMechanismRSA_Destroy (NSSCKMDMechanism *mdMechanism, NSSCKFWMechanism *fwMechanism, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance)
static CK_ULONG ckcapi_mdMechanismRSA_GetMinKeySize (NSSCKMDMechanism *mdMechanism, NSSCKFWMechanism *fwMechanism, NSSCKMDToken *mdToken, NSSCKFWToken *fwToken, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, CK_RV *pError)
static CK_ULONG ckcapi_mdMechanismRSA_GetMaxKeySize (NSSCKMDMechanism *mdMechanism, NSSCKFWMechanism *fwMechanism, NSSCKMDToken *mdToken, NSSCKFWToken *fwToken, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, CK_RV *pError)
static NSSCKMDCryptoOperation * ckcapi_mdMechanismRSA_DecryptInit (NSSCKMDMechanism *mdMechanism, NSSCKFWMechanism *fwMechanism, CK_MECHANISM *pMechanism, NSSCKMDSession *mdSession, NSSCKFWSession *fwSession, NSSCKMDToken *mdToken, NSSCKFWToken *fwToken, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, NSSCKMDObject *mdKey, NSSCKFWObject *fwKey, CK_RV *pError)
static NSSCKMDCryptoOperation * ckcapi_mdMechanismRSA_SignInit (NSSCKMDMechanism *mdMechanism, NSSCKFWMechanism *fwMechanism, CK_MECHANISM *pMechanism, NSSCKMDSession *mdSession, NSSCKFWSession *fwSession, NSSCKMDToken *mdToken, NSSCKFWToken *fwToken, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, NSSCKMDObject *mdKey, NSSCKFWObject *fwKey, CK_RV *pError)

Variables

NSS_IMPLEMENT_DATA const
NSSCKMDCryptoOperation 
ckcapi_mdCryptoOperationRSADecrypt_proto
NSS_IMPLEMENT_DATA const
NSSCKMDCryptoOperation 
ckcapi_mdCryptoOperationRSASign_proto
NSS_IMPLEMENT_DATA const
NSSCKMDMechanism 
nss_ckcapi_mdMechanismRSA

Class Documentation

struct ckcapiInternalCryptoOperationRSAPrivStr

Definition at line 269 of file crsa.c.

Class Members
NSSItem * buffer
HCRYPTKEY hKey
HCRYPTPROV hProv
ckcapiInternalObject * iKey
DWORD keySpec
NSSCKMDMechanism * mdMechanism
NSSCKMDCryptoOperation mdOperation

Define Documentation

#define SSL3_SHAMD5_HASH_SIZE   36 /* LEN_MD5 (16) + LEN_SHA1 (20) */

Definition at line 45 of file crsa.c.


Typedef Documentation

Definition at line 267 of file crsa.c.


Function Documentation

static CK_RV ckcapi_GetRawHash ( const NSSItem *  input,
NSSItem *  hash,
ALG_ID *  hashAlg 
) [static]

Definition at line 155 of file crsa.c.

{
   unsigned char *current;
   unsigned char *algid;
   unsigned char *oid;
   unsigned char *hashData;
   char *oidStr;
   CK_RV error;
   int oidSize;
   int size;
   /*
    * there are 2 types of hashes NSS typically tries to sign, regular
    * RSA signature format (with encoded DER_OIDS), and SSL3 Signed hashes.
    * CAPI knows not to add any oids to SSL3_Signed hashes, so if we have any
    * random hash that is exactly the same size as an SSL3 hash, then we can
    * just pass the data through. CAPI has know way of knowing if the value
    * is really a combined hash or some other arbitrary data, so it's safe to
    * handle this case first.
    */
  if (SSL3_SHAMD5_HASH_SIZE == input->size) {
    hash->data = input->data;
    hash->size = input->size;
    *hashAlg = CALG_SSL3_SHAMD5;
    return CKR_OK;
  }

  current = (unsigned char *)input->data;

  /* make sure we have a sequence tag */
  if ((DER_SEQUENCE|DER_CONSTRUCTED) != *current) {
    return CKR_DATA_INVALID;
  }

  /* parse the input block to get 1) the hash oid, and 2) the raw hash value.
   * unfortunatly CAPI doesn't have a builtin function to do this work, so
   * we go ahead and do it by hand here.
   *
   * format is:
   *  SEQUENCE {
   *     SECQUENCE { // algid
   *       OID {}    // oid
   *       ANY {}    // optional params 
   *     }
   *     OCTECT {}   // hash
   */

  /* unwrap */
  algid = nss_ckcapi_DERUnwrap(current,input->size, &size, NULL);
  
  if (algid+size != current+input->size) {
    /* make sure there is not extra data at the end */
    return CKR_DATA_INVALID;
  }

  if ((DER_SEQUENCE|DER_CONSTRUCTED) != *algid) {
    /* wasn't an algid */
    return CKR_DATA_INVALID;
  }
  oid = nss_ckcapi_DERUnwrap(algid, size, &oidSize, &hashData);

  if (DER_OCTET_STRING != *hashData) {
    /* wasn't a hash */
    return CKR_DATA_INVALID;
  }

  /* get the real hash */
  current = hashData;
  size = size - (hashData-algid);
  hash->data = nss_ckcapi_DERUnwrap(current, size, &hash->size, NULL);

  /* get the real oid as a string. Again, Microsoft does not
   * export anything that does this for us */
  oidStr = nss_ckcapi_GetOidString(oid, oidSize, &error);
  if ((char *)NULL == oidStr ) {
    return error;
  }

  /* look up the hash alg from the oid (fortunately CAPI does to this) */ 
  *hashAlg = CertOIDToAlgId(oidStr);
  nss_ZFreeIf(oidStr);
  if (0 == *hashAlg) {
    return CKR_HOST_MEMORY;
  }

  /* hash looks reasonably consistent, we should be able to sign it now */
  return CKR_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static CK_ULONG ckcapi_mdCryptoOperationRSA_GetFinalLength ( NSSCKMDCryptoOperation *  mdOperation,
NSSCKFWCryptoOperation *  fwOperation,
NSSCKMDSession *  mdSession,
NSSCKFWSession *  fwSession,
NSSCKMDToken *  mdToken,
NSSCKFWToken *  fwToken,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
CK_RV pError 
) [static]

Definition at line 360 of file crsa.c.

{
  ckcapiInternalCryptoOperationRSAPriv *iOperation =
       (ckcapiInternalCryptoOperationRSAPriv *)mdOperation->etc;
  const NSSItem *modulus = 
       nss_ckcapi_FetchAttribute(iOperation->iKey, CKA_MODULUS);

  return modulus->size;
}

Here is the call graph for this function:

static CK_ULONG ckcapi_mdCryptoOperationRSADecrypt_GetOperationLength ( NSSCKMDCryptoOperation *  mdOperation,
NSSCKFWCryptoOperation *  fwOperation,
NSSCKMDSession *  mdSession,
NSSCKFWSession *  fwSession,
NSSCKMDToken *  mdToken,
NSSCKFWToken *  fwToken,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
const NSSItem *  input,
CK_RV pError 
) [static]

Definition at line 389 of file crsa.c.

{
  ckcapiInternalCryptoOperationRSAPriv *iOperation =
       (ckcapiInternalCryptoOperationRSAPriv *)mdOperation->etc;
  BOOL rc;

  /* Microsoft's Decrypt operation works in place. Since we don't want
   * to trash our input buffer, we make a copy of it */
  iOperation->buffer = nssItem_Duplicate((NSSItem *)input, NULL, NULL);
  if ((NSSItem *) NULL == iOperation->buffer) {
    *pError = CKR_HOST_MEMORY;
    return 0;
  }
  /* Sigh, reverse it */
  ckcapi_ReverseData(iOperation->buffer);
  
  rc = CryptDecrypt(iOperation->hKey, 0, TRUE, 0, 
                  iOperation->buffer->data, &iOperation->buffer->size);
  if (!rc) {
    DWORD msError = GetLastError();
    switch (msError) {
    case NTE_BAD_DATA:
      *pError = CKR_ENCRYPTED_DATA_INVALID;
      break;
    case NTE_FAIL:
    case NTE_BAD_UID:
      *pError = CKR_DEVICE_ERROR;
      break;
    default:
      *pError = CKR_GENERAL_ERROR; 
    }
    return 0;
  }

  return iOperation->buffer->size;
}

Here is the call graph for this function:

static CK_RV ckcapi_mdCryptoOperationRSADecrypt_UpdateFinal ( NSSCKMDCryptoOperation *  mdOperation,
NSSCKFWCryptoOperation *  fwOperation,
NSSCKMDSession *  mdSession,
NSSCKFWSession *  fwSession,
NSSCKMDToken *  mdToken,
NSSCKFWToken *  fwToken,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
const NSSItem *  input,
NSSItem *  output 
) [static]

Definition at line 445 of file crsa.c.

{
  ckcapiInternalCryptoOperationRSAPriv *iOperation =
       (ckcapiInternalCryptoOperationRSAPriv *)mdOperation->etc;
  NSSItem *buffer = iOperation->buffer;

  if ((NSSItem *)NULL == buffer) {
    return CKR_GENERAL_ERROR;
  }
  nsslibc_memcpy(output->data, buffer->data, buffer->size);
  output->size = buffer->size;
  return CKR_OK;
}

Here is the call graph for this function:

static NSSCKMDCryptoOperation* ckcapi_mdCryptoOperationRSAPriv_Create ( const NSSCKMDCryptoOperation *  proto,
NSSCKMDMechanism *  mdMechanism,
NSSCKMDObject *  mdKey,
CK_RV pError 
) [static]

Definition at line 285 of file crsa.c.

{
  ckcapiInternalObject *iKey = (ckcapiInternalObject *)mdKey->etc;
  const NSSItem *classItem = nss_ckcapi_FetchAttribute(iKey, CKA_CLASS);
  const NSSItem *keyType = nss_ckcapi_FetchAttribute(iKey, CKA_KEY_TYPE);
  ckcapiInternalCryptoOperationRSAPriv *iOperation;
  CK_RV   error;
  HCRYPTPROV  hProv;
  DWORD       keySpec;
  HCRYPTKEY   hKey;

  /* make sure we have the right objects */
  if (((const NSSItem *)NULL == classItem) ||
      (sizeof(CK_OBJECT_CLASS) != classItem->size) ||
      (CKO_PRIVATE_KEY != *(CK_OBJECT_CLASS *)classItem->data) ||
      ((const NSSItem *)NULL == keyType) ||
      (sizeof(CK_KEY_TYPE) != keyType->size) ||
      (CKK_RSA != *(CK_KEY_TYPE *)keyType->data)) {
    *pError =  CKR_KEY_TYPE_INCONSISTENT;
    return (NSSCKMDCryptoOperation *)NULL;
  }

  error = nss_ckcapi_FetchKeyContainer(iKey, &hProv, &keySpec, &hKey);
  if (error != CKR_OK) {
    *pError = error;
    return (NSSCKMDCryptoOperation *)NULL;
  }

  iOperation = nss_ZNEW(NULL, ckcapiInternalCryptoOperationRSAPriv);
  if ((ckcapiInternalCryptoOperationRSAPriv *)NULL == iOperation) {
    *pError = CKR_HOST_MEMORY;
    return (NSSCKMDCryptoOperation *)NULL;
  }
  iOperation->mdMechanism = mdMechanism;
  iOperation->iKey = iKey;
  iOperation->hProv = hProv;
  iOperation->keySpec = keySpec;
  iOperation->hKey = hKey;

  nsslibc_memcpy(&iOperation->mdOperation, 
                 proto, sizeof(NSSCKMDCryptoOperation));
  iOperation->mdOperation.etc = iOperation;

  return &iOperation->mdOperation;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static CK_RV ckcapi_mdCryptoOperationRSAPriv_Destroy ( NSSCKMDCryptoOperation *  mdOperation,
NSSCKFWCryptoOperation *  fwOperation,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance 
) [static]

Definition at line 338 of file crsa.c.

{
  ckcapiInternalCryptoOperationRSAPriv *iOperation =
       (ckcapiInternalCryptoOperationRSAPriv *)mdOperation->etc;

  if (iOperation->hKey) {
    CryptDestroyKey(iOperation->hKey);
  }
  if (iOperation->buffer) {
    nssItem_Destroy(iOperation->buffer);
  }
  nss_ZFreeIf(iOperation);
  return CKR_OK;
}

Here is the call graph for this function:

static CK_RV ckcapi_mdCryptoOperationRSASign_UpdateFinal ( NSSCKMDCryptoOperation *  mdOperation,
NSSCKFWCryptoOperation *  fwOperation,
NSSCKMDSession *  mdSession,
NSSCKFWSession *  fwSession,
NSSCKMDToken *  mdToken,
NSSCKFWToken *  fwToken,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
const NSSItem *  input,
NSSItem *  output 
) [static]

Definition at line 476 of file crsa.c.

{
  ckcapiInternalCryptoOperationRSAPriv *iOperation =
       (ckcapiInternalCryptoOperationRSAPriv *)mdOperation->etc;
  CK_RV error = CKR_OK;
  DWORD msError;
  NSSItem hash;
  HCRYPTHASH hHash = 0;
  ALG_ID  hashAlg;
  DWORD  hashSize;
  DWORD  len; /* temp length value we throw away */
  BOOL   rc;

  /*
   * PKCS #11 sign for RSA expects to take a fully DER-encoded hash value, 
   * which includes the hash OID. CAPI expects to take a Hash Context. While 
   * CAPI does have the capability of setting a raw hash value, it does not 
   * have the ability to sign an arbitrary value. This function tries to
   * reduce the passed in data into something that CAPI could actually sign.
   */
  error = ckcapi_GetRawHash(input, &hash, &hashAlg);
  if (CKR_OK != error) {
    goto loser;
  }

  rc = CryptCreateHash(iOperation->hProv, hashAlg, 0, 0, &hHash);
  if (!rc) {
    goto loser;
  }

  /* make sure the hash lens match before we set it */
  len = sizeof(DWORD);
  rc = CryptGetHashParam(hHash, HP_HASHSIZE, (BYTE *)&hashSize, &len, 0);
  if (!rc) {
    goto loser;
  }

  if (hash.size != hashSize) {
    /* The input must have been bad for this to happen */
    error = CKR_DATA_INVALID;
    goto loser;
  }

  /* we have an explicit hash, set it, note that the length is
   * implicit by the hashAlg used in create */
  rc = CryptSetHashParam(hHash, HP_HASHVAL, hash.data, 0);
  if (!rc) {
    goto loser;
  }

  /* OK, we have the data in a hash structure, sign it! */
  rc = CryptSignHash(hHash, iOperation->keySpec, NULL, 0,
                     output->data, &output->size);
  if (!rc) {
    goto loser;
  }

  /* Don't return a signature that might have been broken because of a cosmic
   * ray, or a broken processor, verify that it is valid... */
  rc = CryptVerifySignature(hHash, output->data, output->size, 
                            iOperation->hKey, NULL, 0);
  if (!rc) {
    goto loser;
  }

  /* OK, Microsoft likes to do things completely differently than anyone
   * else. We need to reverse the data we recieved here */
  ckcapi_ReverseData(output);
  CryptDestroyHash(hHash);
  return CKR_OK;

loser:
  /* map the microsoft error */
  if (CKR_OK == error) {
    msError = GetLastError();
    switch (msError) {
    case ERROR_NOT_ENOUGH_MEMORY:
      error = CKR_HOST_MEMORY;
      break;
    case NTE_NO_MEMORY:
      error = CKR_DEVICE_MEMORY;
      break;
    case ERROR_MORE_DATA:
      return CKR_BUFFER_TOO_SMALL;
    case ERROR_INVALID_PARAMETER: /* these params were derived from the */
    case ERROR_INVALID_HANDLE:    /* inputs, so if they are bad, the input */ 
    case NTE_BAD_ALGID:           /* data is bad */
    case NTE_BAD_HASH:
      error = CKR_DATA_INVALID;
      break;
    case ERROR_BUSY:
    case NTE_FAIL:
    case NTE_BAD_UID:
      error = CKR_DEVICE_ERROR;
      break;
    default:
      error = CKR_GENERAL_ERROR;
      break;
    }
  }
  if (hHash) {
    CryptDestroyHash(hHash);
  }
  return error;
}

Here is the call graph for this function:

static NSSCKMDCryptoOperation* ckcapi_mdMechanismRSA_DecryptInit ( NSSCKMDMechanism *  mdMechanism,
NSSCKFWMechanism *  fwMechanism,
CK_MECHANISM pMechanism,
NSSCKMDSession *  mdSession,
NSSCKFWSession *  fwSession,
NSSCKMDToken *  mdToken,
NSSCKFWToken *  fwToken,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
NSSCKMDObject *  mdKey,
NSSCKFWObject *  fwKey,
CK_RV pError 
) [static]

Definition at line 681 of file crsa.c.

Here is the call graph for this function:

static void ckcapi_mdMechanismRSA_Destroy ( NSSCKMDMechanism *  mdMechanism,
NSSCKFWMechanism *  fwMechanism,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance 
) [static]

Definition at line 630 of file crsa.c.

{
  nss_ZFreeIf(fwMechanism);
}

Here is the call graph for this function:

static CK_ULONG ckcapi_mdMechanismRSA_GetMaxKeySize ( NSSCKMDMechanism *  mdMechanism,
NSSCKFWMechanism *  fwMechanism,
NSSCKMDToken *  mdToken,
NSSCKFWToken *  fwToken,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
CK_RV pError 
) [static]

Definition at line 663 of file crsa.c.

{
  return 16384;
}
static CK_ULONG ckcapi_mdMechanismRSA_GetMinKeySize ( NSSCKMDMechanism *  mdMechanism,
NSSCKFWMechanism *  fwMechanism,
NSSCKMDToken *  mdToken,
NSSCKFWToken *  fwToken,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
CK_RV pError 
) [static]

Definition at line 645 of file crsa.c.

{
  return 384;
}
static NSSCKMDCryptoOperation* ckcapi_mdMechanismRSA_SignInit ( NSSCKMDMechanism *  mdMechanism,
NSSCKFWMechanism *  fwMechanism,
CK_MECHANISM pMechanism,
NSSCKMDSession *  mdSession,
NSSCKFWSession *  fwSession,
NSSCKMDToken *  mdToken,
NSSCKFWToken *  fwToken,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
NSSCKMDObject *  mdKey,
NSSCKFWObject *  fwKey,
CK_RV pError 
) [static]

Definition at line 706 of file crsa.c.

Here is the call graph for this function:

void ckcapi_ReverseData ( NSSItem *  item)

Definition at line 252 of file crsa.c.

{
  int end = (item->size)-1;
  int middle = (item->size)/2;
  unsigned char *buf = item->data;
  int i;

  for (i=0; i < middle; i++) {
    unsigned char  tmp = buf[i];
    buf[i] = buf[end-i];
    buf[end-i] = tmp;
  }
  return;
}
static char* nss_ckcapi_GetOidString ( unsigned char *  oidTag,
int  oidTagSize,
CK_RV pError 
) [static]

Definition at line 89 of file crsa.c.

{
  unsigned char *oid;
  char *oidStr;
  char *cstr;
  unsigned long value;
  int oidSize;

  if (DER_OBJECT_ID != *oidTag) {
    /* wasn't an oid */
    *pError = CKR_DATA_INVALID;
    return NULL;
  }
  oid = nss_ckcapi_DERUnwrap(oidTag, oidTagSize, &oidSize, NULL);

  if (oidSize < 2) {
    *pError = CKR_DATA_INVALID;
    return NULL;
  }

  oidStr = nss_ZNEWARRAY( NULL, char, oidSize*4 );
  if ((char *)NULL == oidStr) {
    *pError = CKR_HOST_MEMORY;
    return NULL;
  }
  cstr = oidStr;
  cstr = putDecimalString(cstr, (*oid) / 40);
  *cstr++ = '.';
  cstr = putDecimalString(cstr, (*oid) % 40);
  oidSize--;

  value = 0;
  while (oidSize--) {
    oid++;
    value = (value << 7) + (*oid & 0x7f);
    if (0 == (*oid & 0x80)) {
      *cstr++ = '.';
      cstr = putDecimalString(cstr, value);
      value = 0;
    }
  }

  *cstr = 0; /* NULL terminate */

  if (value != 0) {
    nss_ZFreeIf(oidStr);
    *pError = CKR_DATA_INVALID;
    return NULL;
  }
  return oidStr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* putDecimalString ( char *  cstr,
unsigned long  value 
) [static]

Definition at line 59 of file crsa.c.

{
  unsigned long tenpower;
  int first = 1;

  for (tenpower=10000000; tenpower; tenpower /= 10) {
    unsigned char digit = (unsigned char )(value/tenpower);
    value = value % tenpower;

    /* drop leading zeros */
    if (first && (0 == digit)) {
      continue;
    }
    first = 0;
    *cstr++ = digit + '0';
  }

  /* if value was zero, put one of them out */
  if (first) {
    *cstr++ = '0';
  }
  return cstr;
}

Here is the caller graph for this function:


Variable Documentation