src/jdk.crypto.cryptoki/share/native/libj2pkcs11/j2secmod.h
author alanb
Sat, 30 Nov 2019 16:21:19 +0000
changeset 59329 289000934908
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234805: (dc) Remove JNI upcall from DatagramChannel.receive implementation Reviewed-by: dfuchs, chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include <jni.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "sun_security_pkcs11_Secmod.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
// #define SECMOD_DEBUG
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "j2secmod_md.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "p11_md.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#ifdef SECMOD_DEBUG
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#define dprintf(s) printf(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define dprintf1(s, p1) printf(s, p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#define dprintf2(s, p1, p2) printf(s, p1, p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define dprintf3(s, p1, p2, p3) printf(s, p1, p2, p3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#define dprintf(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#define dprintf1(s, p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#define dprintf2(s, p1, p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define dprintf3(s, p1, p2, p3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
// NSS types
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
typedef int PRBool;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
typedef struct SECMODModuleStr SECMODModule;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
typedef struct SECMODModuleListStr SECMODModuleList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
struct SECMODModuleStr {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    void        *v1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    PRBool      internal;       /* true of internally linked modules, false
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                                 * for the loaded modules */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    PRBool      loaded;         /* Set to true if module has been loaded */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    PRBool      isFIPS;         /* Set to true if module is finst internal */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    char        *dllName;       /* name of the shared library which implements
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                                 * this module */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    char        *commonName;    /* name of the module to display to the user */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    void        *library;       /* pointer to the library. opaque. used only by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                                 * pk11load.c */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    void        *functionList; /* The PKCS #11 function table */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    void        *refLock;       /* only used pk11db.c */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    int         refCount;       /* Module reference count */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    void        **slots;        /* array of slot points attached to this mod*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    int         slotCount;      /* count of slot in above array */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    void        *slotInfo;      /* special info about slots default settings */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    int         slotInfoCount;  /* count */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    // incomplete, sizeof() is wrong
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
struct SECMODModuleListStr {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    SECMODModuleList    *next;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    SECMODModule        *module;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
};