security/nss/lib/dev/devm.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef DEVM_H
     6 #define DEVM_H
     8 #ifndef BASE_H
     9 #include "base.h"
    10 #endif /* BASE_H */
    12 #ifndef DEV_H
    13 #include "dev.h"
    14 #endif /* DEV_H */
    16 #ifndef DEVTM_H
    17 #include "devtm.h"
    18 #endif /* DEVTM_H */
    20 PR_BEGIN_EXTERN_C
    22 /* Shortcut to cryptoki API functions. */
    23 #define CKAPI(epv) \
    24     ((CK_FUNCTION_LIST_PTR)(epv))
    26 NSS_EXTERN void
    27 nssDevice_AddRef
    28 (
    29  struct nssDeviceBaseStr *device
    30 );
    32 NSS_EXTERN PRBool
    33 nssDevice_Destroy
    34 (
    35  struct nssDeviceBaseStr *device
    36 );
    38 NSS_EXTERN PRBool
    39 nssModule_IsThreadSafe
    40 (
    41   NSSModule *module
    42 );
    44 NSS_EXTERN PRBool
    45 nssModule_IsInternal
    46 (
    47   NSSModule *mod
    48 );
    50 NSS_EXTERN PRBool
    51 nssModule_IsModuleDBOnly
    52 (
    53   NSSModule *mod
    54 );
    56 NSS_EXTERN void *
    57 nssModule_GetCryptokiEPV
    58 (
    59   NSSModule *mod
    60 );
    62 NSS_EXTERN NSSSlot *
    63 nssSlot_Create
    64 (
    65   CK_SLOT_ID slotId,
    66   NSSModule *parent
    67 );
    69 NSS_EXTERN void *
    70 nssSlot_GetCryptokiEPV
    71 (
    72   NSSSlot *slot
    73 );
    75 NSS_EXTERN NSSToken *
    76 nssToken_Create
    77 (
    78   CK_SLOT_ID slotID,
    79   NSSSlot *peer
    80 );
    82 NSS_EXTERN void *
    83 nssToken_GetCryptokiEPV
    84 (
    85   NSSToken *token
    86 );
    88 NSS_EXTERN nssSession *
    89 nssToken_GetDefaultSession
    90 (
    91   NSSToken *token
    92 );
    94 NSS_EXTERN PRBool
    95 nssToken_IsLoginRequired
    96 (
    97   NSSToken *token
    98 );
   100 NSS_EXTERN void
   101 nssToken_Remove
   102 (
   103   NSSToken *token
   104 );
   106 NSS_EXTERN nssCryptokiObject *
   107 nssCryptokiObject_Create
   108 (
   109   NSSToken *t, 
   110   nssSession *session,
   111   CK_OBJECT_HANDLE h
   112 );
   114 NSS_EXTERN nssTokenObjectCache *
   115 nssTokenObjectCache_Create
   116 (
   117   NSSToken *token,
   118   PRBool cacheCerts,
   119   PRBool cacheTrust,
   120   PRBool cacheCRLs
   121 );
   123 NSS_EXTERN void
   124 nssTokenObjectCache_Destroy
   125 (
   126   nssTokenObjectCache *cache
   127 );
   129 NSS_EXTERN void
   130 nssTokenObjectCache_Clear
   131 (
   132   nssTokenObjectCache *cache
   133 );
   135 NSS_EXTERN PRBool
   136 nssTokenObjectCache_HaveObjectClass
   137 (
   138   nssTokenObjectCache *cache,
   139   CK_OBJECT_CLASS objclass
   140 );
   142 NSS_EXTERN nssCryptokiObject **
   143 nssTokenObjectCache_FindObjectsByTemplate
   144 (
   145   nssTokenObjectCache *cache,
   146   CK_OBJECT_CLASS objclass,
   147   CK_ATTRIBUTE_PTR otemplate,
   148   CK_ULONG otlen,
   149   PRUint32 maximumOpt,
   150   PRStatus *statusOpt
   151 );
   153 NSS_EXTERN PRStatus
   154 nssTokenObjectCache_GetObjectAttributes
   155 (
   156   nssTokenObjectCache *cache,
   157   NSSArena *arenaOpt,
   158   nssCryptokiObject *object,
   159   CK_OBJECT_CLASS objclass,
   160   CK_ATTRIBUTE_PTR atemplate,
   161   CK_ULONG atlen
   162 );
   164 NSS_EXTERN PRStatus
   165 nssTokenObjectCache_ImportObject
   166 (
   167   nssTokenObjectCache *cache,
   168   nssCryptokiObject *object,
   169   CK_OBJECT_CLASS objclass,
   170   CK_ATTRIBUTE_PTR ot,
   171   CK_ULONG otlen
   172 );
   174 NSS_EXTERN void
   175 nssTokenObjectCache_RemoveObject
   176 (
   177   nssTokenObjectCache *cache,
   178   nssCryptokiObject *object
   179 );
   181 /* XXX allows peek back into token */
   182 NSS_EXTERN PRStatus
   183 nssToken_GetCachedObjectAttributes
   184 (
   185   NSSToken *token,
   186   NSSArena *arenaOpt,
   187   nssCryptokiObject *object,
   188   CK_OBJECT_CLASS objclass,
   189   CK_ATTRIBUTE_PTR atemplate,
   190   CK_ULONG atlen
   191 );
   193 /* PKCS#11 stores strings in a fixed-length buffer padded with spaces.  This
   194  * function gets the length of the actual string.
   195  */
   196 NSS_EXTERN PRUint32
   197 nssPKCS11String_Length
   198 (
   199   CK_CHAR *pkcs11str, 
   200   PRUint32 bufLen
   201 );
   203 PR_END_EXTERN_C
   205 #endif /* DEV_H */

mercurial