equal
deleted
inserted
replaced
49 |
49 |
50 #include <stdio.h> |
50 #include <stdio.h> |
51 #include <stdlib.h> |
51 #include <stdlib.h> |
52 #include <string.h> |
52 #include <string.h> |
53 #include <assert.h> |
53 #include <assert.h> |
|
54 #include "jlong.h" |
54 |
55 |
55 #include "sun_security_pkcs11_wrapper_PKCS11.h" |
56 #include "sun_security_pkcs11_wrapper_PKCS11.h" |
56 |
57 |
57 #ifdef P11_ENABLE_C_SIGNINIT |
58 #ifdef P11_ENABLE_C_SIGNINIT |
58 /* |
59 /* |
196 if (ckpFunctions == NULL) { return; } |
197 if (ckpFunctions == NULL) { return; } |
197 |
198 |
198 ckSessionHandle = jLongToCKULong(jSessionHandle); |
199 ckSessionHandle = jLongToCKULong(jSessionHandle); |
199 |
200 |
200 if (directIn != 0) { |
201 if (directIn != 0) { |
201 rv = (*ckpFunctions->C_SignUpdate)(ckSessionHandle, (CK_BYTE_PTR)directIn, jInLen); |
202 rv = (*ckpFunctions->C_SignUpdate)(ckSessionHandle, (CK_BYTE_PTR) jlong_to_ptr(directIn), jInLen); |
202 ckAssertReturnValueOK(env, rv); |
203 ckAssertReturnValueOK(env, rv); |
203 return; |
204 return; |
204 } |
205 } |
205 |
206 |
206 if (jInLen <= MAX_STACK_BUFFER_LEN) { |
207 if (jInLen <= MAX_STACK_BUFFER_LEN) { |
260 CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); |
261 CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); |
261 if (ckpFunctions == NULL) { return NULL; } |
262 if (ckpFunctions == NULL) { return NULL; } |
262 |
263 |
263 ckSessionHandle = jLongToCKULong(jSessionHandle); |
264 ckSessionHandle = jLongToCKULong(jSessionHandle); |
264 |
265 |
265 if ((jExpectedLength > 0) && (jExpectedLength < ckSignatureLength)) { |
266 if ((jExpectedLength > 0) && ((CK_ULONG)jExpectedLength < ckSignatureLength)) { |
266 ckSignatureLength = jExpectedLength; |
267 ckSignatureLength = jExpectedLength; |
267 } |
268 } |
268 |
269 |
269 rv = (*ckpFunctions->C_SignFinal)(ckSessionHandle, bufP, &ckSignatureLength); |
270 rv = (*ckpFunctions->C_SignFinal)(ckSessionHandle, bufP, &ckSignatureLength); |
270 if (rv == CKR_BUFFER_TOO_SMALL) { |
271 if (rv == CKR_BUFFER_TOO_SMALL) { |
494 if (ckpFunctions == NULL) { return; } |
495 if (ckpFunctions == NULL) { return; } |
495 |
496 |
496 ckSessionHandle = jLongToCKULong(jSessionHandle); |
497 ckSessionHandle = jLongToCKULong(jSessionHandle); |
497 |
498 |
498 if (directIn != 0) { |
499 if (directIn != 0) { |
499 rv = (*ckpFunctions->C_VerifyUpdate)(ckSessionHandle, (CK_BYTE_PTR)directIn, jInLen); |
500 rv = (*ckpFunctions->C_VerifyUpdate)(ckSessionHandle, (CK_BYTE_PTR)jlong_to_ptr(directIn), jInLen); |
500 ckAssertReturnValueOK(env, rv); |
501 ckAssertReturnValueOK(env, rv); |
501 return; |
502 return; |
502 } |
503 } |
503 |
504 |
504 if (jInLen <= MAX_STACK_BUFFER_LEN) { |
505 if (jInLen <= MAX_STACK_BUFFER_LEN) { |