Compare commits

..

2 Commits

Author SHA1 Message Date
sdv%sparc.spb.su
53866ece4f workaround for bug=30927
git-svn-id: svn://10.0.0.236/branches/M15-patch@72213 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-14 11:34:36 +00:00
(no author)
350be55313 This commit was manufactured by cvs2svn to create branch 'M15-patch'.
git-svn-id: svn://10.0.0.236/branches/M15-patch@52901 18797224-902f-48f8-a5cc-f745e15eee43
1999-11-06 02:47:16 +00:00
10 changed files with 105 additions and 17063 deletions

View File

@@ -0,0 +1,105 @@
/*
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 mozilla.org code.
The Initial Developer of the Original Code is Sun Microsystems,
Inc. Portions created by Sun are
Copyright (C) 1999 Sun Microsystems, Inc. All
Rights Reserved.
Contributor(s):
*/
#ifndef __JavaDOMGlobals_h__
#define __JavaDOMGlobals_h__
#include "jni.h"
#include "prclist.h"
#include "nsError.h"
#ifdef ERROR
#undef ERROR
#endif
class nsISupports;
class nsIDOMNode;
struct PRLogModuleInfo;
struct PRLock;
class JavaDOMGlobals {
public:
static jclass attrClass;
static jclass cDataSectionClass;
static jclass commentClass;
static jclass documentClass;
static jclass documentFragmentClass;
static jclass documentTypeClass;
static jclass domImplementationClass;
static jclass elementClass;
static jclass entityClass;
static jclass entityReferenceClass;
static jclass namedNodeMapClass;
static jclass nodeClass;
static jclass nodeListClass;
static jclass notationClass;
static jclass processingInstructionClass;
static jclass textClass;
static jfieldID nodePtrFID;
static jfieldID nodeListPtrFID;
static jfieldID domImplementationPtrFID;
static jfieldID nodeTypeAttributeFID;
static jfieldID nodeTypeCDataSectionFID;
static jfieldID nodeTypeCommentFID;
static jfieldID nodeTypeDocumentFragmentFID;
static jfieldID nodeTypeDocumentFID;
static jfieldID nodeTypeDocumentTypeFID;
static jfieldID nodeTypeElementFID;
static jfieldID nodeTypeEntityFID;
static jfieldID nodeTypeEntityReferenceFID;
static jfieldID nodeTypeNotationFID;
static jfieldID nodeTypeProcessingInstructionFID;
static jfieldID nodeTypeTextFID;
static jclass domExceptionClass;
static jmethodID domExceptionInitMID;
static jclass runtimeExceptionClass;
static jmethodID runtimeExceptionInitMID;
static const char* const DOM_EXCEPTION_MESSAGE[];
typedef enum ExceptionType { EXCEPTION_RUNTIME,
EXCEPTION_DOM } ExceptionType;
static PRLogModuleInfo* log;
static PRCList garbage;
static PRLock* garbageLock;
static PRInt32 javaMaxInt;
static void Initialize(JNIEnv *env);
static void Destroy(JNIEnv *env);
static jobject CreateNodeSubtype(JNIEnv *env,
nsIDOMNode *node);
static void AddToGarbage(nsISupports* domObject);
static void TakeOutGarbage();
static void ThrowException(JNIEnv *env,
const char * message = NULL,
nsresult rv = NS_OK,
ExceptionType exceptionType = EXCEPTION_RUNTIME);
};
#endif /* __JavaDOMGlobals_h__ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,528 +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) 2000 Netscape Communications Corporation. All
;+# Rights Reserved.
;+#
;+# Contributor(s):
;+# Dr Stephen Henson <stephen.henson@gemplus.com>
;+#
;+# 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.
;+#
;+#
;+# OK, this file is meant to support SUN, LINUX, AIX and WINDOWS
;+# 1. For all unix platforms, the string ";-" means "remove this line"
;+# 2. For all unix platforms, the string " DATA " will be removed from any
;+# line on which it occurs.
;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
;+# On AIX, lines containing ";+" will be removed.
;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed.
;+# 5. For all unix platforms, after the above processing has taken place,
;+# all characters after the first ";" on the line will be removed.
;+# And for AIX, the first ";" will also be removed.
;+# This file is passed directly to windows. Since ';' is a comment, all UNIX
;+# directives are hidden behind ";", ";+", and ";-"
;+NSS_3.2 { # NSS 3.2 release
;+ global:
LIBRARY nss3 ;-
EXPORTS ;-
ATOB_AsciiToData;
BTOA_ConvertItemToAscii;
BTOA_DataToAscii;
CERT_AsciiToName;
CERT_CertTimesValid;
CERT_CheckCertValidTimes;
CERT_CreateCertificateRequest;
CERT_ChangeCertTrust;
CERT_DecodeDERCrl;
CERT_DestroyCertificateRequest;
CERT_DestroyCertList;
CERT_DestroyName;
CERT_EnableOCSPChecking;
CERT_FormatName;
CERT_DestroyCertificate;
CERT_DupCertificate;
CERT_FreeDistNames;
CERT_FreeNicknames;
CERT_GetAVATag;
CERT_GetCertEmailAddress;
CERT_GetCertNicknames;
CERT_GetCertIssuerAndSN;
CERT_GetCertTrust;
CERT_GetCertUid;
CERT_GetCommonName;
CERT_GetCountryName;
CERT_GetDBContentVersion;
CERT_GetDefaultCertDB;
CERT_GetDomainComponentName;
CERT_GetLocalityName;
CERT_GetOrgName;
CERT_GetOrgUnitName;
CERT_GetSSLCACerts;
CERT_GetSlopTime;
CERT_GetStateName;
CERT_ImportCAChain;
CERT_NameToAscii;
CERT_RFC1485_EscapeAndQuote;
CERT_SetSlopTime;
CERT_VerifyCertName;
CERT_VerifyCertNow;
DER_UTCDayToAscii;
DER_UTCTimeToAscii;
DER_GeneralizedTimeToTime;
NSS_Init;
NSS_Initialize;
NSS_InitReadWrite;
NSS_NoDB_Init;
NSS_Shutdown;
NSS_VersionCheck;
PK11_Authenticate;
PK11_ChangePW;
PK11_CheckUserPassword;
PK11_CipherOp;
PK11_CloneContext;
PK11_ConfigurePKCS11;
PK11_CreateContextBySymKey;
PK11_CreateDigestContext;
PK11_DestroyContext;
PK11_DestroyTokenObject;
PK11_DigestBegin;
PK11_DigestOp;
PK11_DigestFinal;
PK11_DoesMechanism;
PK11_FindCertFromNickname;
PK11_FindCertFromDERCert;
PK11_FindCertByIssuerAndSN;
PK11_FindKeyByAnyCert;
PK11_FindKeyByDERCert;
PK11_FindSlotByName;
PK11_Finalize;
PK11_FortezzaHasKEA;
PK11_FreeSlot;
PK11_FreeSlotList;
PK11_FreeSymKey;
PK11_GenerateKeyPair;
PK11_GenerateRandom;
PK11_GenerateNewParam;
PK11_GetAllTokens;
PK11_GetBlockSize;
PK11_GetFirstSafe;
PK11_GetInternalKeySlot;
PK11_GetInternalSlot;
PK11_GetSlotName;
PK11_GetTokenName;
PK11_HashBuf;
PK11_IsFIPS;
PK11_IsFriendly;
PK11_IsInternal;
PK11_IsHW;
PK11_IsPresent;
PK11_IsReadOnly;
PK11_KeyGen;
PK11_ListCerts;
PK11_NeedLogin;
PK11_RandomUpdate;
PK11_SetPasswordFunc;
PK11_SetSlotPWValues;
PORT_Alloc;
PORT_Free;
PORT_GetError;
PORT_SetError;
PORT_SetUCS4_UTF8ConversionFunction;
PORT_SetUCS2_UTF8ConversionFunction;
PORT_SetUCS2_ASCIIConversionFunction;
SECITEM_CopyItem;
SECITEM_DupItem;
SECITEM_FreeItem;
SECITEM_ZfreeItem;
SECKEY_ConvertToPublicKey;
SECKEY_CopyPrivateKey;
SECKEY_CreateSubjectPublicKeyInfo;
SECKEY_DestroyPrivateKey;
SECKEY_DestroySubjectPublicKeyInfo;
SECMOD_IsModulePresent;
SECOID_FindOIDTagDescription;
SECOID_GetAlgorithmTag;
SEC_DeletePermCertificate;
SEC_DeletePermCRL;
SEC_DerSignData;
SEC_DestroyCrl;
SEC_FindCrlByDERCert;
SEC_FindCrlByName;
SEC_LookupCrls;
SEC_NewCrl;
;+#
;+# The following symbols are exported only to make libssl3.so work.
;+# These are still private!!!
;+#
__CERT_NewTempCertificate;
__PK11_CreateContextByRawKey;
__PK11_GetKeyData;
__nss_InitLock;
CERT_CertChainFromCert;
CERT_DestroyCertificateList;
CERT_DupCertList;
CERT_ExtractPublicKey;
CERT_FindCertByName;
DER_Lengths;
DSAU_DecodeDerSig;
DSAU_EncodeDerSig;
HASH_GetHashObject;
NSSRWLock_Destroy;
NSSRWLock_HaveWriteLock;
NSSRWLock_LockRead;
NSSRWLock_LockWrite;
NSSRWLock_New;
NSSRWLock_UnlockRead;
NSSRWLock_UnlockWrite;
NSS_PutEnv;
PK11_Derive;
PK11_DeriveWithFlags;
PK11_DigestKey;
PK11_FindBestKEAMatch;
PK11_FindFixedKey;
PK11_GenerateFortezzaIV;
PK11_GetBestKeyLength;
PK11_GetBestSlot;
PK11_GetBestSlotMultiple;
PK11_GetBestWrapMechanism;
PK11_GetCurrentWrapIndex;
PK11_GetMechanism;
PK11_GetModuleID;
PK11_GetPrivateModulusLen;
PK11_GetSlotFromKey;
PK11_GetSlotFromPrivateKey;
PK11_GetSlotID;
PK11_GetSlotSeries;
PK11_GetTokenInfo;
PK11_GetWindow;
PK11_GetWrapKey;
PK11_IVFromParam;
PK11_MakeKEAPubKey;
PK11_ParamFromIV;
PK11_PubDecryptRaw;
PK11_PubDerive;
PK11_PubEncryptRaw;
PK11_PubUnwrapSymKey;
PK11_PubWrapSymKey;
PK11_ReferenceSymKey;
PK11_RestoreContext;
PK11_SaveContext;
PK11_SetFortezzaHack;
PK11_SetWrapKey;
PK11_Sign;
PK11_SignatureLen;
PK11_SymKeyFromHandle;
PK11_TokenExists;
PK11_UnwrapSymKey;
PK11_UnwrapSymKeyWithFlags;
PK11_Verify;
PK11_VerifyKeyOK;
PK11_WrapSymKey;
PORT_ArenaAlloc;
PORT_ArenaZAlloc;
PORT_FreeArena;
PORT_NewArena;
PORT_Realloc;
PORT_ZAlloc;
PORT_ZFree;
RSA_FormatBlock;
SECITEM_CompareItem;
SECKEY_CreateRSAPrivateKey;
SECKEY_DestroyPublicKey;
SECKEY_PublicKeyStrength;
SECKEY_UpdateCertPQG;
SECMOD_LookupSlot;
SGN_Begin;
SGN_DestroyContext;
SGN_End;
SGN_NewContext;
SGN_Update;
VFY_Begin;
VFY_CreateContext;
VFY_DestroyContext;
VFY_End;
VFY_Update;
;+#
;+# The following symbols are exported only to make libsmime3.so work.
;+# These are still private!!!
;+#
__CERT_ClosePermCertDB;
__CERT_DecodeDERCertificate;
__CERT_TraversePermCertsForNickname;
__CERT_TraversePermCertsForSubject;
__PBE_CreateContext;
__PBE_DestroyContext;
__PBE_GenerateBits;
ATOB_ConvertAsciiToItem;
CERT_AddCertToListTail;
CERT_CertListFromCert;
CERT_DestroyCertArray;
CERT_FindCertByDERCert;
CERT_FindCertByIssuerAndSN;
CERT_FindSMimeProfile;
CERT_ImportCerts;
CERT_NewCertList;
CERT_OpenCertDBFilename;
CERT_SaveSMimeProfile;
CERT_VerifyCert;
DER_GetInteger;
DER_TimeToUTCTime;
DER_UTCTimeToTime;
PK11_AlgtagToMechanism;
PK11_BlockData;
PK11_CreatePBEAlgorithmID;
PK11_DestroyObject;
PK11_ExportEncryptedPrivateKeyInfo;
PK11_ExportPrivateKeyInfo;
PK11_FindCertAndKeyByRecipientList;
PK11_FindCertAndKeyByRecipientListNew;
PK11_FindCertInSlot;
PK11_FindPrivateKeyFromCert;
PK11_FortezzaMapSig;
PK11_GetKeyLength;
PK11_GetKeyStrength;
PK11_ImportCertForKeyToSlot;
PK11_ImportEncryptedPrivateKeyInfo;
PK11_ImportPrivateKeyInfo;
PK11_MapPBEMechanismToCryptoMechanism;
PK11_PBEKeyGen;
PK11_ParamFromAlgid;
PK11_ParamToAlgid;
PK11_TraverseCertsForNicknameInSlot;
PK11_TraverseCertsForSubjectInSlot;
PORT_ArenaGrow;
PORT_ArenaMark;
PORT_ArenaRelease;
PORT_ArenaStrdup;
PORT_ArenaUnmark;
PORT_UCS2_ASCIIConversion;
PORT_UCS2_UTF8Conversion;
SECITEM_AllocItem;
SECKEY_CopyEncryptedPrivateKeyInfo;
SECKEY_CopyPrivateKeyInfo;
SECKEY_DestroyEncryptedPrivateKeyInfo;
SECKEY_DestroyPrivateKeyInfo;
SECOID_CompareAlgorithmID;
SECOID_CopyAlgorithmID;
SECOID_DestroyAlgorithmID;
SECOID_FindOID;
SECOID_FindOIDByTag;
SECOID_FindOIDTag;
SECOID_SetAlgorithmID;
SEC_ASN1DecodeInteger;
SEC_ASN1DecodeItem;
SEC_ASN1DecoderClearFilterProc;
SEC_ASN1DecoderClearNotifyProc;
SEC_ASN1DecoderFinish;
SEC_ASN1DecoderSetFilterProc;
SEC_ASN1DecoderSetNotifyProc;
SEC_ASN1DecoderStart;
SEC_ASN1DecoderUpdate;
SEC_ASN1Encode;
SEC_ASN1EncodeInteger;
SEC_ASN1EncodeItem;
SEC_ASN1EncoderClearNotifyProc;
SEC_ASN1EncoderClearStreaming;
SEC_ASN1EncoderClearTakeFromBuf;
SEC_ASN1EncoderFinish;
SEC_ASN1EncoderSetNotifyProc;
SEC_ASN1EncoderSetStreaming;
SEC_ASN1EncoderSetTakeFromBuf;
SEC_ASN1EncoderStart;
SEC_ASN1EncoderUpdate;
SEC_ASN1LengthLength;
SEC_PKCS5GetCryptoAlgorithm;
SEC_PKCS5GetKeyLength;
SEC_PKCS5GetPBEAlgorithm;
SEC_PKCS5IsAlgorithmPBEAlg;
SEC_SignData;
SGN_CompareDigestInfo;
SGN_CopyDigestInfo;
SGN_CreateDigestInfo;
SGN_DestroyDigestInfo;
SGN_Digest;
VFY_VerifyData;
VFY_VerifyDigest;
;+#
;+# Data objects
;+#
;+# Don't export these DATA symbols on Windows because they don't work right.
;;CERT_CrlTemplate DATA ;
;;CERT_SignedDataTemplate DATA ;
;;CERT_CertificateTemplate DATA ;
;;CERT_CertificateRequestTemplate DATA ;
;;CERT_IssuerAndSNTemplate DATA ;
;;CERT_SetOfSignedCrlTemplate DATA ;
;;SECKEY_DSAPublicKeyTemplate DATA ;
;;SECKEY_EncryptedPrivateKeyInfoTemplate DATA ;
;;SECKEY_PointerToEncryptedPrivateKeyInfoTemplate DATA ;
;;SECKEY_PointerToPrivateKeyInfoTemplate DATA ;
;;SECKEY_PrivateKeyInfoTemplate DATA ;
;;SECKEY_RSAPublicKeyTemplate DATA ;
;;SECOID_AlgorithmIDTemplate DATA ;
;;SEC_AnyTemplate DATA ;
;;SEC_BMPStringTemplate DATA ;
;;SEC_BitStringTemplate DATA ;
;;SEC_GeneralizedTimeTemplate DATA ;
;;SEC_IA5StringTemplate DATA ;
;;SEC_IntegerTemplate DATA ;
;;SEC_ObjectIDTemplate DATA ;
;;SEC_OctetStringTemplate DATA ;
;;SEC_PointerToAnyTemplate DATA ;
;;SEC_PointerToOctetStringTemplate DATA ;
;;SEC_SetOfAnyTemplate DATA ;
;;SEC_UTCTimeTemplate DATA ;
;;sgn_DigestInfoTemplate DATA ;
NSS_Get_CERT_CrlTemplate;
NSS_Get_CERT_SignedDataTemplate;
NSS_Get_CERT_CertificateTemplate;
NSS_Get_CERT_CertificateRequestTemplate;
NSS_Get_CERT_IssuerAndSNTemplate;
NSS_Get_CERT_SetOfSignedCrlTemplate;
NSS_Get_SECKEY_DSAPublicKeyTemplate;
NSS_Get_SECKEY_EncryptedPrivateKeyInfoTemplate;
NSS_Get_SECKEY_PointerToEncryptedPrivateKeyInfoTemplate;
NSS_Get_SECKEY_PointerToPrivateKeyInfoTemplate;
NSS_Get_SECKEY_PrivateKeyInfoTemplate;
NSS_Get_SECKEY_RSAPublicKeyTemplate;
NSS_Get_SECOID_AlgorithmIDTemplate;
NSS_Get_SEC_AnyTemplate;
NSS_Get_SEC_BMPStringTemplate;
NSS_Get_SEC_BitStringTemplate;
NSS_Get_SEC_GeneralizedTimeTemplate;
NSS_Get_SEC_IA5StringTemplate;
NSS_Get_SEC_IntegerTemplate;
NSS_Get_SEC_ObjectIDTemplate;
NSS_Get_SEC_OctetStringTemplate;
NSS_Get_SEC_PointerToAnyTemplate;
NSS_Get_SEC_PointerToOctetStringTemplate;
NSS_Get_SEC_SetOfAnyTemplate;
NSS_Get_SEC_UTCTimeTemplate;
NSS_Get_sgn_DigestInfoTemplate;
;+# commands
CERT_DecodeBasicConstraintValue;
CERT_DecodeOidSequence;
CERT_DecodeUserNotice;
CERT_DecodeCertificatePoliciesExtension;
CERT_DestroyCertificatePoliciesExtension;
CERT_FindCertByNicknameOrEmailAddr;
CERT_FindCertByNickname;
CERT_GenTime2FormattedAscii;
CERT_Hexify;
CERT_CompareName;
PK11SDR_Encrypt;
PK11SDR_Decrypt;
NSSBase64Decoder_Create;
NSSBase64Decoder_Destroy;
NSSBase64Decoder_Update;
NSSBase64Encoder_Create;
NSSBase64Encoder_Destroy;
NSSBase64Encoder_Update;
;+#PK11_DoPassword;
;+#PK11_FindKeyByKeyID;
PK11_InitPin;
PK11_NeedUserInit;
;+ local:
;+ *;
;+};
;+NSS_3.2.1 { # NSS 3.2.1 release
;+ global:
CERT_AddRDN;
CERT_CreateRDN;
CERT_CreateAVA;
CERT_CreateName;
;+ local:
;+ *;
;+};
;+NSS_3.3 { # NSS 3.3. release
;+ global:
SECKEY_CreateDHPrivateKey;
;+#
;+# The following symbols are exported only to make JSS work.
;+# These are still private!!!
;+#
CERT_DisableOCSPChecking;
CERT_DisableOCSPDefaultResponder;
CERT_EnableOCSPDefaultResponder;
CERT_GetCertTimes;
CERT_ImportCAChainTrusted;
CERT_ImportCRL;
CERT_IsCACert;
CERT_IsCADERCert;
CERT_SetOCSPDefaultResponder;
PBE_CreateContext;
PBE_DestroyContext;
PBE_GenerateBits;
PK11_CheckSSOPassword;
PK11_GetIVLength;
PK11_GetKeyData;
PK11_GetKeyType;
PK11_GetLowLevelKeyIDForCert;
PK11_GetLowLevelKeyIDForPrivateKey;
PK11_ImportCertForKey;
PK11_ImportDERCertForKey;
PK11_IsLoggedIn;
PK11_KeyForDERCertExists;
PK11_Logout;
PK11_NeedPWInit;
PK11_MakeIDFromPubKey;
PK11_PQG_DestroyParams;
PK11_PQG_DestroyVerify;
PK11_PQG_GetBaseFromParams;
PK11_PQG_GetCounterFromVerify;
PK11_PQG_GetHFromVerify;
PK11_PQG_GetPrimeFromParams;
PK11_PQG_GetSeedFromVerify;
PK11_PQG_GetSubPrimeFromParams;
PK11_PQG_NewParams;
PK11_PQG_NewVerify;
PK11_PQG_ParamGen;
PK11_PQG_ParamGenSeedLen;
PK11_PQG_VerifyParams;
PK11_SeedRandom;
PK11_UnwrapPrivKey;
PK11_VerifyRecover;
PK11_WrapPrivKey;
PK11_ReferenceSlot;
PK11_GetSlotPWValues;
PK11_ImportSymKey;
PK11_ExtractKeyValue;
SECMOD_DeleteInternalModule;
SECMOD_DestroyModule;
SECMOD_GetDefaultModuleList;
SECMOD_GetDefaultModuleListLock;
SECMOD_GetInternalModule;
SECMOD_GetReadLock;
SECMOD_ReferenceModule;
SECMOD_ReleaseReadLock;
SECKEY_GetPrivateKeyType;
SECKEY_EncodeDERSubjectPublicKeyInfo;
SECKEY_ExtractPublicKey;
SEC_PKCS5GetIV;
VFY_EndWithSignature;
;+ local:
;+ *;
;+};

View File

@@ -1,136 +0,0 @@
/*
* NSS utility functions
*
* 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.
*
* $Id: nss.h,v 1.10 2001-04-11 22:42:28 nelsonb%netscape.com Exp $
*/
#ifndef __nss_h_
#define __nss_h_
#include "seccomon.h"
SEC_BEGIN_PROTOS
/*
* NSS's major version, minor version, patch level, and whether
* this is a beta release.
*
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
#define NSS_VERSION "3.3 Beta"
#define NSS_VMAJOR 3
#define NSS_VMINOR 3
#define NSS_VPATCH 0
#define NSS_BETA PR_TRUE
/*
* Return a boolean that indicates whether the underlying library
* will perform as the caller expects.
*
* The only argument is a string, which should be the verson
* identifier of the NSS library. That string will be compared
* against a string that represents the actual build version of
* the NSS library. It also invokes the version checking functions
* of the dependent libraries such as NSPR.
*/
extern PRBool NSS_VersionCheck(const char *importedVersion);
/*
* Open the Cert, Key, and Security Module databases, read only.
* Initialize the Random Number Generator.
* Does not initialize the cipher policies or enables.
* Default policy settings disallow all ciphers.
*/
extern SECStatus NSS_Init(const char *configdir);
/*
* Open the Cert, Key, and Security Module databases, read/write.
* Initialize the Random Number Generator.
* Does not initialize the cipher policies or enables.
* Default policy settings disallow all ciphers.
*/
extern SECStatus NSS_InitReadWrite(const char *configdir);
/*
* Open the Cert, Key, and Security Module databases, read/write.
* Initialize the Random Number Generator.
* Does not initialize the cipher policies or enables.
* Default policy settings disallow all ciphers.
*
* This allows using application defined prefixes for the cert and key db's
* and an alternate name for the secmod database. NOTE: In future releases,
* the database prefixes my not necessarily map to database names.
*
* configdir - base directory where all the cert, key, and module datbases live.
* certPrefix - prefix added to the beginning of the cert database example: "
* "https-server1-"
* keyPrefix - prefix added to the beginning of the key database example: "
* "https-server1-"
* secmodName - name of the security module database (usually "secmod.db").
* flags - change the open options of NSS_Initialize as follows:
* NSS_INIT_READONLY - Open the databases read only.
* NSS_INIT_NOCERTDB - Don't open the cert DB and key DB's, just
* initialize the volatile certdb.
* NSS_INIT_NOMODDB - Don't open the security module DB, just
* initialize the PKCS #11 module.
* NSS_INIT_FORCEOPEN - Continue to force initializations even if the
* databases cannot be opened.
*
* Also NOTE: This is not the recommended method for initializing NSS.
* The prefered method is NSS_init().
*/
#define NSS_INIT_READONLY 0x1
#define NSS_INIT_NOCERTDB 0x2
#define NSS_INIT_NOMODDB 0x4
#define NSS_INIT_FORCEOPEN 0x8
extern SECStatus NSS_Initialize(const char *configdir,
const char *certPrefix, const char *keyPrefix,
const char *secmodName, PRUint32 flags);
/*
* initialize NSS without a creating cert db's, key db's, or secmod db's.
*/
SECStatus NSS_NoDB_Init(const char *configdir);
/*
* Close the Cert, Key databases.
*/
extern void NSS_Shutdown(void);
SEC_END_PROTOS
#endif /* __nss_h_ */

View File

@@ -1,434 +0,0 @@
/*
* NSS utility functions
*
* 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.
*
# $Id: nssinit.c,v 1.18 2001-03-14 18:58:14 javi%netscape.com Exp $
*/
#include <ctype.h>
#include "seccomon.h"
#include "prinit.h"
#include "prprf.h"
#include "prmem.h"
#include "cert.h"
#include "key.h"
#include "ssl.h"
#include "sslproto.h"
#include "secmod.h"
#include "secmodi.h"
#include "nss.h"
#include "secrng.h"
#include "cdbhdl.h" /* ??? */
#include "pk11func.h"
#ifdef macintosh
#define PATH_SEPARATOR ":"
#define SECMOD_DB "Security Modules"
#define CERT_DB_FMT "%sCertificates%s"
#define KEY_DB_FMT "%sKey Database%s"
#else
#define PATH_SEPARATOR "/"
#define SECMOD_DB "secmod.db"
#define CERT_DB_FMT "%scert%s.db"
#define KEY_DB_FMT "%skey%s.db"
#endif
static char *secmodname = NULL;
static char *
nss_certdb_name_cb(void *arg, int dbVersion)
{
const char *configdir = (const char *)arg;
const char *dbver;
switch (dbVersion) {
case 7:
dbver = "7";
break;
case 6:
dbver = "6";
break;
case 5:
dbver = "5";
break;
case 4:
default:
dbver = "";
break;
}
return PR_smprintf(CERT_DB_FMT, configdir, dbver);
}
static char *
nss_keydb_name_cb(void *arg, int dbVersion)
{
const char *configdir = (const char *)arg;
const char *dbver;
switch (dbVersion) {
case 3:
dbver = "3";
break;
case 1:
dbver = "1";
break;
case 2:
default:
dbver = "";
break;
}
return PR_smprintf(KEY_DB_FMT, configdir, dbver);
}
static SECStatus
nss_OpenCertDB(const char * configdir, const char *prefix, PRBool readOnly)
{
CERTCertDBHandle *certdb;
SECStatus status;
char * name = NULL;
certdb = CERT_GetDefaultCertDB();
if (certdb)
return SECSuccess; /* idempotency */
name = PR_smprintf("%s" PATH_SEPARATOR "%s",configdir,prefix);
if (name == NULL) goto loser;
certdb = (CERTCertDBHandle*)PORT_ZAlloc(sizeof(CERTCertDBHandle));
if (certdb == NULL)
goto loser;
status = CERT_OpenCertDB(certdb, readOnly, nss_certdb_name_cb, (void *)name);
if (status == SECSuccess)
CERT_SetDefaultCertDB(certdb);
else {
PR_Free(certdb);
loser:
status = SECFailure;
}
if (name) PORT_Free(name);
return status;
}
static SECStatus
nss_OpenKeyDB(const char * configdir, const char *prefix, PRBool readOnly)
{
SECKEYKeyDBHandle *keydb;
char * name = NULL;
keydb = SECKEY_GetDefaultKeyDB();
if (keydb)
return SECSuccess;
name = PR_smprintf("%s" PATH_SEPARATOR "%s",configdir,prefix);
if (name == NULL)
return SECFailure;
keydb = SECKEY_OpenKeyDB(readOnly, nss_keydb_name_cb, (void *)name);
if (keydb == NULL)
return SECFailure;
SECKEY_SetDefaultKeyDB(keydb);
PORT_Free(name);
return SECSuccess;
}
static SECStatus
nss_OpenSecModDB(const char * configdir,const char *dbname)
{
/* XXX
* For idempotency, this should check to see if the secmodDB is alredy open
* but no function exists to make that determination.
*/
if (secmodname)
return SECSuccess;
secmodname = PR_smprintf("%s" PATH_SEPARATOR "%s", configdir,dbname);
if (secmodname == NULL)
return SECFailure;
SECMOD_init(secmodname);
return SECSuccess;
}
static CERTCertDBHandle certhandle = { 0 };
static SECStatus
nss_OpenVolatileCertDB() {
SECStatus rv = SECSuccess;
/* now we want to verify the signature */
/* Initialize the cert code */
rv = CERT_OpenVolatileCertDB(&certhandle);
if (rv != SECSuccess) {
return rv;
}
CERT_SetDefaultCertDB(&certhandle);
return rv;
}
static SECStatus
nss_OpenVolatileSecModDB() {
SECStatus rv = SECSuccess;
SECMODModule *module;
PK11_InitSlotLists();
module = SECMOD_NewInternal();
if (module == NULL) {
return SECFailure;
}
rv = SECMOD_LoadModule(module);
if (rv != SECSuccess) {
return rv;
}
SECMOD_SetInternalModule(module);
return rv;
}
/*
* OK there are now lots of options here, lets go through them all:
*
* configdir - base directory where all the cert, key, and module datbases live.
* certPrefix - prefix added to the beginning of the cert database example: "
* "https-server1-"
* keyPrefix - prefix added to the beginning of the key database example: "
* "https-server1-"
* secmodName - name of the security module database (usually "secmod.db").
* readOnly - Boolean: true if the databases are to be openned read only.
* nocertdb - Don't open the cert DB and key DB's, just initialize the
* Volatile certdb.
* nomoddb - Don't open the security module DB, just initialize the
* PKCS #11 module.
* forceOpen - Continue to force initializations even if the databases cannot
* be opened.
*/
static SECStatus
nss_Init(const char *configdir, const char *certPrefix, const char *keyPrefix,
const char *secmodName, PRBool readOnly, PRBool noCertDB,
PRBool noModDB, PRBool forceOpen)
{
SECStatus status;
SECStatus rv = SECFailure;
status = RNG_RNGInit(); /* initialize random number generator */
if (status != SECSuccess)
goto loser;
RNG_SystemInfoForRNG();
if (noCertDB) {
status = nss_OpenVolatileCertDB();
if (status != SECSuccess) {
goto loser;
}
} else {
status = nss_OpenCertDB(configdir, certPrefix, readOnly);
if (status != SECSuccess) {
if (!forceOpen) goto loser;
status = nss_OpenVolatileCertDB();
if (status != SECSuccess) {
goto loser;
}
}
status = nss_OpenKeyDB(configdir, keyPrefix, readOnly);
if (status != SECSuccess) {
if (!forceOpen) goto loser;
}
}
if (noModDB) {
status = nss_OpenVolatileSecModDB();
if (status != SECSuccess) {
goto loser;
}
} else {
status = nss_OpenSecModDB(configdir, secmodName);
if (status != SECSuccess) {
if (!forceOpen) goto loser;
status = nss_OpenVolatileSecModDB();
if (status != SECSuccess) {
goto loser;
}
}
}
rv = SECSuccess;
loser:
if (rv != SECSuccess)
NSS_Shutdown();
return rv;
}
SECStatus
NSS_Init(const char *configdir)
{
return nss_Init(configdir, "", "", SECMOD_DB, PR_TRUE,
PR_FALSE, PR_FALSE, PR_FALSE);
}
SECStatus
NSS_InitReadWrite(const char *configdir)
{
return nss_Init(configdir, "", "", SECMOD_DB, PR_FALSE,
PR_FALSE, PR_FALSE, PR_FALSE);
}
/*
* OK there are now lots of options here, lets go through them all:
*
* configdir - base directory where all the cert, key, and module datbases live.
* certPrefix - prefix added to the beginning of the cert database example: "
* "https-server1-"
* keyPrefix - prefix added to the beginning of the key database example: "
* "https-server1-"
* secmodName - name of the security module database (usually "secmod.db").
* flags - change the open options of NSS_Initialize as follows:
* NSS_INIT_READONLY - Open the databases read only.
* NSS_INIT_NOCERTDB - Don't open the cert DB and key DB's, just
* initialize the volatile certdb.
* NSS_INIT_NOMODDB - Don't open the security module DB, just
* initialize the PKCS #11 module.
* NSS_INIT_FORCEOPEN - Continue to force initializations even if the
* databases cannot be opened.
*/
SECStatus
NSS_Initialize(const char *configdir, const char *certPrefix,
const char *keyPrefix, const char *secmodName, PRUint32 flags)
{
return nss_Init(configdir, certPrefix, keyPrefix, secmodName,
((flags & NSS_INIT_READONLY) == NSS_INIT_READONLY),
((flags & NSS_INIT_NOCERTDB) == NSS_INIT_NOCERTDB),
((flags & NSS_INIT_NOMODDB) == NSS_INIT_NOMODDB),
((flags & NSS_INIT_FORCEOPEN) == NSS_INIT_FORCEOPEN));
}
/*
* initialize NSS without a creating cert db's, key db's, or secmod db's.
*/
SECStatus
NSS_NoDB_Init(const char * configdir)
{
SECStatus rv = SECSuccess;
rv = RNG_RNGInit();
if (rv != SECSuccess) {
return rv;
}
RNG_SystemInfoForRNG();
rv = nss_OpenVolatileCertDB();
if (rv != SECSuccess) {
return rv;
}
rv = nss_OpenVolatileSecModDB();
return rv;
}
void
NSS_Shutdown(void)
{
CERTCertDBHandle *certHandle;
SECKEYKeyDBHandle *keyHandle;
SECMOD_Shutdown();
PR_FREEIF(secmodname);
certHandle = CERT_GetDefaultCertDB();
if (certHandle)
CERT_ClosePermCertDB(certHandle);
CERT_SetDefaultCertDB(NULL);
keyHandle = SECKEY_GetDefaultKeyDB();
if (keyHandle)
SECKEY_CloseKeyDB(keyHandle);
SECKEY_SetDefaultKeyDB(NULL);
}
extern const char __nss_base_rcsid[];
extern const char __nss_base_sccsid[];
PRBool
NSS_VersionCheck(const char *importedVersion)
{
/*
* This is the secret handshake algorithm.
*
* This release has a simple version compatibility
* check algorithm. This release is not backward
* compatible with previous major releases. It is
* not compatible with future major, minor, or
* patch releases.
*/
int vmajor = 0, vminor = 0, vpatch = 0;
const char *ptr = importedVersion;
volatile char c; /* force a reference that won't get optimized away */
c = __nss_base_rcsid[0] + __nss_base_sccsid[0];
while (isdigit(*ptr)) {
vmajor = 10 * vmajor + *ptr - '0';
ptr++;
}
if (*ptr == '.') {
ptr++;
while (isdigit(*ptr)) {
vminor = 10 * vminor + *ptr - '0';
ptr++;
}
if (*ptr == '.') {
ptr++;
while (isdigit(*ptr)) {
vpatch = 10 * vpatch + *ptr - '0';
ptr++;
}
}
}
if (vmajor != NSS_VMAJOR) {
return PR_FALSE;
}
if (vmajor == NSS_VMAJOR && vminor > NSS_VMINOR) {
return PR_FALSE;
}
if (vmajor == NSS_VMAJOR && vminor == NSS_VMINOR && vpatch > NSS_VPATCH) {
return PR_FALSE;
}
/* Check dependent libraries */
if (PR_VersionCheck(PR_VERSION) == PR_FALSE) {
return PR_FALSE;
}
return PR_TRUE;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,465 +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.
*
* PKCS #11 Wrapper functions which handles authenticating to the card's
* choosing the best cards, etc.
*/
#ifndef _PK11FUNC_H_
#define _PK11FUNC_H_
#include "plarena.h"
#include "seccomon.h"
#include "secoidt.h"
#include "secdert.h"
#include "keyt.h"
#include "certt.h"
#include "pkcs11t.h"
#include "secmodt.h"
#include "seccomon.h"
#include "pkcs7t.h"
#include "cmsreclist.h"
SEC_BEGIN_PROTOS
/************************************************************
* Generic Slot Lists Management
************************************************************/
PK11SlotList * PK11_NewSlotList(void);
void PK11_FreeSlotList(PK11SlotList *list);
SECStatus PK11_AddSlotToList(PK11SlotList *list,PK11SlotInfo *slot);
SECStatus PK11_DeleteSlotFromList(PK11SlotList *list,PK11SlotListElement *le);
PK11SlotListElement * PK11_GetFirstSafe(PK11SlotList *list);
PK11SlotListElement *PK11_GetNextSafe(PK11SlotList *list,
PK11SlotListElement *le, PRBool restart);
PK11SlotListElement *PK11_FindSlotElement(PK11SlotList *list,
PK11SlotInfo *slot);
/************************************************************
* Generic Slot Management
************************************************************/
PK11SlotInfo *PK11_ReferenceSlot(PK11SlotInfo *slot);
PK11SlotInfo *PK11_FindSlotByID(SECMODModuleID modID,CK_SLOT_ID slotID);
void PK11_FreeSlot(PK11SlotInfo *slot);
SECStatus PK11_DestroyObject(PK11SlotInfo *slot,CK_OBJECT_HANDLE object);
SECStatus PK11_DestroyTokenObject(PK11SlotInfo *slot,CK_OBJECT_HANDLE object);
CK_OBJECT_HANDLE PK11_CopyKey(PK11SlotInfo *slot, CK_OBJECT_HANDLE srcObject);
SECStatus PK11_ReadAttribute(PK11SlotInfo *slot, CK_OBJECT_HANDLE id,
CK_ATTRIBUTE_TYPE type, PRArenaPool *arena, SECItem *result);
CK_ULONG PK11_ReadULongAttribute(PK11SlotInfo *slot, CK_OBJECT_HANDLE id,
CK_ATTRIBUTE_TYPE type);
PK11SlotInfo *PK11_GetInternalKeySlot(void);
PK11SlotInfo *PK11_GetInternalSlot(void);
char * PK11_MakeString(PRArenaPool *arena,char *space,char *staticSring,
int stringLen);
int PK11_MapError(CK_RV error);
CK_SESSION_HANDLE PK11_GetRWSession(PK11SlotInfo *slot);
void PK11_RestoreROSession(PK11SlotInfo *slot,CK_SESSION_HANDLE rwsession);
PRBool PK11_RWSessionHasLock(PK11SlotInfo *slot,
CK_SESSION_HANDLE session_handle);
PK11SlotInfo *PK11_NewSlotInfo(void);
SECStatus PK11_Logout(PK11SlotInfo *slot);
void PK11_LogoutAll(void);
void PK11_EnterSlotMonitor(PK11SlotInfo *);
void PK11_ExitSlotMonitor(PK11SlotInfo *);
void PK11_CleanKeyList(PK11SlotInfo *slot);
/************************************************************
* Slot Password Management
************************************************************/
void PK11_SetSlotPWValues(PK11SlotInfo *slot,int askpw, int timeout);
void PK11_GetSlotPWValues(PK11SlotInfo *slot,int *askpw, int *timeout);
SECStatus PK11_CheckSSOPassword(PK11SlotInfo *slot, char *ssopw);
SECStatus PK11_CheckUserPassword(PK11SlotInfo *slot,char *pw);
SECStatus PK11_DoPassword(PK11SlotInfo *slot, PRBool loadCerts, void *wincx);
PRBool PK11_IsLoggedIn(PK11SlotInfo *slot, void *wincx);
SECStatus PK11_VerifyPW(PK11SlotInfo *slot,char *pw);
SECStatus PK11_InitPin(PK11SlotInfo *slot,char *ssopw, char *pk11_userpwd);
SECStatus PK11_ChangePW(PK11SlotInfo *slot,char *oldpw, char *newpw);
void PK11_HandlePasswordCheck(PK11SlotInfo *slot,void *wincx);
void PK11_SetPasswordFunc(PK11PasswordFunc func);
void PK11_SetVerifyPasswordFunc(PK11VerifyPasswordFunc func);
void PK11_SetIsLoggedInFunc(PK11IsLoggedInFunc func);
int PK11_GetMinimumPwdLength(PK11SlotInfo *slot);
SECStatus PK11_ResetToken(PK11SlotInfo *slot, char *sso_pwd);
/************************************************************
* Manage the built-In Slot Lists
************************************************************/
SECStatus PK11_InitSlotLists(void);
void PK11_DestroySlotLists(void);
PK11SlotList *PK11_GetSlotList(CK_MECHANISM_TYPE type);
void PK11_LoadSlotList(PK11SlotInfo *slot, PK11PreSlotInfo *psi, int count);
void PK11_ClearSlotList(PK11SlotInfo *slot);
/******************************************************************
* Slot initialization
******************************************************************/
PRBool PK11_VerifyMechanism(PK11SlotInfo *slot,PK11SlotInfo *intern,
CK_MECHANISM_TYPE mech, SECItem *data, SECItem *iv);
PRBool PK11_VerifySlotMechanisms(PK11SlotInfo *slot);
SECStatus pk11_CheckVerifyTest(PK11SlotInfo *slot);
SECStatus PK11_InitToken(PK11SlotInfo *slot, PRBool loadCerts);
SECStatus PK11_Authenticate(PK11SlotInfo *slot, PRBool loadCerts, void *wincx);
void PK11_InitSlot(SECMODModule *mod,CK_SLOT_ID slotID,PK11SlotInfo *slot);
/******************************************************************
* Slot info functions
******************************************************************/
PK11SlotInfo *PK11_FindSlotByName(char *name);
PK11SlotInfo *PK11_FindSlotBySerial(char *serial);
PRBool PK11_IsReadOnly(PK11SlotInfo *slot);
PRBool PK11_IsInternal(PK11SlotInfo *slot);
char * PK11_GetTokenName(PK11SlotInfo *slot);
char * PK11_GetSlotName(PK11SlotInfo *slot);
PRBool PK11_NeedLogin(PK11SlotInfo *slot);
PRBool PK11_IsFriendly(PK11SlotInfo *slot);
PRBool PK11_IsHW(PK11SlotInfo *slot);
PRBool PK11_NeedUserInit(PK11SlotInfo *slot);
int PK11_GetSlotSeries(PK11SlotInfo *slot);
int PK11_GetCurrentWrapIndex(PK11SlotInfo *slot);
unsigned long PK11_GetDefaultFlags(PK11SlotInfo *slot);
CK_SLOT_ID PK11_GetSlotID(PK11SlotInfo *slot);
SECMODModuleID PK11_GetModuleID(PK11SlotInfo *slot);
SECStatus PK11_GetSlotInfo(PK11SlotInfo *slot, CK_SLOT_INFO *info);
SECStatus PK11_GetTokenInfo(PK11SlotInfo *slot, CK_TOKEN_INFO *info);
PRBool PK11_IsDisabled(PK11SlotInfo *slot);
PRBool PK11_HasRootCerts(PK11SlotInfo *slot);
PK11DisableReasons PK11_GetDisabledReason(PK11SlotInfo *slot);
/* Prevents the slot from being used, and set disable reason to user-disable */
/* NOTE: Mechanisms that were ON continue to stay ON */
/* Therefore, when the slot is enabled, it will remember */
/* what mechanisms needs to be turned on */
PRBool PK11_UserDisableSlot(PK11SlotInfo *slot);
/* Allow all mechanisms that are ON before UserDisableSlot() */
/* was called to be available again */
PRBool PK11_UserEnableSlot(PK11SlotInfo *slot);
PRBool PK11_NeedPWInit(void);
PRBool PK11_NeedPWInitForSlot(PK11SlotInfo *slot);
PRBool PK11_TokenExists(CK_MECHANISM_TYPE);
SECStatus PK11_GetModInfo(SECMODModule *mod, CK_INFO *info);
PRBool PK11_IsFIPS(void);
SECMODModule *PK11_GetModule(PK11SlotInfo *slot);
/*********************************************************************
* Slot mapping utility functions.
*********************************************************************/
PRBool PK11_IsPresent(PK11SlotInfo *slot);
PRBool PK11_DoesMechanism(PK11SlotInfo *slot, CK_MECHANISM_TYPE type);
PK11SlotList * PK11_GetAllTokens(CK_MECHANISM_TYPE type,PRBool needRW,
PRBool loadCerts, void *wincx);
PK11SlotList * PK11_GetPrivateKeyTokens(CK_MECHANISM_TYPE type,
PRBool needRW,void *wincx);
PK11SlotInfo *PK11_GetBestSlotMultiple(CK_MECHANISM_TYPE *type, int count,
void *wincx);
PK11SlotInfo *PK11_GetBestSlot(CK_MECHANISM_TYPE type, void *wincx);
CK_MECHANISM_TYPE PK11_GetBestWrapMechanism(PK11SlotInfo *slot);
int PK11_GetBestKeyLength(PK11SlotInfo *slot, CK_MECHANISM_TYPE type);
/*********************************************************************
* Mechanism Mapping functions
*********************************************************************/
void PK11_AddMechanismEntry(CK_MECHANISM_TYPE type, CK_KEY_TYPE key,
CK_MECHANISM_TYPE keygen, int ivLen, int blocksize);
CK_MECHANISM_TYPE PK11_GetKeyType(CK_MECHANISM_TYPE type,unsigned long len);
CK_MECHANISM_TYPE PK11_GetKeyGen(CK_MECHANISM_TYPE type);
int PK11_GetBlockSize(CK_MECHANISM_TYPE type,SECItem *params);
int PK11_GetIVLength(CK_MECHANISM_TYPE type);
SECItem *PK11_ParamFromIV(CK_MECHANISM_TYPE type,SECItem *iv);
unsigned char *PK11_IVFromParam(CK_MECHANISM_TYPE type,SECItem *param,int *len);
SECItem * PK11_BlockData(SECItem *data,unsigned long size);
/* PKCS #11 to DER mapping functions */
SECItem *PK11_ParamFromAlgid(SECAlgorithmID *algid);
SECItem *PK11_GenerateNewParam(CK_MECHANISM_TYPE, PK11SymKey *);
CK_MECHANISM_TYPE PK11_AlgtagToMechanism(SECOidTag algTag);
SECOidTag PK11_MechanismToAlgtag(CK_MECHANISM_TYPE type);
SECOidTag PK11_FortezzaMapSig(SECOidTag algTag);
SECStatus PK11_ParamToAlgid(SECOidTag algtag, SECItem *param,
PRArenaPool *arena, SECAlgorithmID *algid);
SECStatus PK11_SeedRandom(PK11SlotInfo *,unsigned char *data,int len);
SECStatus PK11_RandomUpdate(void *data, size_t bytes);
SECStatus PK11_GenerateRandom(unsigned char *data,int len);
CK_RV PK11_MapPBEMechanismToCryptoMechanism(CK_MECHANISM_PTR pPBEMechanism,
CK_MECHANISM_PTR pCryptoMechanism,
SECItem *pbe_pwd, PRBool bad3DES);
CK_MECHANISM_TYPE PK11_GetPadMechanism(CK_MECHANISM_TYPE);
/**********************************************************************
* Symetric, Public, and Private Keys
**********************************************************************/
PK11SymKey *PK11_CreateSymKey(PK11SlotInfo *slot,
CK_MECHANISM_TYPE type, void *wincx);
void PK11_FreeSymKey(PK11SymKey *key);
PK11SymKey *PK11_ReferenceSymKey(PK11SymKey *symKey);
PK11SymKey *PK11_ImportSymKey(PK11SlotInfo *slot, CK_MECHANISM_TYPE type,
PK11Origin origin, CK_ATTRIBUTE_TYPE operation, SECItem *key,void *wincx);
PK11SymKey *PK11_SymKeyFromHandle(PK11SlotInfo *slot, PK11SymKey *parent,
PK11Origin origin, CK_MECHANISM_TYPE type, CK_OBJECT_HANDLE keyID,
PRBool owner, void *wincx);
PK11SymKey *PK11_GetWrapKey(PK11SlotInfo *slot, int wrap,
CK_MECHANISM_TYPE type,int series, void *wincx);
void PK11_SetWrapKey(PK11SlotInfo *slot, int wrap, PK11SymKey *wrapKey);
CK_MECHANISM_TYPE PK11_GetMechanism(PK11SymKey *symKey);
CK_OBJECT_HANDLE PK11_ImportPublicKey(PK11SlotInfo *slot,
SECKEYPublicKey *pubKey, PRBool isToken);
PK11SymKey *PK11_KeyGen(PK11SlotInfo *slot,CK_MECHANISM_TYPE type,
SECItem *param, int keySize,void *wincx);
/* Key Generation specialized for SDR (fixed DES3 key) */
PK11SymKey *PK11_GenDES3TokenKey(PK11SlotInfo *slot, SECItem *keyid, void *cx);
SECStatus PK11_PubWrapSymKey(CK_MECHANISM_TYPE type, SECKEYPublicKey *pubKey,
PK11SymKey *symKey, SECItem *wrappedKey);
SECStatus PK11_WrapSymKey(CK_MECHANISM_TYPE type, SECItem *params,
PK11SymKey *wrappingKey, PK11SymKey *symKey, SECItem *wrappedKey);
PK11SymKey *PK11_Derive(PK11SymKey *baseKey, CK_MECHANISM_TYPE mechanism,
SECItem *param, CK_MECHANISM_TYPE target,
CK_ATTRIBUTE_TYPE operation, int keySize);
PK11SymKey *PK11_DeriveWithFlags( PK11SymKey *baseKey,
CK_MECHANISM_TYPE derive, SECItem *param, CK_MECHANISM_TYPE target,
CK_ATTRIBUTE_TYPE operation, int keySize, CK_FLAGS flags);
PK11SymKey *PK11_PubDerive( SECKEYPrivateKey *privKey,
SECKEYPublicKey *pubKey, PRBool isSender, SECItem *randomA, SECItem *randomB,
CK_MECHANISM_TYPE derive, CK_MECHANISM_TYPE target,
CK_ATTRIBUTE_TYPE operation, int keySize,void *wincx) ;
PK11SymKey *PK11_UnwrapSymKey(PK11SymKey *key,
CK_MECHANISM_TYPE wraptype, SECItem *param, SECItem *wrapppedKey,
CK_MECHANISM_TYPE target, CK_ATTRIBUTE_TYPE operation, int keySize);
PK11SymKey *PK11_UnwrapSymKeyWithFlags(PK11SymKey *wrappingKey,
CK_MECHANISM_TYPE wrapType, SECItem *param, SECItem *wrappedKey,
CK_MECHANISM_TYPE target, CK_ATTRIBUTE_TYPE operation, int keySize,
CK_FLAGS flags);
PK11SymKey *PK11_PubUnwrapSymKey(SECKEYPrivateKey *key, SECItem *wrapppedKey,
CK_MECHANISM_TYPE target, CK_ATTRIBUTE_TYPE operation, int keySize);
PK11SymKey *PK11_FindFixedKey(PK11SlotInfo *slot, CK_MECHANISM_TYPE type,
SECItem *keyID, void *wincx);
SECStatus PK11_DeleteTokenPrivateKey(SECKEYPrivateKey *privKey);
SECStatus PK11_DeleteTokenCertAndKey(CERTCertificate *cert,void *wincx);
/* size to hold key in bytes */
unsigned int PK11_GetKeyLength(PK11SymKey *key);
/* size of actual secret parts of key in bits */
/* algid is because RC4 strength is determined by the effective bits as well
* as the key bits */
unsigned int PK11_GetKeyStrength(PK11SymKey *key,SECAlgorithmID *algid);
SECStatus PK11_ExtractKeyValue(PK11SymKey *symKey);
SECItem * PK11_GetKeyData(PK11SymKey *symKey);
PK11SlotInfo * PK11_GetSlotFromKey(PK11SymKey *symKey);
void *PK11_GetWindow(PK11SymKey *symKey);
SECKEYPrivateKey *PK11_GenerateKeyPair(PK11SlotInfo *slot,
CK_MECHANISM_TYPE type, void *param, SECKEYPublicKey **pubk,
PRBool isPerm, PRBool isSensitive, void *wincx);
SECKEYPrivateKey *PK11_MakePrivKey(PK11SlotInfo *slot, KeyType keyType,
PRBool isTemp, CK_OBJECT_HANDLE privID, void *wincx);
SECKEYPrivateKey * PK11_FindPrivateKeyFromCert(PK11SlotInfo *slot,
CERTCertificate *cert, void *wincx);
SECKEYPrivateKey * PK11_FindKeyByAnyCert(CERTCertificate *cert, void *wincx);
SECKEYPrivateKey * PK11_FindKeyByKeyID(PK11SlotInfo *slot, SECItem *keyID,
void *wincx);
CK_OBJECT_HANDLE PK11_FindObjectForCert(CERTCertificate *cert,
void *wincx, PK11SlotInfo **pSlot);
int PK11_GetPrivateModulusLen(SECKEYPrivateKey *key);
SECStatus PK11_PubDecryptRaw(SECKEYPrivateKey *key, unsigned char *data,
unsigned *outLen, unsigned int maxLen, unsigned char *enc, unsigned encLen);
/* The encrypt version of the above function */
SECStatus PK11_PubEncryptRaw(SECKEYPublicKey *key, unsigned char *enc,
unsigned char *data, unsigned dataLen, void *wincx);
SECStatus PK11_ImportPrivateKeyInfo(PK11SlotInfo *slot,
SECKEYPrivateKeyInfo *pki, SECItem *nickname,
SECItem *publicValue, PRBool isPerm, PRBool isPrivate,
unsigned int usage, void *wincx);
SECStatus PK11_ImportEncryptedPrivateKeyInfo(PK11SlotInfo *slot,
SECKEYEncryptedPrivateKeyInfo *epki, SECItem *pwitem,
SECItem *nickname, SECItem *publicValue, PRBool isPerm,
PRBool isPrivate, KeyType type,
unsigned int usage, void *wincx);
SECKEYPrivateKeyInfo *PK11_ExportPrivateKeyInfo(
CERTCertificate *cert, void *wincx);
SECKEYEncryptedPrivateKeyInfo *PK11_ExportEncryptedPrivateKeyInfo(
PK11SlotInfo *slot, SECOidTag algTag, SECItem *pwitem,
CERTCertificate *cert, int iteration, void *wincx);
SECKEYPrivateKey *PK11_FindKeyByDERCert(PK11SlotInfo *slot,
CERTCertificate *cert, void *wincx);
SECKEYPublicKey *PK11_MakeKEAPubKey(unsigned char *data, int length);
SECStatus PK11_DigestKey(PK11Context *context, PK11SymKey *key);
PRBool PK11_VerifyKeyOK(PK11SymKey *key);
SECKEYPrivateKey *PK11_UnwrapPrivKey(PK11SlotInfo *slot,
PK11SymKey *wrappingKey, CK_MECHANISM_TYPE wrapType,
SECItem *param, SECItem *wrappedKey, SECItem *label,
SECItem *publicValue, PRBool token, PRBool sensitive,
CK_KEY_TYPE keyType, CK_ATTRIBUTE_TYPE *usage, int usageCount,
void *wincx);
SECStatus PK11_WrapPrivKey(PK11SlotInfo *slot, PK11SymKey *wrappingKey,
SECKEYPrivateKey *privKey, CK_MECHANISM_TYPE wrapType,
SECItem *param, SECItem *wrappedKey, void *wincx);
PK11SymKey * pk11_CopyToSlot(PK11SlotInfo *slot,CK_MECHANISM_TYPE type,
CK_ATTRIBUTE_TYPE operation, PK11SymKey *symKey);
SECItem *PK11_GetKeyIDFromCert(CERTCertificate *cert, void *wincx);
SECItem * PK11_GetKeyIDFromPrivateKey(SECKEYPrivateKey *key, void *wincx);
/**********************************************************************
* Certs
**********************************************************************/
SECItem *PK11_MakeIDFromPubKey(SECItem *pubKeyData);
CERTCertificate *PK11_GetCertFromPrivateKey(SECKEYPrivateKey *privKey);
SECStatus PK11_TraverseSlotCerts(
SECStatus(* callback)(CERTCertificate*,SECItem *,void *),
void *arg, void *wincx);
CERTCertificate * PK11_FindCertFromNickname(char *nickname, void *wincx);
CERTCertList * PK11_FindCertsFromNickname(char *nickname, void *wincx);
SECKEYPrivateKey * PK11_FindPrivateKeyFromNickname(char *nickname, void *wincx);
PK11SlotInfo *PK11_ImportCertForKey(CERTCertificate *cert, char *nickname,
void *wincx);
PK11SlotInfo *PK11_ImportDERCertForKey(SECItem *derCert, char *nickname,
void *wincx);
CK_OBJECT_HANDLE * PK11_FindObjectsFromNickname(char *nickname,
PK11SlotInfo **slotptr, CK_OBJECT_CLASS objclass, int *returnCount,
void *wincx);
PK11SlotInfo *PK11_KeyForCertExists(CERTCertificate *cert,
CK_OBJECT_HANDLE *keyPtr, void *wincx);
PK11SlotInfo *PK11_KeyForDERCertExists(SECItem *derCert,
CK_OBJECT_HANDLE *keyPtr, void *wincx);
CK_OBJECT_HANDLE PK11_MatchItem(PK11SlotInfo *slot,CK_OBJECT_HANDLE peer,
CK_OBJECT_CLASS o_class);
CERTCertificate * PK11_FindCertByIssuerAndSN(PK11SlotInfo **slot,
CERTIssuerAndSN *sn, void *wincx);
CERTCertificate * PK11_FindCertAndKeyByRecipientList(PK11SlotInfo **slot,
SEC_PKCS7RecipientInfo **array, SEC_PKCS7RecipientInfo **rip,
SECKEYPrivateKey**privKey, void *wincx);
int PK11_FindCertAndKeyByRecipientListNew(NSSCMSRecipient **recipientlist,
void *wincx);
CK_BBOOL PK11_HasAttributeSet( PK11SlotInfo *slot,
CK_OBJECT_HANDLE id,
CK_ATTRIBUTE_TYPE type );
CK_RV PK11_GetAttributes(PRArenaPool *arena,PK11SlotInfo *slot,
CK_OBJECT_HANDLE obj,CK_ATTRIBUTE *attr, int count);
int PK11_NumberCertsForCertSubject(CERTCertificate *cert);
SECStatus PK11_TraverseCertsForSubject(CERTCertificate *cert,
SECStatus(*callback)(CERTCertificate *, void *), void *arg);
SECStatus PK11_TraverseCertsForSubjectInSlot(CERTCertificate *cert,
PK11SlotInfo *slot, SECStatus(*callback)(CERTCertificate *, void *),
void *arg);
CERTCertificate *PK11_FindCertFromDERCert(PK11SlotInfo *slot,
CERTCertificate *cert, void *wincx);
CERTCertificate *PK11_FindCertFromDERSubjectAndNickname(
PK11SlotInfo *slot,
CERTCertificate *cert, char *nickname,
void *wincx);
SECStatus PK11_ImportCertForKeyToSlot(PK11SlotInfo *slot, CERTCertificate *cert,
char *nickname, PRBool addUsage,
void *wincx);
CERTCertificate *PK11_FindBestKEAMatch(CERTCertificate *serverCert,void *wincx);
SECStatus PK11_GetKEAMatchedCerts(PK11SlotInfo *slot1,
PK11SlotInfo *slot2, CERTCertificate **cert1, CERTCertificate **cert2);
PRBool PK11_FortezzaHasKEA(CERTCertificate *cert);
CK_OBJECT_HANDLE PK11_FindCertInSlot(PK11SlotInfo *slot, CERTCertificate *cert,
void *wincx);
SECStatus PK11_TraverseCertsForNicknameInSlot(SECItem *nickname,
PK11SlotInfo *slot, SECStatus(*callback)(CERTCertificate *, void *),
void *arg);
SECStatus PK11_TraverseCertsInSlot(PK11SlotInfo *slot,
SECStatus(* callback)(CERTCertificate*, void *), void *arg);
CERTCertList *
PK11_ListCerts(PK11CertListType type, void *pwarg);
/**********************************************************************
* Sign/Verify
**********************************************************************/
int PK11_SignatureLen(SECKEYPrivateKey *key);
PK11SlotInfo * PK11_GetSlotFromPrivateKey(SECKEYPrivateKey *key);
SECStatus PK11_Sign(SECKEYPrivateKey *key, SECItem *sig, SECItem *hash);
SECStatus PK11_VerifyRecover(SECKEYPublicKey *key, SECItem *sig,
SECItem *dsig, void * wincx);
SECStatus PK11_Verify(SECKEYPublicKey *key, SECItem *sig,
SECItem *hash, void *wincx);
/**********************************************************************
* Crypto Contexts
**********************************************************************/
void PK11_DestroyContext(PK11Context *context, PRBool freeit);
PK11Context * PK11_CreateContextByRawKey(PK11SlotInfo *slot,
CK_MECHANISM_TYPE type, PK11Origin origin, CK_ATTRIBUTE_TYPE operation,
SECItem *key, SECItem *param, void *wincx);
PK11Context *PK11_CreateContextBySymKey(CK_MECHANISM_TYPE type,
CK_ATTRIBUTE_TYPE operation, PK11SymKey *symKey, SECItem *param);
PK11Context *PK11_CreateDigestContext(SECOidTag hashAlg);
PK11Context *PK11_CloneContext(PK11Context *old);
SECStatus PK11_DigestBegin(PK11Context *cx);
SECStatus PK11_HashBuf(SECOidTag hashAlg, unsigned char *out, unsigned char *in,
int32 len);
SECStatus PK11_DigestOp(PK11Context *context, const unsigned char *in,
unsigned len);
SECStatus PK11_CipherOp(PK11Context *context, unsigned char * out, int *outlen,
int maxout, unsigned char *in, int inlen);
SECStatus PK11_Finalize(PK11Context *context);
SECStatus PK11_DigestFinal(PK11Context *context, unsigned char *data,
unsigned int *outLen, unsigned int length);
PRBool PK11_HashOK(SECOidTag hashAlg);
SECStatus PK11_SaveContext(PK11Context *cx,unsigned char *save,
int *len, int saveLength);
SECStatus PK11_RestoreContext(PK11Context *cx,unsigned char *save,int len);
SECStatus PK11_GenerateFortezzaIV(PK11SymKey *symKey,unsigned char *iv,int len);
SECStatus PK11_ReadSlotCerts(PK11SlotInfo *slot);
void PK11_FreeSlotCerts(PK11SlotInfo *slot);
void PK11_SetFortezzaHack(PK11SymKey *symKey) ;
/**********************************************************************
* PBE functions
**********************************************************************/
SECAlgorithmID *
PK11_CreatePBEAlgorithmID(SECOidTag algorithm, int iteration, SECItem *salt);
PK11SymKey *
PK11_PBEKeyGen(PK11SlotInfo *slot, SECAlgorithmID *algid, SECItem *pwitem,
PRBool faulty3DES, void *wincx);
SECItem *
PK11_GetPBEIV(SECAlgorithmID *algid, SECItem *pwitem);
/**********************************************************************
* New fucntions which are already depricated....
**********************************************************************/
SECItem *
PK11GetLowLevelKeyIDForCert(PK11SlotInfo *slot,
CERTCertificate *cert, void *pwarg);
SECItem *
PK11GetLowLevelKeyIDForPrivateKey(SECKEYPrivateKey *key);
SEC_END_PROTOS
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,182 +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.
*
* Definition of Security Module Data Structure. There is a separate data
* structure for each loaded PKCS #11 module.
*/
#ifndef _SECMODT_H_
#define _SECMODT_H_ 1
/* PKCS11 needs to be included */
typedef struct SECMODModuleStr SECMODModule;
typedef struct SECMODModuleListStr SECMODModuleList;
typedef struct SECMODListLockStr SECMODListLock; /* defined in secmodi.h */
typedef struct PK11SlotInfoStr PK11SlotInfo; /* defined in secmodti.h */
typedef struct PK11PreSlotInfoStr PK11PreSlotInfo; /* defined in secmodti.h */
typedef struct PK11SymKeyStr PK11SymKey; /* defined in secmodti.h */
typedef struct PK11ContextStr PK11Context; /* defined in secmodti.h */
typedef struct PK11SlotListStr PK11SlotList;
typedef struct PK11SlotListElementStr PK11SlotListElement;
typedef struct PK11RSAGenParamsStr PK11RSAGenParams;
typedef unsigned long SECMODModuleID;
typedef struct PK11DefaultArrayEntryStr PK11DefaultArrayEntry;
struct SECMODModuleStr {
PRArenaPool *arena;
PRBool internal; /* true of internally linked modules, false
* for the loaded modules */
PRBool loaded; /* Set to true if module has been loaded */
PRBool isFIPS; /* Set to true if module is finst internal */
char *dllName; /* name of the shared library which implements
* this module */
char *commonName; /* name of the module to display to the user */
void *library; /* pointer to the library. opaque. used only by
* pk11load.c */
void *functionList; /* The PKCS #11 function table */
void *refLock; /* only used pk11db.c */
int refCount; /* Module reference count */
PK11SlotInfo **slots; /* array of slot points attatched to this mod*/
int slotCount; /* count of slot in above array */
PK11PreSlotInfo *slotInfo; /* special info about slots default settings */
int slotInfoCount; /* count */
SECMODModuleID moduleID; /* ID so we can find this module again */
PRBool isThreadSafe;
unsigned long ssl[2]; /* SSL cipher enable flags */
};
struct SECMODModuleListStr {
SECMODModuleList *next;
SECMODModule *module;
};
struct PK11SlotListStr {
PK11SlotListElement *head;
PK11SlotListElement *tail;
void *lock;
};
struct PK11SlotListElementStr {
PK11SlotListElement *next;
PK11SlotListElement *prev;
PK11SlotInfo *slot;
int refCount;
};
struct PK11RSAGenParamsStr {
int keySizeInBits;
unsigned long pe;
};
typedef enum {
PK11CertListUnique = 0,
PK11CertListUser = 1,
PK11CertListRootUnique = 2
} PK11CertListType;
/*
* Entry into the Array which lists all the legal bits for the default flags
* in the slot, their definition, and the PKCS #11 mechanism the represent
* Always Statically allocated.
*/
struct PK11DefaultArrayEntryStr {
char *name;
unsigned long flag;
unsigned long mechanism; /* this is a long so we don't include the
* whole pkcs 11 world to use this header */
};
#define SECMOD_RSA_FLAG 0x00000001L
#define SECMOD_DSA_FLAG 0x00000002L
#define SECMOD_RC2_FLAG 0x00000004L
#define SECMOD_RC4_FLAG 0x00000008L
#define SECMOD_DES_FLAG 0x00000010L
#define SECMOD_DH_FLAG 0x00000020L
#define SECMOD_FORTEZZA_FLAG 0x00000040L
#define SECMOD_RC5_FLAG 0x00000080L
#define SECMOD_SHA1_FLAG 0x00000100L
#define SECMOD_MD5_FLAG 0x00000200L
#define SECMOD_MD2_FLAG 0x00000400L
#define SECMOD_SSL_FLAG 0x00000800L
#define SECMOD_TLS_FLAG 0x00001000L
#define SECMOD_AES_FLAG 0x00002000L
/* reserved bit for future, do not use */
#define SECMOD_RESERVED_FLAG 0X08000000L
#define SECMOD_FRIENDLY_FLAG 0x10000000L
#define SECMOD_RANDOM_FLAG 0x80000000L
/* need to make SECMOD and PK11 prefixes consistant. */
#define PK11_OWN_PW_DEFAULTS 0x20000000L
#define PK11_DISABLE_FLAG 0x40000000L
/* FAKE PKCS #11 defines */
#define CKM_FAKE_RANDOM 0x80000efeL
#define CKM_INVALID_MECHANISM 0xffffffffL
#define CKA_DIGEST 0x81000000L
#define CK_INVALID_KEY 0
#define CK_INVALID_SESSION 0
/* Cryptographic module types */
#define SECMOD_EXTERNAL 0 /* external module */
#define SECMOD_INTERNAL 1 /* internal default module */
#define SECMOD_FIPS 2 /* internal fips module */
/*
* What is the origin of a given Key. Normally this doesn't matter, but
* the fortezza code needs to know if it needs to invoke the SSL3 fortezza
* hack.
*/
typedef enum {
PK11_OriginNULL = 0, /* There is not key, it's a null SymKey */
PK11_OriginDerive = 1, /* Key was derived from some other key */
PK11_OriginGenerated = 2, /* Key was generated (also PBE keys) */
PK11_OriginFortezzaHack = 3,/* Key was marked for fortezza hack */
PK11_OriginUnwrap = 4 /* Key was unwrapped or decrypted */
} PK11Origin;
/* PKCS #11 disable reasons */
typedef enum {
PK11_DIS_NONE = 0,
PK11_DIS_USER_SELECTED = 1,
PK11_DIS_COULD_NOT_INIT_TOKEN = 2,
PK11_DIS_TOKEN_VERIFY_FAILED = 3,
PK11_DIS_TOKEN_NOT_PRESENT = 4
} PK11DisableReasons;
/* function pointer type for password callback function.
* This type is passed in to PK11_SetPasswordFunc()
*/
typedef char *(*PK11PasswordFunc)(PK11SlotInfo *slot, PRBool retry, void *arg);
typedef PRBool (*PK11VerifyPasswordFunc)(PK11SlotInfo *slot, void *arg);
typedef PRBool (*PK11IsLoggedInFunc)(PK11SlotInfo *slot, void *arg);
#endif /*_SECMODT_H_ */

View File

@@ -1,177 +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) 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.
;+#
;+# OK, this file is meant to support SUN, LINUX, AIX and WINDOWS
;+# 1. For all unix platforms, the string ";-" means "remove this line"
;+# 2. For all unix platforms, the string " DATA " will be removed from any
;+# line on which it occurs.
;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
;+# On AIX, lines containing ";+" will be removed.
;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed.
;+# 5. For all unix platforms, after the above processing has taken place,
;+# all characters after the first ";" on the line will be removed.
;+# And for AIX, the first ";" will also be removed.
;+# This file is passed directly to windows. Since ';' is a comment, all UNIX
;+# directives are hidden behind ";", ";+", and ";-"
;+
;+NSS_3.2 { # NSS 3.2 release
;+ global:
LIBRARY smime3 ;-
EXPORTS ;-
NSS_CMSContentInfo_GetBulkKey;
NSS_CMSContentInfo_GetBulkKeySize;
NSS_CMSContentInfo_GetContent;
NSS_CMSContentInfo_GetContentEncAlgTag;
NSS_CMSContentInfo_GetContentTypeTag;
NSS_CMSContentInfo_SetBulkKey;
NSS_CMSContentInfo_SetContent;
NSS_CMSContentInfo_SetContentEncAlg;
NSS_CMSContentInfo_SetContent_Data;
NSS_CMSContentInfo_SetContent_DigestedData;
NSS_CMSContentInfo_SetContent_EncryptedData;
NSS_CMSContentInfo_SetContent_EnvelopedData;
NSS_CMSContentInfo_SetContent_SignedData;
NSS_CMSDEREncode;
NSS_CMSDecoder_Cancel;
NSS_CMSDecoder_Finish;
NSS_CMSDecoder_Start;
NSS_CMSDecoder_Update;
NSS_CMSDigestContext_Cancel;
NSS_CMSDigestContext_FinishMultiple;
NSS_CMSDigestContext_FinishSingle;
NSS_CMSDigestContext_StartMultiple;
NSS_CMSDigestContext_StartSingle;
NSS_CMSDigestContext_Update;
NSS_CMSDigestedData_Create;
NSS_CMSDigestedData_Destroy;
NSS_CMSDigestedData_GetContentInfo;
NSS_CMSEncoder_Cancel;
NSS_CMSEncoder_Finish;
NSS_CMSEncoder_Start;
NSS_CMSEncoder_Update;
NSS_CMSEncryptedData_Create;
NSS_CMSEncryptedData_Destroy;
NSS_CMSEncryptedData_GetContentInfo;
NSS_CMSEnvelopedData_AddRecipient;
NSS_CMSEnvelopedData_Create;
NSS_CMSEnvelopedData_Destroy;
NSS_CMSEnvelopedData_GetContentInfo;
NSS_CMSMessage_ContentLevel;
NSS_CMSMessage_ContentLevelCount;
NSS_CMSMessage_Copy;
NSS_CMSMessage_Create;
NSS_CMSMessage_CreateFromDER;
NSS_CMSMessage_Destroy;
NSS_CMSMessage_GetContent;
NSS_CMSMessage_GetContentInfo;
NSS_CMSRecipientInfo_Create;
NSS_CMSRecipientInfo_Destroy;
NSS_CMSSignedData_AddCertChain;
NSS_CMSSignedData_AddCertList;
NSS_CMSSignedData_AddCertificate;
NSS_CMSSignedData_AddDigest;
NSS_CMSSignedData_AddSignerInfo;
NSS_CMSSignedData_Create;
NSS_CMSSignedData_CreateCertsOnly;
NSS_CMSSignedData_Destroy;
NSS_CMSSignedData_GetContentInfo;
NSS_CMSSignedData_GetDigestAlgs;
NSS_CMSSignedData_GetSignerInfo;
NSS_CMSSignedData_HasDigests;
NSS_CMSSignedData_ImportCerts;
NSS_CMSSignedData_SetDigests;
NSS_CMSSignedData_SignerInfoCount;
NSS_CMSSignedData_VerifyCertsOnly;
NSS_CMSSignedData_VerifySignerInfo;
NSS_CMSSignerInfo_AddSMIMECaps;
NSS_CMSSignerInfo_AddSMIMEEncKeyPrefs;
NSS_CMSSignerInfo_AddSigningTime;
NSS_CMSSignerInfo_Create;
NSS_CMSSignerInfo_Destroy;
NSS_CMSSignerInfo_GetCertList;
NSS_CMSSignerInfo_GetSignerCommonName;
NSS_CMSSignerInfo_GetSignerEmailAddress;
NSS_CMSSignerInfo_GetSigningCertificate;
NSS_CMSSignerInfo_GetSigningTime;
NSS_CMSSignerInfo_GetVerificationStatus;
NSS_CMSSignerInfo_GetVersion;
NSS_CMSSignerInfo_IncludeCerts;
NSS_CMSUtil_VerificationStatusToString;
NSS_SMIMEUtil_FindBulkAlgForRecipients;
CERT_DecodeCertPackage;
SEC_PKCS7AddRecipient;
SEC_PKCS7AddSigningTime;
SEC_PKCS7ContentType;
SEC_PKCS7CreateData;
SEC_PKCS7CreateEncryptedData;
SEC_PKCS7CreateEnvelopedData;
SEC_PKCS7CreateSignedData;
SEC_PKCS7DecodeItem;
SEC_PKCS7DecoderFinish;
SEC_PKCS7DecoderStart;
SEC_PKCS7DecoderUpdate;
SEC_PKCS7DecryptContents;
SEC_PKCS7DestroyContentInfo;
SEC_PKCS7EncoderFinish;
SEC_PKCS7EncoderStart;
SEC_PKCS7EncoderUpdate;
SEC_PKCS7GetCertificateList;
SEC_PKCS7GetContent;
SEC_PKCS7GetEncryptionAlgorithm;
SEC_PKCS7IncludeCertChain;
SEC_PKCS7IsContentEmpty;
SEC_PKCS7VerifySignature;
SEC_PKCS12AddCertAndKey;
SEC_PKCS12AddPasswordIntegrity;
SEC_PKCS12CreateExportContext;
SEC_PKCS12CreatePasswordPrivSafe;
SEC_PKCS12CreateUnencryptedSafe;
SEC_PKCS12EnableCipher;
SEC_PKCS12Encode;
SEC_PKCS12DecoderImportBags;
SEC_PKCS12DecoderFinish;
SEC_PKCS12DecoderStart;
SEC_PKCS12DecoderUpdate;
SEC_PKCS12DecoderValidateBags;
SEC_PKCS12DecoderVerify;
SEC_PKCS12DestroyExportContext;
SEC_PKCS12IsEncryptionAllowed;
SEC_PKCS12SetPreferredCipher;
;+ local:
;+ *;
;+};
;+NSS_3.2.1 { # NSS 3.2.1 release
;+ global:
NSSSMIME_VersionCheck;
;+ local:
;+ *;
;+};