security/nss/lib/ckfw/builtins/bsession.c

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial