author | duke |
Wed, 05 Jul 2017 18:58:01 +0200 | |
changeset 17816 | ed57e1210057 |
parent 5547 | f4b087cbb361 |
permissions | -rw-r--r-- |
245
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
2 |
* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. |
603 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
245
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
4 |
* |
603 | 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. |
|
245
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
8 |
* |
603 | 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). |
|
245
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
14 |
* |
603 | 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. |
|
245
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
18 |
* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
21 |
* questions. |
245
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
22 |
* |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
23 |
*/ |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
24 |
|
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
25 |
/** |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
26 |
* @test |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
27 |
* @bug 6663621 |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
28 |
* @summary JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests. |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
29 |
*/ |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
30 |
|
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
31 |
public class IVTest { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
32 |
static int paddedSize; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
33 |
|
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
34 |
static void padV15(byte[] padded) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
35 |
int psSize = padded.length; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
36 |
int k = 0; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
37 |
while (psSize-- > 0) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
38 |
padded[k++] = (byte)0xff; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
39 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
40 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
41 |
|
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
42 |
static void padV15_2(int paddedSize) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
43 |
byte[] padded = new byte[paddedSize]; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
44 |
int psSize = padded.length; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
45 |
int k = 0; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
46 |
while (psSize-- > 0) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
47 |
padded[k++] = (byte)0xff; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
48 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
49 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
50 |
|
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
51 |
static void padV15_3() { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
52 |
byte[] padded = new byte[paddedSize]; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
53 |
int psSize = padded.length; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
54 |
int k = 0; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
55 |
while (psSize-- > 0) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
56 |
padded[k++] = (byte)0xff; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
57 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
58 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
59 |
|
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
60 |
static void padV15_4() { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
61 |
byte[] padded = new byte[paddedSize]; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
62 |
int psSize = padded.length; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
63 |
for (int k = 0;psSize > 0; psSize--) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
64 |
int i = padded.length - psSize; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
65 |
padded[i] = (byte)0xff; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
66 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
67 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
68 |
|
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
69 |
static void padV15_5() { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
70 |
byte[] padded = new byte[paddedSize]; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
71 |
int psSize = padded.length; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
72 |
int k = psSize - 1; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
73 |
for (int i = 0; i < psSize; i++) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
74 |
padded[k--] = (byte)0xff; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
75 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
76 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
77 |
|
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
78 |
public static void main(String argv[]) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
79 |
int bounds = 1024; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
80 |
int lim = 500000; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
81 |
long start = System.currentTimeMillis(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
82 |
for (int j = 0; j < lim; j++) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
83 |
paddedSize = j % bounds; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
84 |
padV15(new byte[paddedSize]); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
85 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
86 |
long end = System.currentTimeMillis(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
87 |
System.out.println(end - start); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
88 |
start = System.currentTimeMillis(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
89 |
for (int j = 0; j < lim; j++) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
90 |
paddedSize = j % bounds; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
91 |
padV15_2(paddedSize); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
92 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
93 |
end = System.currentTimeMillis(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
94 |
System.out.println(end - start); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
95 |
start = System.currentTimeMillis(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
96 |
for (int j = 0; j < lim; j++) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
97 |
paddedSize = j % bounds; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
98 |
padV15_3(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
99 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
100 |
end = System.currentTimeMillis(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
101 |
System.out.println(end - start); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
102 |
start = System.currentTimeMillis(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
103 |
for (int j = 0; j < lim; j++) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
104 |
paddedSize = j % bounds; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
105 |
padV15_4(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
106 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
107 |
end = System.currentTimeMillis(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
108 |
System.out.println(end - start); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
109 |
start = System.currentTimeMillis(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
110 |
for (int j = 0; j < lim; j++) { |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
111 |
paddedSize = j % bounds; |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
112 |
padV15_5(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
113 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
114 |
end = System.currentTimeMillis(); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
115 |
System.out.println(end - start); |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
116 |
} |
b9df534a2faa
6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
never
parents:
diff
changeset
|
117 |
} |