comparison test/compiler/7184394/TestAESDecode.java @ 17910:03214612e77e

8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc Summary: Fix the arbitrary alignment issue in SPARC AES crypto stub routines. Reviewed-by: kvn, iveresov Contributed-by: shrinivas.joshi@oracle.com
author kvn
date Wed, 30 Apr 2014 14:14:01 -0700
parents a3ecd773a7b9
children
comparison
equal deleted inserted replaced
17909:85d6efcb1fa3 17910:03214612e77e
1 /* 1 /*
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
31 public class TestAESDecode extends TestAESBase { 31 public class TestAESDecode extends TestAESBase {
32 @Override 32 @Override
33 public void run() { 33 public void run() {
34 try { 34 try {
35 if (!noReinit) dCipher.init(Cipher.DECRYPT_MODE, key, algParams); 35 if (!noReinit) dCipher.init(Cipher.DECRYPT_MODE, key, algParams);
36 decode = new byte[decodeLength];
37 if (testingMisalignment) {
38 int tempSize = dCipher.update(encode, encOutputOffset, (decodeMsgSize - lastChunkSize), decode, decOutputOffset);
39 dCipher.doFinal(encode, (encOutputOffset + decodeMsgSize - lastChunkSize), lastChunkSize, decode, (decOutputOffset + tempSize));
40 } else {
41 dCipher.doFinal(encode, encOutputOffset, decodeMsgSize, decode, decOutputOffset);
42 }
36 if (checkOutput) { 43 if (checkOutput) {
37 // checked version creates new output buffer each time
38 decode = dCipher.doFinal(encode, 0, encode.length);
39 compareArrays(decode, expectedDecode); 44 compareArrays(decode, expectedDecode);
40 } else {
41 // non-checked version outputs to existing encode buffer for maximum speed
42 decode = new byte[dCipher.getOutputSize(encode.length)];
43 dCipher.doFinal(encode, 0, encode.length, decode);
44 } 45 }
45 } 46 }
46 catch (Exception e) { 47 catch (Exception e) {
47 e.printStackTrace(); 48 e.printStackTrace();
48 System.exit(1); 49 System.exit(1);