author | iveresov |
Thu, 06 Apr 2017 23:01:27 +0000 | |
changeset 46372 | 721b8f969cc8 |
parent 43248 | 5e15de85a1a0 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
14342
8435a30053c1
7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents:
10798
diff
changeset
|
2 |
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
* |
|
23 |
* Alternately, this acknowledgment may appear in the software itself, if |
|
24 |
* and wherever such third-party acknowledgments normally appear. |
|
25 |
* |
|
26 |
* 4. The names "Graz University of Technology" and "IAIK of Graz University of |
|
27 |
* Technology" must not be used to endorse or promote products derived from |
|
28 |
* this software without prior written permission. |
|
29 |
* |
|
30 |
* 5. Products derived from this software may not be called |
|
31 |
* "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior |
|
32 |
* written permission of Graz University of Technology. |
|
33 |
* |
|
34 |
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
|
35 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
36 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
37 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE |
|
38 |
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, |
|
39 |
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
40 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, |
|
41 |
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
|
42 |
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
43 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
|
44 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
45 |
* POSSIBILITY OF SUCH DAMAGE. |
|
46 |
* =========================================================================== |
|
47 |
*/ |
|
48 |
||
49 |
#include "pkcs11wrapper.h" |
|
50 |
||
51 |
#include <stdio.h> |
|
52 |
#include <stdlib.h> |
|
53 |
#include <string.h> |
|
54 |
#include <assert.h> |
|
55 |
||
56 |
#include "sun_security_pkcs11_wrapper_PKCS11.h" |
|
57 |
||
58 |
#ifdef P11_ENABLE_C_DIGESTENCRYPTUPDATE |
|
59 |
/* |
|
60 |
* Class: sun_security_pkcs11_wrapper_PKCS11 |
|
61 |
* Method: C_DigestEncryptUpdate |
|
62 |
* Signature: (J[B)[B |
|
63 |
* Parametermapping: *PKCS11* |
|
64 |
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession |
|
65 |
* @param jbyteArray jPart CK_BYTE_PTR pPart |
|
66 |
* CK_ULONG ulPartLen |
|
67 |
* @return jbyteArray jEncryptedPart CK_BYTE_PTR pEncryptedPart |
|
68 |
* CK_ULONG_PTR pulEncryptedPartLen |
|
69 |
*/ |
|
70 |
JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DigestEncryptUpdate |
|
71 |
(JNIEnv *env, jobject obj, jlong jSessionHandle, jbyteArray jPart) |
|
72 |
{ |
|
73 |
CK_SESSION_HANDLE ckSessionHandle; |
|
74 |
CK_BYTE_PTR ckpPart = NULL_PTR, ckpEncryptedPart; |
|
75 |
CK_ULONG ckPartLength, ckEncryptedPartLength = 0; |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
76 |
jbyteArray jEncryptedPart = NULL; |
2 | 77 |
CK_RV rv; |
78 |
||
79 |
CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); |
|
80 |
if (ckpFunctions == NULL) { return NULL; } |
|
81 |
||
82 |
ckSessionHandle = jLongToCKULong(jSessionHandle); |
|
83 |
jByteArrayToCKByteArray(env, jPart, &ckpPart, &ckPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
84 |
if ((*env)->ExceptionCheck(env)) { return NULL; } |
2 | 85 |
|
86 |
rv = (*ckpFunctions->C_DigestEncryptUpdate)(ckSessionHandle, ckpPart, ckPartLength, NULL_PTR, &ckEncryptedPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
87 |
if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
88 |
free(ckpPart); |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
89 |
return NULL; |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
90 |
} |
2 | 91 |
|
92 |
ckpEncryptedPart = (CK_BYTE_PTR) malloc(ckEncryptedPartLength * sizeof(CK_BYTE)); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
93 |
if (ckpEncryptedPart == NULL) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
94 |
free(ckpPart); |
10798
413b731e1818
7103549: Remove dependencies on libjava and libjvm from security libraries
chegar
parents:
5506
diff
changeset
|
95 |
throwOutOfMemoryError(env, 0); |
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
96 |
return NULL; |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
97 |
} |
2 | 98 |
|
99 |
rv = (*ckpFunctions->C_DigestEncryptUpdate)(ckSessionHandle, ckpPart, ckPartLength, ckpEncryptedPart, &ckEncryptedPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
100 |
if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
101 |
jEncryptedPart = ckByteArrayToJByteArray(env, ckpEncryptedPart, ckEncryptedPartLength); |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
102 |
} |
2 | 103 |
free(ckpPart); |
104 |
free(ckpEncryptedPart); |
|
105 |
||
106 |
return jEncryptedPart ; |
|
107 |
} |
|
108 |
#endif |
|
109 |
||
110 |
#ifdef P11_ENABLE_C_DECRYPTDIGESTUPDATE |
|
111 |
/* |
|
112 |
* Class: sun_security_pkcs11_wrapper_PKCS11 |
|
113 |
* Method: C_DecryptDigestUpdate |
|
114 |
* Signature: (J[B)[B |
|
115 |
* Parametermapping: *PKCS11* |
|
116 |
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession |
|
117 |
* @param jbyteArray jEncryptedPart CK_BYTE_PTR pEncryptedPart |
|
118 |
* CK_ULONG ulEncryptedPartLen |
|
119 |
* @return jbyteArray jPart CK_BYTE_PTR pPart |
|
120 |
* CK_ULONG_PTR pulPartLen |
|
121 |
*/ |
|
122 |
JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DecryptDigestUpdate |
|
123 |
(JNIEnv *env, jobject obj, jlong jSessionHandle, jbyteArray jEncryptedPart) |
|
124 |
{ |
|
125 |
CK_SESSION_HANDLE ckSessionHandle; |
|
126 |
CK_BYTE_PTR ckpPart, ckpEncryptedPart = NULL_PTR; |
|
127 |
CK_ULONG ckPartLength = 0, ckEncryptedPartLength; |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
128 |
jbyteArray jPart = NULL; |
2 | 129 |
CK_RV rv; |
130 |
||
131 |
CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); |
|
132 |
if (ckpFunctions == NULL) { return NULL; } |
|
133 |
||
134 |
ckSessionHandle = jLongToCKULong(jSessionHandle); |
|
135 |
jByteArrayToCKByteArray(env, jEncryptedPart, &ckpEncryptedPart, &ckEncryptedPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
136 |
if ((*env)->ExceptionCheck(env)) { return NULL; } |
2 | 137 |
|
138 |
rv = (*ckpFunctions->C_DecryptDigestUpdate)(ckSessionHandle, ckpEncryptedPart, ckEncryptedPartLength, NULL_PTR, &ckPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
139 |
if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
140 |
free(ckpEncryptedPart); |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
141 |
return NULL; |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
142 |
} |
2 | 143 |
|
144 |
ckpPart = (CK_BYTE_PTR) malloc(ckPartLength * sizeof(CK_BYTE)); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
145 |
if (ckpPart == NULL) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
146 |
free(ckpEncryptedPart); |
10798
413b731e1818
7103549: Remove dependencies on libjava and libjvm from security libraries
chegar
parents:
5506
diff
changeset
|
147 |
throwOutOfMemoryError(env, 0); |
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
148 |
return NULL; |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
149 |
} |
2 | 150 |
|
151 |
rv = (*ckpFunctions->C_DecryptDigestUpdate)(ckSessionHandle, ckpEncryptedPart, ckEncryptedPartLength, ckpPart, &ckPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
152 |
if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
153 |
jPart = ckByteArrayToJByteArray(env, ckpPart, ckPartLength); |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
154 |
} |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
155 |
free(ckpEncryptedPart); |
2 | 156 |
free(ckpPart); |
157 |
||
158 |
return jPart ; |
|
159 |
} |
|
160 |
#endif |
|
161 |
||
162 |
#ifdef P11_ENABLE_C_SIGNENCRYPTUPDATE |
|
163 |
/* |
|
164 |
* Class: sun_security_pkcs11_wrapper_PKCS11 |
|
165 |
* Method: C_SignEncryptUpdate |
|
166 |
* Signature: (J[B)[B |
|
167 |
* Parametermapping: *PKCS11* |
|
168 |
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession |
|
169 |
* @param jbyteArray jPart CK_BYTE_PTR pPart |
|
170 |
* CK_ULONG ulPartLen |
|
171 |
* @return jbyteArray jEncryptedPart CK_BYTE_PTR pEncryptedPart |
|
172 |
* CK_ULONG_PTR pulEncryptedPartLen |
|
173 |
*/ |
|
174 |
JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1SignEncryptUpdate |
|
175 |
(JNIEnv *env, jobject obj, jlong jSessionHandle, jbyteArray jPart) |
|
176 |
{ |
|
177 |
CK_SESSION_HANDLE ckSessionHandle; |
|
178 |
CK_BYTE_PTR ckpPart = NULL_PTR, ckpEncryptedPart; |
|
179 |
CK_ULONG ckPartLength, ckEncryptedPartLength = 0; |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
180 |
jbyteArray jEncryptedPart = NULL; |
2 | 181 |
CK_RV rv; |
182 |
||
183 |
CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); |
|
184 |
if (ckpFunctions == NULL) { return NULL; } |
|
185 |
||
186 |
ckSessionHandle = jLongToCKULong(jSessionHandle); |
|
187 |
jByteArrayToCKByteArray(env, jPart, &ckpPart, &ckPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
188 |
if ((*env)->ExceptionCheck(env)) { return NULL; } |
2 | 189 |
|
190 |
rv = (*ckpFunctions->C_SignEncryptUpdate)(ckSessionHandle, ckpPart, ckPartLength, NULL_PTR, &ckEncryptedPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
191 |
if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
192 |
free(ckpPart); |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
193 |
return NULL; |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
194 |
} |
2 | 195 |
|
196 |
ckpEncryptedPart = (CK_BYTE_PTR) malloc(ckEncryptedPartLength * sizeof(CK_BYTE)); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
197 |
if (ckpEncryptedPart == NULL) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
198 |
free(ckpPart); |
10798
413b731e1818
7103549: Remove dependencies on libjava and libjvm from security libraries
chegar
parents:
5506
diff
changeset
|
199 |
throwOutOfMemoryError(env, 0); |
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
200 |
return NULL; |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
201 |
} |
2 | 202 |
|
203 |
rv = (*ckpFunctions->C_SignEncryptUpdate)(ckSessionHandle, ckpPart, ckPartLength, ckpEncryptedPart, &ckEncryptedPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
204 |
if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
205 |
jEncryptedPart = ckByteArrayToJByteArray(env, ckpEncryptedPart, ckEncryptedPartLength); |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
206 |
} |
2 | 207 |
free(ckpPart); |
208 |
free(ckpEncryptedPart); |
|
209 |
||
210 |
return jEncryptedPart ; |
|
211 |
} |
|
212 |
#endif |
|
213 |
||
214 |
#ifdef P11_ENABLE_C_DECRYPTVERIFYUPDATE |
|
215 |
/* |
|
216 |
* Class: sun_security_pkcs11_wrapper_PKCS11 |
|
217 |
* Method: C_DecryptVerifyUpdate |
|
218 |
* Signature: (J[B)[B |
|
219 |
* Parametermapping: *PKCS11* |
|
220 |
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession |
|
221 |
* @param jbyteArray jEncryptedPart CK_BYTE_PTR pEncryptedPart |
|
222 |
* CK_ULONG ulEncryptedPartLen |
|
223 |
* @return jbyteArray jPart CK_BYTE_PTR pPart |
|
224 |
* CK_ULONG_PTR pulPartLen |
|
225 |
*/ |
|
226 |
JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DecryptVerifyUpdate |
|
227 |
(JNIEnv *env, jobject obj, jlong jSessionHandle, jbyteArray jEncryptedPart) |
|
228 |
{ |
|
229 |
CK_SESSION_HANDLE ckSessionHandle; |
|
230 |
CK_BYTE_PTR ckpPart, ckpEncryptedPart = NULL_PTR; |
|
231 |
CK_ULONG ckPartLength = 0, ckEncryptedPartLength; |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
232 |
jbyteArray jPart = NULL; |
2 | 233 |
CK_RV rv; |
234 |
||
235 |
CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); |
|
236 |
if (ckpFunctions == NULL) { return NULL; } |
|
237 |
||
238 |
ckSessionHandle = jLongToCKULong(jSessionHandle); |
|
239 |
jByteArrayToCKByteArray(env, jEncryptedPart, &ckpEncryptedPart, &ckEncryptedPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
240 |
if ((*env)->ExceptionCheck(env)) { return NULL; } |
2 | 241 |
|
242 |
rv = (*ckpFunctions->C_DecryptVerifyUpdate)(ckSessionHandle, ckpEncryptedPart, ckEncryptedPartLength, NULL_PTR, &ckPartLength); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
243 |
if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
244 |
free(ckpEncryptedPart); |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
245 |
return NULL; |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
246 |
} |
2 | 247 |
|
248 |
ckpPart = (CK_BYTE_PTR) malloc(ckPartLength * sizeof(CK_BYTE)); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
249 |
if (ckpPart == NULL) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
250 |
free(ckpEncryptedPart); |
10798
413b731e1818
7103549: Remove dependencies on libjava and libjvm from security libraries
chegar
parents:
5506
diff
changeset
|
251 |
throwOutOfMemoryError(env, 0); |
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
252 |
return NULL; |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
253 |
} |
2 | 254 |
|
255 |
rv = (*ckpFunctions->C_DecryptVerifyUpdate)(ckSessionHandle, ckpEncryptedPart, ckEncryptedPartLength, ckpPart, &ckPartLength); |
|
256 |
||
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
257 |
if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) { |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
258 |
jPart = ckByteArrayToJByteArray(env, ckpPart, ckPartLength); |
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
259 |
} |
2 | 260 |
free(ckpEncryptedPart); |
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
261 |
free(ckpPart); |
2 | 262 |
|
263 |
return jPart ; |
|
264 |
} |
|
265 |
#endif |
|
266 |
||
267 |
#ifdef P11_ENABLE_C_GETFUNCTIONSTATUS |
|
268 |
/* |
|
269 |
* Class: sun_security_pkcs11_wrapper_PKCS11 |
|
270 |
* Method: C_GetFunctionStatus |
|
271 |
* Signature: (J)V |
|
272 |
* Parametermapping: *PKCS11* |
|
273 |
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession |
|
274 |
*/ |
|
275 |
JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetFunctionStatus |
|
276 |
(JNIEnv *env, jobject obj, jlong jSessionHandle) |
|
277 |
{ |
|
278 |
CK_SESSION_HANDLE ckSessionHandle; |
|
279 |
CK_RV rv; |
|
280 |
||
281 |
CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); |
|
282 |
if (ckpFunctions == NULL) { return; } |
|
283 |
||
284 |
ckSessionHandle = jLongToCKULong(jSessionHandle); |
|
285 |
||
286 |
/* C_GetFunctionStatus should always return CKR_FUNCTION_NOT_PARALLEL */ |
|
287 |
rv = (*ckpFunctions->C_GetFunctionStatus)(ckSessionHandle); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
288 |
if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } |
2 | 289 |
} |
290 |
#endif |
|
291 |
||
292 |
#ifdef P11_ENABLE_C_CANCELFUNCTION |
|
293 |
/* |
|
294 |
* Class: sun_security_pkcs11_wrapper_PKCS11 |
|
295 |
* Method: C_CancelFunction |
|
296 |
* Signature: (J)V |
|
297 |
* Parametermapping: *PKCS11* |
|
298 |
* @param jlong jSessionHandle CK_SESSION_HANDLE hSession |
|
299 |
*/ |
|
300 |
JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1CancelFunction |
|
301 |
(JNIEnv *env, jobject obj, jlong jSessionHandle) |
|
302 |
{ |
|
303 |
CK_SESSION_HANDLE ckSessionHandle; |
|
304 |
CK_RV rv; |
|
305 |
||
306 |
CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); |
|
307 |
if (ckpFunctions == NULL) { return; } |
|
308 |
||
309 |
ckSessionHandle = jLongToCKULong(jSessionHandle); |
|
310 |
||
311 |
/* C_GetFunctionStatus should always return CKR_FUNCTION_NOT_PARALLEL */ |
|
312 |
rv = (*ckpFunctions->C_CancelFunction)(ckSessionHandle); |
|
2180
9994f4f08a59
6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider
valeriep
parents:
2
diff
changeset
|
313 |
if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } |
2 | 314 |
} |
315 |
#endif |