* change errors to macros instead of const int's
* remove pointer-tracking remnants git-svn-id: svn://10.0.0.236/branches/STAN_WORK_BRANCH@128921 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: asn1.c,v $ $Revision: 1.2.44.1 $ $Date: 2002-08-26 15:50:00 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: asn1.c,v $ $Revision: 1.2.44.2 $ $Date: 2002-09-05 22:49:22 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -49,180 +49,6 @@ static const char CVS_ID[] = "@(#) $RCSfile: asn1.c,v $ $Revision: 1.2.44.1 $ $D
|
||||
#include "plarena.h"
|
||||
#include "secasn1.h"
|
||||
|
||||
/*
|
||||
* The pointer-tracking stuff
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
extern const NSSError NSS_ERROR_INTERNAL_ERROR;
|
||||
|
||||
static nssPointerTracker decoder_pointer_tracker;
|
||||
|
||||
static PRStatus
|
||||
decoder_add_pointer
|
||||
(
|
||||
const nssASN1Decoder *decoder
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_initialize(&decoder_pointer_tracker);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = nssPointerTracker_add(&decoder_pointer_tracker, decoder);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
NSSError e = NSS_GetError();
|
||||
if( NSS_ERROR_NO_MEMORY != e ) {
|
||||
nss_SetError(NSS_ERROR_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
static PRStatus
|
||||
decoder_remove_pointer
|
||||
(
|
||||
const nssASN1Decoder *decoder
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_remove(&decoder_pointer_tracker, decoder);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
nss_SetError(NSS_ERROR_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* nssASN1Decoder_verify
|
||||
*
|
||||
* This routine is only available in debug builds.
|
||||
*
|
||||
* If the specified pointer is a valid pointer to an nssASN1Decoder
|
||||
* object, this routine will return PR_SUCCESS. Otherwise, it will
|
||||
* put an error on the error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_ASN1DECODER
|
||||
*
|
||||
* Return value:
|
||||
* PR_FAILURE upon error
|
||||
* PR_SUCCESS upon success
|
||||
*/
|
||||
|
||||
NSS_IMPLEMENT PRStatus
|
||||
nssASN1Decoder_verify
|
||||
(
|
||||
nssASN1Decoder *decoder
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_initialize(&decoder_pointer_tracker);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
rv = nssPointerTracker_verify(&decoder_pointer_tracker, decoder);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_ASN1DECODER);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
static nssPointerTracker encoder_pointer_tracker;
|
||||
|
||||
static PRStatus
|
||||
encoder_add_pointer
|
||||
(
|
||||
const nssASN1Encoder *encoder
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_initialize(&encoder_pointer_tracker);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = nssPointerTracker_add(&encoder_pointer_tracker, encoder);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
NSSError e = NSS_GetError();
|
||||
if( NSS_ERROR_NO_MEMORY != e ) {
|
||||
nss_SetError(NSS_ERROR_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
static PRStatus
|
||||
encoder_remove_pointer
|
||||
(
|
||||
const nssASN1Encoder *encoder
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_remove(&encoder_pointer_tracker, encoder);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
nss_SetError(NSS_ERROR_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* nssASN1Encoder_verify
|
||||
*
|
||||
* This routine is only available in debug builds.
|
||||
*
|
||||
* If the specified pointer is a valid pointer to an nssASN1Encoder
|
||||
* object, this routine will return PR_SUCCESS. Otherwise, it will
|
||||
* put an error on the error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_ASN1ENCODER
|
||||
*
|
||||
* Return value:
|
||||
* PR_FAILURE upon error
|
||||
* PR_SUCCESS upon success
|
||||
*/
|
||||
|
||||
NSS_IMPLEMENT PRStatus
|
||||
nssASN1Encoder_verify
|
||||
(
|
||||
nssASN1Encoder *encoder
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_initialize(&encoder_pointer_tracker);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
rv = nssPointerTracker_verify(&encoder_pointer_tracker, encoder);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_ASN1ENCODER);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* nssASN1Decoder_Create
|
||||
*
|
||||
@@ -255,24 +81,6 @@ nssASN1Decoder_Create
|
||||
{
|
||||
SEC_ASN1DecoderContext *rv;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (nssASN1Decoder *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* May destination be NULL? I'd think so, since one might
|
||||
* have only a filter proc. But if not, check the pointer here.
|
||||
*/
|
||||
|
||||
if( (nssASN1Template *)NULL == template ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (nssASN1Decoder *)NULL;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
rv = SEC_ASN1DecoderStart(arenaOpt, destination, template);
|
||||
if( (SEC_ASN1DecoderContext *)NULL == rv ) {
|
||||
#if 0
|
||||
@@ -281,13 +89,6 @@ nssASN1Decoder_Create
|
||||
return (nssASN1Decoder *)NULL;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != decoder_add_pointer(rv) ) {
|
||||
(void)SEC_ASN1DecoderFinish(rv);
|
||||
return (nssASN1Decoder *)NULL;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return (nssASN1Decoder *)rv;
|
||||
}
|
||||
|
||||
@@ -319,17 +120,6 @@ nssASN1Decoder_Update
|
||||
{
|
||||
SECStatus rv;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Decoder_verify(decoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
if( (void *)NULL == data ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
rv = SEC_ASN1DecoderUpdate((SEC_ASN1DecoderContext *)decoder,
|
||||
(const char *)data,
|
||||
(unsigned long)amount);
|
||||
@@ -367,12 +157,6 @@ nssASN1Decoder_Finish
|
||||
PRStatus rv = PR_SUCCESS;
|
||||
SECStatus srv;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Decoder_verify(decoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
srv = SEC_ASN1DecoderFinish((SEC_ASN1DecoderContext *)decoder);
|
||||
|
||||
if( SECSuccess != srv ) {
|
||||
@@ -382,15 +166,6 @@ nssASN1Decoder_Finish
|
||||
rv = PR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
PRStatus rv2 = decoder_remove_pointer(decoder);
|
||||
if( PR_SUCCESS == rv ) {
|
||||
rv = rv2;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -424,11 +199,6 @@ nssASN1Decoder_SetFilter
|
||||
PRBool noStore
|
||||
)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Decoder_verify(decoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (nssASN1DecoderFilterFunction *)NULL == callback ) {
|
||||
SEC_ASN1DecoderClearFilterProc((SEC_ASN1DecoderContext *)decoder);
|
||||
@@ -465,7 +235,6 @@ nssASN1Decoder_SetFilter
|
||||
* PR_SUCCESS upon success
|
||||
*/
|
||||
|
||||
extern const NSSError NSS_ERROR_INTERNAL_ERROR;
|
||||
|
||||
NSS_IMPLEMENT PRStatus
|
||||
nssASN1Decoder_GetFilter
|
||||
@@ -476,12 +245,6 @@ nssASN1Decoder_GetFilter
|
||||
PRBool *pNoStoreOpt
|
||||
)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Decoder_verify(decoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (nssASN1DecoderFilterFunction **)NULL != pCallbackOpt ) {
|
||||
*pCallbackOpt = (nssASN1DecoderFilterFunction *)NULL;
|
||||
}
|
||||
@@ -525,12 +288,6 @@ nssASN1Decoder_SetNotify
|
||||
void *argument
|
||||
)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Decoder_verify(decoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (nssASN1NotifyFunction *)NULL == callback ) {
|
||||
SEC_ASN1DecoderClearNotifyProc((SEC_ASN1DecoderContext *)decoder);
|
||||
} else {
|
||||
@@ -571,12 +328,6 @@ nssASN1Decoder_GetNotify
|
||||
void **pArgumentOpt
|
||||
)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Decoder_verify(decoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (nssASN1NotifyFunction **)NULL != pCallbackOpt ) {
|
||||
*pCallbackOpt = (nssASN1NotifyFunction *)NULL;
|
||||
}
|
||||
@@ -699,23 +450,6 @@ nssASN1Encoder_Create
|
||||
{
|
||||
SEC_ASN1EncoderContext *rv;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( (void *)NULL == source ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (nssASN1Encoder *)NULL;
|
||||
}
|
||||
|
||||
if( (nssASN1Template *)NULL == template ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (nssASN1Encoder *)NULL;
|
||||
}
|
||||
|
||||
if( (nssASN1EncoderWriteFunction *)NULL == sink ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (nssASN1Encoder *)NULL;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef nodef
|
||||
switch( encoding ) {
|
||||
case NSSASN1BER:
|
||||
@@ -745,13 +479,6 @@ nssASN1Encoder_Create
|
||||
sec_ASN1EncoderSetDER(rv);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != encoder_add_pointer(rv) ) {
|
||||
(void)SEC_ASN1EncoderFinish(rv);
|
||||
return (nssASN1Encoder *)NULL;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return (nssASN1Encoder *)rv;
|
||||
#endif /* nodef */
|
||||
return NULL;
|
||||
@@ -779,16 +506,6 @@ nssASN1Encoder_Update
|
||||
{
|
||||
SECStatus rv;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Can data legitimately be NULL? If not, verify..
|
||||
*/
|
||||
#endif /* DEBUG */
|
||||
|
||||
rv = SEC_ASN1EncoderUpdate((SEC_ASN1EncoderContext *)encoder,
|
||||
(const char *)data,
|
||||
(unsigned long)length);
|
||||
@@ -823,24 +540,9 @@ nssASN1Encoder_Finish
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
SEC_ASN1EncoderFinish((SEC_ASN1EncoderContext *)encoder);
|
||||
rv = PR_SUCCESS; /* no error return defined for that call */
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
PRStatus rv2 = encoder_remove_pointer(encoder);
|
||||
if( PR_SUCCESS == rv ) {
|
||||
rv = rv2;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -870,12 +572,6 @@ nssASN1Encoder_SetNotify
|
||||
void *argument
|
||||
)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (nssASN1NotifyFunction *)NULL == callback ) {
|
||||
SEC_ASN1EncoderClearNotifyProc((SEC_ASN1EncoderContext *)encoder);
|
||||
} else {
|
||||
@@ -916,12 +612,6 @@ nssASN1Encoder_GetNotify
|
||||
void **pArgumentOpt
|
||||
)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (nssASN1NotifyFunction **)NULL != pCallbackOpt ) {
|
||||
*pCallbackOpt = (nssASN1NotifyFunction *)NULL;
|
||||
}
|
||||
@@ -956,12 +646,6 @@ nssASN1Encoder_SetStreaming
|
||||
{
|
||||
SEC_ASN1EncoderContext *cx = (SEC_ASN1EncoderContext *)encoder;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( streaming ) {
|
||||
SEC_ASN1EncoderSetStreaming(cx);
|
||||
} else {
|
||||
@@ -993,12 +677,6 @@ nssASN1Encoder_GetStreaming
|
||||
PRBool *pStreaming
|
||||
)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (PRBool *)NULL != pStreaming ) {
|
||||
*pStreaming = PR_FALSE;
|
||||
}
|
||||
@@ -1029,12 +707,6 @@ nssASN1Encoder_SetTakeFromBuffer
|
||||
{
|
||||
SEC_ASN1EncoderContext *cx = (SEC_ASN1EncoderContext *)encoder;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( takeFromBuffer ) {
|
||||
SEC_ASN1EncoderSetTakeFromBuf(cx);
|
||||
} else {
|
||||
@@ -1066,12 +738,6 @@ nssASN1Encoder_GetTakeFromBuffer
|
||||
PRBool *pTakeFromBuffer
|
||||
)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (PRBool *)NULL != pTakeFromBuffer ) {
|
||||
*pTakeFromBuffer = PR_FALSE;
|
||||
}
|
||||
@@ -1207,24 +873,6 @@ nssASN1_EncodeItem
|
||||
PRUint32 len = 0;
|
||||
PRStatus status;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if( (void *)NULL == source ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
|
||||
if( (nssASN1Template *)NULL == template ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
status = nssASN1_Encode(source, template, encoding,
|
||||
(nssASN1EncoderWriteFunction *)nssasn1_encode_item_count,
|
||||
&len);
|
||||
@@ -1300,14 +948,6 @@ nssASN1_GetDERFromPRUint32
|
||||
NSSDER *rv;
|
||||
NSSItem *item;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (NSSDER *)NULL == rvOpt ) {
|
||||
rv = nss_ZNEW(arenaOpt, NSSDER);
|
||||
if( (NSSDER *)NULL == rv ) {
|
||||
@@ -1364,14 +1004,6 @@ nssASN1_GetDERFromPRInt32
|
||||
NSSDER *rv;
|
||||
NSSItem *item;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (NSSDER *)NULL == rvOpt ) {
|
||||
rv = nss_ZNEW(arenaOpt, NSSDER);
|
||||
if( (NSSDER *)NULL == rv ) {
|
||||
@@ -1489,24 +1121,6 @@ nssUTF8_CreateFromBER
|
||||
PRStatus st;
|
||||
const nssASN1Template *templ;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if( (NSSBER *)NULL == berData ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
|
||||
if( (void *)NULL == berData->data ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
a = NSSArena_Create();
|
||||
if( (NSSArena *)NULL == a ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
@@ -1639,19 +1253,6 @@ nssUTF8_GetDEREncoding
|
||||
const nssASN1Template *templ;
|
||||
NSSArena *a;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if( (const NSSUTF8 *)NULL == string ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
str.data = (void *)string;
|
||||
str.size = nssUTF8_Size(string, (PRStatus *)NULL);
|
||||
if( 0 == str.size ) {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define ASN1_H
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char ASN1_CVS_ID[] = "@(#) $RCSfile: asn1.h,v $ $Revision: 1.1.192.1 $ $Date: 2002-08-26 15:50:02 $ $Name: not supported by cvs2svn $";
|
||||
static const char ASN1_CVS_ID[] = "@(#) $RCSfile: asn1.h,v $ $Revision: 1.1.192.2 $ $Date: 2002-09-05 22:49:24 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -111,9 +111,6 @@ nssASN1Decoder_Create
|
||||
const nssASN1Template template[]
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* nssASN1Decoder_Update
|
||||
@@ -141,9 +138,6 @@ nssASN1Decoder_Update
|
||||
PRUint32 amount
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
extern const NSSError NSS_ERROR_INVALID_BER;
|
||||
|
||||
/*
|
||||
* nssASN1Decoder_Finish
|
||||
@@ -166,7 +160,6 @@ nssASN1Decoder_Finish
|
||||
nssASN1Decoder *decoder
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
|
||||
/*
|
||||
* nssASN1Decoder_SetFilter
|
||||
@@ -198,7 +191,6 @@ nssASN1Decoder_SetFilter
|
||||
PRBool noStore
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
|
||||
/*
|
||||
* nssASN1Decoder_GetFilter
|
||||
@@ -231,7 +223,6 @@ nssASN1Decoder_GetFilter
|
||||
PRBool *pNoStoreOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
|
||||
/*
|
||||
* nssASN1Decoder_SetNotify
|
||||
@@ -259,7 +250,6 @@ nssASN1Decoder_SetNotify
|
||||
void *argument
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
|
||||
/*
|
||||
* nssASN1Decoder_GetNotify
|
||||
@@ -288,7 +278,6 @@ nssASN1Decoder_GetNotify
|
||||
void **pArgumentOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
|
||||
/*
|
||||
* nssASN1Decoder_verify
|
||||
@@ -314,7 +303,6 @@ nssASN1Decoder_verify
|
||||
nssASN1Decoder *decoder
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -346,10 +334,6 @@ nssASN1_Decode
|
||||
PRUint32 amount
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_INVALID_BER;
|
||||
|
||||
/*
|
||||
* nssASN1_DecodeBER
|
||||
@@ -380,10 +364,6 @@ nssASN1_DecodeBER
|
||||
const NSSBER *data
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_INVALID_BER;
|
||||
|
||||
/*
|
||||
* nssASN1Encoder
|
||||
@@ -439,10 +419,6 @@ nssASN1Encoder_Create
|
||||
void *argument
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_ENCODING_NOT_SUPPORTED;
|
||||
|
||||
/*
|
||||
* nssASN1Encoder_Update
|
||||
@@ -464,8 +440,6 @@ nssASN1Encoder_Update
|
||||
PRUint32 length
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* nssASN1Encoder_Finish
|
||||
@@ -486,7 +460,6 @@ nssASN1Encoder_Finish
|
||||
nssASN1Encoder *encoder
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
|
||||
/*
|
||||
* nssASN1Encoder_SetNotify
|
||||
@@ -514,7 +487,6 @@ nssASN1Encoder_SetNotify
|
||||
void *argument
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
|
||||
/*
|
||||
* nssASN1Encoder_GetNotify
|
||||
@@ -543,7 +515,6 @@ nssASN1Encoder_GetNotify
|
||||
void **pArgumentOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
|
||||
/*
|
||||
* nssASN1Encoder_SetStreaming
|
||||
@@ -564,7 +535,6 @@ nssASN1Encoder_SetStreaming
|
||||
PRBool streaming
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
|
||||
/*
|
||||
* nssASN1Encoder_GetStreaming
|
||||
@@ -586,8 +556,6 @@ nssASN1Encoder_GetStreaming
|
||||
PRBool *pStreaming
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* nssASN1Encoder_SetTakeFromBuffer
|
||||
@@ -608,7 +576,6 @@ nssASN1Encoder_SetTakeFromBuffer
|
||||
PRBool takeFromBuffer
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
|
||||
/*
|
||||
* nssASN1Encoder_GetTakeFromBuffer
|
||||
@@ -630,8 +597,6 @@ nssASN1Encoder_GetTakeFromBuffer
|
||||
PRBool *pTakeFromBuffer
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* nssASN1Encoder_verify
|
||||
@@ -657,7 +622,6 @@ nssASN1Encoder_verify
|
||||
nssASN1Encoder *encoder
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -686,10 +650,6 @@ nssASN1_Encode
|
||||
void *argument
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_ENCODING_NOT_SUPPORTED;
|
||||
|
||||
/*
|
||||
* nssASN1_EncodeItem
|
||||
@@ -720,10 +680,6 @@ nssASN1_EncodeItem
|
||||
NSSASN1EncodingType encoding
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_ENCODING_NOT_SUPPORTED;
|
||||
|
||||
/*
|
||||
* Other basic types' encoding and decoding helper functions:
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define NSSASN1_H
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char NSSASN1_CVS_ID[] = "@(#) $RCSfile: nssasn1.h,v $ $Revision: 1.1.2.1 $ $Date: 2002-08-26 18:43:57 $ $Name: not supported by cvs2svn $";
|
||||
static const char NSSASN1_CVS_ID[] = "@(#) $RCSfile: nssasn1.h,v $ $Revision: 1.1.2.2 $ $Date: 2002-09-05 22:49:24 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -102,9 +102,6 @@ NSSASN1Decoder_Create
|
||||
const NSSASN1Template template[]
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* NSSASN1Decoder_Update
|
||||
@@ -132,9 +129,6 @@ NSSASN1Decoder_Update
|
||||
PRUint32 amount
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
extern const NSSError NSS_ERROR_INVALID_BER;
|
||||
|
||||
/*
|
||||
* NSSASN1Decoder_Finish
|
||||
@@ -157,7 +151,6 @@ NSSASN1Decoder_Finish
|
||||
NSSASN1Decoder *decoder
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
|
||||
/*
|
||||
* NSSASN1Decoder_SetFilter
|
||||
@@ -189,7 +182,6 @@ NSSASN1Decoder_SetFilter
|
||||
PRBool noStore
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
|
||||
/*
|
||||
* NSSASN1Decoder_GetFilter
|
||||
@@ -222,7 +214,6 @@ NSSASN1Decoder_GetFilter
|
||||
PRBool *pNoStoreOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
|
||||
/*
|
||||
* NSSASN1Decoder_SetNotify
|
||||
@@ -250,7 +241,6 @@ NSSASN1Decoder_SetNotify
|
||||
void *argument
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
|
||||
/*
|
||||
* NSSASN1Decoder_GetNotify
|
||||
@@ -279,7 +269,6 @@ NSSASN1Decoder_GetNotify
|
||||
void **pArgumentOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1DECODER;
|
||||
|
||||
/*
|
||||
* NSSASN1_Decode
|
||||
@@ -310,10 +299,6 @@ NSSASN1_Decode
|
||||
PRUint32 amount
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_INVALID_BER;
|
||||
|
||||
/*
|
||||
* NSSASN1_DecodeBER
|
||||
@@ -344,10 +329,6 @@ NSSASN1_DecodeBER
|
||||
const NSSBER *data
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_INVALID_BER;
|
||||
|
||||
/*
|
||||
* NSSASN1Encoder
|
||||
@@ -403,10 +384,6 @@ NSSASN1Encoder_Create
|
||||
void *argument
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_ENCODING_NOT_SUPPORTED;
|
||||
|
||||
/*
|
||||
* NSSASN1Encoder_Update
|
||||
@@ -428,8 +405,6 @@ NSSASN1Encoder_Update
|
||||
PRUint32 length
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* NSSASN1Encoder_Finish
|
||||
@@ -450,7 +425,6 @@ NSSASN1Encoder_Finish
|
||||
NSSASN1Encoder *encoder
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
|
||||
/*
|
||||
* NSSASN1Encoder_SetNotify
|
||||
@@ -478,7 +452,6 @@ NSSASN1Encoder_SetNotify
|
||||
void *argument
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
|
||||
/*
|
||||
* NSSASN1Encoder_GetNotify
|
||||
@@ -507,7 +480,6 @@ NSSASN1Encoder_GetNotify
|
||||
void **pArgumentOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
|
||||
/*
|
||||
* NSSASN1Encoder_SetStreaming
|
||||
@@ -528,7 +500,6 @@ NSSASN1Encoder_SetStreaming
|
||||
PRBool streaming
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
|
||||
/*
|
||||
* NSSASN1Encoder_GetStreaming
|
||||
@@ -550,8 +521,6 @@ NSSASN1Encoder_GetStreaming
|
||||
PRBool *pStreaming
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* NSSASN1Encoder_SetTakeFromBuffer
|
||||
@@ -572,7 +541,6 @@ NSSASN1Encoder_SetTakeFromBuffer
|
||||
PRBool takeFromBuffer
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
|
||||
/*
|
||||
* NSSASN1Encoder_GetTakeFromBuffer
|
||||
@@ -594,8 +562,6 @@ NSSASN1Encoder_GetTakeFromBuffer
|
||||
PRBool *pTakeFromBuffer
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* NSSASN1_Encode
|
||||
@@ -623,10 +589,6 @@ NSSASN1_Encode
|
||||
void *argument
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_ENCODING_NOT_SUPPORTED;
|
||||
|
||||
/*
|
||||
* NSSASN1_EncodeItem
|
||||
@@ -657,10 +619,6 @@ NSSASN1_EncodeItem
|
||||
NSSASN1EncodingType encoding
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_ENCODING_NOT_SUPPORTED;
|
||||
|
||||
#if 0
|
||||
/*
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: arena.c,v $ $Revision: 1.5 $ $Date: 2002-04-04 16:14:26 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: arena.c,v $ $Revision: 1.5.18.1 $ $Date: 2002-09-05 22:49:27 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -76,11 +76,6 @@ static const char CVS_ID[] = "@(#) $RCSfile: arena.c,v $ $Revision: 1.5 $ $Date:
|
||||
* nss_ZFreeIf
|
||||
* nss_ZRealloc
|
||||
*
|
||||
* In debug builds, the following calls are available:
|
||||
*
|
||||
* nssArena_verifyPointer
|
||||
* nssArena_registerDestructor
|
||||
* nssArena_deregisterDestructor
|
||||
*/
|
||||
|
||||
struct NSSArenaStr {
|
||||
@@ -117,106 +112,6 @@ struct nssArenaMarkStr {
|
||||
|
||||
#define MARK_MAGIC 0x4d41524b /* "MARK" how original */
|
||||
|
||||
/*
|
||||
* But first, the pointer-tracking code
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
extern const NSSError NSS_ERROR_INTERNAL_ERROR;
|
||||
|
||||
static nssPointerTracker arena_pointer_tracker;
|
||||
|
||||
static PRStatus
|
||||
arena_add_pointer
|
||||
(
|
||||
const NSSArena *arena
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_initialize(&arena_pointer_tracker);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = nssPointerTracker_add(&arena_pointer_tracker, arena);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
NSSError e = NSS_GetError();
|
||||
if( NSS_ERROR_NO_MEMORY != e ) {
|
||||
nss_SetError(NSS_ERROR_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
static PRStatus
|
||||
arena_remove_pointer
|
||||
(
|
||||
const NSSArena *arena
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_remove(&arena_pointer_tracker, arena);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
nss_SetError(NSS_ERROR_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* nssArena_verifyPointer
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* If the specified pointer is a valid pointer to an NSSArena object,
|
||||
* this routine will return PR_SUCCESS. Otherwise, it will put an
|
||||
* error on the error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_ARENA
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS if the pointer is valid
|
||||
* PR_FAILURE if it isn't
|
||||
*/
|
||||
|
||||
NSS_IMPLEMENT PRStatus
|
||||
nssArena_verifyPointer
|
||||
(
|
||||
const NSSArena *arena
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_initialize(&arena_pointer_tracker);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
/*
|
||||
* This is a little disingenious. We have to initialize the
|
||||
* tracker, because someone could "legitimately" try to verify
|
||||
* an arena pointer before one is ever created. And this step
|
||||
* might fail, due to lack of memory. But the only way that
|
||||
* this step can fail is if it's doing the call_once stuff,
|
||||
* (later calls just no-op). And if it didn't no-op, there
|
||||
* aren't any valid arenas.. so the argument certainly isn't one.
|
||||
*/
|
||||
nss_SetError(NSS_ERROR_INVALID_ARENA);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
rv = nssPointerTracker_verify(&arena_pointer_tracker, arena);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_ARENA);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef ARENA_DESTRUCTOR_LIST
|
||||
|
||||
struct arena_destructor_node {
|
||||
@@ -262,17 +157,6 @@ nssArena_registerDestructor
|
||||
{
|
||||
struct arena_destructor_node *it;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arena) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
it = nss_ZNEW(arena, struct arena_destructor_node);
|
||||
if( (struct arena_destructor_node *)NULL == it ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
it->prev = arena->last_destructor;
|
||||
arena->last_destructor->next = it;
|
||||
arena->last_destructor = it;
|
||||
@@ -297,12 +181,6 @@ nssArena_deregisterDestructor
|
||||
{
|
||||
struct arena_destructor_node *it;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arena) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
for( it = arena->first_destructor; it; it = it->next ) {
|
||||
if( (it->destructor == destructor) && (it->arg == arg) ) {
|
||||
break;
|
||||
@@ -438,19 +316,6 @@ nssArena_Create
|
||||
|
||||
PL_InitArenaPool(&rv->pool, "NSS", 2048, sizeof(double));
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
PRStatus st;
|
||||
st = arena_add_pointer(rv);
|
||||
if( PR_SUCCESS != st ) {
|
||||
PL_FinishArenaPool(&rv->pool);
|
||||
PR_DestroyLock(rv->lock);
|
||||
(void)nss_ZFreeIf(rv);
|
||||
return (NSSArena *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -478,12 +343,6 @@ NSSArena_Destroy
|
||||
{
|
||||
nss_ClearErrorStack();
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arena) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return nssArena_Destroy(arena);
|
||||
}
|
||||
|
||||
@@ -511,24 +370,12 @@ nssArena_Destroy
|
||||
{
|
||||
PRLock *lock;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arena) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
PR_Lock(arena->lock);
|
||||
if( (PRLock *)NULL == arena->lock ) {
|
||||
/* Just got destroyed */
|
||||
nss_SetError(NSS_ERROR_INVALID_ARENA);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != arena_remove_pointer(arena) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef ARENA_DESTRUCTOR_LIST
|
||||
/* Note that the arena is locked at this time */
|
||||
@@ -576,12 +423,6 @@ nssArena_Mark
|
||||
nssArenaMark *rv;
|
||||
void *p;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arena) ) {
|
||||
return (nssArenaMark *)NULL;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
PR_Lock(arena->lock);
|
||||
if( (PRLock *)NULL == arena->lock ) {
|
||||
/* Just got destroyed */
|
||||
@@ -654,12 +495,6 @@ nss_arena_unmark_release
|
||||
{
|
||||
void *inner_mark;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arena) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
if( MARK_MAGIC != arenaMark->magic ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_ARENA_MARK);
|
||||
return PR_FAILURE;
|
||||
@@ -899,11 +734,6 @@ nss_ZAlloc
|
||||
} else {
|
||||
void *rv;
|
||||
/* Arena allocation */
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (void *)NULL;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
PR_Lock(arenaOpt->lock);
|
||||
if( (PRLock *)NULL == arenaOpt->lock ) {
|
||||
@@ -972,16 +802,11 @@ nss_ZFreeIf
|
||||
return PR_SUCCESS;
|
||||
} else {
|
||||
/* Arena */
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(h->arena) ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
PR_Lock(h->arena->lock);
|
||||
if( (PRLock *)NULL == h->arena->lock ) {
|
||||
/* Just got destroyed.. so this pointer is invalid */
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
nss_SetError(NSS_ERROR_INVALID_ARENA);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1075,12 +900,6 @@ nss_ZRealloc
|
||||
} else {
|
||||
void *p;
|
||||
/* Arena */
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(h->arena) ) {
|
||||
return (void *)NULL;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
PR_Lock(h->arena->lock);
|
||||
if( (PRLock *)NULL == h->arena->lock ) {
|
||||
/* Just got destroyed.. so this pointer is invalid */
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define BASE_H
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char BASE_CVS_ID[] = "@(#) $RCSfile: base.h,v $ $Revision: 1.15.18.1 $ $Date: 2002-08-26 15:52:23 $ $Name: not supported by cvs2svn $";
|
||||
static const char BASE_CVS_ID[] = "@(#) $RCSfile: base.h,v $ $Revision: 1.15.18.2 $ $Date: 2002-09-05 22:49:29 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -80,12 +80,6 @@ PR_BEGIN_EXTERN_C
|
||||
* nss_ZNEW
|
||||
* nss_ZNEWARRAY
|
||||
*
|
||||
* In debug builds, the following calls are available:
|
||||
*
|
||||
* nssArena_verifyPointer
|
||||
* nssArena_registerDestructor
|
||||
* nssArena_deregisterDestructor
|
||||
*
|
||||
* The following preprocessor macro is also always available:
|
||||
*
|
||||
* nssArena_VERIFYPOINTER
|
||||
@@ -125,8 +119,6 @@ nssArena_Create
|
||||
void
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* nssArena_Destroy
|
||||
*
|
||||
@@ -149,8 +141,6 @@ nssArena_Destroy
|
||||
NSSArena *arena
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
|
||||
/*
|
||||
* nssArena_Mark
|
||||
*
|
||||
@@ -178,10 +168,6 @@ nssArena_Mark
|
||||
NSSArena *arena
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_ARENA_MARKED_BY_ANOTHER_THREAD;
|
||||
|
||||
/*
|
||||
* nssArena_Release
|
||||
*
|
||||
@@ -208,9 +194,6 @@ nssArena_Release
|
||||
nssArenaMark *arenaMark
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA_MARK;
|
||||
|
||||
/*
|
||||
* nssArena_Unmark
|
||||
*
|
||||
@@ -240,10 +223,6 @@ nssArena_Unmark
|
||||
nssArenaMark *arenaMark
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA_MARK;
|
||||
extern const NSSError NSS_ERROR_ARENA_MARKED_BY_ANOTHER_THREAD;
|
||||
|
||||
#ifdef ARENA_DESTRUCTOR_LIST
|
||||
|
||||
/*
|
||||
@@ -280,9 +259,6 @@ nssArena_registerDestructor
|
||||
void *arg
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* nssArena_deregisterDestructor
|
||||
*
|
||||
@@ -310,10 +286,6 @@ nssArena_deregisterDestructor
|
||||
void *arg
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ITEM;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_NOT_FOUND;
|
||||
|
||||
#endif /* ARENA_DESTRUCTOR_LIST */
|
||||
|
||||
/*
|
||||
@@ -346,10 +318,6 @@ nss_ZAlloc
|
||||
PRUint32 size
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_ARENA_MARKED_BY_ANOTHER_THREAD;
|
||||
|
||||
/*
|
||||
* nss_ZFreeIf
|
||||
*
|
||||
@@ -374,8 +342,6 @@ nss_ZFreeIf
|
||||
void *pointer
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* nss_ZRealloc
|
||||
*
|
||||
@@ -403,10 +369,6 @@ nss_ZRealloc
|
||||
PRUint32 newSize
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_ARENA_MARKED_BY_ANOTHER_THREAD;
|
||||
|
||||
/*
|
||||
* nss_ZNEW
|
||||
*
|
||||
@@ -472,53 +434,6 @@ extern const NSSError NSS_ERROR_ARENA_MARKED_BY_ANOTHER_THREAD;
|
||||
*/
|
||||
#define nss_ZREALLOCARRAY(p, type, quantity) ((type *)nss_ZRealloc((p), sizeof(type) * (quantity)))
|
||||
|
||||
/*
|
||||
* nssArena_verifyPointer
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* If the specified pointer is a valid pointer to an NSSArena object,
|
||||
* this routine will return PR_SUCCESS. Otherwise, it will put an
|
||||
* error on the error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_ARENA
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS if the pointer is valid
|
||||
* PR_FAILURE if it isn't
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
NSS_EXTERN PRStatus
|
||||
nssArena_verifyPointer
|
||||
(
|
||||
const NSSArena *arena
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* nssArena_VERIFYPOINTER
|
||||
*
|
||||
* This macro is always available. In debug builds it will call
|
||||
* nssArena_verifyPointer; in non-debug builds, it will merely
|
||||
* check that the pointer is not null. Note that in non-debug
|
||||
* builds it cannot place an error on the error stack.
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS if the pointer is valid
|
||||
* PR_FAILURE if it isn't
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#define nssArena_VERIFYPOINTER(p) nssArena_verifyPointer(p)
|
||||
#else /* DEBUG */
|
||||
/* The following line exceeds 72 characters, but emacs screws up if I split it. */
|
||||
#define nssArena_VERIFYPOINTER(p) (((NSSArena *)NULL == (p))?PR_FAILURE:PR_SUCCESS)
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* nssArenaHashAllocOps
|
||||
*
|
||||
@@ -716,9 +631,6 @@ nssUTF8_Size
|
||||
PRStatus *statusOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_VALUE_TOO_LARGE;
|
||||
|
||||
/*
|
||||
* nssUTF8_Length
|
||||
*
|
||||
@@ -743,10 +655,6 @@ nssUTF8_Length
|
||||
PRStatus *statusOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_VALUE_TOO_LARGE;
|
||||
extern const NSSError NSS_ERROR_INVALID_STRING;
|
||||
|
||||
/*
|
||||
* nssUTF8_Create
|
||||
*
|
||||
@@ -779,10 +687,6 @@ nssUTF8_Create
|
||||
PRUint32 size /* in bytes, not characters */
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_UNSUPPORTED_TYPE;
|
||||
|
||||
NSS_EXTERN NSSItem *
|
||||
nssUTF8_GetEncoding
|
||||
(
|
||||
@@ -803,9 +707,6 @@ nssUTF8_GetEncoding
|
||||
* Blah, blah, blah.
|
||||
*/
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARGUMENT;
|
||||
|
||||
NSS_EXTERN PRStatus
|
||||
nssUTF8_CopyIntoFixedBuffer
|
||||
(
|
||||
@@ -892,10 +793,6 @@ nssHash_Destroy
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0
|
||||
extern const NSSError NSS_ERROR_HASH_COLLISION;
|
||||
#endif
|
||||
|
||||
NSS_EXTERN PRStatus
|
||||
nssHash_Add
|
||||
(
|
||||
@@ -959,188 +856,6 @@ nssHash_Iterate
|
||||
void *closure
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* nssPointerTracker
|
||||
*
|
||||
* This type and these methods are only present in debug builds.
|
||||
*
|
||||
* The nonpublic methods relating to this type are:
|
||||
*
|
||||
* nssPointerTracker_initialize
|
||||
* nssPointerTracker_finalize
|
||||
* nssPointerTracker_add
|
||||
* nssPointerTracker_remove
|
||||
* nssPointerTracker_verify
|
||||
*/
|
||||
|
||||
/*
|
||||
* nssPointerTracker_initialize
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* This routine initializes an nssPointerTracker object. Note that
|
||||
* the object must have been declared *static* to guarantee that it
|
||||
* is in a zeroed state initially. This routine is idempotent, and
|
||||
* may even be safely called by multiple threads simultaneously with
|
||||
* the same argument. This routine returns a PRStatus value; if
|
||||
* successful, it will return PR_SUCCESS. On failure it will set an
|
||||
* error on the error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_NO_MEMORY
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS
|
||||
* PR_FAILURE
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
NSS_EXTERN PRStatus
|
||||
nssPointerTracker_initialize
|
||||
(
|
||||
nssPointerTracker *tracker
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* nssPointerTracker_finalize
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* This routine returns the nssPointerTracker object to the pre-
|
||||
* initialized state, releasing all resources used by the object.
|
||||
* It will *NOT* destroy the objects being tracked by the pointer
|
||||
* (should any remain), and therefore cannot be used to "sweep up"
|
||||
* remaining objects. This routine returns a PRStatus value; if
|
||||
* successful, it will return PR_SUCCES. On failure it will set an
|
||||
* error on the error stack and return PR_FAILURE. If any objects
|
||||
* remain in the tracker when it is finalized, that will be treated
|
||||
* as an error.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_TRACKER_NOT_EMPTY
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS
|
||||
* PR_FAILURE
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
NSS_EXTERN PRStatus
|
||||
nssPointerTracker_finalize
|
||||
(
|
||||
nssPointerTracker *tracker
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_TRACKER_NOT_EMPTY;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* nssPointerTracker_add
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* This routine adds the specified pointer to the nssPointerTracker
|
||||
* object. It should be called in constructor objects to register
|
||||
* new valid objects. The nssPointerTracker is threadsafe, but this
|
||||
* call is not idempotent. This routine returns a PRStatus value;
|
||||
* if successful it will return PR_SUCCESS. On failure it will set
|
||||
* an error on the error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_NO_MEMORY
|
||||
* NSS_ERROR_TRACKER_NOT_INITIALIZED
|
||||
* NSS_ERROR_DUPLICATE_POINTER
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS
|
||||
* PR_FAILURE
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
NSS_EXTERN PRStatus
|
||||
nssPointerTracker_add
|
||||
(
|
||||
nssPointerTracker *tracker,
|
||||
const void *pointer
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
extern const NSSError NSS_ERROR_TRACKER_NOT_INITIALIZED;
|
||||
extern const NSSError NSS_ERROR_DUPLICATE_POINTER;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* nssPointerTracker_remove
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* This routine removes the specified pointer from the
|
||||
* nssPointerTracker object. It does not call any destructor for the
|
||||
* object; rather, this should be called from the object's destructor.
|
||||
* The nssPointerTracker is threadsafe, but this call is not
|
||||
* idempotent. This routine returns a PRStatus value; if successful
|
||||
* it will return PR_SUCCESS. On failure it will set an error on the
|
||||
* error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_TRACKER_NOT_INITIALIZED
|
||||
* NSS_ERROR_POINTER_NOT_REGISTERED
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS
|
||||
* PR_FAILURE
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
NSS_EXTERN PRStatus
|
||||
nssPointerTracker_remove
|
||||
(
|
||||
nssPointerTracker *tracker,
|
||||
const void *pointer
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_TRACKER_NOT_INITIALIZED;
|
||||
extern const NSSError NSS_ERROR_POINTER_NOT_REGISTERED;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* nssPointerTracker_verify
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* This routine verifies that the specified pointer has been registered
|
||||
* with the nssPointerTracker object. The nssPointerTracker object is
|
||||
* threadsafe, and this call may be safely called from multiple threads
|
||||
* simultaneously with the same arguments. This routine returns a
|
||||
* PRStatus value; if the pointer is registered this will return
|
||||
* PR_SUCCESS. Otherwise it will set an error on the error stack and
|
||||
* return PR_FAILURE. Although the error is suitable for leaving on
|
||||
* the stack, callers may wish to augment the information available by
|
||||
* placing a more type-specific error on the stack.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_POINTER_NOT_REGISTERED
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS
|
||||
* PR_FAILRUE
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
NSS_EXTERN PRStatus
|
||||
nssPointerTracker_verify
|
||||
(
|
||||
nssPointerTracker *tracker,
|
||||
const void *pointer
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_POINTER_NOT_REGISTERED;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* libc
|
||||
*
|
||||
@@ -1168,8 +883,6 @@ nsslibc_memcpy
|
||||
PRUint32 n
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* nsslibc_memset
|
||||
*
|
||||
@@ -1189,8 +902,6 @@ nsslibc_memset
|
||||
PRUint32 n
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
/*
|
||||
* nsslibc_memequal
|
||||
*
|
||||
@@ -1212,8 +923,6 @@ nsslibc_memequal
|
||||
PRStatus *statusOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
|
||||
#define nsslibc_offsetof(str, memb) ((PRPtrdiff)(&(((str *)0)->memb)))
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Netscape security libraries.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1994-2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU General Public License Version 2 or later (the
|
||||
* "GPL"), in which case the provisions of the GPL are applicable
|
||||
* instead of those above. If you wish to allow use of your
|
||||
* version of this file only under the terms of the GPL and not to
|
||||
* allow others to use your version of this file under the MPL,
|
||||
* indicate your decision by deleting the provisions above and
|
||||
* replace them with the notice and other provisions required by
|
||||
* the GPL. If you do not delete the provisions above, a recipient
|
||||
* may use your version of this file under either the MPL or the
|
||||
* GPL.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: errorval.c,v $ $Revision: 1.6.44.1 $ $Date: 2002-08-26 15:52:25 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* errorval.c
|
||||
*
|
||||
* This file contains the actual error constants used in NSS.
|
||||
*/
|
||||
|
||||
#ifndef NSSBASET_H
|
||||
#include "nssbaset.h"
|
||||
#endif /* NSSBASET_H */
|
||||
|
||||
const NSSError NSS_ERROR_NO_ERROR = 0;
|
||||
const NSSError NSS_ERROR_INTERNAL_ERROR = 1;
|
||||
const NSSError NSS_ERROR_NO_MEMORY = 2;
|
||||
const NSSError NSS_ERROR_INVALID_POINTER = 3;
|
||||
const NSSError NSS_ERROR_INVALID_ARENA = 4;
|
||||
const NSSError NSS_ERROR_INVALID_ARENA_MARK = 5;
|
||||
const NSSError NSS_ERROR_DUPLICATE_POINTER = 6;
|
||||
const NSSError NSS_ERROR_POINTER_NOT_REGISTERED = 7;
|
||||
const NSSError NSS_ERROR_TRACKER_NOT_EMPTY = 8;
|
||||
const NSSError NSS_ERROR_TRACKER_NOT_INITIALIZED = 9;
|
||||
const NSSError NSS_ERROR_ARENA_MARKED_BY_ANOTHER_THREAD = 10;
|
||||
const NSSError NSS_ERROR_VALUE_TOO_LARGE = 11;
|
||||
const NSSError NSS_ERROR_UNSUPPORTED_TYPE = 12;
|
||||
const NSSError NSS_ERROR_BUFFER_TOO_SHORT = 13;
|
||||
const NSSError NSS_ERROR_INVALID_ATOB_CONTEXT = 14;
|
||||
const NSSError NSS_ERROR_INVALID_BASE64 = 15;
|
||||
const NSSError NSS_ERROR_INVALID_BTOA_CONTEXT = 16;
|
||||
const NSSError NSS_ERROR_INVALID_ITEM = 17;
|
||||
const NSSError NSS_ERROR_INVALID_STRING = 18;
|
||||
const NSSError NSS_ERROR_INVALID_ASN1ENCODER = 19;
|
||||
const NSSError NSS_ERROR_INVALID_ASN1DECODER = 20;
|
||||
|
||||
const NSSError NSS_ERROR_INVALID_BER = 21;
|
||||
const NSSError NSS_ERROR_INVALID_ATAV = 22;
|
||||
const NSSError NSS_ERROR_INVALID_ARGUMENT = 23;
|
||||
const NSSError NSS_ERROR_INVALID_UTF8 = 24;
|
||||
const NSSError NSS_ERROR_INVALID_NSSOID = 25;
|
||||
const NSSError NSS_ERROR_UNKNOWN_ATTRIBUTE = 26;
|
||||
|
||||
const NSSError NSS_ERROR_NOT_FOUND = 27;
|
||||
|
||||
const NSSError NSS_ERROR_INVALID_PASSWORD = 28;
|
||||
const NSSError NSS_ERROR_USER_CANCELED = 29;
|
||||
|
||||
const NSSError NSS_ERROR_MAXIMUM_FOUND = 30;
|
||||
const NSSError NSS_ERROR_INVALID_SIGNATURE = 31;
|
||||
const NSSError NSS_ERROR_INVALID_DATA = 32;
|
||||
|
||||
/* token errors */
|
||||
const NSSError NSS_ERROR_TOKEN_FAILURE = 100;
|
||||
|
||||
/* certificate errors */
|
||||
const NSSError NSS_ERROR_CERTIFICATE_ISSUER_NOT_FOUND = 500;
|
||||
|
||||
/* crypto context errors */
|
||||
const NSSError NSS_ERROR_INVALID_CRYPTO_CONTEXT = 800;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.6.44.1 $ $Date: 2002-08-26 15:52:26 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.6.44.2 $ $Date: 2002-09-05 22:49:29 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -127,13 +127,6 @@ nssHash_Create
|
||||
NSSArena *arena;
|
||||
PRBool i_alloced;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( arenaOpt && PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (nssHash *)NULL;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
if (arenaOpt) {
|
||||
arena = arenaOpt;
|
||||
i_alloced = PR_FALSE;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: hashops.c,v $ $Revision: 1.4 $ $Date: 2002-02-13 02:26:43 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: hashops.c,v $ $Revision: 1.4.42.1 $ $Date: 2002-09-05 22:49:30 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -54,14 +54,6 @@ nss_arena_hash_alloc_table
|
||||
{
|
||||
NSSArena *arena = (NSSArena *)NULL;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( (void *)NULL != arena ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arena) ) {
|
||||
return (void *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
return nss_ZAlloc(arena, size);
|
||||
}
|
||||
|
||||
@@ -84,14 +76,6 @@ nss_arena_hash_alloc_entry
|
||||
{
|
||||
NSSArena *arena = NULL;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( (void *)NULL != arena ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arena) ) {
|
||||
return (void *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
return nss_ZNEW(arena, PLHashEntry);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: item.c,v $ $Revision: 1.2.44.1 $ $Date: 2002-08-26 15:52:26 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: item.c,v $ $Revision: 1.2.44.2 $ $Date: 2002-09-05 22:49:30 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -72,21 +72,6 @@ nssItem_Create
|
||||
{
|
||||
NSSItem *rv = (NSSItem *)NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSItem *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if( (const void *)NULL == data ) {
|
||||
if( length > 0 ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (NSSItem *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if( (NSSItem *)NULL == rvOpt ) {
|
||||
rv = (NSSItem *)nss_ZNEW(arenaOpt, NSSItem);
|
||||
if( (NSSItem *)NULL == rv ) {
|
||||
@@ -172,52 +157,9 @@ nssItem_Duplicate
|
||||
NSSItem *rvOpt
|
||||
)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSItem *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if( (NSSItem *)NULL == obj ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_ITEM);
|
||||
return (NSSItem *)NULL;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return nssItem_Create(arenaOpt, rvOpt, obj->size, obj->data);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* nssItem_verifyPointer
|
||||
*
|
||||
* -- fgmr comments --
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_ITEM
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS upon success
|
||||
* PR_FAILURE upon failure
|
||||
*/
|
||||
|
||||
NSS_IMPLEMENT PRStatus
|
||||
nssItem_verifyPointer
|
||||
(
|
||||
const NSSItem *item
|
||||
)
|
||||
{
|
||||
if( ((const NSSItem *)NULL == item) ||
|
||||
(((void *)NULL == item->data) && (item->size > 0)) ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_ITEM);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* nssItem_Equal
|
||||
*
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
# may use your version of this file under either the MPL or the
|
||||
# GPL.
|
||||
#
|
||||
MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.5.44.2 $ $Date: 2002-08-26 18:36:30 $ $Name: not supported by cvs2svn $"
|
||||
MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.5.44.3 $ $Date: 2002-09-05 22:49:31 $ $Name: not supported by cvs2svn $"
|
||||
|
||||
CORE_DEPTH = ../../..
|
||||
|
||||
@@ -39,9 +39,10 @@ PRIVATE_EXPORTS = \
|
||||
base.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nssbaset.h \
|
||||
nssbase.h \
|
||||
EXPORTS = \
|
||||
nssbaset.h \
|
||||
nssbase.h \
|
||||
nsserrors.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = security
|
||||
@@ -49,10 +50,8 @@ MODULE = security
|
||||
CSRCS = \
|
||||
arena.c \
|
||||
error.c \
|
||||
errorval.c \
|
||||
hashops.c \
|
||||
libc.c \
|
||||
tracker.c \
|
||||
item.c \
|
||||
utf8.c \
|
||||
hash.c \
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define NSSBASE_H
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char NSSBASE_CVS_ID[] = "@(#) $RCSfile: nssbase.h,v $ $Revision: 1.1.192.1 $ $Date: 2002-08-26 15:52:27 $ $Name: not supported by cvs2svn $";
|
||||
static const char NSSBASE_CVS_ID[] = "@(#) $RCSfile: nssbase.h,v $ $Revision: 1.1.192.2 $ $Date: 2002-09-05 22:49:31 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -49,6 +49,10 @@ static const char NSSBASE_CVS_ID[] = "@(#) $RCSfile: nssbase.h,v $ $Revision: 1.
|
||||
#include "nssbaset.h"
|
||||
#endif /* NSSBASET_H */
|
||||
|
||||
#ifndef NSSERRORS_H
|
||||
#include "nsserrors.h"
|
||||
#endif /* NSSERRORS_H */
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
@@ -80,8 +84,6 @@ NSSArena_Create
|
||||
void
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSArena_Destroy
|
||||
*
|
||||
@@ -104,8 +106,6 @@ NSSArena_Destroy
|
||||
NSSArena *arena
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
|
||||
/*
|
||||
* The error stack
|
||||
*
|
||||
@@ -136,8 +136,6 @@ NSS_GetError
|
||||
void
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_NO_ERROR;
|
||||
|
||||
/*
|
||||
* NSS_GetErrorStack
|
||||
*
|
||||
|
||||
@@ -1,543 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Netscape security libraries.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1994-2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU General Public License Version 2 or later (the
|
||||
* "GPL"), in which case the provisions of the GPL are applicable
|
||||
* instead of those above. If you wish to allow use of your
|
||||
* version of this file only under the terms of the GPL and not to
|
||||
* allow others to use your version of this file under the MPL,
|
||||
* indicate your decision by deleting the provisions above and
|
||||
* replace them with the notice and other provisions required by
|
||||
* the GPL. If you do not delete the provisions above, a recipient
|
||||
* may use your version of this file under either the MPL or the
|
||||
* GPL.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: tracker.c,v $ $Revision: 1.4 $ $Date: 2001-12-06 21:25:32 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* tracker.c
|
||||
*
|
||||
* This file contains the code used by the pointer-tracking calls used
|
||||
* in the debug builds to catch bad pointers. The entire contents are
|
||||
* only available in debug builds (both internal and external builds).
|
||||
*/
|
||||
|
||||
#ifndef BASE_H
|
||||
#include "base.h"
|
||||
#endif /* BASE_H */
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
/*
|
||||
* call_once
|
||||
*
|
||||
* Unfortunately, NSPR's PR_CallOnce function doesn't accept a closure
|
||||
* variable. So I have a static version here which does. This code
|
||||
* is based on NSPR's, and uses the NSPR function to initialize the
|
||||
* required lock.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The is the "once block" that's passed to the "real" PR_CallOnce
|
||||
* function, to call the local initializer myOnceFunction once.
|
||||
*/
|
||||
static PRCallOnceType myCallOnce;
|
||||
|
||||
/*
|
||||
* This structure is used by the call_once function to make sure that
|
||||
* any "other" threads calling the call_once don't return too quickly,
|
||||
* before the initializer has finished.
|
||||
*/
|
||||
static struct {
|
||||
PZLock *ml;
|
||||
PZCondVar *cv;
|
||||
} mod_init;
|
||||
|
||||
/*
|
||||
* This is the initializer for the above mod_init structure.
|
||||
*/
|
||||
static PRStatus
|
||||
myOnceFunction
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
mod_init.ml = PZ_NewLock(nssILockOther);
|
||||
if( (PZLock *)NULL == mod_init.ml ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
mod_init.cv = PZ_NewCondVar(mod_init.ml);
|
||||
if( (PZCondVar *)NULL == mod_init.cv ) {
|
||||
PZ_DestroyLock(mod_init.ml);
|
||||
mod_init.ml = (PZLock *)NULL;
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* The nss call_once callback takes a closure argument.
|
||||
*/
|
||||
typedef PRStatus (PR_CALLBACK *nssCallOnceFN)(void *arg);
|
||||
|
||||
/*
|
||||
* NSS's call_once function.
|
||||
*/
|
||||
static PRStatus
|
||||
call_once
|
||||
(
|
||||
PRCallOnceType *once,
|
||||
nssCallOnceFN func,
|
||||
void *arg
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
if( !myCallOnce.initialized ) {
|
||||
rv = PR_CallOnce(&myCallOnce, myOnceFunction);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if( !once->initialized ) {
|
||||
if( 0 == PR_AtomicSet(&once->inProgress, 1) ) {
|
||||
once->status = (*func)(arg);
|
||||
PZ_Lock(mod_init.ml);
|
||||
once->initialized = 1;
|
||||
PZ_NotifyAllCondVar(mod_init.cv);
|
||||
PZ_Unlock(mod_init.ml);
|
||||
} else {
|
||||
PZ_Lock(mod_init.ml);
|
||||
while( !once->initialized ) {
|
||||
PZ_WaitCondVar(mod_init.cv, PR_INTERVAL_NO_TIMEOUT);
|
||||
}
|
||||
PZ_Unlock(mod_init.ml);
|
||||
}
|
||||
}
|
||||
|
||||
return once->status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now we actually get to my own "call once" payload function.
|
||||
* But wait, to create the hash, I need a hash function!
|
||||
*/
|
||||
|
||||
/*
|
||||
* identity_hash
|
||||
*
|
||||
* This static callback is a PLHashFunction as defined in plhash.h
|
||||
* It merely returns the value of the object pointer as its hash.
|
||||
* There are no possible errors.
|
||||
*/
|
||||
|
||||
static PLHashNumber PR_CALLBACK
|
||||
identity_hash
|
||||
(
|
||||
const void *key
|
||||
)
|
||||
{
|
||||
return (PLHashNumber)key;
|
||||
}
|
||||
|
||||
/*
|
||||
* trackerOnceFunc
|
||||
*
|
||||
* This function is called once, using the nssCallOnce function above.
|
||||
* It creates a new pointer tracker object; initialising its hash
|
||||
* table and protective lock.
|
||||
*/
|
||||
|
||||
static PRStatus
|
||||
trackerOnceFunc
|
||||
(
|
||||
void *arg
|
||||
)
|
||||
{
|
||||
nssPointerTracker *tracker = (nssPointerTracker *)arg;
|
||||
|
||||
tracker->lock = PZ_NewLock(nssILockOther);
|
||||
if( (PZLock *)NULL == tracker->lock ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
tracker->table = PL_NewHashTable(0,
|
||||
identity_hash,
|
||||
PL_CompareValues,
|
||||
PL_CompareValues,
|
||||
(PLHashAllocOps *)NULL,
|
||||
(void *)NULL);
|
||||
if( (PLHashTable *)NULL == tracker->table ) {
|
||||
PZ_DestroyLock(tracker->lock);
|
||||
tracker->lock = (PZLock *)NULL;
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* nssPointerTracker_initialize
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* This routine initializes an nssPointerTracker object. Note that
|
||||
* the object must have been declared *static* to guarantee that it
|
||||
* is in a zeroed state initially. This routine is idempotent, and
|
||||
* may even be safely called by multiple threads simultaneously with
|
||||
* the same argument. This routine returns a PRStatus value; if
|
||||
* successful, it will return PR_SUCCESS. On failure it will set an
|
||||
* error on the error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_NO_MEMORY
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS
|
||||
* PR_FAILURE
|
||||
*/
|
||||
|
||||
NSS_IMPLEMENT PRStatus
|
||||
nssPointerTracker_initialize
|
||||
(
|
||||
nssPointerTracker *tracker
|
||||
)
|
||||
{
|
||||
PRStatus rv = call_once(&tracker->once, trackerOnceFunc, tracker);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
nss_SetError(NSS_ERROR_NO_MEMORY);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef DONT_DESTROY_EMPTY_TABLES
|
||||
/* See same #ifdef below */
|
||||
/*
|
||||
* count_entries
|
||||
*
|
||||
* This static routine is a PLHashEnumerator, as defined in plhash.h.
|
||||
* It merely causes the enumeration function to count the number of
|
||||
* entries.
|
||||
*/
|
||||
|
||||
static PRIntn PR_CALLBACK
|
||||
count_entries
|
||||
(
|
||||
PLHashEntry *he,
|
||||
PRIntn index,
|
||||
void *arg
|
||||
)
|
||||
{
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
#endif /* DONT_DESTROY_EMPTY_TABLES */
|
||||
|
||||
/*
|
||||
* zero_once
|
||||
*
|
||||
* This is a guaranteed zeroed once block. It's used to help clear
|
||||
* the tracker.
|
||||
*/
|
||||
|
||||
static const PRCallOnceType zero_once;
|
||||
|
||||
/*
|
||||
* nssPointerTracker_finalize
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* This routine returns the nssPointerTracker object to the pre-
|
||||
* initialized state, releasing all resources used by the object.
|
||||
* It will *NOT* destroy the objects being tracked by the pointer
|
||||
* (should any remain), and therefore cannot be used to "sweep up"
|
||||
* remaining objects. This routine returns a PRStatus value; if
|
||||
* successful, it will return PR_SUCCES. On failure it will set an
|
||||
* error on the error stack and return PR_FAILURE. If any objects
|
||||
* remain in the tracker when it is finalized, that will be treated
|
||||
* as an error.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_POINTER
|
||||
* NSS_ERROR_TRACKER_NOT_INITIALIZED
|
||||
* NSS_ERROR_TRACKER_NOT_EMPTY
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS
|
||||
* PR_FAILURE
|
||||
*/
|
||||
|
||||
NSS_IMPLEMENT PRStatus
|
||||
nssPointerTracker_finalize
|
||||
(
|
||||
nssPointerTracker *tracker
|
||||
)
|
||||
{
|
||||
PZLock *lock;
|
||||
|
||||
if( (nssPointerTracker *)NULL == tracker ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
if( (PZLock *)NULL == tracker->lock ) {
|
||||
nss_SetError(NSS_ERROR_TRACKER_NOT_INITIALIZED);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
lock = tracker->lock;
|
||||
PZ_Lock(lock);
|
||||
|
||||
if( (PLHashTable *)NULL == tracker->table ) {
|
||||
PZ_Unlock(lock);
|
||||
nss_SetError(NSS_ERROR_TRACKER_NOT_INITIALIZED);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef DONT_DESTROY_EMPTY_TABLES
|
||||
/*
|
||||
* I changed my mind; I think we don't want this after all.
|
||||
* Comments?
|
||||
*/
|
||||
count = PL_HashTableEnumerateEntries(tracker->table,
|
||||
count_entries,
|
||||
(void *)NULL);
|
||||
|
||||
if( 0 != count ) {
|
||||
PZ_Unlock(lock);
|
||||
nss_SetError(NSS_ERROR_TRACKER_NOT_EMPTY);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* DONT_DESTROY_EMPTY_TABLES */
|
||||
|
||||
PL_HashTableDestroy(tracker->table);
|
||||
/* memset(tracker, 0, sizeof(nssPointerTracker)); */
|
||||
tracker->once = zero_once;
|
||||
tracker->lock = (PZLock *)NULL;
|
||||
tracker->table = (PLHashTable *)NULL;
|
||||
|
||||
PZ_Unlock(lock);
|
||||
PZ_DestroyLock(lock);
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* nssPointerTracker_add
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* This routine adds the specified pointer to the nssPointerTracker
|
||||
* object. It should be called in constructor objects to register
|
||||
* new valid objects. The nssPointerTracker is threadsafe, but this
|
||||
* call is not idempotent. This routine returns a PRStatus value;
|
||||
* if successful it will return PR_SUCCESS. On failure it will set
|
||||
* an error on the error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_POINTER
|
||||
* NSS_ERROR_NO_MEMORY
|
||||
* NSS_ERROR_TRACKER_NOT_INITIALIZED
|
||||
* NSS_ERROR_DUPLICATE_POINTER
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS
|
||||
* PR_FAILURE
|
||||
*/
|
||||
|
||||
NSS_IMPLEMENT PRStatus
|
||||
nssPointerTracker_add
|
||||
(
|
||||
nssPointerTracker *tracker,
|
||||
const void *pointer
|
||||
)
|
||||
{
|
||||
void *check;
|
||||
PLHashEntry *entry;
|
||||
|
||||
if( (nssPointerTracker *)NULL == tracker ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
if( (PZLock *)NULL == tracker->lock ) {
|
||||
nss_SetError(NSS_ERROR_TRACKER_NOT_INITIALIZED);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PZ_Lock(tracker->lock);
|
||||
|
||||
if( (PLHashTable *)NULL == tracker->table ) {
|
||||
PZ_Unlock(tracker->lock);
|
||||
nss_SetError(NSS_ERROR_TRACKER_NOT_INITIALIZED);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
check = PL_HashTableLookup(tracker->table, pointer);
|
||||
if( (void *)NULL != check ) {
|
||||
PZ_Unlock(tracker->lock);
|
||||
nss_SetError(NSS_ERROR_DUPLICATE_POINTER);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
entry = PL_HashTableAdd(tracker->table, pointer, (void *)pointer);
|
||||
|
||||
PZ_Unlock(tracker->lock);
|
||||
|
||||
if( (PLHashEntry *)NULL == entry ) {
|
||||
nss_SetError(NSS_ERROR_NO_MEMORY);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* nssPointerTracker_remove
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* This routine removes the specified pointer from the
|
||||
* nssPointerTracker object. It does not call any destructor for the
|
||||
* object; rather, this should be called from the object's destructor.
|
||||
* The nssPointerTracker is threadsafe, but this call is not
|
||||
* idempotent. This routine returns a PRStatus value; if successful
|
||||
* it will return PR_SUCCESS. On failure it will set an error on the
|
||||
* error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_POINTER
|
||||
* NSS_ERROR_TRACKER_NOT_INITIALIZED
|
||||
* NSS_ERROR_POINTER_NOT_REGISTERED
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS
|
||||
* PR_FAILURE
|
||||
*/
|
||||
|
||||
NSS_IMPLEMENT PRStatus
|
||||
nssPointerTracker_remove
|
||||
(
|
||||
nssPointerTracker *tracker,
|
||||
const void *pointer
|
||||
)
|
||||
{
|
||||
PRBool registered;
|
||||
|
||||
if( (nssPointerTracker *)NULL == tracker ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
if( (PZLock *)NULL == tracker->lock ) {
|
||||
nss_SetError(NSS_ERROR_TRACKER_NOT_INITIALIZED);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PZ_Lock(tracker->lock);
|
||||
|
||||
if( (PLHashTable *)NULL == tracker->table ) {
|
||||
PZ_Unlock(tracker->lock);
|
||||
nss_SetError(NSS_ERROR_TRACKER_NOT_INITIALIZED);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
registered = PL_HashTableRemove(tracker->table, pointer);
|
||||
PZ_Unlock(tracker->lock);
|
||||
|
||||
if( !registered ) {
|
||||
nss_SetError(NSS_ERROR_POINTER_NOT_REGISTERED);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* nssPointerTracker_verify
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* This routine verifies that the specified pointer has been registered
|
||||
* with the nssPointerTracker object. The nssPointerTracker object is
|
||||
* threadsafe, and this call may be safely called from multiple threads
|
||||
* simultaneously with the same arguments. This routine returns a
|
||||
* PRStatus value; if the pointer is registered this will return
|
||||
* PR_SUCCESS. Otherwise it will set an error on the error stack and
|
||||
* return PR_FAILURE. Although the error is suitable for leaving on
|
||||
* the stack, callers may wish to augment the information available by
|
||||
* placing a more type-specific error on the stack.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_POINTER
|
||||
* NSS_ERROR_TRACKER_NOT_INITIALIZED
|
||||
* NSS_ERROR_POINTER_NOT_REGISTERED
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS
|
||||
* PR_FAILRUE
|
||||
*/
|
||||
|
||||
NSS_IMPLEMENT PRStatus
|
||||
nssPointerTracker_verify
|
||||
(
|
||||
nssPointerTracker *tracker,
|
||||
const void *pointer
|
||||
)
|
||||
{
|
||||
void *check;
|
||||
|
||||
if( (nssPointerTracker *)NULL == tracker ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
if( (PZLock *)NULL == tracker->lock ) {
|
||||
nss_SetError(NSS_ERROR_TRACKER_NOT_INITIALIZED);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PZ_Lock(tracker->lock);
|
||||
|
||||
if( (PLHashTable *)NULL == tracker->table ) {
|
||||
PZ_Unlock(tracker->lock);
|
||||
nss_SetError(NSS_ERROR_TRACKER_NOT_INITIALIZED);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
check = PL_HashTableLookup(tracker->table, pointer);
|
||||
PZ_Unlock(tracker->lock);
|
||||
|
||||
if( (void *)NULL == check ) {
|
||||
nss_SetError(NSS_ERROR_POINTER_NOT_REGISTERED);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: utf8.c,v $ $Revision: 1.5.44.1 $ $Date: 2002-08-26 15:52:27 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: utf8.c,v $ $Revision: 1.5.44.2 $ $Date: 2002-09-05 22:49:31 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -78,17 +78,6 @@ nssUTF8_CaseIgnoreMatch
|
||||
PRStatus *statusOpt
|
||||
)
|
||||
{
|
||||
#ifdef NSSDEBUG
|
||||
if( ((const NSSUTF8 *)NULL == a) ||
|
||||
((const NSSUTF8 *)NULL == b) ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
if( (PRStatus *)NULL != statusOpt ) {
|
||||
*statusOpt = PR_FAILURE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
if( (PRStatus *)NULL != statusOpt ) {
|
||||
*statusOpt = PR_SUCCESS;
|
||||
}
|
||||
@@ -138,17 +127,6 @@ nssUTF8_PrintableMatch
|
||||
PRUint8 *c;
|
||||
PRUint8 *d;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( ((const NSSUTF8 *)NULL == a) ||
|
||||
((const NSSUTF8 *)NULL == b) ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
if( (PRStatus *)NULL != statusOpt ) {
|
||||
*statusOpt = PR_FAILURE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
if( (PRStatus *)NULL != statusOpt ) {
|
||||
*statusOpt = PR_SUCCESS;
|
||||
}
|
||||
@@ -243,19 +221,6 @@ nssUTF8_Duplicate
|
||||
NSSUTF8 *rv;
|
||||
PRUint32 len;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( (const NSSUTF8 *)NULL == s ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
len = PL_strlen((const char *)s);
|
||||
#ifdef PEDANTIC
|
||||
if( '\0' != ((const char *)s)[ len ] ) {
|
||||
@@ -310,16 +275,6 @@ nssUTF8_Size
|
||||
{
|
||||
PRUint32 sv;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( (const NSSUTF8 *)NULL == s ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
if( (PRStatus *)NULL != statusOpt ) {
|
||||
*statusOpt = PR_FAILURE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
sv = PL_strlen((const char *)s) + 1;
|
||||
#ifdef PEDANTIC
|
||||
if( '\0' != ((const char *)s)[ sv-1 ] ) {
|
||||
@@ -366,13 +321,6 @@ nssUTF8_Length
|
||||
PRUint32 l = 0;
|
||||
const PRUint8 *c = (const PRUint8 *)s;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( (const NSSUTF8 *)NULL == s ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
goto loser;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
/*
|
||||
* From RFC 2044:
|
||||
*
|
||||
@@ -465,7 +413,6 @@ nssUTF8_Length
|
||||
* A non-null pointer to a new UTF8 string otherwise
|
||||
*/
|
||||
|
||||
extern const NSSError NSS_ERROR_INTERNAL_ERROR; /* XXX fgmr */
|
||||
|
||||
NSS_IMPLEMENT NSSUTF8 *
|
||||
nssUTF8_Create
|
||||
@@ -478,19 +425,6 @@ nssUTF8_Create
|
||||
{
|
||||
NSSUTF8 *rv = NULL;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if( (const void *)NULL == inputString ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
switch( type ) {
|
||||
case nssStringType_DirectoryString:
|
||||
/* This is a composite type requiring BER */
|
||||
@@ -581,19 +515,6 @@ nssUTF8_GetEncoding
|
||||
NSSItem *rv = (NSSItem *)NULL;
|
||||
PRStatus status = PR_SUCCESS;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSItem *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if( (NSSUTF8 *)NULL == string ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return (NSSItem *)NULL;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
switch( type ) {
|
||||
case nssStringType_DirectoryString:
|
||||
nss_SetError(NSS_ERROR_INTERNAL_ERROR); /* unimplemented */
|
||||
@@ -671,23 +592,6 @@ nssUTF8_CopyIntoFixedBuffer
|
||||
{
|
||||
PRUint32 stringSize = 0;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( (char *)NULL == buffer ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if( 0 == bufferSize ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_ARGUMENT);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if( (pad & 0x80) != 0x00 ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_ARGUMENT);
|
||||
return PR_FALSE;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
if( (NSSUTF8 *)NULL == string ) {
|
||||
string = (NSSUTF8 *) "";
|
||||
}
|
||||
@@ -740,17 +644,6 @@ nssUTF8_Equal
|
||||
{
|
||||
PRUint32 la, lb;
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( ((const NSSUTF8 *)NULL == a) ||
|
||||
((const NSSUTF8 *)NULL == b) ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_POINTER);
|
||||
if( (PRStatus *)NULL != statusOpt ) {
|
||||
*statusOpt = PR_FAILURE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
la = nssUTF8_Size(a, statusOpt);
|
||||
if( 0 == la ) {
|
||||
return PR_FALSE;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.29.2.1 $ $Date: 2002-08-26 15:57:54 $ $Name: not supported by cvs2svn $";
|
||||
static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.29.2.2 $ $Date: 2002-09-05 22:49:34 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef NSSCKT_H
|
||||
@@ -326,8 +326,6 @@ nssSlot_Login
|
||||
NSSSlot *slot,
|
||||
NSSCallback *pwcb
|
||||
);
|
||||
extern const NSSError NSS_ERROR_INVALID_PASSWORD;
|
||||
extern const NSSError NSS_ERROR_USER_CANCELED;
|
||||
|
||||
NSS_EXTERN PRStatus
|
||||
nssSlot_Logout
|
||||
@@ -867,9 +865,6 @@ nssToken_SignRecover
|
||||
NSSArena *arenaOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_SIGNATURE;
|
||||
extern const NSSError NSS_ERROR_INVALID_DATA;
|
||||
extern const NSSError NSS_ERROR_TOKEN_FAILURE;
|
||||
|
||||
NSS_EXTERN PRStatus
|
||||
nssToken_Verify
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: asymmkey.c,v $ $Revision: 1.3.44.2 $ $Date: 2002-08-27 23:07:06 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: asymmkey.c,v $ $Revision: 1.3.44.3 $ $Date: 2002-09-05 22:49:38 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef BASE_H
|
||||
@@ -47,7 +47,6 @@ static const char CVS_ID[] = "@(#) $RCSfile: asymmkey.c,v $ $Revision: 1.3.44.2
|
||||
#include "pkim.h"
|
||||
#endif /* PKIM_H */
|
||||
|
||||
extern const NSSError NSS_ERROR_NOT_FOUND;
|
||||
|
||||
#ifdef nodef
|
||||
typedef union
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.38.2.3 $ $Date: 2002-08-27 23:07:07 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.38.2.4 $ $Date: 2002-09-05 22:49:38 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef BASE_H
|
||||
@@ -75,7 +75,6 @@ struct NSSCertificateStr
|
||||
nssCertDecoding decoding;
|
||||
};
|
||||
|
||||
extern const NSSError NSS_ERROR_NOT_FOUND;
|
||||
|
||||
NSS_EXTERN NSSCertificateMethods *
|
||||
nss_GetMethodsForType
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: cryptocontext.c,v $ $Revision: 1.10.18.2 $ $Date: 2002-08-27 23:07:08 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: cryptocontext.c,v $ $Revision: 1.10.18.3 $ $Date: 2002-09-05 22:49:39 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef DEV_H
|
||||
@@ -68,7 +68,6 @@ struct NSSCryptoContextStr
|
||||
NSSCertificate *cert;
|
||||
};
|
||||
|
||||
extern const NSSError NSS_ERROR_NOT_FOUND;
|
||||
|
||||
NSS_IMPLEMENT NSSCryptoContext *
|
||||
nssCryptoContext_Create
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define NSSPKI_H
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char NSSPKI_CVS_ID[] = "@(#) $RCSfile: nsspki.h,v $ $Revision: 1.7.44.3 $ $Date: 2002-08-28 15:42:21 $ $Name: not supported by cvs2svn $";
|
||||
static const char NSSPKI_CVS_ID[] = "@(#) $RCSfile: nsspki.h,v $ $Revision: 1.7.44.4 $ $Date: 2002-09-05 22:49:41 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -235,7 +235,6 @@ NSSCertificate_Encode
|
||||
*
|
||||
*/
|
||||
|
||||
extern const NSSError NSS_ERROR_CERTIFICATE_ISSUER_NOT_FOUND;
|
||||
|
||||
NSS_EXTERN NSSCertificate **
|
||||
NSSCertificate_BuildChain
|
||||
@@ -2704,7 +2703,6 @@ NSSCryptoContext_FindSymmetricKeyByAlgorithmAndKeyID
|
||||
* of this crypto context.
|
||||
*/
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_CRYPTO_CONTEXT;
|
||||
|
||||
NSS_EXTERN NSSItem *
|
||||
NSSCryptoContext_Encrypt
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: symmkey.c,v $ $Revision: 1.3.44.1 $ $Date: 2002-08-26 16:02:18 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: symmkey.c,v $ $Revision: 1.3.44.2 $ $Date: 2002-09-05 22:49:42 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef DEV_H
|
||||
@@ -43,7 +43,6 @@ static const char CVS_ID[] = "@(#) $RCSfile: symmkey.c,v $ $Revision: 1.3.44.1 $
|
||||
#include "pkim.h"
|
||||
#endif /* PKIM_H */
|
||||
|
||||
extern const NSSError NSS_ERROR_NOT_FOUND;
|
||||
|
||||
struct NSSSymmetricKeyStr
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: trustdomain.c,v $ $Revision: 1.42.16.3 $ $Date: 2002-08-27 23:07:12 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: trustdomain.c,v $ $Revision: 1.42.16.4 $ $Date: 2002-09-05 22:49:43 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef DEV_H
|
||||
@@ -63,7 +63,6 @@ struct NSSTrustDomainStr {
|
||||
#endif /* CERT_CACHE */
|
||||
};
|
||||
|
||||
extern const NSSError NSS_ERROR_NOT_FOUND;
|
||||
|
||||
NSS_IMPLEMENT NSSTrustDomain *
|
||||
NSSTrustDomain_Create
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: atav.c,v $ $Revision: 1.6 $ $Date: 2002-02-19 02:06:25 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: atav.c,v $ $Revision: 1.6.40.1 $ $Date: 2002-09-05 22:49:47 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -570,7 +570,6 @@ NSSATAV_Duplicate
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
extern const NSSError NSS_ERROR_INTERNAL_ERROR;
|
||||
|
||||
static nssPointerTracker atav_pointer_tracker;
|
||||
|
||||
@@ -1008,7 +1007,6 @@ nss_atav_fromhex
|
||||
* A pointer to an NSSATAV upon success
|
||||
*/
|
||||
|
||||
extern const NSSError NSS_ERROR_INTERNAL_ERROR;
|
||||
|
||||
NSS_IMPLEMENT NSSATAV *
|
||||
nssATAV_CreateFromUTF8
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define NSSPKI1_H
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char NSSPKI1_CVS_ID[] = "@(#) $RCSfile: nsspki1.h,v $ $Revision: 1.1.192.2 $ $Date: 2002-08-28 16:20:29 $ $Name: not supported by cvs2svn $";
|
||||
static const char NSSPKI1_CVS_ID[] = "@(#) $RCSfile: nsspki1.h,v $ $Revision: 1.1.192.3 $ $Date: 2002-09-05 22:49:47 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -115,8 +115,6 @@ NSSOID_CreateFromBER
|
||||
NSSBER *berOid
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_BER;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSOID_CreateFromUTF8
|
||||
@@ -141,8 +139,6 @@ NSSOID_CreateFromUTF8
|
||||
NSSUTF8 *stringOid
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_STRING;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSOID_GetDEREncoding
|
||||
@@ -170,8 +166,6 @@ NSSOID_GetDEREncoding
|
||||
NSSArena *arenaOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_NSSOID;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSOID_GetUTF8Encoding
|
||||
@@ -200,8 +194,6 @@ NSSOID_GetUTF8Encoding
|
||||
NSSArena *arenaOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_NSSOID;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSOID_GetAlgorithmAndParameters
|
||||
@@ -259,8 +251,6 @@ NSSATAV_CreateFromBER
|
||||
NSSBER *derATAV
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_BER;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSATAV_CreateFromUTF8
|
||||
@@ -289,9 +279,6 @@ NSSATAV_CreateFromUTF8
|
||||
NSSUTF8 *stringATAV
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_UNKNOWN_ATTRIBUTE;
|
||||
extern const NSSError NSS_ERROR_INVALID_STRING;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSATAV_Create
|
||||
@@ -324,10 +311,6 @@ NSSATAV_Create
|
||||
PRUint32 length
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ARENA;
|
||||
extern const NSSError NSS_ERROR_INVALID_NSSOID;
|
||||
extern const NSSError NSS_ERROR_INVALID_POINTER;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSATAV_Destroy
|
||||
@@ -353,7 +336,6 @@ NSSATAV_Destroy
|
||||
NSSATAV *atav
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ATAV;
|
||||
|
||||
/*
|
||||
* NSSATAV_GetDEREncoding
|
||||
@@ -380,8 +362,6 @@ NSSATAV_GetDEREncoding
|
||||
NSSArena *arenaOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ATAV;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSATAV_GetUTF8Encoding
|
||||
@@ -410,8 +390,6 @@ NSSATAV_GetUTF8Encoding
|
||||
NSSArena *arenaOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ATAV;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSATAV_GetType
|
||||
@@ -434,7 +412,6 @@ NSSATAV_GetType
|
||||
NSSATAV *atav
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ATAV;
|
||||
|
||||
/*
|
||||
* NSSATAV_GetValue
|
||||
@@ -461,8 +438,6 @@ NSSATAV_GetValue
|
||||
NSSArena *arenaOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ATAV;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSATAV_Compare
|
||||
@@ -492,8 +467,6 @@ NSSATAV_Compare
|
||||
PRBool *equalp
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ATAV;
|
||||
extern const NSSError NSS_ERROR_INVALID_ARGUMENT;
|
||||
|
||||
/*
|
||||
* NSSATAV_Duplicate
|
||||
@@ -520,8 +493,6 @@ NSSATAV_Duplicate
|
||||
NSSArena *arenaOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_ATAV;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* NSSRDN
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: oid.c,v $ $Revision: 1.4.44.2 $ $Date: 2002-08-28 16:20:30 $ $Name: not supported by cvs2svn $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: oid.c,v $ $Revision: 1.4.44.3 $ $Date: 2002-09-05 22:49:48 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -75,7 +75,6 @@ static const char CVS_ID[] = "@(#) $RCSfile: oid.c,v $ $Revision: 1.4.44.2 $ $Da
|
||||
*
|
||||
* In debug builds, the following non-public calls are also available:
|
||||
*
|
||||
* nssOID_verifyPointer
|
||||
* nssOID_getExplanation
|
||||
* nssOID_getTaggedUTF8
|
||||
*/
|
||||
@@ -266,18 +265,6 @@ NSSOID_GetDEREncoding
|
||||
{
|
||||
nss_ClearErrorStack();
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssOID_verifyPointer(oid) ) {
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return nssOID_GetDEREncoding(oid, rvOpt, arenaOpt);
|
||||
}
|
||||
|
||||
@@ -310,18 +297,6 @@ NSSOID_GetUTF8Encoding
|
||||
{
|
||||
nss_ClearErrorStack();
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != nssOID_verifyPointer(oid) ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return nssOID_GetUTF8Encoding(oid, arenaOpt);
|
||||
}
|
||||
|
||||
@@ -403,67 +378,6 @@ oid_hash_compare
|
||||
return (PRIntn)nssItem_Equal(i1, i2, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* The pointer-tracking code
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
extern const NSSError NSS_ERROR_INTERNAL_ERROR;
|
||||
|
||||
static nssPointerTracker oid_pointer_tracker;
|
||||
|
||||
static PRStatus
|
||||
oid_add_pointer
|
||||
(
|
||||
const NSSOID *oid
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_initialize(&oid_pointer_tracker);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = nssPointerTracker_add(&oid_pointer_tracker, oid);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
NSSError e = NSS_GetError();
|
||||
if( NSS_ERROR_NO_MEMORY != e ) {
|
||||
nss_SetError(NSS_ERROR_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined(CAN_DELETE_OIDS)
|
||||
/*
|
||||
* We actually don't define NSSOID deletion, since we keep OIDs
|
||||
* in a hash table for easy comparison. Were we to, this is
|
||||
* what the pointer-removal function would look like.
|
||||
*/
|
||||
|
||||
static PRStatus
|
||||
oid_remove_pointer
|
||||
(
|
||||
const NSSOID *oid
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = nssPointerTracker_remove(&oid_pointer_tracker, oid);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
nss_SetError(NSS_ERROR_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
#endif /* CAN_DELETE_OIDS */
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* All dynamically-added OIDs get their memory from one statically-
|
||||
* declared arena here, merely so that any cleanup code will have
|
||||
@@ -517,12 +431,6 @@ oid_once_func
|
||||
nss_SetError(NSS_ERROR_NO_MEMORY);
|
||||
goto loser;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if( PR_SUCCESS != oid_add_pointer(oid) ) {
|
||||
goto loser;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
@@ -566,54 +474,6 @@ oid_init
|
||||
return PR_CallOnce(&oid_call_once, oid_once_func);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
/*
|
||||
* nssOID_verifyPointer
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* If the specified pointer is a valid pointer to an NSSOID object,
|
||||
* this routine will return PR_SUCCESS. Otherwise, it will put an
|
||||
* error on the error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_NSSOID
|
||||
* NSS_ERROR_NO_MEMORY
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS if the pointer is valid
|
||||
* PR_FAILURE if it isn't
|
||||
*/
|
||||
|
||||
NSS_EXTERN PRStatus
|
||||
nssOID_verifyPointer
|
||||
(
|
||||
const NSSOID *oid
|
||||
)
|
||||
{
|
||||
PRStatus rv;
|
||||
|
||||
rv = oid_init();
|
||||
if( PR_SUCCESS != rv ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
rv = nssPointerTracker_initialize(&oid_pointer_tracker);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
rv = nssPointerTracker_verify(&oid_pointer_tracker, oid);
|
||||
if( PR_SUCCESS != rv ) {
|
||||
nss_SetError(NSS_ERROR_INVALID_NSSOID);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* oid_sanity_check_ber
|
||||
*
|
||||
@@ -767,21 +627,6 @@ nssOID_CreateFromBER
|
||||
return (NSSOID *)NULL;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
PRStatus st;
|
||||
st = oid_add_pointer(rv);
|
||||
if( PR_SUCCESS != st ) {
|
||||
PZ_Lock(oid_hash_lock);
|
||||
(void)PL_HashTableRemove(oid_hash_table, &rv->data);
|
||||
(void)PZ_Unlock(oid_hash_lock);
|
||||
(void)nss_ZFreeIf(rv->data.data);
|
||||
(void)nss_ZFreeIf(rv);
|
||||
return (NSSOID *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1024,7 +869,6 @@ oid_encode_huge
|
||||
* one. It assumes we've already sanity-checked the string.
|
||||
*/
|
||||
|
||||
extern const NSSError NSS_ERROR_INTERNAL_ERROR;
|
||||
|
||||
static NSSOID *
|
||||
oid_encode_string
|
||||
@@ -1236,19 +1080,6 @@ nssOID_CreateFromUTF8
|
||||
goto loser;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
PRStatus st;
|
||||
st = oid_add_pointer(rv);
|
||||
if( PR_SUCCESS != st ) {
|
||||
PZ_Lock(oid_hash_lock);
|
||||
(void)PL_HashTableRemove(oid_hash_table, &rv->data);
|
||||
(void)PZ_Unlock(oid_hash_lock);
|
||||
goto loser;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
return rv;
|
||||
|
||||
loser:
|
||||
@@ -1298,18 +1129,6 @@ nssOID_GetDEREncoding
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssOID_verifyPointer(oid) ) {
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSDER *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
it = &oid->data;
|
||||
|
||||
if( (NSSDER *)NULL == rvOpt ) {
|
||||
@@ -1374,18 +1193,6 @@ nssOID_GetUTF8Encoding
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssOID_verifyPointer(oid) ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
a = (char *)NULL;
|
||||
|
||||
/* d will point to the next sequence of bytes to decode */
|
||||
@@ -1524,16 +1331,9 @@ nssOID_getExplanation
|
||||
return (const NSSUTF8 *)NULL;
|
||||
}
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssOID_verifyPointer(oid) ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
return oid->expl;
|
||||
}
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_NSSOID;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -1582,18 +1382,6 @@ nssOID_getTaggedUTF8
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
|
||||
#ifdef NSSDEBUG
|
||||
if( PR_SUCCESS != nssOID_verifyPointer(oid) ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
|
||||
if( (NSSArena *)NULL != arenaOpt ) {
|
||||
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
|
||||
return (NSSUTF8 *)NULL;
|
||||
}
|
||||
}
|
||||
#endif /* NSSDEBUG */
|
||||
|
||||
a = PR_smprintf("{");
|
||||
if( (char *)NULL == a ) {
|
||||
nss_SetError(NSS_ERROR_NO_MEMORY);
|
||||
@@ -1681,6 +1469,4 @@ nssOID_getTaggedUTF8
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_NSSOID;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
#endif /* DEBUG */
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define PKI1_H
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char PKI1_CVS_ID[] = "@(#) $RCSfile: pki1.h,v $ $Revision: 1.2.50.1 $ $Date: 2002-08-26 16:21:26 $ $Name: not supported by cvs2svn $";
|
||||
static const char PKI1_CVS_ID[] = "@(#) $RCSfile: pki1.h,v $ $Revision: 1.2.50.2 $ $Date: 2002-09-05 22:49:50 $ $Name: not supported by cvs2svn $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -73,7 +73,6 @@ extern const PRUint32 nss_attribute_type_alias_count;
|
||||
*
|
||||
* In debug builds, the following non-public calls are also available:
|
||||
*
|
||||
* nssOID_verifyPointer
|
||||
* nssOID_getExplanation
|
||||
* nssOID_getTaggedUTF8
|
||||
*/
|
||||
@@ -106,8 +105,6 @@ nssOID_CreateFromBER
|
||||
NSSBER *berOid
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_BER;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* nssOID_CreateFromUTF8
|
||||
@@ -133,8 +130,6 @@ nssOID_CreateFromUTF8
|
||||
NSSUTF8 *stringOid
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_UTF8;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
|
||||
/*
|
||||
* nssOID_GetDEREncoding
|
||||
@@ -189,33 +184,6 @@ nssOID_GetUTF8Encoding
|
||||
NSSArena *arenaOpt
|
||||
);
|
||||
|
||||
/*
|
||||
* nssOID_verifyPointer
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* If the specified pointer is a valid poitner to an NSSOID object,
|
||||
* this routine will return PR_SUCCESS. Otherwise, it will put an
|
||||
* error on the error stack and return PR_FAILURE.
|
||||
*
|
||||
* The error may be one of the following values:
|
||||
* NSS_ERROR_INVALID_NSSOID
|
||||
*
|
||||
* Return value:
|
||||
* PR_SUCCESS if the pointer is valid
|
||||
* PR_FAILURE if it isn't
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
NSS_EXTERN PRStatus
|
||||
nssOID_verifyPointer
|
||||
(
|
||||
const NSSOID *oid
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_NSSOID;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* nssOID_getExplanation
|
||||
*
|
||||
@@ -247,7 +215,6 @@ nssOID_getExplanation
|
||||
NSSOID *oid
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_NSSOID;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -284,8 +251,6 @@ nssOID_getTaggedUTF8
|
||||
NSSArena *arenaOpt
|
||||
);
|
||||
|
||||
extern const NSSError NSS_ERROR_INVALID_NSSOID;
|
||||
extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
@@ -307,7 +272,6 @@ extern const NSSError NSS_ERROR_NO_MEMORY;
|
||||
*
|
||||
* In debug builds, the following non-public call is also available:
|
||||
*
|
||||
* nssATAV_verifyPointer
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -572,8 +536,6 @@ nssATAV_Duplicate
|
||||
);
|
||||
|
||||
/*
|
||||
* nssATAV_verifyPointer
|
||||
*
|
||||
* This method is only present in debug builds.
|
||||
*
|
||||
* If the specified pointer is a valid pointer to an NSSATAV object,
|
||||
@@ -589,14 +551,6 @@ nssATAV_Duplicate
|
||||
* PR_FAILURE if it isn't
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
NSS_EXTERN PRStatus
|
||||
nssATAV_verifyPointer
|
||||
(
|
||||
NSSATAV *atav
|
||||
);
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* NSSRDN
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user