1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/dev/devt.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,156 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef DEVT_H 1.9 +#define DEVT_H 1.10 + 1.11 +/* 1.12 + * devt.h 1.13 + * 1.14 + * This file contains definitions for the low-level cryptoki devices. 1.15 + */ 1.16 + 1.17 +#ifndef NSSBASET_H 1.18 +#include "nssbaset.h" 1.19 +#endif /* NSSBASET_H */ 1.20 + 1.21 +#ifndef NSSPKIT_H 1.22 +#include "nsspkit.h" 1.23 +#endif /* NSSPKIT_H */ 1.24 + 1.25 +#ifndef NSSDEVT_H 1.26 +#include "nssdevt.h" 1.27 +#endif /* NSSDEVT_H */ 1.28 + 1.29 +#ifndef BASET_H 1.30 +#include "baset.h" 1.31 +#endif /* BASET_H */ 1.32 + 1.33 +#include "secmodt.h" 1.34 + 1.35 +PR_BEGIN_EXTERN_C 1.36 + 1.37 +typedef struct nssSessionStr nssSession; 1.38 + 1.39 +/* XXX until NSSTokenStr is moved */ 1.40 +struct nssDeviceBaseStr 1.41 +{ 1.42 + NSSArena *arena; 1.43 + PZLock *lock; 1.44 + PRInt32 refCount; 1.45 + NSSUTF8 *name; 1.46 + PRUint32 flags; 1.47 +}; 1.48 + 1.49 +typedef struct nssTokenObjectCacheStr nssTokenObjectCache; 1.50 + 1.51 +/* XXX until devobject.c goes away */ 1.52 +struct NSSTokenStr 1.53 +{ 1.54 + struct nssDeviceBaseStr base; 1.55 + NSSSlot *slot; /* Parent (or peer, if you will) */ 1.56 + CK_FLAGS ckFlags; /* from CK_TOKEN_INFO.flags */ 1.57 + PRUint32 flags; 1.58 + void *epv; 1.59 + nssSession *defaultSession; 1.60 + NSSTrustDomain *trustDomain; 1.61 + PRIntervalTime lastTime; 1.62 + nssTokenObjectCache *cache; 1.63 + PK11SlotInfo *pk11slot; 1.64 +}; 1.65 + 1.66 +typedef enum { 1.67 + nssSlotAskPasswordTimes_FirstTime = 0, 1.68 + nssSlotAskPasswordTimes_EveryTime = 1, 1.69 + nssSlotAskPasswordTimes_Timeout = 2 1.70 +} 1.71 +nssSlotAskPasswordTimes; 1.72 + 1.73 +struct nssSlotAuthInfoStr 1.74 +{ 1.75 + PRTime lastLogin; 1.76 + nssSlotAskPasswordTimes askTimes; 1.77 + PRIntervalTime askPasswordTimeout; 1.78 +}; 1.79 + 1.80 +struct NSSSlotStr 1.81 +{ 1.82 + struct nssDeviceBaseStr base; 1.83 + NSSModule *module; /* Parent */ 1.84 + NSSToken *token; /* Peer */ 1.85 + CK_SLOT_ID slotID; 1.86 + CK_FLAGS ckFlags; /* from CK_SLOT_INFO.flags */ 1.87 + struct nssSlotAuthInfoStr authInfo; 1.88 + PRIntervalTime lastTokenPing; 1.89 + PZLock *lock; 1.90 + void *epv; 1.91 + PK11SlotInfo *pk11slot; 1.92 +}; 1.93 + 1.94 +struct nssSessionStr 1.95 +{ 1.96 + PZLock *lock; 1.97 + CK_SESSION_HANDLE handle; 1.98 + NSSSlot *slot; 1.99 + PRBool isRW; 1.100 + PRBool ownLock; 1.101 +}; 1.102 + 1.103 +typedef enum { 1.104 + NSSCertificateType_Unknown = 0, 1.105 + NSSCertificateType_PKIX = 1 1.106 +} NSSCertificateType; 1.107 + 1.108 +typedef enum { 1.109 + nssTrustLevel_Unknown = 0, 1.110 + nssTrustLevel_NotTrusted = 1, 1.111 + nssTrustLevel_Trusted = 2, 1.112 + nssTrustLevel_TrustedDelegator = 3, 1.113 + nssTrustLevel_MustVerify = 4, 1.114 + nssTrustLevel_ValidDelegator = 5 1.115 +} nssTrustLevel; 1.116 + 1.117 +typedef struct nssCryptokiInstanceStr nssCryptokiInstance; 1.118 + 1.119 +struct nssCryptokiInstanceStr 1.120 +{ 1.121 + CK_OBJECT_HANDLE handle; 1.122 + NSSToken *token; 1.123 + PRBool isTokenObject; 1.124 + NSSUTF8 *label; 1.125 +}; 1.126 + 1.127 +typedef struct nssCryptokiInstanceStr nssCryptokiObject; 1.128 + 1.129 +typedef struct nssTokenCertSearchStr nssTokenCertSearch; 1.130 + 1.131 +typedef enum { 1.132 + nssTokenSearchType_AllObjects = 0, 1.133 + nssTokenSearchType_SessionOnly = 1, 1.134 + nssTokenSearchType_TokenOnly = 2, 1.135 + nssTokenSearchType_TokenForced = 3 1.136 +} nssTokenSearchType; 1.137 + 1.138 +struct nssTokenCertSearchStr 1.139 +{ 1.140 + nssTokenSearchType searchType; 1.141 + PRStatus (* callback)(NSSCertificate *c, void *arg); 1.142 + void *cbarg; 1.143 + nssList *cached; 1.144 + /* TODO: add a cache query callback if the list would be large 1.145 + * (traversal) 1.146 + */ 1.147 +}; 1.148 + 1.149 +struct nssSlotListStr; 1.150 +typedef struct nssSlotListStr nssSlotList; 1.151 + 1.152 +struct NSSAlgorithmAndParametersStr 1.153 +{ 1.154 + CK_MECHANISM mechanism; 1.155 +}; 1.156 + 1.157 +PR_END_EXTERN_C 1.158 + 1.159 +#endif /* DEVT_H */