302 bool inline_reference_get(); |
302 bool inline_reference_get(); |
303 bool inline_aescrypt_Block(vmIntrinsics::ID id); |
303 bool inline_aescrypt_Block(vmIntrinsics::ID id); |
304 bool inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id); |
304 bool inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id); |
305 Node* inline_cipherBlockChaining_AESCrypt_predicate(bool decrypting); |
305 Node* inline_cipherBlockChaining_AESCrypt_predicate(bool decrypting); |
306 Node* get_key_start_from_aescrypt_object(Node* aescrypt_object); |
306 Node* get_key_start_from_aescrypt_object(Node* aescrypt_object); |
|
307 Node* get_original_key_start_from_aescrypt_object(Node* aescrypt_object); |
307 bool inline_encodeISOArray(); |
308 bool inline_encodeISOArray(); |
308 bool inline_updateCRC32(); |
309 bool inline_updateCRC32(); |
309 bool inline_updateBytesCRC32(); |
310 bool inline_updateBytesCRC32(); |
310 bool inline_updateByteBufferCRC32(); |
311 bool inline_updateByteBufferCRC32(); |
311 }; |
312 }; |
5943 // now need to get the start of its expanded key array |
5944 // now need to get the start of its expanded key array |
5944 // this requires a newer class file that has this array as littleEndian ints, otherwise we revert to java |
5945 // this requires a newer class file that has this array as littleEndian ints, otherwise we revert to java |
5945 Node* k_start = get_key_start_from_aescrypt_object(aescrypt_object); |
5946 Node* k_start = get_key_start_from_aescrypt_object(aescrypt_object); |
5946 if (k_start == NULL) return false; |
5947 if (k_start == NULL) return false; |
5947 |
5948 |
5948 // Call the stub. |
5949 if (Matcher::pass_original_key_for_aes()) { |
5949 make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::aescrypt_block_Type(), |
5950 // on SPARC we need to pass the original key since key expansion needs to happen in intrinsics due to |
5950 stubAddr, stubName, TypePtr::BOTTOM, |
5951 // compatibility issues between Java key expansion and SPARC crypto instructions |
5951 src_start, dest_start, k_start); |
5952 Node* original_k_start = get_original_key_start_from_aescrypt_object(aescrypt_object); |
|
5953 if (original_k_start == NULL) return false; |
|
5954 |
|
5955 // Call the stub. |
|
5956 make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::aescrypt_block_Type(), |
|
5957 stubAddr, stubName, TypePtr::BOTTOM, |
|
5958 src_start, dest_start, k_start, original_k_start); |
|
5959 } else { |
|
5960 // Call the stub. |
|
5961 make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::aescrypt_block_Type(), |
|
5962 stubAddr, stubName, TypePtr::BOTTOM, |
|
5963 src_start, dest_start, k_start); |
|
5964 } |
5952 |
5965 |
5953 return true; |
5966 return true; |
5954 } |
5967 } |
5955 |
5968 |
5956 //------------------------------inline_cipherBlockChaining_AESCrypt----------------------- |
5969 //------------------------------inline_cipherBlockChaining_AESCrypt----------------------- |
6024 // similarly, get the start address of the r vector |
6037 // similarly, get the start address of the r vector |
6025 Node* objRvec = load_field_from_object(cipherBlockChaining_object, "r", "[B", /*is_exact*/ false); |
6038 Node* objRvec = load_field_from_object(cipherBlockChaining_object, "r", "[B", /*is_exact*/ false); |
6026 if (objRvec == NULL) return false; |
6039 if (objRvec == NULL) return false; |
6027 Node* r_start = array_element_address(objRvec, intcon(0), T_BYTE); |
6040 Node* r_start = array_element_address(objRvec, intcon(0), T_BYTE); |
6028 |
6041 |
6029 // Call the stub, passing src_start, dest_start, k_start, r_start and src_len |
6042 Node* cbcCrypt; |
6030 make_runtime_call(RC_LEAF|RC_NO_FP, |
6043 if (Matcher::pass_original_key_for_aes()) { |
6031 OptoRuntime::cipherBlockChaining_aescrypt_Type(), |
6044 // on SPARC we need to pass the original key since key expansion needs to happen in intrinsics due to |
6032 stubAddr, stubName, TypePtr::BOTTOM, |
6045 // compatibility issues between Java key expansion and SPARC crypto instructions |
6033 src_start, dest_start, k_start, r_start, len); |
6046 Node* original_k_start = get_original_key_start_from_aescrypt_object(aescrypt_object); |
6034 |
6047 if (original_k_start == NULL) return false; |
6035 // return is void so no result needs to be pushed |
6048 |
6036 |
6049 // Call the stub, passing src_start, dest_start, k_start, r_start, src_len and original_k_start |
|
6050 cbcCrypt = make_runtime_call(RC_LEAF|RC_NO_FP, |
|
6051 OptoRuntime::cipherBlockChaining_aescrypt_Type(), |
|
6052 stubAddr, stubName, TypePtr::BOTTOM, |
|
6053 src_start, dest_start, k_start, r_start, len, original_k_start); |
|
6054 } else { |
|
6055 // Call the stub, passing src_start, dest_start, k_start, r_start and src_len |
|
6056 cbcCrypt = make_runtime_call(RC_LEAF|RC_NO_FP, |
|
6057 OptoRuntime::cipherBlockChaining_aescrypt_Type(), |
|
6058 stubAddr, stubName, TypePtr::BOTTOM, |
|
6059 src_start, dest_start, k_start, r_start, len); |
|
6060 } |
|
6061 |
|
6062 // return cipher length (int) |
|
6063 Node* retvalue = _gvn.transform(new (C) ProjNode(cbcCrypt, TypeFunc::Parms)); |
|
6064 set_result(retvalue); |
6037 return true; |
6065 return true; |
6038 } |
6066 } |
6039 |
6067 |
6040 //------------------------------get_key_start_from_aescrypt_object----------------------- |
6068 //------------------------------get_key_start_from_aescrypt_object----------------------- |
6041 Node * LibraryCallKit::get_key_start_from_aescrypt_object(Node *aescrypt_object) { |
6069 Node * LibraryCallKit::get_key_start_from_aescrypt_object(Node *aescrypt_object) { |
6044 if (objAESCryptKey == NULL) return (Node *) NULL; |
6072 if (objAESCryptKey == NULL) return (Node *) NULL; |
6045 |
6073 |
6046 // now have the array, need to get the start address of the K array |
6074 // now have the array, need to get the start address of the K array |
6047 Node* k_start = array_element_address(objAESCryptKey, intcon(0), T_INT); |
6075 Node* k_start = array_element_address(objAESCryptKey, intcon(0), T_INT); |
6048 return k_start; |
6076 return k_start; |
|
6077 } |
|
6078 |
|
6079 //------------------------------get_original_key_start_from_aescrypt_object----------------------- |
|
6080 Node * LibraryCallKit::get_original_key_start_from_aescrypt_object(Node *aescrypt_object) { |
|
6081 Node* objAESCryptKey = load_field_from_object(aescrypt_object, "lastKey", "[B", /*is_exact*/ false); |
|
6082 assert (objAESCryptKey != NULL, "wrong version of com.sun.crypto.provider.AESCrypt"); |
|
6083 if (objAESCryptKey == NULL) return (Node *) NULL; |
|
6084 |
|
6085 // now have the array, need to get the start address of the lastKey array |
|
6086 Node* original_k_start = array_element_address(objAESCryptKey, intcon(0), T_BYTE); |
|
6087 return original_k_start; |
6049 } |
6088 } |
6050 |
6089 |
6051 //----------------------------inline_cipherBlockChaining_AESCrypt_predicate---------------------------- |
6090 //----------------------------inline_cipherBlockChaining_AESCrypt_predicate---------------------------- |
6052 // Return node representing slow path of predicate check. |
6091 // Return node representing slow path of predicate check. |
6053 // the pseudo code we want to emulate with this predicate is: |
6092 // the pseudo code we want to emulate with this predicate is: |