andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public andre@0: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@0: andre@0: #include "builtins.h" andre@0: andre@0: /* andre@0: * builtins/session.c andre@0: * andre@0: * This file implements the NSSCKMDSession object for the andre@0: * "builtin objects" cryptoki module. andre@0: */ andre@0: andre@0: static NSSCKMDFindObjects * andre@0: builtins_mdSession_FindObjectsInit andre@0: ( andre@0: NSSCKMDSession *mdSession, andre@0: NSSCKFWSession *fwSession, andre@0: NSSCKMDToken *mdToken, andre@0: NSSCKFWToken *fwToken, andre@0: NSSCKMDInstance *mdInstance, andre@0: NSSCKFWInstance *fwInstance, andre@0: CK_ATTRIBUTE_PTR pTemplate, andre@0: CK_ULONG ulAttributeCount, andre@0: CK_RV *pError andre@0: ) andre@0: { andre@0: return nss_builtins_FindObjectsInit(fwSession, pTemplate, ulAttributeCount, pError); andre@0: } andre@0: andre@0: NSS_IMPLEMENT NSSCKMDSession * andre@0: nss_builtins_CreateSession andre@0: ( andre@0: NSSCKFWSession *fwSession, andre@0: CK_RV *pError andre@0: ) andre@0: { andre@0: NSSArena *arena; andre@0: NSSCKMDSession *rv; andre@0: andre@0: arena = NSSCKFWSession_GetArena(fwSession, pError); andre@0: if( (NSSArena *)NULL == arena ) { andre@0: return (NSSCKMDSession *)NULL; andre@0: } andre@0: andre@0: rv = nss_ZNEW(arena, NSSCKMDSession); andre@0: if( (NSSCKMDSession *)NULL == rv ) { andre@0: *pError = CKR_HOST_MEMORY; andre@0: return (NSSCKMDSession *)NULL; andre@0: } andre@0: andre@0: /* andre@0: * rv was zeroed when allocated, so we only andre@0: * need to set the non-zero members. andre@0: */ andre@0: andre@0: rv->etc = (void *)fwSession; andre@0: /* rv->Close */ andre@0: /* rv->GetDeviceError */ andre@0: /* rv->Login */ andre@0: /* rv->Logout */ andre@0: /* rv->InitPIN */ andre@0: /* rv->SetPIN */ andre@0: /* rv->GetOperationStateLen */ andre@0: /* rv->GetOperationState */ andre@0: /* rv->SetOperationState */ andre@0: /* rv->CreateObject */ andre@0: /* rv->CopyObject */ andre@0: rv->FindObjectsInit = builtins_mdSession_FindObjectsInit; andre@0: /* rv->SeedRandom */ andre@0: /* rv->GetRandom */ andre@0: /* rv->null */ andre@0: andre@0: return rv; andre@0: }