diff options
author | julien.pierre.boogz%sun.com <devnull@localhost> | 2007-11-07 22:36:10 +0000 |
---|---|---|
committer | julien.pierre.boogz%sun.com <devnull@localhost> | 2007-11-07 22:36:10 +0000 |
commit | 58f734b06535cec37465073fd7f4eef27e25df4c (patch) | |
tree | ff4d5333a1c3092b8d568feff57a5b8b14e5cdb1 | |
parent | 6c7792b9c6fe09a3cc5f6fa72f820304561a9cfb (diff) | |
download | nss-hg-58f734b06535cec37465073fd7f4eef27e25df4c.tar.gz |
Fix for bug 396653. Get rid of lib/asn1 which is unused. r=nelson, rrelyea
-rw-r--r-- | security/nss/lib/asn1/Makefile | 44 | ||||
-rw-r--r-- | security/nss/lib/asn1/asn1.c | 1730 | ||||
-rw-r--r-- | security/nss/lib/asn1/asn1.h | 882 | ||||
-rw-r--r-- | security/nss/lib/asn1/asn1m.h | 83 | ||||
-rw-r--r-- | security/nss/lib/asn1/asn1t.h | 169 | ||||
-rw-r--r-- | security/nss/lib/asn1/config.mk | 52 | ||||
-rw-r--r-- | security/nss/lib/asn1/manifest.mn | 59 | ||||
-rw-r--r-- | security/nss/lib/asn1/nssasn1t.h | 70 | ||||
-rw-r--r-- | security/nss/lib/manifest.mn | 4 |
9 files changed, 2 insertions, 3091 deletions
diff --git a/security/nss/lib/asn1/Makefile b/security/nss/lib/asn1/Makefile deleted file mode 100644 index 2d25c00f2..000000000 --- a/security/nss/lib/asn1/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# 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 the Initial Developer are Copyright (C) 1994-2000 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** -MAKEFILE_CVS_ID = "@(#) $RCSfile$ $Revision$ $Date$" - -include manifest.mn -include $(CORE_DEPTH)/coreconf/config.mk -include config.mk -include $(CORE_DEPTH)/coreconf/rules.mk - -export:: private_export diff --git a/security/nss/lib/asn1/asn1.c b/security/nss/lib/asn1/asn1.c deleted file mode 100644 index fda5bd71a..000000000 --- a/security/nss/lib/asn1/asn1.c +++ /dev/null @@ -1,1730 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * 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 the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifdef DEBUG -static const char CVS_ID[] = "@(#) $RCSfile$ $Revision$ $Date$"; -#endif /* DEBUG */ - -/* - * asn1.c - * - * At this point in time, this file contains the NSS wrappers for - * the old "SEC" ASN.1 encoder/decoder stuff. - */ - -#ifndef ASN1M_H -#include "asn1m.h" -#endif /* ASN1M_H */ - -#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 - * - * This routine creates an ASN.1 Decoder, which will use the specified - * template to decode a datastream into the specified destination - * structure. If the optional arena argument is non-NULL, blah blah - * blah. XXX fgmr Should we include an nssASN1EncodingType argument, - * as a hint? Or is each encoding distinctive? This routine may - * return NULL upon error, in which case an error will have been - * placed upon the error stack. - * - * The error may be one of the following values: - * NSS_ERROR_NO_MEMORY - * NSS_ERROR_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * ... - * - * Return value: - * NULL upon error - * A pointer to an ASN.1 Decoder upon success. - */ - -NSS_IMPLEMENT nssASN1Decoder * -nssASN1Decoder_Create -( - NSSArena *arenaOpt, - void *destination, - const nssASN1Template template[] -) -{ - SEC_ASN1DecoderContext *rv; - PLArenaPool *hack = (PLArenaPool *)arenaOpt; - -#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(hack, destination, template); - if( (SEC_ASN1DecoderContext *)NULL == rv ) { - nss_SetError(PORT_GetError()); /* also evil */ - return (nssASN1Decoder *)NULL; - } - -#ifdef DEBUG - if( PR_SUCCESS != decoder_add_pointer(rv) ) { - (void)SEC_ASN1DecoderFinish(rv); - return (nssASN1Decoder *)NULL; - } -#endif /* DEBUG */ - - return (nssASN1Decoder *)rv; -} - -/* - * nssASN1Decoder_Update - * - * This routine feeds data to the decoder. In the event of an error, - * it will place 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_INVALID_POINTER - * NSS_ERROR_INVALID_ASN1DECODER - * NSS_ERROR_INVALID_BER - * ... - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success. - */ - -NSS_IMPLEMENT PRStatus -nssASN1Decoder_Update -( - nssASN1Decoder *decoder, - const void *data, - PRUint32 amount -) -{ - 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); - if( SECSuccess != rv ) { - nss_SetError(PORT_GetError()); /* ugly */ - return PR_FAILURE; - } - - return PR_SUCCESS; -} - -/* - * nssASN1Decoder_Finish - * - * This routine finishes the decoding and destroys the decoder. - * In the event of an error, it will place 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_Finish -( - nssASN1Decoder *decoder -) -{ - 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 ) { - nss_SetError(PORT_GetError()); /* ugly */ - rv = PR_FAILURE; - } - -#ifdef DEBUG - { - PRStatus rv2 = decoder_remove_pointer(decoder); - if( PR_SUCCESS == rv ) { - rv = rv2; - } - } -#endif /* DEBUG */ - - return rv; -} - -/* - * nssASN1Decoder_SetFilter - * - * This routine registers a callback filter routine with the decoder, - * which will be called blah blah blah. The specified argument will - * be passed as-is to the filter routine. The routine pointer may - * be NULL, in which case no filter callback will be called. If the - * noStore boolean is PR_TRUE, then decoded fields will not be stored - * in the destination structure specified when the decoder was - * created. This routine returns a PRStatus value; in the event of - * an error, it will place 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_SetFilter -( - nssASN1Decoder *decoder, - nssASN1DecoderFilterFunction *callback, - void *argument, - PRBool noStore -) -{ -#ifdef DEBUG - if( PR_SUCCESS != nssASN1Decoder_verify(decoder) ) { - return PR_FAILURE; - } -#endif /* DEBUG */ - - if( (nssASN1DecoderFilterFunction *)NULL == callback ) { - SEC_ASN1DecoderClearFilterProc((SEC_ASN1DecoderContext *)decoder); - } else { - SEC_ASN1DecoderSetFilterProc((SEC_ASN1DecoderContext *)decoder, - (SEC_ASN1WriteProc)callback, - argument, noStore); - } - - /* No error returns defined for those routines */ - - return PR_SUCCESS; -} - -/* - * nssASN1Decoder_GetFilter - * - * If the optional pCallbackOpt argument to this routine is non-null, - * then the pointer to any callback function established for this - * decoder with nssASN1Decoder_SetFilter will be stored at the - * location indicated by it. If the optional pArgumentOpt - * pointer is non-null, the filter's closure argument will be stored - * there. If the optional pNoStoreOpt pointer is non-null, the - * noStore value specified when setting the filter will be stored - * there. This routine returns a PRStatus value; in the event of - * an error it will place 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 - */ - -extern const NSSError NSS_ERROR_INTERNAL_ERROR; - -NSS_IMPLEMENT PRStatus -nssASN1Decoder_GetFilter -( - nssASN1Decoder *decoder, - nssASN1DecoderFilterFunction **pCallbackOpt, - void **pArgumentOpt, - PRBool *pNoStoreOpt -) -{ -#ifdef DEBUG - if( PR_SUCCESS != nssASN1Decoder_verify(decoder) ) { - return PR_FAILURE; - } -#endif /* DEBUG */ - - if( (nssASN1DecoderFilterFunction **)NULL != pCallbackOpt ) { - *pCallbackOpt = (nssASN1DecoderFilterFunction *)NULL; - } - - if( (void **)NULL != pArgumentOpt ) { - *pArgumentOpt = (void *)NULL; - } - - if( (PRBool *)NULL != pNoStoreOpt ) { - *pNoStoreOpt = PR_FALSE; - } - - /* Error because it's unimplemented */ - nss_SetError(NSS_ERROR_INTERNAL_ERROR); - return PR_FAILURE; -} - -/* - * nssASN1Decoder_SetNotify - * - * This routine registers a callback notify routine with the decoder, - * which will be called whenever.. The specified argument will be - * passed as-is to the notify routine. The routine pointer may be - * NULL, in which case no notify routine will be called. This routine - * returns a PRStatus value; in the event of an error it will place - * 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_SetNotify -( - nssASN1Decoder *decoder, - nssASN1NotifyFunction *callback, - 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 { - SEC_ASN1DecoderSetNotifyProc((SEC_ASN1DecoderContext *)decoder, - (SEC_ASN1NotifyProc)callback, - argument); - } - - /* No error returns defined for those routines */ - - return PR_SUCCESS; -} - -/* - * nssASN1Decoder_GetNotify - * - * If the optional pCallbackOpt argument to this routine is non-null, - * then the pointer to any callback function established for this - * decoder with nssASN1Decoder_SetNotify will be stored at the - * location indicated by it. If the optional pArgumentOpt pointer is - * non-null, the filter's closure argument will be stored there. - * This routine returns a PRStatus value; in the event of an error it - * will place 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_GetNotify -( - nssASN1Decoder *decoder, - nssASN1NotifyFunction **pCallbackOpt, - void **pArgumentOpt -) -{ -#ifdef DEBUG - if( PR_SUCCESS != nssASN1Decoder_verify(decoder) ) { - return PR_FAILURE; - } -#endif /* DEBUG */ - - if( (nssASN1NotifyFunction **)NULL != pCallbackOpt ) { - *pCallbackOpt = (nssASN1NotifyFunction *)NULL; - } - - if( (void **)NULL != pArgumentOpt ) { - *pArgumentOpt = (void *)NULL; - } - - /* Error because it's unimplemented */ - nss_SetError(NSS_ERROR_INTERNAL_ERROR); - return PR_FAILURE; -} - -/* - * nssASN1_Decode - * - * This routine will decode the specified data into the specified - * destination structure, as specified by the specified template. - * This routine returns a PRStatus value; in the event of an error - * it will place 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_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * NSS_ERROR_INVALID_BER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_IMPLEMENT PRStatus -nssASN1_Decode -( - NSSArena *arenaOpt, - void *destination, - const nssASN1Template template[], - const void *berData, - PRUint32 amount -) -{ - PRStatus rv; - nssASN1Decoder *decoder; - - /* This call will do our pointer-checking for us! */ - decoder = nssASN1Decoder_Create(arenaOpt, destination, template); - if( (nssASN1Decoder *)NULL == decoder ) { - return PR_FAILURE; - } - - rv = nssASN1Decoder_Update(decoder, berData, amount); - if( PR_SUCCESS != nssASN1Decoder_Finish(decoder) ) { - rv = PR_FAILURE; - } - - return rv; -} - -/* - * nssASN1_DecodeBER - * - * This routine will decode the data in the specified NSSBER - * into the destination structure, as specified by the template. - * This routine returns a PRStatus value; in the event of an error - * it will place 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_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * NSS_ERROR_INVALID_NSSBER - * NSS_ERROR_INVALID_BER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_IMPLEMENT PRStatus -nssASN1_DecodeBER -( - NSSArena *arenaOpt, - void *destination, - const nssASN1Template template[], - const NSSBER *data -) -{ - return nssASN1_Decode(arenaOpt, destination, template, - data->data, data->size); -} - -/* - * nssASN1Encoder_Create - * - * This routine creates an ASN.1 Encoder, blah blah blah. This - * may return NULL upon error, in which case an error will have been - * placed on the error stack. - * - * The error may be one of the following values: - * NSS_ERROR_NO_MEMORY - * NSS_ERROR_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * ... - * - * Return value: - * NULL upon error - * A pointer to an ASN.1 Encoder upon success - */ - -NSS_IMPLEMENT nssASN1Encoder * -nssASN1Encoder_Create -( - const void *source, - const nssASN1Template template[], - NSSASN1EncodingType encoding, - nssASN1EncoderWriteFunction *sink, - void *argument -) -{ - 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 */ - - switch( encoding ) { - case NSSASN1BER: - case NSSASN1DER: - break; - case NSSASN1CER: - case NSSASN1LWER: - case NSSASN1PER: - case NSSASN1UnknownEncoding: - default: - nss_SetError(NSS_ERROR_ENCODING_NOT_SUPPORTED); - return (nssASN1Encoder *)NULL; - } - - rv = SEC_ASN1EncoderStart((void *)source, template, - (SEC_ASN1WriteProc)sink, argument); - if( (SEC_ASN1EncoderContext *)NULL == rv ) { - nss_SetError(PORT_GetError()); /* ugly */ - return (nssASN1Encoder *)NULL; - } - - if( NSSASN1DER == encoding ) { - sec_ASN1EncoderSetDER(rv); - } - -#ifdef DEBUG - if( PR_SUCCESS != encoder_add_pointer(rv) ) { - (void)SEC_ASN1EncoderFinish(rv); - return (nssASN1Encoder *)NULL; - } -#endif /* DEBUG */ - - return (nssASN1Encoder *)rv; -} - -/* - * nssASN1Encoder_Update - * - * The error may be one of the following values: - * NSS_ERROR_INVALID_ASN1ENCODER - * NSS_ERROR_INVALID_POINTER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_IMPLEMENT PRStatus -nssASN1Encoder_Update -( - nssASN1Encoder *encoder, - const void *data, - PRUint32 length -) -{ - 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); - if( SECSuccess != rv ) { - nss_SetError(PORT_GetError()); /* ugly */ - return PR_FAILURE; - } - - return PR_SUCCESS; -} - -/* - * nssASN1Encoder_Finish - * - * Destructor. - * - * 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_Finish -( - nssASN1Encoder *encoder -) -{ - 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; -} - -/* - * nssASN1Encoder_SetNotify - * - * This routine registers a callback notify routine with the encoder, - * which will be called whenever.. The specified argument will be - * passed as-is to the notify routine. The routine pointer may be - * NULL, in which case no notify routine will be called. This routine - * returns a PRStatus value; in the event of an error it will place - * 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 -nssASN1Encoder_SetNotify -( - nssASN1Encoder *encoder, - nssASN1NotifyFunction *callback, - 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 { - SEC_ASN1EncoderSetNotifyProc((SEC_ASN1EncoderContext *)encoder, - (SEC_ASN1NotifyProc)callback, - argument); - } - - /* no error return defined for those routines */ - - return PR_SUCCESS; -} - -/* - * nssASN1Encoder_GetNotify - * - * If the optional pCallbackOpt argument to this routine is non-null, - * then the pointer to any callback function established for this - * decoder with nssASN1Encoder_SetNotify will be stored at the - * location indicated by it. If the optional pArgumentOpt pointer is - * non-null, the filter's closure argument will be stored there. - * This routine returns a PRStatus value; in the event of an error it - * will place 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_GetNotify -( - nssASN1Encoder *encoder, - nssASN1NotifyFunction **pCallbackOpt, - void **pArgumentOpt -) -{ -#ifdef DEBUG - if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) { - return PR_FAILURE; - } -#endif /* DEBUG */ - - if( (nssASN1NotifyFunction **)NULL != pCallbackOpt ) { - *pCallbackOpt = (nssASN1NotifyFunction *)NULL; - } - - if( (void **)NULL != pArgumentOpt ) { - *pArgumentOpt = (void *)NULL; - } - - /* Error because it's unimplemented */ - nss_SetError(NSS_ERROR_INTERNAL_ERROR); - return PR_FAILURE; -} - -/* - * nssASN1Encoder_SetStreaming - * - * - * 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_SetStreaming -( - nssASN1Encoder *encoder, - PRBool streaming -) -{ - 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 { - SEC_ASN1EncoderClearStreaming(cx); - } - - /* no error return defined for those routines */ - - return PR_SUCCESS; -} - -/* - * nssASN1Encoder_GetStreaming - * - * - * The error may be one of the following values: - * NSS_ERROR_INVALID_ASN1ENCODER - * NSS_ERROR_INVALID_POINTER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_EXTERN PRStatus -nssASN1Encoder_GetStreaming -( - nssASN1Encoder *encoder, - PRBool *pStreaming -) -{ -#ifdef DEBUG - if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) { - return PR_FAILURE; - } -#endif /* DEBUG */ - - if( (PRBool *)NULL != pStreaming ) { - *pStreaming = PR_FALSE; - } - - /* Error because it's unimplemented */ - nss_SetError(NSS_ERROR_INTERNAL_ERROR); - return PR_FAILURE; -} - -/* - * nssASN1Encoder_SetTakeFromBuffer - * - * - * 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_SetTakeFromBuffer -( - nssASN1Encoder *encoder, - PRBool takeFromBuffer -) -{ - 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 { - SEC_ASN1EncoderClearTakeFromBuf(cx); - } - - /* no error return defined for those routines */ - - return PR_SUCCESS; -} - -/* - * nssASN1Encoder_GetTakeFromBuffer - * - * - * The error may be one of the following values: - * NSS_ERROR_INVALID_ASN1ENCODER - * NSS_ERROR_INVALID_POINTER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_IMPLEMENT PRStatus -nssASN1Encoder_GetTakeFromBuffer -( - nssASN1Encoder *encoder, - PRBool *pTakeFromBuffer -) -{ -#ifdef DEBUG - if( PR_SUCCESS != nssASN1Encoder_verify(encoder) ) { - return PR_FAILURE; - } -#endif /* DEBUG */ - - if( (PRBool *)NULL != pTakeFromBuffer ) { - *pTakeFromBuffer = PR_FALSE; - } - - /* Error because it's unimplemented */ - nss_SetError(NSS_ERROR_INTERNAL_ERROR); - return PR_FAILURE; -} - -/* - * nssASN1_Encode - * - * - * The error may be one of the following values: - * NSS_ERROR_NO_MEMORY - * NSS_ERROR_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * NSS_ERROR_ENCODING_NOT_SUPPORTED - * ... - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_IMPLEMENT PRStatus -nssASN1_Encode -( - const void *source, - const nssASN1Template template[], - NSSASN1EncodingType encoding, - nssASN1EncoderWriteFunction *sink, - void *argument -) -{ - PRStatus rv; - nssASN1Encoder *encoder; - - encoder = nssASN1Encoder_Create(source, template, encoding, sink, argument); - if( (nssASN1Encoder *)NULL == encoder ) { - return PR_FAILURE; - } - - rv = nssASN1Encoder_Update(encoder, (const void *)NULL, 0); - if( PR_SUCCESS != nssASN1Encoder_Finish(encoder) ) { - rv = PR_FAILURE; - } - - return rv; -} - -/* - * nssasn1_encode_item_count - * - * This is a helper function for nssASN1_EncodeItem. It just counts - * up the space required for an encoding. - */ - -static void -nssasn1_encode_item_count -( - void *arg, - const char *buf, - unsigned long len, - int depth, - nssASN1EncodingPart data_kind -) -{ - unsigned long *count; - - count = (unsigned long*)arg; - PR_ASSERT (count != NULL); - - *count += len; -} - -/* - * nssasn1_encode_item_store - * - * This is a helper function for nssASN1_EncodeItem. It appends the - * new data onto the destination item. - */ - -static void -nssasn1_encode_item_store -( - void *arg, - const char *buf, - unsigned long len, - int depth, - nssASN1EncodingPart data_kind -) -{ - NSSItem *dest; - - dest = (NSSItem*)arg; - PR_ASSERT (dest != NULL); - - memcpy((unsigned char *)dest->data + dest->size, buf, len); - dest->size += len; -} - -/* - * nssASN1_EncodeItem - * - * There must be a better name. If the optional arena argument is - * non-null, it'll be used for the space. If the optional rvOpt is - * non-null, it'll be the return value-- if it is null, a new one - * will be allocated. - * - * The error may be one of the following values: - * NSS_ERROR_NO_MEMORY - * NSS_ERROR_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * NSS_ERROR_ENCODING_NOT_SUPPORTED - * - * Return value: - * NULL upon error - * A valid pointer to an NSSDER upon success - */ - -NSS_IMPLEMENT NSSDER * -nssASN1_EncodeItem -( - NSSArena *arenaOpt, - NSSDER *rvOpt, - const void *source, - const nssASN1Template template[], - NSSASN1EncodingType encoding -) -{ - NSSDER *rv; - 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); - if( PR_SUCCESS != status ) { - return (NSSDER *)NULL; - } - - if( (NSSDER *)NULL == rvOpt ) { - rv = nss_ZNEW(arenaOpt, NSSDER); - if( (NSSDER *)NULL == rv ) { - return (NSSDER *)NULL; - } - } else { - rv = rvOpt; - } - - rv->size = len; - rv->data = nss_ZAlloc(arenaOpt, len); - if( (void *)NULL == rv->data ) { - if( (NSSDER *)NULL == rvOpt ) { - nss_ZFreeIf(rv); - } - return (NSSDER *)NULL; - } - - rv->size = 0; /* for nssasn1_encode_item_store */ - - status = nssASN1_Encode(source, template, encoding, - (nssASN1EncoderWriteFunction *)nssasn1_encode_item_store, - rv); - if( PR_SUCCESS != status ) { - nss_ZFreeIf(rv->data); - if( (NSSDER *)NULL == rvOpt ) { - nss_ZFreeIf(rv); - } - return (NSSDER *)NULL; - } - - PR_ASSERT(rv->size == len); - - return rv; -} - -/* - * nssASN1_CreatePRUint32FromBER - * - */ - -NSS_IMPLEMENT PRStatus -nssASN1_CreatePRUint32FromBER -( - NSSBER *encoded, - PRUint32 *pResult -) -{ - nss_SetError(NSS_ERROR_INTERNAL_ERROR); - return PR_FALSE; -} - -/* - * nssASN1_GetDERFromPRUint32 - * - */ - -NSS_EXTERN NSSDER * -nssASN1_GetDERFromPRUint32 -( - NSSArena *arenaOpt, - NSSDER *rvOpt, - PRUint32 value -) -{ - NSSDER *rv; - PLArenaPool *hack = (PLArenaPool *)arenaOpt; - SECItem *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 ) { - return (NSSDER *)NULL; - } - } else { - rv = rvOpt; - } - - item = SEC_ASN1EncodeUnsignedInteger(hack, (SECItem *)rv, value); - if( (SECItem *)NULL == item ) { - if( (NSSDER *)NULL == rvOpt ) { - (void)nss_ZFreeIf(rv); - } - - nss_SetError(PORT_GetError()); /* ugly */ - return (NSSDER *)NULL; - } - - /* - * I happen to know that these things look alike.. but I'm only - * doing it for these "temporary" wrappers. This is an evil thing. - */ - return (NSSDER *)item; -} - -/*himom*/ -NSS_IMPLEMENT PRStatus -nssASN1_CreatePRInt32FromBER -( - NSSBER *encoded, - PRInt32 *pResult -) -{ - nss_SetError(NSS_ERROR_INTERNAL_ERROR); - return PR_FALSE; -} - -/* - * nssASN1_GetDERFromPRInt32 - * - */ - -NSS_IMPLEMENT NSSDER * -nssASN1_GetDERFromPRInt32 -( - NSSArena *arenaOpt, - NSSDER *rvOpt, - PRInt32 value -) -{ - NSSDER *rv; - PLArenaPool *hack = (PLArenaPool *)arenaOpt; - SECItem *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 ) { - return (NSSDER *)NULL; - } - } else { - rv = rvOpt; - } - - item = SEC_ASN1EncodeInteger(hack, (SECItem *)rv, value); - if( (SECItem *)NULL == item ) { - if( (NSSDER *)NULL == rvOpt ) { - (void)nss_ZFreeIf(rv); - } - - nss_SetError(PORT_GetError()); /* ugly */ - return (NSSDER *)NULL; - } - - /* - * I happen to know that these things look alike.. but I'm only - * doing it for these "temporary" wrappers. This is an evil thing. - */ - return (NSSDER *)item; -} - -/* - * Generic Templates - * One for each of the simple types, plus a special one for ANY, plus: - * - a pointer to each one of those - * - a set of each one of those - * - * Note that these are alphabetical (case insensitive); please add new - * ones in the appropriate place. - */ - -const nssASN1Template *nssASN1Template_Any = (nssASN1Template *)SEC_AnyTemplate; -const nssASN1Template *nssASN1Template_BitString = (nssASN1Template *)SEC_BitStringTemplate; -const nssASN1Template *nssASN1Template_BMPString = (nssASN1Template *)SEC_BMPStringTemplate; -const nssASN1Template *nssASN1Template_Boolean = (nssASN1Template *)SEC_BooleanTemplate; -const nssASN1Template *nssASN1Template_Enumerated = (nssASN1Template *)SEC_EnumeratedTemplate; -const nssASN1Template *nssASN1Template_GeneralizedTime = (nssASN1Template *)SEC_GeneralizedTimeTemplate; -const nssASN1Template *nssASN1Template_IA5String = (nssASN1Template *)SEC_IA5StringTemplate; -const nssASN1Template *nssASN1Template_Integer = (nssASN1Template *)SEC_IntegerTemplate; -const nssASN1Template *nssASN1Template_Null = (nssASN1Template *)SEC_NullTemplate; -const nssASN1Template *nssASN1Template_ObjectID = (nssASN1Template *)SEC_ObjectIDTemplate; -const nssASN1Template *nssASN1Template_OctetString = (nssASN1Template *)SEC_OctetStringTemplate; -const nssASN1Template *nssASN1Template_PrintableString = (nssASN1Template *)SEC_PrintableStringTemplate; -const nssASN1Template *nssASN1Template_T61String = (nssASN1Template *)SEC_T61StringTemplate; -const nssASN1Template *nssASN1Template_UniversalString = (nssASN1Template *)SEC_UniversalStringTemplate; -const nssASN1Template *nssASN1Template_UTCTime = (nssASN1Template *)SEC_UTCTimeTemplate; -const nssASN1Template *nssASN1Template_UTF8String = (nssASN1Template *)SEC_UTF8StringTemplate; -const nssASN1Template *nssASN1Template_VisibleString = (nssASN1Template *)SEC_VisibleStringTemplate; - -const nssASN1Template *nssASN1Template_PointerToAny = (nssASN1Template *)SEC_PointerToAnyTemplate; -const nssASN1Template *nssASN1Template_PointerToBitString = (nssASN1Template *)SEC_PointerToBitStringTemplate; -const nssASN1Template *nssASN1Template_PointerToBMPString = (nssASN1Template *)SEC_PointerToBMPStringTemplate; -const nssASN1Template *nssASN1Template_PointerToBoolean = (nssASN1Template *)SEC_PointerToBooleanTemplate; -const nssASN1Template *nssASN1Template_PointerToEnumerated = (nssASN1Template *)SEC_PointerToEnumeratedTemplate; -const nssASN1Template *nssASN1Template_PointerToGeneralizedTime = (nssASN1Template *)SEC_PointerToGeneralizedTimeTemplate; -const nssASN1Template *nssASN1Template_PointerToIA5String = (nssASN1Template *)SEC_PointerToIA5StringTemplate; -const nssASN1Template *nssASN1Template_PointerToInteger = (nssASN1Template *)SEC_PointerToIntegerTemplate; -const nssASN1Template *nssASN1Template_PointerToNull = (nssASN1Template *)SEC_PointerToNullTemplate; -const nssASN1Template *nssASN1Template_PointerToObjectID = (nssASN1Template *)SEC_PointerToObjectIDTemplate; -const nssASN1Template *nssASN1Template_PointerToOctetString = (nssASN1Template *)SEC_PointerToOctetStringTemplate; -const nssASN1Template *nssASN1Template_PointerToPrintableString = (nssASN1Template *)SEC_PointerToPrintableStringTemplate; -const nssASN1Template *nssASN1Template_PointerToT61String = (nssASN1Template *)SEC_PointerToT61StringTemplate; -const nssASN1Template *nssASN1Template_PointerToUniversalString = (nssASN1Template *)SEC_PointerToUniversalStringTemplate; -const nssASN1Template *nssASN1Template_PointerToUTCTime = (nssASN1Template *)SEC_PointerToUTCTimeTemplate; -const nssASN1Template *nssASN1Template_PointerToUTF8String = (nssASN1Template *)SEC_PointerToUTF8StringTemplate; -const nssASN1Template *nssASN1Template_PointerToVisibleString = (nssASN1Template *)SEC_PointerToVisibleStringTemplate; - -const nssASN1Template *nssASN1Template_SetOfAny = (nssASN1Template *)SEC_SetOfAnyTemplate; -const nssASN1Template *nssASN1Template_SetOfBitString = (nssASN1Template *)SEC_SetOfBitStringTemplate; -const nssASN1Template *nssASN1Template_SetOfBMPString = (nssASN1Template *)SEC_SetOfBMPStringTemplate; -const nssASN1Template *nssASN1Template_SetOfBoolean = (nssASN1Template *)SEC_SetOfBooleanTemplate; -const nssASN1Template *nssASN1Template_SetOfEnumerated = (nssASN1Template *)SEC_SetOfEnumeratedTemplate; -const nssASN1Template *nssASN1Template_SetOfGeneralizedTime = (nssASN1Template *)SEC_SetOfGeneralizedTimeTemplate; -const nssASN1Template *nssASN1Template_SetOfIA5String = (nssASN1Template *)SEC_SetOfIA5StringTemplate; -const nssASN1Template *nssASN1Template_SetOfInteger = (nssASN1Template *)SEC_SetOfIntegerTemplate; -const nssASN1Template *nssASN1Template_SetOfNull = (nssASN1Template *)SEC_SetOfNullTemplate; -const nssASN1Template *nssASN1Template_SetOfObjectID = (nssASN1Template *)SEC_SetOfObjectIDTemplate; -const nssASN1Template *nssASN1Template_SetOfOctetString = (nssASN1Template *)SEC_SetOfOctetStringTemplate; -const nssASN1Template *nssASN1Template_SetOfPrintableString = (nssASN1Template *)SEC_SetOfPrintableStringTemplate; -const nssASN1Template *nssASN1Template_SetOfT61String = (nssASN1Template *)SEC_SetOfT61StringTemplate; -const nssASN1Template *nssASN1Template_SetOfUniversalString = (nssASN1Template *)SEC_SetOfUniversalStringTemplate; -const nssASN1Template *nssASN1Template_SetOfUTCTime = (nssASN1Template *)SEC_SetOfUTCTimeTemplate; -const nssASN1Template *nssASN1Template_SetOfUTF8String = (nssASN1Template *)SEC_SetOfUTF8StringTemplate; -const nssASN1Template *nssASN1Template_SetOfVisibleString = (nssASN1Template *)SEC_SetOfVisibleStringTemplate; - -/* - * - */ - -NSS_IMPLEMENT NSSUTF8 * -nssUTF8_CreateFromBER -( - NSSArena *arenaOpt, - nssStringType type, - NSSBER *berData -) -{ - NSSUTF8 *rv = NULL; - PRUint8 tag; - NSSArena *a; - NSSItem in; - NSSItem out; - 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; - } - - in = *berData; - - /* - * By the way, at first I succumbed to the temptation to make - * this an incestuous nested switch statement. Count yourself - * lucky I cleaned it up. - */ - - switch( type ) { - case nssStringType_DirectoryString: - /* - * draft-ietf-pkix-ipki-part1-11 says in part: - * - * DirectoryString { INTEGER:maxSize } ::= CHOICE { - * teletexString TeletexString (SIZE (1..maxSize)), - * printableString PrintableString (SIZE (1..maxSize)), - * universalString UniversalString (SIZE (1..maxSize)), - * bmpString BMPString (SIZE(1..maxSize)), - * utf8String UTF8String (SIZE(1..maxSize)) - * } - * - * The tags are: - * TeletexString UNIVERSAL 20 - * PrintableString UNIVERSAL 19 - * UniversalString UNIVERSAL 28 - * BMPString UNIVERSAL 30 - * UTF8String UNIVERSAL 12 - * - * "UNIVERSAL" tags have bits 8 and 7 zero, bit 6 is zero for - * primitive encodings, and if the tag value is less than 30, - * the tag value is directly encoded in bits 5 through 1. - */ - in.data = (void *)&(((PRUint8 *)berData->data)[1]); - in.size = berData->size-1; - - tag = *(PRUint8 *)berData->data; - switch( tag & nssASN1_TAGNUM_MASK ) { - case 20: - /* - * XXX fgmr-- we have to accept Latin-1 for Teletex; (see - * below) but is T61 a suitable value for "Latin-1"? - */ - templ = nssASN1Template_T61String; - type = nssStringType_TeletexString; - break; - case 19: - templ = nssASN1Template_PrintableString; - type = nssStringType_PrintableString; - break; - case 28: - templ = nssASN1Template_UniversalString; - type = nssStringType_UniversalString; - break; - case 30: - templ = nssASN1Template_BMPString; - type = nssStringType_BMPString; - break; - case 12: - templ = nssASN1Template_UTF8String; - type = nssStringType_UTF8String; - break; - default: - nss_SetError(NSS_ERROR_INVALID_POINTER); /* "pointer"? */ - (void)NSSArena_Destroy(a); - return (NSSUTF8 *)NULL; - } - - break; - - case nssStringType_TeletexString: - /* - * XXX fgmr-- we have to accept Latin-1 for Teletex; (see - * below) but is T61 a suitable value for "Latin-1"? - */ - templ = nssASN1Template_T61String; - break; - - case nssStringType_PrintableString: - templ = nssASN1Template_PrintableString; - break; - - case nssStringType_UniversalString: - templ = nssASN1Template_UniversalString; - break; - - case nssStringType_BMPString: - templ = nssASN1Template_BMPString; - break; - - case nssStringType_UTF8String: - templ = nssASN1Template_UTF8String; - break; - - case nssStringType_PHGString: - templ = nssASN1Template_IA5String; - break; - - default: - nss_SetError(NSS_ERROR_UNSUPPORTED_TYPE); - (void)NSSArena_Destroy(a); - return (NSSUTF8 *)NULL; - } - - st = nssASN1_DecodeBER(a, &out, templ, &in); - - if( PR_SUCCESS == st ) { - rv = nssUTF8_Create(arenaOpt, type, out.data, out.size); - } - (void)NSSArena_Destroy(a); - - return rv; -} - -NSS_EXTERN NSSDER * -nssUTF8_GetDEREncoding -( - NSSArena *arenaOpt, - nssStringType type, - const NSSUTF8 *string -) -{ - NSSDER *rv = (NSSDER *)NULL; - NSSItem str; - NSSDER *der; - 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 ) { - return (NSSDER *)NULL; - } - - a = NSSArena_Create(); - if( (NSSArena *)NULL == a ) { - return (NSSDER *)NULL; - } - - switch( type ) { - case nssStringType_DirectoryString: - { - NSSDER *utf; - PRUint8 *c; - - utf = nssASN1_EncodeItem(a, (NSSDER *)NULL, &str, - nssASN1Template_UTF8String, - NSSASN1DER); - if( (NSSDER *)NULL == utf ) { - (void)NSSArena_Destroy(a); - return (NSSDER *)NULL; - } - - rv = nss_ZNEW(arenaOpt, NSSDER); - if( (NSSDER *)NULL == rv ) { - (void)NSSArena_Destroy(a); - return (NSSDER *)NULL; - } - - rv->size = utf->size + 1; - rv->data = nss_ZAlloc(arenaOpt, rv->size); - if( (void *)NULL == rv->data ) { - (void)nss_ZFreeIf(rv); - (void)NSSArena_Destroy(a); - return (NSSDER *)NULL; - } - - c = (PRUint8 *)rv->data; - (void)nsslibc_memcpy(&c[1], utf->data, utf->size); - *c = 12; /* UNIVERSAL primitive encoding tag for UTF8String */ - - (void)NSSArena_Destroy(a); - return rv; - } - case nssStringType_TeletexString: - /* - * XXX fgmr-- we have to accept Latin-1 for Teletex; (see - * below) but is T61 a suitable value for "Latin-1"? - */ - templ = nssASN1Template_T61String; - break; - case nssStringType_PrintableString: - templ = nssASN1Template_PrintableString; - break; - - case nssStringType_UniversalString: - templ = nssASN1Template_UniversalString; - break; - - case nssStringType_BMPString: - templ = nssASN1Template_BMPString; - break; - - case nssStringType_UTF8String: - templ = nssASN1Template_UTF8String; - break; - - case nssStringType_PHGString: - templ = nssASN1Template_IA5String; - break; - - default: - nss_SetError(NSS_ERROR_UNSUPPORTED_TYPE); - (void)NSSArena_Destroy(a); - return (NSSDER *)NULL; - } - - der = nssUTF8_GetDEREncoding(a, type, string); - if( (NSSItem *)NULL == der ) { - (void)NSSArena_Destroy(a); - return (NSSDER *)NULL; - } - - rv = nssASN1_EncodeItem(arenaOpt, (NSSDER *)NULL, der, templ, NSSASN1DER); - if( (NSSDER *)NULL == rv ) { - (void)NSSArena_Destroy(a); - return (NSSDER *)NULL; - } - - (void)NSSArena_Destroy(a); - return rv; -} diff --git a/security/nss/lib/asn1/asn1.h b/security/nss/lib/asn1/asn1.h deleted file mode 100644 index eecc54120..000000000 --- a/security/nss/lib/asn1/asn1.h +++ /dev/null @@ -1,882 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * 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 the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef ASN1_H -#define ASN1_H - -#ifdef DEBUG -static const char ASN1_CVS_ID[] = "@(#) $RCSfile$ $Revision$ $Date$"; -#endif /* DEBUG */ - -/* - * asn1.h - * - * This file contains the ASN.1 encoder/decoder routines available - * internally within NSS. It's not clear right now if this file - * will be folded into base.h or something, I just needed to get this - * going. At the moment, most of these routines wrap the old SEC_ASN1 - * calls. - */ - -#ifndef ASN1T_H -#include "asn1t.h" -#endif /* ASN1T_H */ - -#ifndef BASE_H -#include "base.h" -#endif /* BASE_H */ - -PR_BEGIN_EXTERN_C - -/* - * nssASN1Decoder - * - * ... description here ... - * - * nssASN1Decoder_Create (Factory/Constructor) - * nssASN1Decoder_Update - * nssASN1Decoder_Finish (Destructor) - * nssASN1Decoder_SetFilter - * nssASN1Decoder_GetFilter - * nssASN1Decoder_SetNotify - * nssASN1Decoder_GetNotify - * - * Debug builds only: - * - * nssASN1Decoder_verify - * - * Related functions that aren't type methods: - * - * nssASN1_Decode - * nssASN1_DecodeBER - */ - -/* - * nssASN1Decoder_Create - * - * This routine creates an ASN.1 Decoder, which will use the specified - * template to decode a datastream into the specified destination - * structure. If the optional arena argument is non-NULL, blah blah - * blah. XXX fgmr Should we include an nssASN1EncodingType argument, - * as a hint? Or is each encoding distinctive? This routine may - * return NULL upon error, in which case an error will have been - * placed upon the error stack. - * - * The error may be one of the following values: - * NSS_ERROR_NO_MEMORY - * NSS_ERROR_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * ... - * - * Return value: - * NULL upon error - * A pointer to an ASN.1 Decoder upon success. - */ - -NSS_EXTERN nssASN1Decoder * -nssASN1Decoder_Create -( - NSSArena *arenaOpt, - void *destination, - 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 - * - * This routine feeds data to the decoder. In the event of an error, - * it will place 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_INVALID_POINTER - * NSS_ERROR_INVALID_ASN1DECODER - * NSS_ERROR_INVALID_BER - * ... - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success. - */ - -NSS_EXTERN PRStatus -nssASN1Decoder_Update -( - nssASN1Decoder *decoder, - const void *data, - 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 - * - * This routine finishes the decoding and destroys the decoder. - * In the event of an error, it will place 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_EXTERN PRStatus -nssASN1Decoder_Finish -( - nssASN1Decoder *decoder -); - -extern const NSSError NSS_ERROR_INVALID_ASN1DECODER; - -/* - * nssASN1Decoder_SetFilter - * - * This routine registers a callback filter routine with the decoder, - * which will be called blah blah blah. The specified argument will - * be passed as-is to the filter routine. The routine pointer may - * be NULL, in which case no filter callback will be called. If the - * noStore boolean is PR_TRUE, then decoded fields will not be stored - * in the destination structure specified when the decoder was - * created. This routine returns a PRStatus value; in the event of - * an error, it will place 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_EXTERN PRStatus -nssASN1Decoder_SetFilter -( - nssASN1Decoder *decoder, - nssASN1DecoderFilterFunction *callback, - void *argument, - PRBool noStore -); - -extern const NSSError NSS_ERROR_INVALID_ASN1DECODER; - -/* - * nssASN1Decoder_GetFilter - * - * If the optional pCallbackOpt argument to this routine is non-null, - * then the pointer to any callback function established for this - * decoder with nssASN1Decoder_SetFilter will be stored at the - * location indicated by it. If the optional pArgumentOpt - * pointer is non-null, the filter's closure argument will be stored - * there. If the optional pNoStoreOpt pointer is non-null, the - * noStore value specified when setting the filter will be stored - * there. This routine returns a PRStatus value; in the event of - * an error it will place 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_EXTERN PRStatus -nssASN1Decoder_GetFilter -( - nssASN1Decoder *decoder, - nssASN1DecoderFilterFunction **pCallbackOpt, - void **pArgumentOpt, - PRBool *pNoStoreOpt -); - -extern const NSSError NSS_ERROR_INVALID_ASN1DECODER; - -/* - * nssASN1Decoder_SetNotify - * - * This routine registers a callback notify routine with the decoder, - * which will be called whenever.. The specified argument will be - * passed as-is to the notify routine. The routine pointer may be - * NULL, in which case no notify routine will be called. This routine - * returns a PRStatus value; in the event of an error it will place - * 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_EXTERN PRStatus -nssASN1Decoder_SetNotify -( - nssASN1Decoder *decoder, - nssASN1NotifyFunction *callback, - void *argument -); - -extern const NSSError NSS_ERROR_INVALID_ASN1DECODER; - -/* - * nssASN1Decoder_GetNotify - * - * If the optional pCallbackOpt argument to this routine is non-null, - * then the pointer to any callback function established for this - * decoder with nssASN1Decoder_SetNotify will be stored at the - * location indicated by it. If the optional pArgumentOpt pointer is - * non-null, the filter's closure argument will be stored there. - * This routine returns a PRStatus value; in the event of an error it - * will place 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_EXTERN PRStatus -nssASN1Decoder_GetNotify -( - nssASN1Decoder *decoder, - nssASN1NotifyFunction **pCallbackOpt, - void **pArgumentOpt -); - -extern const NSSError NSS_ERROR_INVALID_ASN1DECODER; - -/* - * 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 - */ - -#ifdef DEBUG -NSS_EXTERN PRStatus -nssASN1Decoder_verify -( - nssASN1Decoder *decoder -); - -extern const NSSError NSS_ERROR_INVALID_ASN1DECODER; -#endif /* DEBUG */ - -/* - * nssASN1_Decode - * - * This routine will decode the specified data into the specified - * destination structure, as specified by the specified template. - * This routine returns a PRStatus value; in the event of an error - * it will place 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_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * NSS_ERROR_INVALID_BER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_EXTERN PRStatus -nssASN1_Decode -( - NSSArena *arenaOpt, - void *destination, - const nssASN1Template template[], - const void *berData, - 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 - * - * This routine will decode the data in the specified NSSBER - * into the destination structure, as specified by the template. - * This routine returns a PRStatus value; in the event of an error - * it will place 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_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * NSS_ERROR_INVALID_NSSBER - * NSS_ERROR_INVALID_BER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_EXTERN PRStatus -nssASN1_DecodeBER -( - NSSArena *arenaOpt, - void *destination, - const nssASN1Template template[], - 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 - * - * ... description here ... - * - * nssASN1Encoder_Create (Factory/Constructor) - * nssASN1Encoder_Update - * nssASN1Encoder_Finish (Destructor) - * nssASN1Encoder_SetNotify - * nssASN1Encoder_GetNotify - * nssASN1Encoder_SetStreaming - * nssASN1Encoder_GetStreaming - * nssASN1Encoder_SetTakeFromBuffer - * nssASN1Encoder_GetTakeFromBuffer - * - * Debug builds only: - * - * nssASN1Encoder_verify - * - * Related functions that aren't type methods: - * - * nssASN1_Encode - * nssASN1_EncodeItem - */ - -/* - * nssASN1Encoder_Create - * - * This routine creates an ASN.1 Encoder, blah blah blah. This - * may return NULL upon error, in which case an error will have been - * placed on the error stack. - * - * The error may be one of the following values: - * NSS_ERROR_NO_MEMORY - * NSS_ERROR_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * NSS_ERROR_ENCODING_NOT_SUPPORTED - * ... - * - * Return value: - * NULL upon error - * A pointer to an ASN.1 Encoder upon success - */ - -NSS_EXTERN nssASN1Encoder * -nssASN1Encoder_Create -( - const void *source, - const nssASN1Template template[], - NSSASN1EncodingType encoding, - nssASN1EncoderWriteFunction *sink, - 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 - * - * The error may be one of the following values: - * NSS_ERROR_INVALID_ASN1ENCODER - * NSS_ERROR_INVALID_POINTER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_EXTERN PRStatus -nssASN1Encoder_Update -( - nssASN1Encoder *encoder, - const void *data, - PRUint32 length -); - -extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER; -extern const NSSError NSS_ERROR_INVALID_POINTER; - -/* - * nssASN1Encoder_Finish - * - * Destructor. - * - * The error may be one of the following values: - * NSS_ERROR_INVALID_ASN1ENCODER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_EXTERN PRStatus -nssASN1Encoder_Finish -( - nssASN1Encoder *encoder -); - -extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER; - -/* - * nssASN1Encoder_SetNotify - * - * This routine registers a callback notify routine with the encoder, - * which will be called whenever.. The specified argument will be - * passed as-is to the notify routine. The routine pointer may be - * NULL, in which case no notify routine will be called. This routine - * returns a PRStatus value; in the event of an error it will place - * 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_EXTERN PRStatus -nssASN1Encoder_SetNotify -( - nssASN1Encoder *encoder, - nssASN1NotifyFunction *callback, - void *argument -); - -extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER; - -/* - * nssASN1Encoder_GetNotify - * - * If the optional pCallbackOpt argument to this routine is non-null, - * then the pointer to any callback function established for this - * decoder with nssASN1Encoder_SetNotify will be stored at the - * location indicated by it. If the optional pArgumentOpt pointer is - * non-null, the filter's closure argument will be stored there. - * This routine returns a PRStatus value; in the event of an error it - * will place 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_EXTERN PRStatus -nssASN1Encoder_GetNotify -( - nssASN1Encoder *encoder, - nssASN1NotifyFunction **pCallbackOpt, - void **pArgumentOpt -); - -extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER; - -/* - * nssASN1Encoder_SetStreaming - * - * - * The error may be one of the following values: - * NSS_ERROR_INVALID_ASN1ENCODER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_EXTERN PRStatus -nssASN1Encoder_SetStreaming -( - nssASN1Encoder *encoder, - PRBool streaming -); - -extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER; - -/* - * nssASN1Encoder_GetStreaming - * - * - * The error may be one of the following values: - * NSS_ERROR_INVALID_ASN1ENCODER - * NSS_ERROR_INVALID_POINTER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_EXTERN PRStatus -nssASN1Encoder_GetStreaming -( - nssASN1Encoder *encoder, - PRBool *pStreaming -); - -extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER; -extern const NSSError NSS_ERROR_INVALID_POINTER; - -/* - * nssASN1Encoder_SetTakeFromBuffer - * - * - * The error may be one of the following values: - * NSS_ERROR_INVALID_ASN1ENCODER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_EXTERN PRStatus -nssASN1Encoder_SetTakeFromBuffer -( - nssASN1Encoder *encoder, - PRBool takeFromBuffer -); - -extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER; - -/* - * nssASN1Encoder_GetTakeFromBuffer - * - * - * The error may be one of the following values: - * NSS_ERROR_INVALID_ASN1ENCODER - * NSS_ERROR_INVALID_POINTER - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_EXTERN PRStatus -nssASN1Encoder_GetTakeFromBuffer -( - nssASN1Encoder *encoder, - PRBool *pTakeFromBuffer -); - -extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER; -extern const NSSError NSS_ERROR_INVALID_POINTER; - -/* - * 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 - */ - -#ifdef DEBUG -NSS_EXTERN PRStatus -nssASN1Encoder_verify -( - nssASN1Encoder *encoder -); - -extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER; -#endif /* DEBUG */ - -/* - * nssASN1_Encode - * - * - * The error may be one of the following values: - * NSS_ERROR_NO_MEMORY - * NSS_ERROR_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * NSS_ERROR_ENCODING_NOT_SUPPORTED - * ... - * - * Return value: - * PR_FAILURE upon error - * PR_SUCCESS upon success - */ - -NSS_EXTERN PRStatus -nssASN1_Encode -( - const void *source, - const nssASN1Template template[], - NSSASN1EncodingType encoding, - nssASN1EncoderWriteFunction *sink, - 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 - * - * There must be a better name. If the optional arena argument is - * non-null, it'll be used for the space. If the optional rvOpt is - * non-null, it'll be the return value-- if it is null, a new one - * will be allocated. - * - * The error may be one of the following values: - * NSS_ERROR_NO_MEMORY - * NSS_ERROR_INVALID_ARENA - * NSS_ERROR_INVALID_POINTER - * NSS_ERROR_ENCODING_NOT_SUPPORTED - * - * Return value: - * NULL upon error - * A valid pointer to an NSSDER upon success - */ - -NSS_EXTERN NSSDER * -nssASN1_EncodeItem -( - NSSArena *arenaOpt, - NSSDER *rvOpt, - const void *source, - const nssASN1Template template[], - 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: - * - * nssASN1_CreatePRUint32FromBER - * nssASN1_GetDERFromPRUint32 - * nssASN1_CreatePRInt32FromBER - * nssASN1_GetDERFromPRInt32 - * ..etc.. - */ - -/* - * nssASN1_CreatePRUint32FromBER - * - */ - -NSS_EXTERN PRStatus -nssASN1_CreatePRUint32FromBER -( - NSSBER *encoded, - PRUint32 *pResult -); - -/* - * nssASN1_GetDERFromPRUint32 - * - */ - -NSS_EXTERN NSSDER * -nssASN1_GetDERFromPRUint32 -( - NSSArena *arenaOpt, - NSSDER *rvOpt, - PRUint32 value -); - -/* - * nssASN1_CreatePRInt32FromBER - * - */ - -NSS_EXTERN PRStatus -nssASN1_CreatePRInt32FromBER -( - NSSBER *encoded, - PRInt32 *pResult -); - -/* - * nssASN1_GetDERFromPRInt32 - * - */ - -NSS_EXTERN NSSDER * -nssASN1_GetDERFromPRInt32 -( - NSSArena *arenaOpt, - NSSDER *rvOpt, - PRInt32 value -); - -/* - * Builtin templates - */ - -/* - * Generic Templates - * One for each of the simple types, plus a special one for ANY, plus: - * - a pointer to each one of those - * - a set of each one of those - * - * Note that these are alphabetical (case insensitive); please add new - * ones in the appropriate place. - */ - -extern const nssASN1Template *nssASN1Template_Any; -extern const nssASN1Template *nssASN1Template_BitString; -extern const nssASN1Template *nssASN1Template_BMPString; -extern const nssASN1Template *nssASN1Template_Boolean; -extern const nssASN1Template *nssASN1Template_Enumerated; -extern const nssASN1Template *nssASN1Template_GeneralizedTime; -extern const nssASN1Template *nssASN1Template_IA5String; -extern const nssASN1Template *nssASN1Template_Integer; -extern const nssASN1Template *nssASN1Template_Null; -extern const nssASN1Template *nssASN1Template_ObjectID; -extern const nssASN1Template *nssASN1Template_OctetString; -extern const nssASN1Template *nssASN1Template_PrintableString; -extern const nssASN1Template *nssASN1Template_T61String; -extern const nssASN1Template *nssASN1Template_UniversalString; -extern const nssASN1Template *nssASN1Template_UTCTime; -extern const nssASN1Template *nssASN1Template_UTF8String; -extern const nssASN1Template *nssASN1Template_VisibleString; - -extern const nssASN1Template *nssASN1Template_PointerToAny; -extern const nssASN1Template *nssASN1Template_PointerToBitString; -extern const nssASN1Template *nssASN1Template_PointerToBMPString; -extern const nssASN1Template *nssASN1Template_PointerToBoolean; -extern const nssASN1Template *nssASN1Template_PointerToEnumerated; -extern const nssASN1Template *nssASN1Template_PointerToGeneralizedTime; -extern const nssASN1Template *nssASN1Template_PointerToIA5String; -extern const nssASN1Template *nssASN1Template_PointerToInteger; -extern const nssASN1Template *nssASN1Template_PointerToNull; -extern const nssASN1Template *nssASN1Template_PointerToObjectID; -extern const nssASN1Template *nssASN1Template_PointerToOctetString; -extern const nssASN1Template *nssASN1Template_PointerToPrintableString; -extern const nssASN1Template *nssASN1Template_PointerToT61String; -extern const nssASN1Template *nssASN1Template_PointerToUniversalString; -extern const nssASN1Template *nssASN1Template_PointerToUTCTime; -extern const nssASN1Template *nssASN1Template_PointerToUTF8String; -extern const nssASN1Template *nssASN1Template_PointerToVisibleString; - -extern const nssASN1Template *nssASN1Template_SetOfAny; -extern const nssASN1Template *nssASN1Template_SetOfBitString; -extern const nssASN1Template *nssASN1Template_SetOfBMPString; -extern const nssASN1Template *nssASN1Template_SetOfBoolean; -extern const nssASN1Template *nssASN1Template_SetOfEnumerated; -extern const nssASN1Template *nssASN1Template_SetOfGeneralizedTime; -extern const nssASN1Template *nssASN1Template_SetOfIA5String; -extern const nssASN1Template *nssASN1Template_SetOfInteger; -extern const nssASN1Template *nssASN1Template_SetOfNull; -extern const nssASN1Template *nssASN1Template_SetOfObjectID; -extern const nssASN1Template *nssASN1Template_SetOfOctetString; -extern const nssASN1Template *nssASN1Template_SetOfPrintableString; -extern const nssASN1Template *nssASN1Template_SetOfT61String; -extern const nssASN1Template *nssASN1Template_SetOfUniversalString; -extern const nssASN1Template *nssASN1Template_SetOfUTCTime; -extern const nssASN1Template *nssASN1Template_SetOfUTF8String; -extern const nssASN1Template *nssASN1Template_SetOfVisibleString; - -/* - * - */ - -NSS_EXTERN NSSUTF8 * -nssUTF8_CreateFromBER -( - NSSArena *arenaOpt, - nssStringType type, - NSSBER *berData -); - -NSS_EXTERN NSSDER * -nssUTF8_GetDEREncoding -( - NSSArena *arenaOpt, - /* Should have an NSSDER *rvOpt */ - nssStringType type, - const NSSUTF8 *string -); - -PR_END_EXTERN_C - -#endif /* ASN1_H */ diff --git a/security/nss/lib/asn1/asn1m.h b/security/nss/lib/asn1/asn1m.h deleted file mode 100644 index 957591d88..000000000 --- a/security/nss/lib/asn1/asn1m.h +++ /dev/null @@ -1,83 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * 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 the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef ASN1M_H -#define ASN1M_H - -#ifdef DEBUG -static const char ASN1M_CVS_ID[] = "@(#) $RCSfile$ $Revision$ $Date$"; -#endif /* DEBUG */ - -/* - * asn1m.h - * - * This file contains the ASN.1 encoder/decoder routines available - * only within the ASN.1 module itself. - */ - -#ifndef ASN1_H -#include "asn1.h" -#endif /* ASN1_H */ - -PR_BEGIN_EXTERN_C - -/* - * nssasn1_number_length - * - */ - -NSS_EXTERN PRUint32 -nssasn1_length_length -( - PRUint32 number -); - -/* - * nssasn1_get_subtemplate - * - */ - -NSS_EXTERN const nssASN1Template * -nssasn1_get_subtemplate -( - const nssASN1Template template[], - void *thing, - PRBool encoding -); - -PR_END_EXTERN_C - -#endif /* ASN1M_H */ diff --git a/security/nss/lib/asn1/asn1t.h b/security/nss/lib/asn1/asn1t.h deleted file mode 100644 index d7d8d6585..000000000 --- a/security/nss/lib/asn1/asn1t.h +++ /dev/null @@ -1,169 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * 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 the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef ASN1T_H -#define ASN1T_H - -#ifdef DEBUG -static const char ASN1T_CVS_ID[] = "@(#) $RCSfile$ $Revision$ $Date$"; -#endif /* DEBUG */ - -/* - * asn1t.h - * - * This file contains the ASN.1 encoder/decoder types available - * internally within NSS. It's not clear right now if this file - * will be folded into baset.h or something, I just needed to - * get this going. At the moment, these types are wrappers for - * the old types. - */ - -#ifndef BASET_H -#include "baset.h" -#endif /* BASET_H */ - -#ifndef NSSASN1T_H -#include "nssasn1t.h" -#endif /* NSSASN1T_H */ - -#include "seccomon.h" -#include "secasn1t.h" - -PR_BEGIN_EXTERN_C - -/* - * XXX fgmr - * - * This sort of bites. Let's keep an eye on this, to make sure - * we aren't stuck with it forever. - */ - -struct nssASN1ItemStr { - PRUint32 reserved; - PRUint8 *data; - PRUint32 size; -}; - -typedef struct nssASN1ItemStr nssASN1Item; - -/* - * I'm not documenting these here, since this'll require another - * pass anyway. - */ - -typedef SEC_ASN1Template nssASN1Template; - -#define nssASN1_TAG_MASK SEC_ASN1_TAG_MASK - -#define nssASN1_TAGNUM_MASK SEC_ASN1_TAGNUM_MASK -#define nssASN1_BOOLEAN SEC_ASN1_BOOLEAN -#define nssASN1_INTEGER SEC_ASN1_INTEGER -#define nssASN1_BIT_STRING SEC_ASN1_BIT_STRING -#define nssASN1_OCTET_STRING SEC_ASN1_OCTET_STRING -#define nssASN1_NULL SEC_ASN1_NULL -#define nssASN1_OBJECT_ID SEC_ASN1_OBJECT_ID -#define nssASN1_OBJECT_DESCRIPTOR SEC_ASN1_OBJECT_DESCRIPTOR -/* External type and instance-of type 0x08 */ -#define nssASN1_REAL SEC_ASN1_REAL -#define nssASN1_ENUMERATED SEC_ASN1_ENUMERATED -#define nssASN1_EMBEDDED_PDV SEC_ASN1_EMBEDDED_PDV -#define nssASN1_UTF8_STRING SEC_ASN1_UTF8_STRING -#define nssASN1_SEQUENCE SEC_ASN1_SEQUENCE -#define nssASN1_SET SEC_ASN1_SET -#define nssASN1_NUMERIC_STRING SEC_ASN1_NUMERIC_STRING -#define nssASN1_PRINTABLE_STRING SEC_ASN1_PRINTABLE_STRING -#define nssASN1_T61_STRING SEC_ASN1_T61_STRING -#define nssASN1_TELETEX_STRING nssASN1_T61_STRING -#define nssASN1_VIDEOTEX_STRING SEC_ASN1_VIDEOTEX_STRING -#define nssASN1_IA5_STRING SEC_ASN1_IA5_STRING -#define nssASN1_UTC_TIME SEC_ASN1_UTC_TIME -#define nssASN1_GENERALIZED_TIME SEC_ASN1_GENERALIZED_TIME -#define nssASN1_GRAPHIC_STRING SEC_ASN1_GRAPHIC_STRING -#define nssASN1_VISIBLE_STRING SEC_ASN1_VISIBLE_STRING -#define nssASN1_GENERAL_STRING SEC_ASN1_GENERAL_STRING -#define nssASN1_UNIVERSAL_STRING SEC_ASN1_UNIVERSAL_STRING -/* 0x1d */ -#define nssASN1_BMP_STRING SEC_ASN1_BMP_STRING -#define nssASN1_HIGH_TAG_NUMBER SEC_ASN1_HIGH_TAG_NUMBER - -#define nssASN1_METHOD_MASK SEC_ASN1_METHOD_MASK -#define nssASN1_PRIMITIVE SEC_ASN1_PRIMITIVE -#define nssASN1_CONSTRUCTED SEC_ASN1_CONSTRUCTED - -#define nssASN1_CLASS_MASK SEC_ASN1_CLASS_MASK -#define nssASN1_UNIVERSAL SEC_ASN1_UNIVERSAL -#define nssASN1_APPLICATION SEC_ASN1_APPLICATION -#define nssASN1_CONTEXT_SPECIFIC SEC_ASN1_CONTEXT_SPECIFIC -#define nssASN1_PRIVATE SEC_ASN1_PRIVATE - -#define nssASN1_OPTIONAL SEC_ASN1_OPTIONAL -#define nssASN1_EXPLICIT SEC_ASN1_EXPLICIT -#define nssASN1_ANY SEC_ASN1_ANY -#define nssASN1_INLINE SEC_ASN1_INLINE -#define nssASN1_POINTER SEC_ASN1_POINTER -#define nssASN1_GROUP SEC_ASN1_GROUP -#define nssASN1_DYNAMIC SEC_ASN1_DYNAMIC -#define nssASN1_SKIP SEC_ASN1_SKIP -#define nssASN1_INNER SEC_ASN1_INNER -#define nssASN1_SAVE SEC_ASN1_SAVE -#define nssASN1_MAY_STREAM SEC_ASN1_MAY_STREAM -#define nssASN1_SKIP_REST SEC_ASN1_SKIP_REST -#define nssASN1_CHOICE SEC_ASN1_CHOICE - -#define nssASN1_SEQUENCE_OF SEC_ASN1_SEQUENCE_OF -#define nssASN1_SET_OF SEC_ASN1_SET_OF -#define nssASN1_ANY_CONTENTS SEC_ASN1_ANY_CONTENTS - -typedef SEC_ASN1TemplateChooserPtr nssASN1ChooseTemplateFunction; - -typedef SEC_ASN1DecoderContext nssASN1Decoder; -typedef SEC_ASN1EncoderContext nssASN1Encoder; - -typedef enum { - nssASN1EncodingPartIdentifier = SEC_ASN1_Identifier, - nssASN1EncodingPartLength = SEC_ASN1_Length, - nssASN1EncodingPartContents = SEC_ASN1_Contents, - nssASN1EncodingPartEndOfContents = SEC_ASN1_EndOfContents -} nssASN1EncodingPart; - -typedef SEC_ASN1NotifyProc nssASN1NotifyFunction; - -typedef SEC_ASN1WriteProc nssASN1EncoderWriteFunction; -typedef SEC_ASN1WriteProc nssASN1DecoderFilterFunction; - -PR_END_EXTERN_C - -#endif /* ASN1T_H */ diff --git a/security/nss/lib/asn1/config.mk b/security/nss/lib/asn1/config.mk deleted file mode 100644 index f4e5b965b..000000000 --- a/security/nss/lib/asn1/config.mk +++ /dev/null @@ -1,52 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# 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 the Initial Developer are Copyright (C) 1994-2000 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** -CONFIG_CVS_ID = "@(#) $RCSfile$ $Revision$ $Date$" - -ifdef BUILD_IDG -DEFINES += -DNSSDEBUG -endif - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -TARGETS = $(LIBRARY) -SHARED_LIBRARY = -IMPORT_LIBRARY = -PROGRAM = - diff --git a/security/nss/lib/asn1/manifest.mn b/security/nss/lib/asn1/manifest.mn deleted file mode 100644 index 382a5baa3..000000000 --- a/security/nss/lib/asn1/manifest.mn +++ /dev/null @@ -1,59 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# 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 the Initial Developer are Copyright (C) 1994-2000 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** -MANIFEST_CVS_ID = "@(#) $RCSfile$ $Revision$ $Date$" - -CORE_DEPTH = ../../.. - -PRIVATE_EXPORTS = \ - asn1t.h \ - asn1m.h \ - asn1.h \ - nssasn1t.h \ - $(NULL) - -EXPORTS = \ - $(NULL) - -MODULE = nss - -CSRCS = \ - asn1.c \ - $(NULL) - -REQUIRES = nspr - -LIBRARY_NAME = asn1 diff --git a/security/nss/lib/asn1/nssasn1t.h b/security/nss/lib/asn1/nssasn1t.h deleted file mode 100644 index 6df1f24a0..000000000 --- a/security/nss/lib/asn1/nssasn1t.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * 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 the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef NSSASN1T_H -#define NSSASN1T_H - -#ifdef DEBUG -static const char NSSASN1T_CVS_ID[] = "@(#) $RCSfile$ $Revision$ $Date$"; -#endif /* DEBUG */ - -/* - * nssasn1t.h - * - * This file contains the public types related to our ASN.1 encoder - * and decoder. - */ - -PR_BEGIN_EXTERN_C - -/* - * NSSASN1EncodingType - * - * This type enumerates specific types of ASN.1 encodings. - */ - -typedef enum { - NSSASN1BER, /* Basic Encoding Rules */ - NSSASN1CER, /* Canonical Encoding Rules */ - NSSASN1DER, /* Distinguished Encoding Rules */ - NSSASN1LWER, /* LightWeight Encoding Rules */ - NSSASN1PER, /* Packed Encoding Rules */ - NSSASN1UnknownEncoding = -1 -} NSSASN1EncodingType; - -PR_END_EXTERN_C - -#endif /* NSSASN1T_H */ diff --git a/security/nss/lib/manifest.mn b/security/nss/lib/manifest.mn index 268ff0496..0b30b0674 100644 --- a/security/nss/lib/manifest.mn +++ b/security/nss/lib/manifest.mn @@ -48,7 +48,7 @@ DEPTH = ../.. # ckfw (builtins module) # crmf jar (not dll's) DIRS = util freebl softoken \ - base asn1 dev pki pki1 \ + base dev pki pki1 \ certdb certhigh pk11wrap cryptohi nss \ ssl \ pkcs12 pkcs7 smime \ @@ -60,7 +60,7 @@ DIRS = util freebl softoken \ # NSS 4.0 build - pure stan libraries ifdef PURE_STAN_BUILD -DIRS = base asn1 dev pki pki1 +DIRS = base dev pki pki1 endif # |