/*
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment:
*
* "This product includes software developed by IAIK of Graz University of
* Technology."
*
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Graz University of Technology" and "IAIK of Graz University of
* Technology" must not be used to endorse or promote products derived from
* this software without prior written permission.
*
* 5. Products derived from this software may not be called
* "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior
* written permission of Graz University of Technology.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "pkcs11wrapper.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "sun_security_pkcs11_wrapper_PKCS11.h"
#ifdef P11_ENABLE_C_DIGESTINIT
/*
* Class: sun_security_pkcs11_wrapper_PKCS11
* Method: C_DigestInit
* Signature: (JLsun/security/pkcs11/wrapper/CK_MECHANISM;)V
* Parametermapping: *PKCS11*
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession
* @param jobject jMechanism CK_MECHANISM_PTR pMechanism
*/
{
if (ckpFunctions == NULL) { return; }
}
}
#endif
#ifdef P11_ENABLE_C_DIGEST
/*
* Class: sun_security_pkcs11_wrapper_PKCS11
* Method: C_Digest
* Signature: (J[BII[BII)I
* Parametermapping: *PKCS11*
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession
* @param jbyteArray jData CK_BYTE_PTR pData
* CK_ULONG ulDataLen
* @return jbyteArray jDigest CK_BYTE_PTR pDigest
* CK_ULONG_PTR pulDigestLen
*/
(JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism, jbyteArray jIn, jint jInOfs, jint jInLen, jbyteArray jDigest, jint jDigestOfs, jint jDigestLen)
{
if (ckpFunctions == NULL) { return 0; }
}
if (jInLen <= MAX_STACK_BUFFER_LEN) {
} else {
/* always use single part op, even for large data */
return 0;
}
}
return 0;
}
}
return ckDigestLength;
}
#endif
#ifdef P11_ENABLE_C_DIGESTUPDATE
/*
* Class: sun_security_pkcs11_wrapper_PKCS11
* Method: C_DigestUpdate
* Signature: (J[B)V
* Parametermapping: *PKCS11*
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession
* @param jbyteArray jData CK_BYTE_PTR pData
* CK_ULONG ulDataLen
*/
(JNIEnv *env, jobject obj, jlong jSessionHandle, jlong directIn, jbyteArray jIn, jint jInOfs, jint jInLen)
{
if (ckpFunctions == NULL) { return; }
if (directIn != 0) {
return;
}
if (jInLen <= MAX_STACK_BUFFER_LEN) {
} else {
return;
}
}
while (jInLen > 0) {
return;
}
return;
}
}
}
}
#endif
#ifdef P11_ENABLE_C_DIGESTKEY
/*
* Class: sun_security_pkcs11_wrapper_PKCS11
* Method: C_DigestKey
* Signature: (JJ)V
* Parametermapping: *PKCS11*
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession
* @param jlong jKeyHandle CK_OBJECT_HANDLE hKey
*/
{
if (ckpFunctions == NULL) { return; }
}
#endif
#ifdef P11_ENABLE_C_DIGESTFINAL
/*
* Class: sun_security_pkcs11_wrapper_PKCS11
* Method: C_DigestFinal
* Signature: (J[BII)I
* Parametermapping: *PKCS11*
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession
* @return jbyteArray jDigest CK_BYTE_PTR pDigest
* CK_ULONG_PTR pulDigestLen
*/
(JNIEnv *env, jobject obj, jlong jSessionHandle, jbyteArray jDigest, jint jDigestOfs, jint jDigestLen)
{
if (ckpFunctions == NULL) { return 0; }
}
return ckDigestLength;
}
#endif
#ifdef P11_ENABLE_C_SEEDRANDOM
/*
* Class: sun_security_pkcs11_wrapper_PKCS11
* Method: C_SeedRandom
* Signature: (J[B)V
* Parametermapping: *PKCS11*
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession
* @param jbyteArray jSeed CK_BYTE_PTR pSeed
* CK_ULONG ulSeedLen
*/
{
if (ckpFunctions == NULL) { return; }
}
#endif
#ifdef P11_ENABLE_C_GENERATERANDOM
/*
* Class: sun_security_pkcs11_wrapper_PKCS11
* Method: C_GenerateRandom
* Signature: (J[B)V
* Parametermapping: *PKCS11*
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession
* @param jbyteArray jRandomData CK_BYTE_PTR pRandomData
* CK_ULONG ulRandomDataLen
*/
{
if (ckpFunctions == NULL) { return; }
if (jRandomBuffer == NULL) { return; }
/* copy back generated bytes */
}
#endif