OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 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 | 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/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 #include "builtins.h" | 5 #include "builtins.h" |
6 | 6 |
7 /* | 7 /* |
8 * builtins/session.c | 8 * builtins/session.c |
9 * | 9 * |
10 * This file implements the NSSCKMDSession object for the | 10 * This file implements the NSSCKMDSession object for the |
11 * "builtin objects" cryptoki module. | 11 * "builtin objects" cryptoki module. |
12 */ | 12 */ |
13 | 13 |
14 static NSSCKMDFindObjects * | 14 static NSSCKMDFindObjects * |
15 builtins_mdSession_FindObjectsInit | 15 builtins_mdSession_FindObjectsInit( |
16 ( | 16 NSSCKMDSession *mdSession, |
17 NSSCKMDSession *mdSession, | 17 NSSCKFWSession *fwSession, |
18 NSSCKFWSession *fwSession, | 18 NSSCKMDToken *mdToken, |
19 NSSCKMDToken *mdToken, | 19 NSSCKFWToken *fwToken, |
20 NSSCKFWToken *fwToken, | 20 NSSCKMDInstance *mdInstance, |
21 NSSCKMDInstance *mdInstance, | 21 NSSCKFWInstance *fwInstance, |
22 NSSCKFWInstance *fwInstance, | 22 CK_ATTRIBUTE_PTR pTemplate, |
23 CK_ATTRIBUTE_PTR pTemplate, | 23 CK_ULONG ulAttributeCount, |
24 CK_ULONG ulAttributeCount, | 24 CK_RV *pError) |
25 CK_RV *pError | |
26 ) | |
27 { | 25 { |
28 return nss_builtins_FindObjectsInit(fwSession, pTemplate, ulAttributeCount, pE
rror); | 26 return nss_builtins_FindObjectsInit(fwSession, pTemplate, ulAttributeCount,
pError); |
29 } | 27 } |
30 | 28 |
31 NSS_IMPLEMENT NSSCKMDSession * | 29 NSS_IMPLEMENT NSSCKMDSession * |
32 nss_builtins_CreateSession | 30 nss_builtins_CreateSession( |
33 ( | 31 NSSCKFWSession *fwSession, |
34 NSSCKFWSession *fwSession, | 32 CK_RV *pError) |
35 CK_RV *pError | |
36 ) | |
37 { | 33 { |
38 NSSArena *arena; | 34 NSSArena *arena; |
39 NSSCKMDSession *rv; | 35 NSSCKMDSession *rv; |
40 | 36 |
41 arena = NSSCKFWSession_GetArena(fwSession, pError); | 37 arena = NSSCKFWSession_GetArena(fwSession, pError); |
42 if( (NSSArena *)NULL == arena ) { | 38 if ((NSSArena *)NULL == arena) { |
43 return (NSSCKMDSession *)NULL; | 39 return (NSSCKMDSession *)NULL; |
44 } | 40 } |
45 | 41 |
46 rv = nss_ZNEW(arena, NSSCKMDSession); | 42 rv = nss_ZNEW(arena, NSSCKMDSession); |
47 if( (NSSCKMDSession *)NULL == rv ) { | 43 if ((NSSCKMDSession *)NULL == rv) { |
48 *pError = CKR_HOST_MEMORY; | 44 *pError = CKR_HOST_MEMORY; |
49 return (NSSCKMDSession *)NULL; | 45 return (NSSCKMDSession *)NULL; |
50 } | 46 } |
51 | 47 |
52 /* | 48 /* |
53 * rv was zeroed when allocated, so we only | 49 * rv was zeroed when allocated, so we only |
54 * need to set the non-zero members. | 50 * need to set the non-zero members. |
55 */ | 51 */ |
56 | 52 |
57 rv->etc = (void *)fwSession; | 53 rv->etc = (void *)fwSession; |
58 /* rv->Close */ | 54 /* rv->Close */ |
59 /* rv->GetDeviceError */ | 55 /* rv->GetDeviceError */ |
60 /* rv->Login */ | 56 /* rv->Login */ |
61 /* rv->Logout */ | 57 /* rv->Logout */ |
62 /* rv->InitPIN */ | 58 /* rv->InitPIN */ |
63 /* rv->SetPIN */ | 59 /* rv->SetPIN */ |
64 /* rv->GetOperationStateLen */ | 60 /* rv->GetOperationStateLen */ |
65 /* rv->GetOperationState */ | 61 /* rv->GetOperationState */ |
66 /* rv->SetOperationState */ | 62 /* rv->SetOperationState */ |
67 /* rv->CreateObject */ | 63 /* rv->CreateObject */ |
68 /* rv->CopyObject */ | 64 /* rv->CopyObject */ |
69 rv->FindObjectsInit = builtins_mdSession_FindObjectsInit; | 65 rv->FindObjectsInit = builtins_mdSession_FindObjectsInit; |
70 /* rv->SeedRandom */ | 66 /* rv->SeedRandom */ |
71 /* rv->GetRandom */ | 67 /* rv->GetRandom */ |
72 /* rv->null */ | 68 /* rv->null */ |
73 | 69 |
74 return rv; | 70 return rv; |
75 } | 71 } |
OLD | NEW |