2323 * Method: RAND_nextBytes
2424 * Signature: (J[B)V
2525 */
26- JNIEXPORT void JNICALL Java_com_ibm_crypto_plus_provider_ock_NativeInterface_RAND_1nextBytes
27- ( JNIEnv * env , jclass thisObj , jlong ockContextId , jbyteArray bytes )
28- {
29- static const char * functionName = "NativeInterface.RAND_nextbytes" ;
30-
31- ICC_CTX * ockCtx = (ICC_CTX * )((intptr_t ) ockContextId );
32- unsigned char * bytesNative = NULL ;
33- jboolean isCopy ;
34- jint size ;
35- int rc = ICC_OK ;
36-
37- if ( debug ) {
38- gslogFunctionEntry (functionName );
39- }
40-
41- bytesNative = (* env )-> GetPrimitiveArrayCritical (env , bytes , & isCopy );
42- if ( bytesNative == NULL ) {
43- throwOCKException (env , 0 , "NULL from GetPrimitiveArrayCritical!" );
44- } else {
45- size = (* env )-> GetArrayLength (env , bytes );
26+ JNIEXPORT void JNICALL
27+ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_RAND_1nextBytes (
28+ JNIEnv * env , jclass thisObj , jlong ockContextId , jbyteArray bytes ) {
29+ static const char * functionName = "NativeInterface.RAND_nextbytes" ;
30+
31+ ICC_CTX * ockCtx = (ICC_CTX * )((intptr_t )ockContextId );
32+ unsigned char * bytesNative = NULL ;
33+ jboolean isCopy ;
34+ jint size ;
35+ int rc = ICC_OK ;
36+
37+ if ( debug ) {
38+ gslogFunctionEntry (functionName );
39+ }
40+
41+ bytesNative = (* env )-> GetPrimitiveArrayCritical (env , bytes , & isCopy );
42+ if ( bytesNative == NULL ) {
43+ throwOCKException (env , 0 , "NULL from GetPrimitiveArrayCritical!" );
44+ } else {
45+ size = (* env )-> GetArrayLength (env , bytes );
4646#ifdef DEBUG_RANDOM_DETAIL
47- gslogMessage ("DETAIL_RANDOM size=%d" , (int ) size );
47+ gslogMessage ("DETAIL_RANDOM size=%d" , (int )size );
4848#endif
49- rc = ICC_RAND_bytes (ockCtx , bytesNative , size );
50- if ( rc != ICC_OSSL_SUCCESS ) {
51- ockCheckStatus (ockCtx );
52- throwOCKException (env , 0 , "ICC_RAND_BYTES failed" );
49+ rc = ICC_RAND_bytes (ockCtx , bytesNative , size );
50+ if (rc != ICC_OSSL_SUCCESS ) {
51+ ockCheckStatus (ockCtx );
52+ throwOCKException (env , 0 , "ICC_RAND_BYTES failed" );
53+ }
5354 }
54- }
5555
56- if ( bytesNative != NULL ) {
57- (* env )-> ReleasePrimitiveArrayCritical (env , bytes , bytesNative , 0 );
58- }
56+ if ( bytesNative != NULL ) {
57+ (* env )-> ReleasePrimitiveArrayCritical (env , bytes , bytesNative , 0 );
58+ }
5959
60- if ( debug ) {
61- gslogFunctionExit (functionName );
62- }
60+ if ( debug ) {
61+ gslogFunctionExit (functionName );
62+ }
6363}
6464
6565//============================================================================
@@ -68,39 +68,39 @@ JNIEXPORT void JNICALL Java_com_ibm_crypto_plus_provider_ock_NativeInterface_RAN
6868 * Method: RAND_setSeed
6969 * Signature: (J[B)V
7070 */
71- JNIEXPORT void JNICALL Java_com_ibm_crypto_plus_provider_ock_NativeInterface_RAND_1setSeed
72- ( JNIEnv * env , jclass thisObj , jlong ockContextId , jbyteArray seed )
73- {
74- static const char * functionName = "NativeInterface.RAND_setSeed" ;
75-
76- ICC_CTX * ockCtx = (ICC_CTX * )((intptr_t ) ockContextId );
77- unsigned char * seedNative = NULL ;
78- jboolean isCopy ;
79- jint size ;
80-
81- if ( debug ) {
82- gslogFunctionEntry (functionName );
83- }
84-
85- seedNative = (* env )-> GetPrimitiveArrayCritical (env , seed , & isCopy );
86- if ( seedNative == NULL ) {
87- throwOCKException (env , 0 , "NULL from GetPrimitiveArrayCritical!" );
88- } else {
89- size = (* env )-> GetArrayLength (env , seed );
71+ JNIEXPORT void JNICALL
72+ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_RAND_1setSeed (
73+ JNIEnv * env , jclass thisObj , jlong ockContextId , jbyteArray seed ) {
74+ static const char * functionName = "NativeInterface.RAND_setSeed" ;
75+
76+ ICC_CTX * ockCtx = (ICC_CTX * )((intptr_t )ockContextId );
77+ unsigned char * seedNative = NULL ;
78+ jboolean isCopy ;
79+ jint size ;
80+
81+ if ( debug ) {
82+ gslogFunctionEntry (functionName );
83+ }
84+
85+ seedNative = (* env )-> GetPrimitiveArrayCritical (env , seed , & isCopy );
86+ if ( seedNative == NULL ) {
87+ throwOCKException (env , 0 , "NULL from GetPrimitiveArrayCritical!" );
88+ } else {
89+ size = (* env )-> GetArrayLength (env , seed );
9090#ifdef DEBUG_RANDOM_DETAIL
91- gslogMessage ("DETAIL_RANDOM size=%d" , (int ) size );
91+ gslogMessage ("DETAIL_RANDOM size=%d" , (int )size );
9292#endif
9393
94- ICC_RAND_seed (ockCtx , seedNative , size );
95- }
94+ ICC_RAND_seed (ockCtx , seedNative , size );
95+ }
9696
97- if ( seedNative != NULL ) {
98- (* env )-> ReleasePrimitiveArrayCritical (env , seed , seedNative , 0 );
99- }
97+ if ( seedNative != NULL ) {
98+ (* env )-> ReleasePrimitiveArrayCritical (env , seed , seedNative , 0 );
99+ }
100100
101- if ( debug ) {
102- gslogFunctionExit (functionName );
103- }
101+ if ( debug ) {
102+ gslogFunctionExit (functionName );
103+ }
104104}
105105
106106//============================================================================
@@ -109,43 +109,42 @@ JNIEXPORT void JNICALL Java_com_ibm_crypto_plus_provider_ock_NativeInterface_RAN
109109 * Method: RAND_generateSeed
110110 * Signature: (J[B)V
111111 */
112- JNIEXPORT void JNICALL Java_com_ibm_crypto_plus_provider_ock_NativeInterface_RAND_1generateSeed
113- ( JNIEnv * env , jclass thisObj , jlong ockContextId , jbyteArray seed )
114- {
115- static const char * functionName = "NativeInterface.RAND_generateSeed" ;
116-
117- ICC_CTX * ockCtx = (ICC_CTX * )((intptr_t ) ockContextId );
118- unsigned char * seedNative = NULL ;
119- jboolean isCopy ;
120- jint size ;
121- ICC_STATUS status ;
122-
123- if ( debug ) {
124- gslogFunctionEntry (functionName );
125- }
126-
127- seedNative = (* env )-> GetPrimitiveArrayCritical (env , seed , & isCopy );
128- if ( seedNative == NULL ) {
129- throwOCKException (env , 0 , "NULL from GetPrimitiveArrayCritical!" );
130- } else {
131- size = (* env )-> GetArrayLength (env , seed );
132-
133- ICC_GenerateRandomSeed (ockCtx , & status , size , seedNative );
112+ JNIEXPORT void JNICALL
113+ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_RAND_1generateSeed (
114+ JNIEnv * env , jclass thisObj , jlong ockContextId , jbyteArray seed ) {
115+ static const char * functionName = "NativeInterface.RAND_generateSeed" ;
116+
117+ ICC_CTX * ockCtx = (ICC_CTX * )((intptr_t )ockContextId );
118+ unsigned char * seedNative = NULL ;
119+ jboolean isCopy ;
120+ jint size ;
121+ ICC_STATUS status ;
122+
123+ if ( debug ) {
124+ gslogFunctionEntry (functionName );
125+ }
126+
127+ seedNative = (* env )-> GetPrimitiveArrayCritical (env , seed , & isCopy );
128+ if ( seedNative == NULL ) {
129+ throwOCKException (env , 0 , "NULL from GetPrimitiveArrayCritical!" );
130+ } else {
131+ size = (* env )-> GetArrayLength (env , seed );
132+
133+ ICC_GenerateRandomSeed (ockCtx , & status , size , seedNative );
134134#ifdef DEBUG_RANDOM_DETAIL
135- if ( debug ) {
136- gslogMessage ("DETAIL_RAND size=%d" , (int ) size );
137- gslogMessagePrefix ("DETAIL_RAND size =%d" , (int ) size );
138- gslogMessageHex ((char * )seedNative , 0 , (int ) size , 0 , 0 , NULL );
139- }
135+ if ( debug ) {
136+ gslogMessage ("DETAIL_RAND size=%d" , (int )size );
137+ gslogMessagePrefix ("DETAIL_RAND size =%d" , (int )size );
138+ gslogMessageHex ((char * )seedNative , 0 , (int )size , 0 , 0 , NULL );
139+ }
140140#endif
141- }
141+ }
142142
143- if ( seedNative != NULL ) {
144- (* env )-> ReleasePrimitiveArrayCritical (env , seed , seedNative , 0 );
145- }
143+ if ( seedNative != NULL ) {
144+ (* env )-> ReleasePrimitiveArrayCritical (env , seed , seedNative , 0 );
145+ }
146146
147- if ( debug ) {
148- gslogFunctionExit (functionName );
149- }
147+ if ( debug ) {
148+ gslogFunctionExit (functionName );
149+ }
150150}
151-
0 commit comments