author | ykantser |
Thu, 26 Mar 2015 16:36:56 +0100 | |
changeset 29678 | dd2f3932c21e |
parent 27699 | 9913b19c0948 |
child 31404 | 63e8fcd70bfc |
permissions | -rw-r--r-- |
14132 | 1 |
/* |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
27699
diff
changeset
|
2 |
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
14132 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
/** |
|
26 |
* @test |
|
27 |
* @bug 7184394 |
|
28 |
* @summary add intrinsics to use AES instructions |
|
27453
9aeb9b97bef6
8044186: Introduce a reproducible random generator
iignatyev
parents:
24329
diff
changeset
|
29 |
* @library /testlibrary |
14132 | 30 |
* |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
27699
diff
changeset
|
31 |
* @modules java.base/sun.misc |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
27699
diff
changeset
|
32 |
* java.management |
14834 | 33 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain |
24328
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
34 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 TestAESMain |
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
35 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencOutputOffset=1 TestAESMain |
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
36 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DdecOutputOffset=1 TestAESMain |
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
37 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 TestAESMain |
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
38 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain |
24329
13ccf2b92d69
8042281: compiler/7184394/TestAESMain.java fails with: javax.crypto.IllegalBlockSizeException: Input length not multiple of 16 bytes
kvn
parents:
24328
diff
changeset
|
39 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain |
14834 | 40 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB TestAESMain |
24328
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
41 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 TestAESMain |
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
42 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencOutputOffset=1 TestAESMain |
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
43 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DdecOutputOffset=1 TestAESMain |
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
44 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 TestAESMain |
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
45 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain |
24329
13ccf2b92d69
8042281: compiler/7184394/TestAESMain.java fails with: javax.crypto.IllegalBlockSizeException: Input length not multiple of 16 bytes
kvn
parents:
24328
diff
changeset
|
46 |
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain |
14132 | 47 |
* |
48 |
* @author Tom Deneau |
|
49 |
*/ |
|
50 |
||
51 |
public class TestAESMain { |
|
52 |
public static void main(String[] args) { |
|
53 |
int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 1000000); |
|
24328
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
54 |
int warmupIters = (args.length > 1 ? Integer.valueOf(args[1]) : 20000); |
14132 | 55 |
System.out.println(iters + " iterations"); |
56 |
TestAESEncode etest = new TestAESEncode(); |
|
57 |
etest.prepare(); |
|
24328
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
58 |
// warm-up |
22505 | 59 |
System.out.println("Starting encryption warm-up"); |
24328
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
60 |
for (int i=0; i<warmupIters; i++) { |
22505 | 61 |
etest.run(); |
62 |
} |
|
63 |
System.out.println("Finished encryption warm-up"); |
|
14132 | 64 |
long start = System.nanoTime(); |
65 |
for (int i=0; i<iters; i++) { |
|
66 |
etest.run(); |
|
67 |
} |
|
68 |
long end = System.nanoTime(); |
|
22505 | 69 |
System.out.println("TestAESEncode runtime was " + (double)((end - start)/1000000.0) + " ms"); |
14132 | 70 |
|
71 |
TestAESDecode dtest = new TestAESDecode(); |
|
72 |
dtest.prepare(); |
|
24328
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
73 |
// warm-up |
22505 | 74 |
System.out.println("Starting decryption warm-up"); |
24328
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
22505
diff
changeset
|
75 |
for (int i=0; i<warmupIters; i++) { |
22505 | 76 |
dtest.run(); |
77 |
} |
|
78 |
System.out.println("Finished decryption warm-up"); |
|
14132 | 79 |
start = System.nanoTime(); |
80 |
for (int i=0; i<iters; i++) { |
|
81 |
dtest.run(); |
|
82 |
} |
|
83 |
end = System.nanoTime(); |
|
22505 | 84 |
System.out.println("TestAESDecode runtime was " + (double)((end - start)/1000000.0) + " ms"); |
14132 | 85 |
} |
86 |
} |