Back to index

lightning-sunbird  0.9+nobinonly
Functions
certxutl.h File Reference
#include "nspr.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

PRBool cert_HasCriticalExtension (CERTCertExtension **extensions)
SECStatus CERT_FindBitStringExtension (CERTCertExtension **extensions, int tag, SECItem *retItem)
voidcert_StartExtensions (void *owner, PLArenaPool *arena, void(*setExts)(void *object, CERTCertExtension **exts))
SECStatus cert_FindExtension (CERTCertExtension **extensions, int tag, SECItem *value)
SECStatus cert_FindExtensionByOID (CERTCertExtension **extensions, SECItem *oid, SECItem *value)
SECStatus cert_GetExtenCriticality (CERTCertExtension **extensions, int tag, PRBool *isCritical)
PRBool cert_HasUnknownCriticalExten (CERTCertExtension **extensions)

Function Documentation

SECStatus CERT_FindBitStringExtension ( CERTCertExtension **  extensions,
int  tag,
SECItem *  retItem 
)

Definition at line 426 of file certxutl.c.

{
    SECItem wrapperItem, tmpItem = {siBuffer,0};
    SECStatus rv;
    PRArenaPool *arena = NULL;
    
    wrapperItem.data = NULL;
    tmpItem.data = NULL;
    
    arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
    
    if ( ! arena ) {
       return(SECFailure);
    }
    
    rv = cert_FindExtension(extensions, tag, &wrapperItem);
    if ( rv != SECSuccess ) {
       goto loser;
    }

    rv = SEC_QuickDERDecodeItem(arena, &tmpItem, SEC_BitStringTemplate, 
                         &wrapperItem);

    if ( rv != SECSuccess ) {
       goto loser;
    }

    retItem->data = (unsigned char *)PORT_Alloc( ( tmpItem.len + 7 ) >> 3 );
    if ( retItem->data == NULL ) {
       goto loser;
    }
    
    PORT_Memcpy(retItem->data, tmpItem.data, ( tmpItem.len + 7 ) >> 3);
    retItem->len = tmpItem.len;
    
    rv = SECSuccess;
    goto done;
    
loser:
    rv = SECFailure;

done:
    if ( arena ) {
       PORT_FreeArena(arena, PR_FALSE);
    }
    
    if ( wrapperItem.data ) {
       PORT_Free(wrapperItem.data);
    }

    return(rv);
}

Here is the call graph for this function:

Here is the caller graph for this function:

SECStatus cert_FindExtension ( CERTCertExtension **  extensions,
int  tag,
SECItem *  value 
)

Definition at line 125 of file certxutl.c.

{
    SECOidData *oid;
    
    oid = SECOID_FindOIDByTag((SECOidTag)tag);
    if ( !oid ) {
       return(SECFailure);
    }

    return(cert_FindExtensionByOID(extensions, &oid->oid, value));
}

Here is the call graph for this function:

Here is the caller graph for this function:

SECStatus cert_FindExtensionByOID ( CERTCertExtension **  extensions,
SECItem *  oid,
SECItem *  value 
)

Definition at line 79 of file certxutl.c.

{
    CERTCertExtension *ext;
    SECStatus rv = SECSuccess;
    
    ext = GetExtension (extensions, oid);
    if (ext == NULL) {
       PORT_SetError (SEC_ERROR_EXTENSION_NOT_FOUND);
       return (SECFailure);
    }
    if (value)
       rv = SECITEM_CopyItem(NULL, value, &ext->value);
    return (rv);
}

Here is the call graph for this function:

Here is the caller graph for this function:

SECStatus cert_GetExtenCriticality ( CERTCertExtension **  extensions,
int  tag,
PRBool isCritical 
)
PRBool cert_HasCriticalExtension ( CERTCertExtension **  extensions)

Definition at line 481 of file certxutl.c.

{
    CERTCertExtension **exts;
    CERTCertExtension *ext = NULL;
    PRBool hasCriticalExten = PR_FALSE;
    
    exts = extensions;
    
    if (exts) {
       while ( *exts ) {
           ext = *exts;
           /* If the criticality is omitted, it's non-critical */
           if (ext->critical.data && ext->critical.data[0] == 0xff) {
              hasCriticalExten = PR_TRUE;
              break;
           }
           exts++;
       }
    }
    return (hasCriticalExten);
}

Here is the caller graph for this function:

PRBool cert_HasUnknownCriticalExten ( CERTCertExtension **  extensions)

Definition at line 504 of file certxutl.c.

{
    CERTCertExtension **exts;
    CERTCertExtension *ext = NULL;
    PRBool hasUnknownCriticalExten = PR_FALSE;
    
    exts = extensions;
    
    if (exts) {
       while ( *exts ) {
           ext = *exts;
           /* If the criticality is omitted, it's non-critical.
              If an extension is critical, make sure that we know
              how to process the extension.
             */
           if (ext->critical.data && ext->critical.data[0] == 0xff) {
              if (SECOID_KnownCertExtenOID (&ext->id) == PR_FALSE) {
                  hasUnknownCriticalExten = PR_TRUE;
                  break;
              }
           }
           exts++;
       }
    }
    return (hasUnknownCriticalExten);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* cert_StartExtensions ( void owner,
PLArenaPool arena,
void(*)(void *object, CERTCertExtension **exts)  setExts 
)