src/share/native/sun/security/pkcs11/wrapper/p11_convert.c

Print this page




 670         return ckParam;
 671     }
 672 
 673     // the handles are output params only, no need to fetch them from Java
 674     ckParam.pReturnedKeyMaterial->hClientMacSecret = 0;
 675     ckParam.pReturnedKeyMaterial->hServerMacSecret = 0;
 676     ckParam.pReturnedKeyMaterial->hClientKey = 0;
 677     ckParam.pReturnedKeyMaterial->hServerKey = 0;
 678 
 679     jByteArrayToCKByteArray(env, jRMIvClient, &(ckParam.pReturnedKeyMaterial->pIVClient), &ckTemp);
 680     if ((*env)->ExceptionCheck(env)) {
 681         free(ckParam.RandomInfo.pClientRandom);
 682         free(ckParam.RandomInfo.pServerRandom);
 683         free(ckParam.pReturnedKeyMaterial);
 684         return ckParam;
 685     }
 686     jByteArrayToCKByteArray(env, jRMIvServer, &(ckParam.pReturnedKeyMaterial->pIVServer), &ckTemp);
 687     if ((*env)->ExceptionCheck(env)) {
 688         free(ckParam.RandomInfo.pClientRandom);
 689         free(ckParam.RandomInfo.pServerRandom);
 690         free(ckParam.pReturnedKeyMaterial);
 691         free(ckParam.pReturnedKeyMaterial->pIVClient);

 692         return ckParam;
 693     }
 694 
 695     return ckParam ;
 696 }
 697 
 698 /*
 699  * converts the Java CK_AES_CTR_PARAMS object to a CK_AES_CTR_PARAMS structure
 700  *
 701  * @param env - used to call JNI funktions to get the Java classes and objects
 702  * @param jParam - the Java CK_AES_CTR_PARAMS object to convert
 703  * @param ckpParam - pointer to the new CK_AES_CTR_PARAMS structure
 704  */
 705 void jAesCtrParamsToCKAesCtrParam(JNIEnv *env, jobject jParam,
 706                                   CK_AES_CTR_PARAMS_PTR ckpParam) {
 707     jclass jAesCtrParamsClass;
 708     jfieldID fieldID;
 709     jlong jCounterBits;
 710     jobject jCb;
 711     CK_BYTE_PTR ckBytes;




 670         return ckParam;
 671     }
 672 
 673     // the handles are output params only, no need to fetch them from Java
 674     ckParam.pReturnedKeyMaterial->hClientMacSecret = 0;
 675     ckParam.pReturnedKeyMaterial->hServerMacSecret = 0;
 676     ckParam.pReturnedKeyMaterial->hClientKey = 0;
 677     ckParam.pReturnedKeyMaterial->hServerKey = 0;
 678 
 679     jByteArrayToCKByteArray(env, jRMIvClient, &(ckParam.pReturnedKeyMaterial->pIVClient), &ckTemp);
 680     if ((*env)->ExceptionCheck(env)) {
 681         free(ckParam.RandomInfo.pClientRandom);
 682         free(ckParam.RandomInfo.pServerRandom);
 683         free(ckParam.pReturnedKeyMaterial);
 684         return ckParam;
 685     }
 686     jByteArrayToCKByteArray(env, jRMIvServer, &(ckParam.pReturnedKeyMaterial->pIVServer), &ckTemp);
 687     if ((*env)->ExceptionCheck(env)) {
 688         free(ckParam.RandomInfo.pClientRandom);
 689         free(ckParam.RandomInfo.pServerRandom);

 690         free(ckParam.pReturnedKeyMaterial->pIVClient);
 691         free(ckParam.pReturnedKeyMaterial);
 692         return ckParam;
 693     }
 694 
 695     return ckParam ;
 696 }
 697 
 698 /*
 699  * converts the Java CK_AES_CTR_PARAMS object to a CK_AES_CTR_PARAMS structure
 700  *
 701  * @param env - used to call JNI funktions to get the Java classes and objects
 702  * @param jParam - the Java CK_AES_CTR_PARAMS object to convert
 703  * @param ckpParam - pointer to the new CK_AES_CTR_PARAMS structure
 704  */
 705 void jAesCtrParamsToCKAesCtrParam(JNIEnv *env, jobject jParam,
 706                                   CK_AES_CTR_PARAMS_PTR ckpParam) {
 707     jclass jAesCtrParamsClass;
 708     jfieldID fieldID;
 709     jlong jCounterBits;
 710     jobject jCb;
 711     CK_BYTE_PTR ckBytes;