Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
cmmfi.h File Reference
#include "cmmfit.h"
#include "crmfi.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define CMMF_MAX_CHALLENGES   10
#define CMMF_MAX_KEY_PAIRS   50

Functions

SECStatus cmmf_CopyCertResponse (PRArenaPool *poolp, CMMFCertResponse *dest, CMMFCertResponse *src)
SECStatus cmmf_CopyPKIStatusInfo (PRArenaPool *poolp, CMMFPKIStatusInfo *dest, CMMFPKIStatusInfo *src)
SECStatus cmmf_CopyCertifiedKeyPair (PRArenaPool *poolp, CMMFCertifiedKeyPair *dest, CMMFCertifiedKeyPair *src)
SECStatus cmmf_DestroyPKIStatusInfo (CMMFPKIStatusInfo *info, PRBool freeit)
SECStatus cmmf_DestroyCertOrEncCert (CMMFCertOrEncCert *certOrEncCert, PRBool freeit)
SECStatus cmmf_PKIStatusInfoSetStatus (CMMFPKIStatusInfo *statusInfo, PRArenaPool *poolp, CMMFPKIStatus inStatus)
SECStatus cmmf_ExtractCertsFromList (CERTCertList *inCertList, PRArenaPool *poolp, CERTCertificate ***certArray)
SECStatus cmmf_CertOrEncCertSetCertificate (CMMFCertOrEncCert *certOrEncCert, PRArenaPool *poolp, CERTCertificate *inCert)
CMMFPKIStatus cmmf_PKIStatusInfoGetStatus (CMMFPKIStatusInfo *inStatus)
CERTCertList * cmmf_MakeCertList (CERTCertificate **inCerts)
CERTCertificate * cmmf_CertOrEncCertGetCertificate (CMMFCertOrEncCert *certOrEncCert, CERTCertDBHandle *certdb)
SECStatus cmmf_decode_process_cert_response (PRArenaPool *poolp, CERTCertDBHandle *db, CMMFCertResponse *inCertResp)
SECStatus cmmf_decode_process_certified_key_pair (PRArenaPool *poolp, CERTCertDBHandle *db, CMMFCertifiedKeyPair *inCertKeyPair)
SECStatus cmmf_user_encode (void *src, CRMFEncoderOutputCallback inCallback, void *inArg, const SEC_ASN1Template *inTemplate)
SECStatus cmmf_copy_secitem (PRArenaPool *poolp, SECItem *dest, SECItem *src)

Variables

const SEC_ASN1Template CMMFCertOrEncCertCertificateTemplate []
const SEC_ASN1Template CMMFCertOrEncCertEncryptedCertTemplate []
const SEC_ASN1Template CMMFPOPODecKeyRespContentTemplate []
const SEC_ASN1Template CMMFRandTemplate []
const SEC_ASN1Template CMMFSequenceOfCertsTemplate []
const SEC_ASN1Template CMMFPKIStatusInfoTemplate []
const SEC_ASN1Template CMMFCertifiedKeyPairTemplate []

Define Documentation

Definition at line 48 of file cmmfi.h.

Definition at line 49 of file cmmfi.h.


Function Documentation

CERTCertificate* cmmf_CertOrEncCertGetCertificate ( CMMFCertOrEncCert *  certOrEncCert,
CERTCertDBHandle *  certdb 
)

Definition at line 407 of file respcmn.c.

{
    if (certOrEncCert->choice           != cmmfCertificate || 
       certOrEncCert->cert.certificate == NULL) {
        return NULL;
    }
    return CERT_NewTempCertificate(certdb,
                               &certOrEncCert->cert.certificate->derCert,
                               NULL, PR_FALSE, PR_TRUE);
}
SECStatus cmmf_CertOrEncCertSetCertificate ( CMMFCertOrEncCert *  certOrEncCert,
PRArenaPool poolp,
CERTCertificate *  inCert 
)

Definition at line 74 of file cmmfresp.c.

{
    SECItem               *derDest = NULL;
    SECStatus             rv = SECFailure;

    if (inCert->derCert.data == NULL) {
        derDest = SEC_ASN1EncodeItem(NULL, NULL, inCert, 
                                 CMMFCertOrEncCertCertificateTemplate);
       if (derDest == NULL) {
           goto loser;
       }
    } else {
        derDest = SECITEM_DupItem(&inCert->derCert);
       if (derDest == NULL) {
           goto loser;
       }
    }
    PORT_Assert(certOrEncCert->cert.certificate == NULL);
    certOrEncCert->cert.certificate = CERT_DupCertificate(inCert);
    certOrEncCert->choice = cmmfCertificate;
    if (poolp != NULL) {
        rv = SECITEM_CopyItem(poolp, &certOrEncCert->derValue, derDest);
       if (rv != SECSuccess) {
           goto loser;
       }
    } else {
        certOrEncCert->derValue = *derDest;
    }
    PORT_Free(derDest);
    return SECSuccess;
 loser:
    if (derDest != NULL) {
        SECITEM_FreeItem(derDest, PR_TRUE);
    }
    return rv;
}

Here is the call graph for this function:

SECStatus cmmf_copy_secitem ( PRArenaPool poolp,
SECItem *  dest,
SECItem *  src 
)

Definition at line 250 of file respcmn.c.

{
    SECStatus rv;

    if (src->data != NULL) {
        rv = SECITEM_CopyItem(poolp, dest, src);
    } else {
        dest->data = NULL;
       dest->len  = 0;
       rv = SECSuccess;
    }
    return rv;
}

Here is the call graph for this function:

SECStatus cmmf_CopyCertifiedKeyPair ( PRArenaPool poolp,
CMMFCertifiedKeyPair *  dest,
CMMFCertifiedKeyPair *  src 
)

Definition at line 354 of file respcmn.c.

{
    SECStatus rv;

    rv = cmmf_CopyCertOrEncCert(poolp, &dest->certOrEncCert, 
                            &src->certOrEncCert);
    if (rv != SECSuccess) {
        return rv;
    }

    if (src->privateKey != NULL) {
       CRMFEncryptedValue *encVal;

       encVal = (poolp == NULL) ? PORT_ZNew(CRMFEncryptedValue) :
                                  PORT_ArenaZNew(poolp, CRMFEncryptedValue);
       if (encVal == NULL) {
           return SECFailure;
       }
       rv = crmf_copy_encryptedvalue(poolp, src->privateKey, 
                                  encVal);
       if (rv != SECSuccess) {
           if (!poolp) {
               crmf_destroy_encrypted_value(encVal, PR_TRUE);
           }
           return rv;
       }
       dest->privateKey = encVal;
    }
    rv = cmmf_copy_secitem(poolp, &dest->derPublicationInfo, 
                        &src->derPublicationInfo);
    return rv;
}

Here is the call graph for this function:

SECStatus cmmf_CopyCertResponse ( PRArenaPool poolp,
CMMFCertResponse *  dest,
CMMFCertResponse *  src 
)

Definition at line 282 of file respcmn.c.

{
    SECStatus rv;

    if (src->certReqId.data != NULL) {
        rv = SECITEM_CopyItem(poolp, &dest->certReqId, &src->certReqId);
       if (rv != SECSuccess) {
           return rv;
       }
    }
    rv = cmmf_CopyPKIStatusInfo(poolp, &dest->status, &src->status);
    if (rv != SECSuccess) {
        return rv;
    }
    if (src->certifiedKeyPair != NULL) {
       CMMFCertifiedKeyPair *destKeyPair;

       destKeyPair = (poolp == NULL) ? PORT_ZNew(CMMFCertifiedKeyPair) :
                               PORT_ArenaZNew(poolp, CMMFCertifiedKeyPair);
       if (!destKeyPair) {
           return SECFailure;
       }
       rv = cmmf_CopyCertifiedKeyPair(poolp, destKeyPair,
                                   src->certifiedKeyPair);
       if (rv != SECSuccess) {
           if (!poolp) {
               CMMF_DestroyCertifiedKeyPair(destKeyPair);
           }
           return rv;
       }
       dest->certifiedKeyPair = destKeyPair;
    }
    return SECSuccess;
}

Here is the call graph for this function:

SECStatus cmmf_CopyPKIStatusInfo ( PRArenaPool poolp,
CMMFPKIStatusInfo *  dest,
CMMFPKIStatusInfo *  src 
)

Definition at line 389 of file respcmn.c.

{
    SECStatus rv;

    rv = cmmf_copy_secitem (poolp, &dest->status, &src->status);
    if (rv != SECSuccess) {
        return rv;
    }
    rv = cmmf_copy_secitem (poolp, &dest->statusString, &src->statusString);
    if (rv != SECSuccess) {
        return rv;
    }
    rv = cmmf_copy_secitem (poolp, &dest->failInfo, &src->failInfo);
    return rv;
}

Here is the call graph for this function:

SECStatus cmmf_decode_process_cert_response ( PRArenaPool poolp,
CERTCertDBHandle *  db,
CMMFCertResponse *  inCertResp 
)

Definition at line 151 of file asn1cmn.c.

{
    SECStatus rv = SECSuccess;
  
    if (inCertResp->certifiedKeyPair != NULL) {
        rv = cmmf_decode_process_certified_key_pair(poolp, 
                                              db,
                                          inCertResp->certifiedKeyPair);
    }
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

SECStatus cmmf_decode_process_certified_key_pair ( PRArenaPool poolp,
CERTCertDBHandle *  db,
CMMFCertifiedKeyPair *  inCertKeyPair 
)

Definition at line 244 of file asn1cmn.c.

{
    return cmmf_decode_process_certorenccert (poolp,
                                         db,
                                         &inCertKeyPair->certOrEncCert);
}

Here is the call graph for this function:

Here is the caller graph for this function:

SECStatus cmmf_DestroyCertOrEncCert ( CMMFCertOrEncCert *  certOrEncCert,
PRBool  freeit 
)

Definition at line 228 of file respcmn.c.

{
    switch (certOrEncCert->choice) {
    case cmmfCertificate:
        CERT_DestroyCertificate(certOrEncCert->cert.certificate);
       certOrEncCert->cert.certificate = NULL;
       break;
    case cmmfEncryptedCert:
        crmf_destroy_encrypted_value(certOrEncCert->cert.encryptedCert,
                                 PR_TRUE);
        certOrEncCert->cert.encryptedCert = NULL;
       break;
    default:
        break;
    }
    if (freeit) {
        PORT_Free(certOrEncCert);
    }
    return SECSuccess;
}

Here is the call graph for this function:

SECStatus cmmf_DestroyPKIStatusInfo ( CMMFPKIStatusInfo *  info,
PRBool  freeit 
)

Definition at line 45 of file respcmn.c.

{
    if (info->status.data != NULL) {
        PORT_Free(info->status.data);
        info->status.data = NULL;
    }
    if (info->statusString.data != NULL) {
        PORT_Free(info->statusString.data);
        info->statusString.data = NULL;
    }
    if (info->failInfo.data != NULL) {
        PORT_Free(info->failInfo.data);
        info->failInfo.data = NULL;
    }
    if (freeit) {
        PORT_Free(info);
    }
    return SECSuccess;
}

Here is the call graph for this function:

SECStatus cmmf_ExtractCertsFromList ( CERTCertList *  inCertList,
PRArenaPool poolp,
CERTCertificate ***  certArray 
)

Definition at line 114 of file cmmfresp.c.

{
    CERTCertificate  **arrayLocalCopy;
    CERTCertListNode  *node;
    int                numNodes = 0, i;

    for (node = CERT_LIST_HEAD(inCertList); !CERT_LIST_END(node, inCertList);
        node = CERT_LIST_NEXT(node)) {
        numNodes++;
    }

    arrayLocalCopy = *certArray = (poolp == NULL) ?
                    PORT_NewArray(CERTCertificate*, (numNodes+1)) :
                    PORT_ArenaNewArray(poolp, CERTCertificate*, (numNodes+1));
    if (arrayLocalCopy == NULL) {
        return SECFailure;
    }
    for (node = CERT_LIST_HEAD(inCertList), i=0; 
        !CERT_LIST_END(node, inCertList);
        node = CERT_LIST_NEXT(node), i++) {
        arrayLocalCopy[i] = CERT_DupCertificate(node->cert);
       if (arrayLocalCopy[i] == NULL) {
           int j;
           
           for (j=0; j<i; j++) {
               CERT_DestroyCertificate(arrayLocalCopy[j]);
           }
           if (poolp == NULL) {
               PORT_Free(arrayLocalCopy);
           }
           *certArray = NULL;
           return SECFailure;
       }
    }
    arrayLocalCopy[numNodes] = NULL;
    return SECSuccess;
}

Here is the call graph for this function:

CERTCertList* cmmf_MakeCertList ( CERTCertificate **  inCerts)

Definition at line 164 of file respcmn.c.

{
    CERTCertList    *certList;
    CERTCertificate *currCert;
    SECItem         *derCert, *freeCert = NULL;
    SECStatus        rv;
    int              i;

    certList = CERT_NewCertList();
    if (certList == NULL) {
        return NULL;
    }
    for (i=0; inCerts[i] != NULL; i++) {
        derCert = &inCerts[i]->derCert;
       if (derCert->data == NULL) {
           derCert = freeCert = cmmf_encode_certificate(inCerts[i]);
       }
       currCert=CERT_NewTempCertificate(CERT_GetDefaultCertDB(), 
                                        derCert, NULL, PR_FALSE, PR_TRUE);
       if (freeCert != NULL) {
           SECITEM_FreeItem(freeCert, PR_TRUE);
           freeCert = NULL;
       }
       if (currCert == NULL) {
           goto loser;
       }
       rv = CERT_AddCertToListTail(certList, currCert);
       if (rv != SECSuccess) {
           goto loser;
       }
    }
    return certList;
 loser:
    CERT_DestroyCertList(certList);
    return NULL;
}

Here is the call graph for this function:

CMMFPKIStatus cmmf_PKIStatusInfoGetStatus ( CMMFPKIStatusInfo *  inStatus)

Definition at line 202 of file respcmn.c.

{
    long derVal;

    derVal = DER_GetInteger(&inStatus->status);
    if (derVal == -1 || derVal < cmmfGranted || derVal >= cmmfNumPKIStatus) {
        return cmmfNoPKIStatus;
    }
    return (CMMFPKIStatus)derVal;
}

Here is the call graph for this function:

SECStatus cmmf_PKIStatusInfoSetStatus ( CMMFPKIStatusInfo *  statusInfo,
PRArenaPool poolp,
CMMFPKIStatus  inStatus 
)

Definition at line 420 of file respcmn.c.

{
    SECItem *dummy;
    
    if (inStatus <cmmfGranted || inStatus >= cmmfNumPKIStatus) {
        return SECFailure;
    }

    dummy = SEC_ASN1EncodeInteger(poolp, &statusInfo->status, inStatus); 
    PORT_Assert(dummy == &statusInfo->status);
    if (dummy != &statusInfo->status) {
        SECITEM_FreeItem(dummy, PR_TRUE);
       return SECFailure;
    }
    return SECSuccess;
}

Here is the call graph for this function:

SECStatus cmmf_user_encode ( void src,
CRMFEncoderOutputCallback  inCallback,
void inArg,
const SEC_ASN1Template inTemplate 
)

Definition at line 53 of file encutil.c.

{
    struct crmfEncoderOutput output;

    PORT_Assert(src != NULL);
    if (src == NULL) {
        return SECFailure;
    }
    output.fn        = inCallback;
    output.outputArg = inArg;
    return SEC_ASN1Encode(src, inTemplate, crmf_encoder_out, &output);    
}

Here is the call graph for this function:


Variable Documentation

Definition at line 63 of file asn1cmn.c.

Definition at line 114 of file asn1cmn.c.

Definition at line 107 of file asn1cmn.c.

Definition at line 77 of file asn1cmn.c.

Definition at line 99 of file asn1cmn.c.

Definition at line 92 of file asn1cmn.c.

Definition at line 87 of file asn1cmn.c.