blob: 12b841fa58878d7e664f339cdae45b2d2e7d0de0 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26#include <jni.h>
27
28#include "sun_security_pkcs11_Secmod.h"
29
30// #define SECMOD_DEBUG
31
32#include "j2secmod_md.h"
33
34#include "p11_md.h"
35
36
37void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName);
38
39#ifdef SECMOD_DEBUG
40#define dprintf(s) printf(s)
41#define dprintf1(s, p1) printf(s, p1)
42#define dprintf2(s, p1, p2) printf(s, p1, p2)
43#define dprintf3(s, p1, p2, p3) printf(s, p1, p2, p3)
44#else
45#define dprintf(s)
46#define dprintf1(s, p1)
47#define dprintf2(s, p1, p2)
48#define dprintf3(s, p1, p2, p3)
49#endif
50
51// NSS types
52
53typedef int PRBool;
54
55typedef struct SECMODModuleStr SECMODModule;
56typedef struct SECMODModuleListStr SECMODModuleList;
57
58struct SECMODModuleStr {
59 void *v1;
60 PRBool internal; /* true of internally linked modules, false
61 * for the loaded modules */
62 PRBool loaded; /* Set to true if module has been loaded */
63 PRBool isFIPS; /* Set to true if module is finst internal */
64 char *dllName; /* name of the shared library which implements
65 * this module */
66 char *commonName; /* name of the module to display to the user */
67 void *library; /* pointer to the library. opaque. used only by
68 * pk11load.c */
69
70 void *functionList; /* The PKCS #11 function table */
71 void *refLock; /* only used pk11db.c */
72 int refCount; /* Module reference count */
73 void **slots; /* array of slot points attached to this mod*/
74 int slotCount; /* count of slot in above array */
75 void *slotInfo; /* special info about slots default settings */
76 int slotInfoCount; /* count */
77 // incomplete, sizeof() is wrong
78};
79
80struct SECMODModuleListStr {
81 SECMODModuleList *next;
82 SECMODModule *module;
83};