< prev index next >

src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_general.c

Print this page


   1 /*
   2  * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
   3  */
   4 
   5 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
   6  *
   7  * Redistribution and use in  source and binary forms, with or without
   8  * modification, are permitted  provided that the following conditions are met:
   9  *
  10  * 1. Redistributions of  source code must retain the above copyright notice,
  11  *    this list of conditions and the following disclaimer.
  12  *
  13  * 2. Redistributions in  binary form must reproduce the above copyright notice,
  14  *    this list of conditions and the following disclaimer in the documentation
  15  *    and/or other materials provided with the distribution.
  16  *
  17  * 3. The end-user documentation included with the redistribution, if any, must
  18  *    include the following acknowledgment:
  19  *
  20  *    "This product includes software developed by IAIK of Graz University of
  21  *     Technology."
  22  *


  56 
  57 /* declare file private functions */
  58 
  59 void prefetchFields(JNIEnv *env, jclass thisClass);
  60 jobject ckInfoPtrToJInfo(JNIEnv *env, const CK_INFO_PTR ckpInfo);
  61 jobject ckSlotInfoPtrToJSlotInfo(JNIEnv *env, const CK_SLOT_INFO_PTR ckpSlotInfo);
  62 jobject ckTokenInfoPtrToJTokenInfo(JNIEnv *env, const CK_TOKEN_INFO_PTR ckpTokenInfo);
  63 jobject ckMechanismInfoPtrToJMechanismInfo(JNIEnv *env, const CK_MECHANISM_INFO_PTR ckpMechanismInfo);
  64 
  65 /* define variables */
  66 
  67 jfieldID pNativeDataID;
  68 jfieldID mech_mechanismID;
  69 jfieldID mech_pParameterID;
  70 
  71 jclass jByteArrayClass;
  72 jclass jLongClass;
  73 
  74 JavaVM* jvm = NULL;
  75 
  76 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
  77     jvm = vm;
  78     return JNI_VERSION_1_4;
  79 }
  80 
  81 /* ************************************************************************** */
  82 /* The native implementation of the methods of the PKCS11Implementation class */
  83 /* ************************************************************************** */
  84 
  85 /*
  86  * This method is used to do static initialization. This method is static and
  87  * synchronized. Summary: use this method like a static initialization block.
  88  *
  89  * Class:     sun_security_pkcs11_wrapper_PKCS11
  90  * Method:    initializeLibrary
  91  * Signature: ()V
  92  */
  93 JNIEXPORT void JNICALL
  94 Java_sun_security_pkcs11_wrapper_PKCS11_initializeLibrary
  95 (JNIEnv *env, jclass thisClass)
  96 {


   1 /*
   2  * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
   3  */
   4 
   5 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
   6  *
   7  * Redistribution and use in  source and binary forms, with or without
   8  * modification, are permitted  provided that the following conditions are met:
   9  *
  10  * 1. Redistributions of  source code must retain the above copyright notice,
  11  *    this list of conditions and the following disclaimer.
  12  *
  13  * 2. Redistributions in  binary form must reproduce the above copyright notice,
  14  *    this list of conditions and the following disclaimer in the documentation
  15  *    and/or other materials provided with the distribution.
  16  *
  17  * 3. The end-user documentation included with the redistribution, if any, must
  18  *    include the following acknowledgment:
  19  *
  20  *    "This product includes software developed by IAIK of Graz University of
  21  *     Technology."
  22  *


  56 
  57 /* declare file private functions */
  58 
  59 void prefetchFields(JNIEnv *env, jclass thisClass);
  60 jobject ckInfoPtrToJInfo(JNIEnv *env, const CK_INFO_PTR ckpInfo);
  61 jobject ckSlotInfoPtrToJSlotInfo(JNIEnv *env, const CK_SLOT_INFO_PTR ckpSlotInfo);
  62 jobject ckTokenInfoPtrToJTokenInfo(JNIEnv *env, const CK_TOKEN_INFO_PTR ckpTokenInfo);
  63 jobject ckMechanismInfoPtrToJMechanismInfo(JNIEnv *env, const CK_MECHANISM_INFO_PTR ckpMechanismInfo);
  64 
  65 /* define variables */
  66 
  67 jfieldID pNativeDataID;
  68 jfieldID mech_mechanismID;
  69 jfieldID mech_pParameterID;
  70 
  71 jclass jByteArrayClass;
  72 jclass jLongClass;
  73 
  74 JavaVM* jvm = NULL;
  75 
  76 JNIEXPORT jint JNICALL DEF_JNI_OnLoad(JavaVM *vm, void *reserved) {
  77     jvm = vm;
  78     return JNI_VERSION_1_4;
  79 }
  80 
  81 /* ************************************************************************** */
  82 /* The native implementation of the methods of the PKCS11Implementation class */
  83 /* ************************************************************************** */
  84 
  85 /*
  86  * This method is used to do static initialization. This method is static and
  87  * synchronized. Summary: use this method like a static initialization block.
  88  *
  89  * Class:     sun_security_pkcs11_wrapper_PKCS11
  90  * Method:    initializeLibrary
  91  * Signature: ()V
  92  */
  93 JNIEXPORT void JNICALL
  94 Java_sun_security_pkcs11_wrapper_PKCS11_initializeLibrary
  95 (JNIEnv *env, jclass thisClass)
  96 {


< prev index next >