jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/j2secmod.h
changeset 25859 3317bb8137f4
parent 5506 202f599c92aa
equal deleted inserted replaced
25858:836adbf7a2cd 25859:3317bb8137f4
       
     1 /*
       
     2  * Copyright (c) 2005, Oracle and/or its affiliates. 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.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * 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 
       
    37 void *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 
       
    53 typedef int PRBool;
       
    54 
       
    55 typedef struct SECMODModuleStr SECMODModule;
       
    56 typedef struct SECMODModuleListStr SECMODModuleList;
       
    57 
       
    58 struct 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 
       
    80 struct SECMODModuleListStr {
       
    81     SECMODModuleList    *next;
       
    82     SECMODModule        *module;
       
    83 };