Tue, 14 Jan 2014 17:46:48 -0800
8002074: Support for AES on SPARC
Summary: Add intrinsics/stub routines support for single-block and multi-block (as used by Cipher Block Chaining mode) AES encryption and decryption operations on the SPARC platform.
Reviewed-by: kvn, roland
Contributed-by: shrinivas.joshi@oracle.com
kvn@4205 | 1 | /* |
kvn@6312 | 2 | * Copyright (c) 2012, 2014 Oracle and/or its affiliates. All rights reserved. |
kvn@4205 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
kvn@4205 | 4 | * |
kvn@4205 | 5 | * This code is free software; you can redistribute it and/or modify it |
kvn@4205 | 6 | * under the terms of the GNU General Public License version 2 only, as |
kvn@4205 | 7 | * published by the Free Software Foundation. |
kvn@4205 | 8 | * |
kvn@4205 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
kvn@4205 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
kvn@4205 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
kvn@4205 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
kvn@4205 | 13 | * accompanied this code). |
kvn@4205 | 14 | * |
kvn@4205 | 15 | * You should have received a copy of the GNU General Public License version |
kvn@4205 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
kvn@4205 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
kvn@4205 | 18 | * |
kvn@4205 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
kvn@4205 | 20 | * or visit www.oracle.com if you need additional information or have any |
kvn@4205 | 21 | * questions. |
kvn@4205 | 22 | * |
kvn@4205 | 23 | */ |
kvn@4205 | 24 | |
kvn@4205 | 25 | /** |
kvn@4205 | 26 | * @test |
kvn@4205 | 27 | * @bug 7184394 |
kvn@4205 | 28 | * @summary add intrinsics to use AES instructions |
kvn@4205 | 29 | * |
kvn@4363 | 30 | * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain |
kvn@4363 | 31 | * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB TestAESMain |
kvn@4205 | 32 | * |
kvn@4205 | 33 | * @author Tom Deneau |
kvn@4205 | 34 | */ |
kvn@4205 | 35 | |
kvn@4205 | 36 | public class TestAESMain { |
kvn@4205 | 37 | public static void main(String[] args) { |
kvn@4205 | 38 | int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 1000000); |
kvn@4205 | 39 | System.out.println(iters + " iterations"); |
kvn@4205 | 40 | TestAESEncode etest = new TestAESEncode(); |
kvn@4205 | 41 | etest.prepare(); |
kvn@6312 | 42 | // warm-up for 20K iterations |
kvn@6312 | 43 | System.out.println("Starting encryption warm-up"); |
kvn@6312 | 44 | for (int i=0; i<20000; i++) { |
kvn@6312 | 45 | etest.run(); |
kvn@6312 | 46 | } |
kvn@6312 | 47 | System.out.println("Finished encryption warm-up"); |
kvn@4205 | 48 | long start = System.nanoTime(); |
kvn@4205 | 49 | for (int i=0; i<iters; i++) { |
kvn@4205 | 50 | etest.run(); |
kvn@4205 | 51 | } |
kvn@4205 | 52 | long end = System.nanoTime(); |
kvn@6312 | 53 | System.out.println("TestAESEncode runtime was " + (double)((end - start)/1000000.0) + " ms"); |
kvn@4205 | 54 | |
kvn@4205 | 55 | TestAESDecode dtest = new TestAESDecode(); |
kvn@4205 | 56 | dtest.prepare(); |
kvn@6312 | 57 | // warm-up for 20K iterations |
kvn@6312 | 58 | System.out.println("Starting decryption warm-up"); |
kvn@6312 | 59 | for (int i=0; i<20000; i++) { |
kvn@6312 | 60 | dtest.run(); |
kvn@6312 | 61 | } |
kvn@6312 | 62 | System.out.println("Finished decryption warm-up"); |
kvn@4205 | 63 | start = System.nanoTime(); |
kvn@4205 | 64 | for (int i=0; i<iters; i++) { |
kvn@4205 | 65 | dtest.run(); |
kvn@4205 | 66 | } |
kvn@4205 | 67 | end = System.nanoTime(); |
kvn@6312 | 68 | System.out.println("TestAESDecode runtime was " + (double)((end - start)/1000000.0) + " ms"); |
kvn@4205 | 69 | } |
kvn@4205 | 70 | } |