Back to index

lightning-sunbird  0.9+nobinonly
cslot.c
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Netscape security libraries.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00019  * the Initial Developer. All Rights Reserved.
00020  * Portions created by Red Hat, Inc, are Copyright (C) 2005
00021  *
00022  * Contributor(s):
00023  *   Bob Relyea (rrelyea@redhat.com)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifdef DEBUG
00040 static const char CVS_ID[] = "@(#) $RCSfile: cslot.c,v $ $Revision: 1.1 $ $Date: 2005/11/04 02:05:04 $";
00041 #endif /* DEBUG */
00042 
00043 #include "ckcapi.h"
00044 
00045 /*
00046  * ckcapi/cslot.c
00047  *
00048  * This file implements the NSSCKMDSlot object for the
00049  * "nss to capi" cryptoki module.
00050  */
00051 
00052 static NSSUTF8 *
00053 ckcapi_mdSlot_GetSlotDescription
00054 (
00055   NSSCKMDSlot *mdSlot,
00056   NSSCKFWSlot *fwSlot,
00057   NSSCKMDInstance *mdInstance,
00058   NSSCKFWInstance *fwInstance,
00059   CK_RV *pError
00060 )
00061 {
00062   return (NSSUTF8 *)nss_ckcapi_SlotDescription;
00063 }
00064 
00065 static NSSUTF8 *
00066 ckcapi_mdSlot_GetManufacturerID
00067 (
00068   NSSCKMDSlot *mdSlot,
00069   NSSCKFWSlot *fwSlot,
00070   NSSCKMDInstance *mdInstance,
00071   NSSCKFWInstance *fwInstance,
00072   CK_RV *pError
00073 )
00074 {
00075   return (NSSUTF8 *)nss_ckcapi_ManufacturerID;
00076 }
00077 
00078 static CK_VERSION
00079 ckcapi_mdSlot_GetHardwareVersion
00080 (
00081   NSSCKMDSlot *mdSlot,
00082   NSSCKFWSlot *fwSlot,
00083   NSSCKMDInstance *mdInstance,
00084   NSSCKFWInstance *fwInstance
00085 )
00086 {
00087   return nss_ckcapi_HardwareVersion;
00088 }
00089 
00090 static CK_VERSION
00091 ckcapi_mdSlot_GetFirmwareVersion
00092 (
00093   NSSCKMDSlot *mdSlot,
00094   NSSCKFWSlot *fwSlot,
00095   NSSCKMDInstance *mdInstance,
00096   NSSCKFWInstance *fwInstance
00097 )
00098 {
00099   return nss_ckcapi_FirmwareVersion;
00100 }
00101 
00102 static NSSCKMDToken *
00103 ckcapi_mdSlot_GetToken
00104 (
00105   NSSCKMDSlot *mdSlot,
00106   NSSCKFWSlot *fwSlot,
00107   NSSCKMDInstance *mdInstance,
00108   NSSCKFWInstance *fwInstance,
00109   CK_RV *pError
00110 )
00111 {
00112   return (NSSCKMDToken *)&nss_ckcapi_mdToken;
00113 }
00114 
00115 NSS_IMPLEMENT_DATA const NSSCKMDSlot
00116 nss_ckcapi_mdSlot = {
00117   (void *)NULL, /* etc */
00118   NULL, /* Initialize */
00119   NULL, /* Destroy */
00120   ckcapi_mdSlot_GetSlotDescription,
00121   ckcapi_mdSlot_GetManufacturerID,
00122   NULL, /* GetTokenPresent -- defaults to true */
00123   NULL, /* GetRemovableDevice -- defaults to false */
00124   NULL, /* GetHardwareSlot -- defaults to false */
00125   ckcapi_mdSlot_GetHardwareVersion,
00126   ckcapi_mdSlot_GetFirmwareVersion,
00127   ckcapi_mdSlot_GetToken,
00128   (void *)NULL /* null terminator */
00129 };