Back to index

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

Go to the source code of this file.

Functions

SEC_BEGIN_PROTOS char * BTOA_DataToAscii (const unsigned char *data, unsigned int len)
unsigned char * ATOB_AsciiToData (const char *string, unsigned int *lenp)
SECStatus ATOB_ConvertAsciiToItem (SECItem *binary_item, char *ascii)
char * BTOA_ConvertItemToAscii (SECItem *binary_item)

Function Documentation

unsigned char* ATOB_AsciiToData ( const char *  string,
unsigned int lenp 
)

Definition at line 816 of file nssb64d.c.

{
    SECItem binary_item, *dummy;

    binary_item.data = NULL;
    binary_item.len = 0;

    dummy = NSSBase64_DecodeBuffer (NULL, &binary_item, string,
                                (PRUint32) PORT_Strlen(string));
    if (dummy == NULL)
       return NULL;

    PORT_Assert(dummy == &binary_item);

    *lenp = dummy->len;
    return dummy->data;
}

Here is the caller graph for this function:

SECStatus ATOB_ConvertAsciiToItem ( SECItem *  binary_item,
char *  ascii 
)

Definition at line 838 of file nssb64d.c.

{
    SECItem *dummy;

    if (binary_item == NULL) {
       PORT_SetError (SEC_ERROR_INVALID_ARGS);
       return SECFailure;
    }

    /*
     * XXX Would prefer to assert here if data is non-null (actually,
     * don't need to, just let NSSBase64_DecodeBuffer do it), so as to
     * to catch unintended memory leaks, but callers are not clean in
     * this respect so we need to explicitly clear here to avoid the
     * assert in NSSBase64_DecodeBuffer.
     */
    binary_item->data = NULL;
    binary_item->len = 0;

    dummy = NSSBase64_DecodeBuffer (NULL, binary_item, ascii,
                                (PRUint32) PORT_Strlen(ascii));

    if (dummy == NULL)
       return SECFailure;

    return SECSuccess;
}

Here is the caller graph for this function:

char* BTOA_ConvertItemToAscii ( SECItem *  binary_item)

Definition at line 762 of file nssb64e.c.

{
    return NSSBase64_EncodeItem (NULL, NULL, 0, binary_item);
}

Here is the caller graph for this function:

SEC_BEGIN_PROTOS char* BTOA_DataToAscii ( const unsigned char *  data,
unsigned int  len 
)

Definition at line 748 of file nssb64e.c.

{
    SECItem binary_item;

    binary_item.data = (unsigned char *)data;
    binary_item.len = len;

    return NSSBase64_EncodeItem (NULL, NULL, 0, &binary_item);
}

Here is the caller graph for this function: