comparison test/compiler/7184394/TestAESEncode.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 TestAESEncode extends TestAESBase { 31 public class TestAESEncode extends TestAESBase {
32 @Override 32 @Override
33 public void run() { 33 public void run() {
34 try { 34 try {
35 if (!noReinit) cipher.init(Cipher.ENCRYPT_MODE, key, algParams); 35 if (!noReinit) cipher.init(Cipher.ENCRYPT_MODE, key, algParams);
36 encode = new byte[encodeLength];
37 if (testingMisalignment) {
38 int tempSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset);
39 cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + tempSize));
40 } else {
41 cipher.doFinal(input, encInputOffset, msgSize, encode, encOutputOffset);
42 }
36 if (checkOutput) { 43 if (checkOutput) {
37 // checked version creates new output buffer each time
38 encode = cipher.doFinal(input, 0, msgSize);
39 compareArrays(encode, expectedEncode); 44 compareArrays(encode, expectedEncode);
40 } else {
41 // non-checked version outputs to existing encode buffer for maximum speed
42 encode = new byte[cipher.getOutputSize(msgSize)];
43 cipher.doFinal(input, 0, msgSize, encode);
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);