OLD | NEW |
| (Empty) |
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/. */ | |
4 | |
5 #ifdef DEBUG | |
6 static const char CVS_ID[] = "@(#) $RCSfile: bsession.c,v $ $Revision: 1.4 $ $Da
te: 2012/04/25 14:49:29 $"; | |
7 #endif /* DEBUG */ | |
8 | |
9 #include "builtins.h" | |
10 | |
11 /* | |
12 * builtins/session.c | |
13 * | |
14 * This file implements the NSSCKMDSession object for the | |
15 * "builtin objects" cryptoki module. | |
16 */ | |
17 | |
18 static NSSCKMDFindObjects * | |
19 builtins_mdSession_FindObjectsInit | |
20 ( | |
21 NSSCKMDSession *mdSession, | |
22 NSSCKFWSession *fwSession, | |
23 NSSCKMDToken *mdToken, | |
24 NSSCKFWToken *fwToken, | |
25 NSSCKMDInstance *mdInstance, | |
26 NSSCKFWInstance *fwInstance, | |
27 CK_ATTRIBUTE_PTR pTemplate, | |
28 CK_ULONG ulAttributeCount, | |
29 CK_RV *pError | |
30 ) | |
31 { | |
32 return nss_builtins_FindObjectsInit(fwSession, pTemplate, ulAttributeCount, pE
rror); | |
33 } | |
34 | |
35 NSS_IMPLEMENT NSSCKMDSession * | |
36 nss_builtins_CreateSession | |
37 ( | |
38 NSSCKFWSession *fwSession, | |
39 CK_RV *pError | |
40 ) | |
41 { | |
42 NSSArena *arena; | |
43 NSSCKMDSession *rv; | |
44 | |
45 arena = NSSCKFWSession_GetArena(fwSession, pError); | |
46 if( (NSSArena *)NULL == arena ) { | |
47 return (NSSCKMDSession *)NULL; | |
48 } | |
49 | |
50 rv = nss_ZNEW(arena, NSSCKMDSession); | |
51 if( (NSSCKMDSession *)NULL == rv ) { | |
52 *pError = CKR_HOST_MEMORY; | |
53 return (NSSCKMDSession *)NULL; | |
54 } | |
55 | |
56 /* | |
57 * rv was zeroed when allocated, so we only | |
58 * need to set the non-zero members. | |
59 */ | |
60 | |
61 rv->etc = (void *)fwSession; | |
62 /* rv->Close */ | |
63 /* rv->GetDeviceError */ | |
64 /* rv->Login */ | |
65 /* rv->Logout */ | |
66 /* rv->InitPIN */ | |
67 /* rv->SetPIN */ | |
68 /* rv->GetOperationStateLen */ | |
69 /* rv->GetOperationState */ | |
70 /* rv->SetOperationState */ | |
71 /* rv->CreateObject */ | |
72 /* rv->CopyObject */ | |
73 rv->FindObjectsInit = builtins_mdSession_FindObjectsInit; | |
74 /* rv->SeedRandom */ | |
75 /* rv->GetRandom */ | |
76 /* rv->null */ | |
77 | |
78 return rv; | |
79 } | |
OLD | NEW |