This commit is contained in:
Mikael Vidstedt 2018-08-20 14:19:30 -07:00
commit 95db6924f2
146 changed files with 1156 additions and 655 deletions

View File

@ -500,6 +500,7 @@ e1b3def126240d5433902f3cb0e91a4c27f6db50 jdk-11+18
ea900a7dc7d77dee30865c60eabd87fc24b1037c jdk-11+24
331888ea4a788df801b1edf8836646cd25fc758b jdk-11+25
945ba9278a272a5477ffb1b3ea1b04174fed8036 jdk-11+26
9d7d74c6f2cbe522e39fa22dc557fdd3f79b32ad jdk-11+27
69b438908512d3dfef5852c6a843a5778333a309 jdk-12+2
990db216e7199b2ba9989d8fa20b657e0ca7d969 jdk-12+3
499b873761d8e8a1cc4aa649daf04cbe98cbce77 jdk-12+4

View File

@ -1171,7 +1171,7 @@ var versionArgs = function(input, common) {
args = concat(args,
// This needs to be changed when we start building release candidates
// with-version-pre must be set to ea for 'ea' and empty for fcs build
"--with-version-pre=ea",
"--with-version-pre=",
"--without-version-opt");
} else {
args = concat(args, "--with-version-opt=" + common.build_id);

View File

@ -3123,6 +3123,16 @@ void MacroAssembler::store_double(Address dst) {
}
}
void MacroAssembler::push_zmm(XMMRegister reg) {
lea(rsp, Address(rsp, -64)); // Use lea to not affect flags
evmovdqul(Address(rsp, 0), reg, Assembler::AVX_512bit);
}
void MacroAssembler::pop_zmm(XMMRegister reg) {
evmovdqul(reg, Address(rsp, 0), Assembler::AVX_512bit);
lea(rsp, Address(rsp, 64)); // Use lea to not affect flags
}
void MacroAssembler::fremr(Register tmp) {
save_rax(tmp);
{ Label L;
@ -3848,33 +3858,25 @@ void MacroAssembler::pcmpeqb(XMMRegister dst, XMMRegister src) {
} else if ((dst_enc < 16) && (src_enc < 16)) {
Assembler::pcmpeqb(dst, src);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::pcmpeqb(xmm0, src);
movdqu(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::pcmpeqb(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
movdqu(xmm0, src);
movdqu(xmm1, dst);
Assembler::pcmpeqb(xmm1, xmm0);
movdqu(dst, xmm1);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
@ -3886,33 +3888,25 @@ void MacroAssembler::pcmpeqw(XMMRegister dst, XMMRegister src) {
} else if ((dst_enc < 16) && (src_enc < 16)) {
Assembler::pcmpeqw(dst, src);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::pcmpeqw(xmm0, src);
movdqu(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::pcmpeqw(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
movdqu(xmm0, src);
movdqu(xmm1, dst);
Assembler::pcmpeqw(xmm1, xmm0);
movdqu(dst, xmm1);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
@ -3921,13 +3915,11 @@ void MacroAssembler::pcmpestri(XMMRegister dst, Address src, int imm8) {
if (dst_enc < 16) {
Assembler::pcmpestri(dst, src, imm8);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::pcmpestri(xmm0, src, imm8);
movdqu(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
}
}
@ -3937,33 +3929,25 @@ void MacroAssembler::pcmpestri(XMMRegister dst, XMMRegister src, int imm8) {
if ((dst_enc < 16) && (src_enc < 16)) {
Assembler::pcmpestri(dst, src, imm8);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::pcmpestri(xmm0, src, imm8);
movdqu(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::pcmpestri(dst, xmm0, imm8);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
movdqu(xmm0, src);
movdqu(xmm1, dst);
Assembler::pcmpestri(xmm1, xmm0, imm8);
movdqu(dst, xmm1);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
@ -3975,33 +3959,25 @@ void MacroAssembler::pmovzxbw(XMMRegister dst, XMMRegister src) {
} else if ((dst_enc < 16) && (src_enc < 16)) {
Assembler::pmovzxbw(dst, src);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::pmovzxbw(xmm0, src);
movdqu(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::pmovzxbw(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
movdqu(xmm0, src);
movdqu(xmm1, dst);
Assembler::pmovzxbw(xmm1, xmm0);
movdqu(dst, xmm1);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
@ -4012,13 +3988,11 @@ void MacroAssembler::pmovzxbw(XMMRegister dst, Address src) {
} else if (dst_enc < 16) {
Assembler::pmovzxbw(dst, src);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::pmovzxbw(xmm0, src);
movdqu(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
}
}
@ -4027,12 +4001,10 @@ void MacroAssembler::pmovmskb(Register dst, XMMRegister src) {
if (src_enc < 16) {
Assembler::pmovmskb(dst, src);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::pmovmskb(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
}
}
@ -4042,31 +4014,23 @@ void MacroAssembler::ptest(XMMRegister dst, XMMRegister src) {
if ((dst_enc < 16) && (src_enc < 16)) {
Assembler::ptest(dst, src);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::ptest(xmm0, src);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::ptest(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
movdqu(xmm0, src);
movdqu(xmm1, dst);
Assembler::ptest(xmm1, xmm0);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
@ -4221,13 +4185,11 @@ void MacroAssembler::vabsss(XMMRegister dst, XMMRegister nds, XMMRegister src, A
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
vandps(xmm0, xmm0, negate_field, vector_len);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
}
}
}
@ -4258,13 +4220,11 @@ void MacroAssembler::vabssd(XMMRegister dst, XMMRegister nds, XMMRegister src, A
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
vandpd(xmm0, xmm0, negate_field, vector_len);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
}
}
}
@ -4294,16 +4254,14 @@ void MacroAssembler::vpaddb(XMMRegister dst, XMMRegister nds, XMMRegister src, i
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
} else {
// worse case scenario, all regs are in the upper bank
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm1);
evmovdqul(nds, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm1, src, Assembler::AVX_512bit);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::vpaddb(xmm0, xmm0, xmm1, vector_len);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
}
}
@ -4353,16 +4311,14 @@ void MacroAssembler::vpaddw(XMMRegister dst, XMMRegister nds, XMMRegister src, i
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
} else {
// worse case scenario, all regs are in the upper bank
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm1);
evmovdqul(nds, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm1, src, Assembler::AVX_512bit);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::vpaddw(xmm0, xmm0, xmm1, vector_len);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
}
}
@ -4404,33 +4360,25 @@ void MacroAssembler::vpbroadcastw(XMMRegister dst, XMMRegister src) {
} else if ((dst_enc < 16) && (src_enc < 16)) {
Assembler::vpbroadcastw(dst, src);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::vpbroadcastw(xmm0, src);
movdqu(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::vpbroadcastw(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
movdqu(xmm0, src);
movdqu(xmm1, dst);
Assembler::vpbroadcastw(xmm1, xmm0);
movdqu(dst, xmm1);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
@ -4442,33 +4390,25 @@ void MacroAssembler::vpcmpeqb(XMMRegister dst, XMMRegister nds, XMMRegister src,
if ((dst_enc < 16) && (src_enc < 16)) {
Assembler::vpcmpeqb(dst, nds, src, vector_len);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::vpcmpeqb(xmm0, xmm0, src, vector_len);
movdqu(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::vpcmpeqb(dst, dst, xmm0, vector_len);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
movdqu(xmm0, src);
movdqu(xmm1, dst);
Assembler::vpcmpeqb(xmm1, xmm1, xmm0, vector_len);
movdqu(dst, xmm1);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
@ -4480,33 +4420,25 @@ void MacroAssembler::vpcmpeqw(XMMRegister dst, XMMRegister nds, XMMRegister src,
if ((dst_enc < 16) && (src_enc < 16)) {
Assembler::vpcmpeqw(dst, nds, src, vector_len);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::vpcmpeqw(xmm0, xmm0, src, vector_len);
movdqu(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::vpcmpeqw(dst, dst, xmm0, vector_len);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
movdqu(xmm0, src);
movdqu(xmm1, dst);
Assembler::vpcmpeqw(xmm1, xmm1, xmm0, vector_len);
movdqu(dst, xmm1);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
@ -4517,13 +4449,11 @@ void MacroAssembler::vpmovzxbw(XMMRegister dst, Address src, int vector_len) {
} else if (dst_enc < 16) {
Assembler::vpmovzxbw(dst, src, vector_len);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::vpmovzxbw(xmm0, src, vector_len);
movdqu(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
}
}
@ -4532,12 +4462,10 @@ void MacroAssembler::vpmovmskb(Register dst, XMMRegister src) {
if (src_enc < 16) {
Assembler::vpmovmskb(dst, src);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::vpmovmskb(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
}
}
@ -4566,16 +4494,14 @@ void MacroAssembler::vpmullw(XMMRegister dst, XMMRegister nds, XMMRegister src,
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
} else {
// worse case scenario, all regs are in the upper bank
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm1);
evmovdqul(nds, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm1, src, Assembler::AVX_512bit);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::vpmullw(xmm0, xmm0, xmm1, vector_len);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
}
}
@ -4625,16 +4551,14 @@ void MacroAssembler::vpsubb(XMMRegister dst, XMMRegister nds, XMMRegister src, i
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
} else {
// worse case scenario, all regs are in the upper bank
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm1);
evmovdqul(nds, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm1, src, Assembler::AVX_512bit);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::vpsubb(xmm0, xmm0, xmm1, vector_len);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
}
}
@ -4684,16 +4608,14 @@ void MacroAssembler::vpsubw(XMMRegister dst, XMMRegister nds, XMMRegister src, i
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
} else {
// worse case scenario, all regs are in the upper bank
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm1);
evmovdqul(nds, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm1, src, Assembler::AVX_512bit);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::vpsubw(xmm0, xmm0, xmm1, vector_len);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
}
}
@ -4751,8 +4673,7 @@ void MacroAssembler::vpsraw(XMMRegister dst, XMMRegister nds, XMMRegister shift,
evmovdqul(dst, nds, Assembler::AVX_512bit);
} else {
// worse case scenario, all regs are in the upper bank
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm1);
evmovdqul(nds, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm1, shift, Assembler::AVX_512bit);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
@ -4760,8 +4681,7 @@ void MacroAssembler::vpsraw(XMMRegister dst, XMMRegister nds, XMMRegister shift,
evmovdqul(xmm1, dst, Assembler::AVX_512bit);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
}
}
@ -4819,8 +4739,7 @@ void MacroAssembler::vpsrlw(XMMRegister dst, XMMRegister nds, XMMRegister shift,
evmovdqul(dst, nds, Assembler::AVX_512bit);
} else {
// worse case scenario, all regs are in the upper bank
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm1);
evmovdqul(nds, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm1, shift, Assembler::AVX_512bit);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
@ -4828,8 +4747,7 @@ void MacroAssembler::vpsrlw(XMMRegister dst, XMMRegister nds, XMMRegister shift,
evmovdqul(xmm1, dst, Assembler::AVX_512bit);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
}
}
@ -4887,8 +4805,7 @@ void MacroAssembler::vpsllw(XMMRegister dst, XMMRegister nds, XMMRegister shift,
evmovdqul(dst, nds, Assembler::AVX_512bit);
} else {
// worse case scenario, all regs are in the upper bank
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm1);
evmovdqul(nds, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm1, shift, Assembler::AVX_512bit);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
@ -4896,8 +4813,7 @@ void MacroAssembler::vpsllw(XMMRegister dst, XMMRegister nds, XMMRegister shift,
evmovdqul(xmm1, dst, Assembler::AVX_512bit);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, nds, Assembler::AVX_512bit);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
}
}
@ -4928,31 +4844,23 @@ void MacroAssembler::vptest(XMMRegister dst, XMMRegister src) {
if ((dst_enc < 16) && (src_enc < 16)) {
Assembler::vptest(dst, src);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::vptest(xmm0, src);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::vptest(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
movdqu(xmm0, src);
movdqu(xmm1, dst);
Assembler::vptest(xmm1, xmm0);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
@ -4966,45 +4874,35 @@ void MacroAssembler::punpcklbw(XMMRegister dst, XMMRegister src) {
if (dst_enc < 16) {
Assembler::punpcklbw(dst, src);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::punpcklbw(xmm0, xmm0);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
}
} else {
if ((src_enc < 16) && (dst_enc < 16)) {
Assembler::punpcklbw(dst, src);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::punpcklbw(xmm0, src);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::punpcklbw(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
evmovdqul(xmm1, src, Assembler::AVX_512bit);
Assembler::punpcklbw(xmm0, xmm1);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
} else {
@ -5020,12 +4918,10 @@ void MacroAssembler::pshufd(XMMRegister dst, Address src, int mode) {
if (dst_enc < 16) {
Assembler::pshufd(dst, src, mode);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
Assembler::pshufd(xmm0, src, mode);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
}
}
}
@ -5040,45 +4936,35 @@ void MacroAssembler::pshuflw(XMMRegister dst, XMMRegister src, int mode) {
if (dst_enc < 16) {
Assembler::pshuflw(dst, src, mode);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::pshuflw(xmm0, xmm0, mode);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
}
} else {
if ((src_enc < 16) && (dst_enc < 16)) {
Assembler::pshuflw(dst, src, mode);
} else if (src_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
Assembler::pshuflw(xmm0, src, mode);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else if (dst_enc < 16) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
evmovdqul(xmm0, src, Assembler::AVX_512bit);
Assembler::pshuflw(dst, xmm0, mode);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm1, Assembler::AVX_512bit);
push_zmm(xmm0);
push_zmm(xmm1);
evmovdqul(xmm0, dst, Assembler::AVX_512bit);
evmovdqul(xmm1, src, Assembler::AVX_512bit);
Assembler::pshuflw(xmm0, xmm1, mode);
evmovdqul(dst, xmm0, Assembler::AVX_512bit);
evmovdqul(xmm1, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm1);
pop_zmm(xmm0);
}
}
} else {
@ -5166,13 +5052,11 @@ void MacroAssembler::vnegatess(XMMRegister dst, XMMRegister nds, AddressLiteral
if (VM_Version::supports_avx512novl() &&
(nds_upper_bank || dst_upper_bank)) {
if (dst_upper_bank) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
movflt(xmm0, nds);
vxorps(xmm0, xmm0, src, Assembler::AVX_128bit);
movflt(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
movflt(dst, nds);
vxorps(dst, dst, src, Assembler::AVX_128bit);
@ -5190,13 +5074,11 @@ void MacroAssembler::vnegatesd(XMMRegister dst, XMMRegister nds, AddressLiteral
if (VM_Version::supports_avx512novl() &&
(nds_upper_bank || dst_upper_bank)) {
if (dst_upper_bank) {
subptr(rsp, 64);
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
push_zmm(xmm0);
movdbl(xmm0, nds);
vxorpd(xmm0, xmm0, src, Assembler::AVX_128bit);
movdbl(dst, xmm0);
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
addptr(rsp, 64);
pop_zmm(xmm0);
} else {
movdbl(dst, nds);
vxorpd(dst, dst, src, Assembler::AVX_128bit);

View File

@ -482,6 +482,10 @@ class MacroAssembler: public Assembler {
// from register xmm0. Otherwise, the value is stored from the FPU stack.
void store_double(Address dst);
// Save/restore ZMM (512bit) register on stack.
void push_zmm(XMMRegister reg);
void pop_zmm(XMMRegister reg);
// pushes double TOS element of FPU stack on CPU stack; pops from FPU stack
void push_fTOS();

View File

@ -38,8 +38,7 @@ import java.util.List;
* @since 1.4.1
*/
enum ProtocolVersion {
// TLS13 (0x0304, "TLSv1.3", false),
TLS13 (SSLConfiguration.tls13VN, "TLSv1.3", false),
TLS13 (0x0304, "TLSv1.3", false),
TLS12 (0x0303, "TLSv1.2", false),
TLS11 (0x0302, "TLSv1.1", false),
TLS10 (0x0301, "TLSv1", false),

View File

@ -100,10 +100,6 @@ final class SSLConfiguration implements Cloneable {
static final boolean acknowledgeCloseNotify = Utilities.getBooleanProperty(
"jdk.tls.acknowledgeCloseNotify", false);
// TODO: Please remove after TLS 1.3 draft interop testing
// delete me
static int tls13VN;
// Is the extended_master_secret extension supported?
static {
boolean supportExtendedMasterSecret = Utilities.getBooleanProperty(
@ -116,21 +112,6 @@ static int tls13VN;
}
}
useExtendedMasterSecret = supportExtendedMasterSecret;
// delete me
try {
tls13VN =
AccessController.doPrivileged(
new PrivilegedExceptionAction<Integer>() {
@Override
public Integer run() throws Exception {
return Integer.parseInt(
System.getProperty("jdk.tls13.version", "0304"), 16);
}
});
} catch (PrivilegedActionException ex) {
// blank
}
}
SSLConfiguration(SSLContextImpl sslContext, boolean isClientMode) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,15 +25,63 @@
package com.apple.laf;
import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.ImageIcon;
import javax.swing.JRadioButton;
import javax.swing.Icon;
import javax.swing.AbstractButton;
import javax.swing.AbstractAction;
import javax.swing.KeyStroke;
import javax.swing.DefaultButtonModel;
import javax.swing.ButtonGroup;
import javax.swing.ButtonModel;
import javax.swing.plaf.ComponentUI;
import apple.laf.JRSUIConstants.*;
import java.awt.Component;
import java.awt.AWTKeyStroke;
import java.awt.KeyboardFocusManager;
import com.apple.laf.AquaUtilControlSize.*;
import com.apple.laf.AquaUtils.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
import apple.laf.JRSUIConstants.Widget;
import com.apple.laf.AquaUtilControlSize.SizeVariant;
import com.apple.laf.AquaUtilControlSize.SizeDescriptor;
import com.apple.laf.AquaUtils.RecyclableSingleton;
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
import java.util.HashSet;
import java.util.Set;
import java.util.Enumeration;
public class AquaButtonRadioUI extends AquaButtonLabeledUI {
private KeyListener keyListener = null;
@SuppressWarnings("serial")
private class SelectPreviousBtn extends AbstractAction {
public SelectPreviousBtn() {
super("Previous");
}
@Override
public void actionPerformed(ActionEvent e) {
AquaButtonRadioUI.this.selectRadioButton(e, false);
}
}
@SuppressWarnings("serial")
private class SelectNextBtn extends AbstractAction {
public SelectNextBtn() {
super("Next");
}
@Override
public void actionPerformed(ActionEvent e) {
AquaButtonRadioUI.this.selectRadioButton(e, true);
}
}
private static final RecyclableSingleton<AquaButtonRadioUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaButtonRadioUI>(AquaButtonRadioUI.class);
private static final RecyclableSingleton<ImageIcon> sizingIcon = new RecyclableSingleton<ImageIcon>() {
protected ImageIcon getInstance() {
@ -45,7 +93,7 @@ public class AquaButtonRadioUI extends AquaButtonLabeledUI {
return instance.get();
}
public static Icon getSizingRadioButtonIcon(){
public static Icon getSizingRadioButtonIcon() {
return sizingIcon.get();
}
@ -67,4 +115,269 @@ public class AquaButtonRadioUI extends AquaButtonLabeledUI {
super(other);
}
}
private KeyListener createKeyListener() {
if (keyListener == null) {
keyListener = new KeyHandler();
}
return keyListener;
}
private boolean isValidRadioButtonObj(Object obj) {
return ((obj instanceof JRadioButton) &&
((JRadioButton)obj).isVisible() &&
((JRadioButton)obj).isEnabled());
}
@Override
protected void installListeners(AbstractButton button) {
super.installListeners(button);
//Only for JRadioButton
if (!(button instanceof JRadioButton))
return;
keyListener = createKeyListener();
button.addKeyListener(keyListener);
button.setFocusTraversalKeysEnabled(false);
button.getActionMap().put("Previous", new SelectPreviousBtn());
button.getActionMap().put("Next", new SelectNextBtn());
button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
put(KeyStroke.getKeyStroke("UP"), "Previous");
button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
put(KeyStroke.getKeyStroke("DOWN"), "Next");
button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
put(KeyStroke.getKeyStroke("LEFT"), "Previous");
button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
put(KeyStroke.getKeyStroke("RIGHT"), "Next");
}
@Override
protected void uninstallListeners(AbstractButton button) {
super.uninstallListeners(button);
//Only for JRadioButton
if (!(button instanceof JRadioButton))
return;
//Unmap actions from the arrow keys.
button.getActionMap().remove("Previous");
button.getActionMap().remove("Next");
button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
remove(KeyStroke.getKeyStroke("UP"));
button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
remove(KeyStroke.getKeyStroke("DOWN"));
button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
remove(KeyStroke.getKeyStroke("LEFT"));
button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
remove(KeyStroke.getKeyStroke("RIGHT"));
if (keyListener != null ) {
button.removeKeyListener(keyListener);
keyListener = null;
}
}
/**
* Select radio button based on "Previous" or "Next" operation
*
* @param event, the event object.
* @param next, indicate if it's next one
*/
private void selectRadioButton(ActionEvent event, boolean next) {
Object eventSrc = event.getSource();
//Check whether the source is JRadioButton, if so, whether it is visible
if (!isValidRadioButtonObj(eventSrc))
return;
ButtonGroupInfo btnGroupInfo = new ButtonGroupInfo((JRadioButton)eventSrc);
btnGroupInfo.selectNewButton(next);
}
/**
* ButtonGroupInfo, used to get related info in button group
* for given radio button.
*/
private class ButtonGroupInfo {
JRadioButton activeBtn = null;
JRadioButton firstBtn = null;
JRadioButton lastBtn = null;
JRadioButton previousBtn = null;
JRadioButton nextBtn = null;
HashSet<JRadioButton> btnsInGroup = null;
boolean srcFound = false;
public ButtonGroupInfo(JRadioButton btn) {
activeBtn = btn;
btnsInGroup = new HashSet<JRadioButton>();
}
//Check if given object is in the button group
boolean containsInGroup(Object obj) {
return btnsInGroup.contains(obj);
}
//Check if the next object to gain focus belongs
//to the button group or not
Component getFocusTransferBaseComponent(boolean next) {
return firstBtn;
}
boolean getButtonGroupInfo() {
if (activeBtn == null)
return false;
btnsInGroup.clear();
//Get the button model from ths source.
ButtonModel model = activeBtn.getModel();
if (!(model instanceof DefaultButtonModel))
return false;
// If the button model is DefaultButtonModel, and use it, otherwise return.
DefaultButtonModel bm = (DefaultButtonModel) model;
//get the ButtonGroup of the button from the button model
ButtonGroup group = bm.getGroup();
if (group == null)
return false;
Enumeration<AbstractButton> e = group.getElements();
if (e == null)
return false;
while (e.hasMoreElements()) {
AbstractButton curElement = e.nextElement();
if (!isValidRadioButtonObj(curElement))
continue;
btnsInGroup.add((JRadioButton) curElement);
// If firstBtn is not set yet, curElement is that first button
if (null == firstBtn)
firstBtn = (JRadioButton)curElement;
if (activeBtn == curElement)
srcFound = true;
else if (!srcFound) {
//The source has not been yet found and the current element
// is the last previousBtn
previousBtn = (JRadioButton) curElement;
} else if (nextBtn == null) {
//The source has been found and the current element
//is the next valid button of the list
nextBtn = (JRadioButton) curElement;
}
//Set new last "valid" JRadioButton of the list
lastBtn = (JRadioButton)curElement;
}
return true;
}
/**
* Find the new radio button that focus needs to be
* moved to in the group, select the button
*
* @param next, indicate if it's arrow up/left or down/right
*/
void selectNewButton(boolean next) {
if (!getButtonGroupInfo())
return;
if (srcFound) {
JRadioButton newSelectedBtn = null;
if (next) {
//Select Next button. Cycle to the first button if the source
//button is the last of the group.
newSelectedBtn = (null == nextBtn) ? firstBtn : nextBtn;
} else {
//Select previous button. Cycle to the last button if the source
//button is the first button of the group.
newSelectedBtn = (null == previousBtn) ? lastBtn: previousBtn;
}
if (newSelectedBtn != null && newSelectedBtn != activeBtn) {
newSelectedBtn.requestFocusInWindow();
newSelectedBtn.setSelected(true);
}
}
}
/**
* Find the button group the passed in JRadioButton belongs to, and
* move focus to next component of the last button in the group
* or previous compoennt of first button
*
* @param next, indicate if jump to next component or previous
*/
void jumpToNextComponent(boolean next) {
if (!getButtonGroupInfo()) {
//In case the button does not belong to any group, it needs
//to be treated as a component
if (activeBtn != null) {
lastBtn = activeBtn;
firstBtn = activeBtn;
} else
return;
}
//If next component in the parent window is not in the button
//group, current active button will be base, otherwise, the base
// will be first or last button in the button group
Component focusBase = getFocusTransferBaseComponent(next);
if (focusBase != null) {
if (next) {
KeyboardFocusManager.
getCurrentKeyboardFocusManager().focusNextComponent(focusBase);
} else {
KeyboardFocusManager.
getCurrentKeyboardFocusManager().focusPreviousComponent(focusBase);
}
}
}
}
/**
* Radiobutton KeyListener
*/
private class KeyHandler implements KeyListener {
//This listener checks if the key event is a focus traversal key event
// on a radio button, consume the event if so and move the focus
// to next/previous component
@Override
public void keyPressed(KeyEvent e) {
AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
if (stroke != null && e.getSource() instanceof JRadioButton) {
JRadioButton source = (JRadioButton) e.getSource();
boolean next = isFocusTraversalKey(source,
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, stroke);
if (next || isFocusTraversalKey(source,
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, stroke)) {
e.consume();
ButtonGroupInfo btnGroupInfo = new ButtonGroupInfo(source);
btnGroupInfo.jumpToNextComponent(next);
}
}
}
private boolean isFocusTraversalKey(JComponent c, int id,
AWTKeyStroke stroke) {
Set<AWTKeyStroke> keys = c.getFocusTraversalKeys(id);
return keys != null && keys.contains(stroke);
}
@Override public void keyReleased(KeyEvent e) {}
@Override public void keyTyped(KeyEvent e) {}
}
}

View File

@ -378,7 +378,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Either java.awt.Frame or java.awt.Dialog can be resizable, however java.awt.Window is never resizable
{
final boolean resizable = isTargetResizable() && isNativelyFocusableWindow();
final boolean resizable = isFrame ? ((Frame)target).isResizable() : (isDialog ? ((Dialog)target).isResizable() : false);
styleBits = SET(styleBits, RESIZABLE, resizable);
if (!resizable) {
styleBits = SET(styleBits, ZOOMABLE, false);
@ -482,16 +482,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
return styleBits;
}
private boolean isTargetResizable() {
if (target instanceof Frame) {
return ((Frame)target).isResizable();
} else if (target instanceof Dialog) {
return ((Dialog)target).isResizable();
}
return false;
}
// this is the counter-point to -[CWindow _nativeSetStyleBit:]
private void setStyleBits(final int mask, final boolean value) {
execute(ptr -> nativeSetNSWindowStyleBits(ptr, mask, value ? mask : 0));
@ -686,9 +676,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Manage the extended state when showing
if (visible) {
/* Frame or Dialog should be set property WINDOW_FULLSCREENABLE to true if the
Frame or Dialog is resizable and focusable.
Frame or Dialog is resizable.
**/
final boolean resizable = isTargetResizable() && isNativelyFocusableWindow();
final boolean resizable = (target instanceof Frame) ? ((Frame)target).isResizable() :
((target instanceof Dialog) ? ((Dialog)target).isResizable() : false);
if (resizable) {
setCanFullscreen(true);
}
@ -823,10 +814,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override
public void setResizable(final boolean resizable) {
final boolean windowResizable = resizable && isNativelyFocusableWindow();
setCanFullscreen(windowResizable);
setStyleBits(RESIZABLE, windowResizable);
setStyleBits(ZOOMABLE, windowResizable);
setCanFullscreen(resizable);
setStyleBits(RESIZABLE, resizable);
setStyleBits(ZOOMABLE, resizable);
}
@Override
@ -868,8 +858,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override
public void updateFocusableWindowState() {
setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN | RESIZABLE,
(isNativelyFocusableWindow() && isTargetResizable()));
final boolean isFocusable = isNativelyFocusableWindow();
setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN, isFocusable); // set both bits at once
}
@Override

View File

@ -40,6 +40,7 @@ import java.util.function.Function;
import java.net.http.HttpHeaders;
import java.net.http.HttpResponse;
import jdk.internal.net.http.ResponseContent.BodyParser;
import jdk.internal.net.http.ResponseContent.UnknownLengthBodyParser;
import jdk.internal.net.http.common.Log;
import jdk.internal.net.http.common.Logger;
import jdk.internal.net.http.common.MinimalFuture;
@ -67,6 +68,7 @@ class Http1Response<T> {
private final BodyReader bodyReader; // used to read the body
private final Http1AsyncReceiver asyncReceiver;
private volatile EOFException eof;
private volatile BodyParser bodyParser;
// max number of bytes of (fixed length) body to ignore on redirect
private final static int MAX_IGNORE = 1024;
@ -230,6 +232,10 @@ class Http1Response<T> {
return finished;
}
/**
* Return known fixed content length or -1 if chunked, or -2 if no content-length
* information in which case, connection termination delimits the response body
*/
int fixupContentLen(int clen) {
if (request.method().equalsIgnoreCase("HEAD") || responseCode == HTTP_NOT_MODIFIED) {
return 0;
@ -239,7 +245,11 @@ class Http1Response<T> {
.equalsIgnoreCase("chunked")) {
return -1;
}
return 0;
if (responseCode == 101) {
// this is a h2c or websocket upgrade, contentlength must be zero
return 0;
}
return -2;
}
return clen;
}
@ -401,7 +411,7 @@ class Http1Response<T> {
// to prevent the SelectorManager thread from exiting until
// the body is fully read.
refCountTracker.acquire();
bodyReader.start(content.getBodyParser(
bodyParser = content.getBodyParser(
(t) -> {
try {
if (t != null) {
@ -417,7 +427,8 @@ class Http1Response<T> {
connection.close();
}
}
}));
});
bodyReader.start(bodyParser);
CompletableFuture<State> bodyReaderCF = bodyReader.completion();
asyncReceiver.subscribe(bodyReader);
assert bodyReaderCF != null : "parsing not started";
@ -723,6 +734,11 @@ class Http1Response<T> {
@Override
public final void onReadError(Throwable t) {
if (t instanceof EOFException && bodyParser != null &&
bodyParser instanceof UnknownLengthBodyParser) {
((UnknownLengthBodyParser)bodyParser).complete();
return;
}
t = wrapWithExtraDetail(t, parser::currentStateMessage);
Http1Response.this.onReadError(t);
}

View File

@ -75,6 +75,12 @@ class ResponseContent {
if (chunkedContentInitialized) {
return chunkedContent;
}
if (contentLength == -2) {
// HTTP/1.0 content
chunkedContentInitialized = true;
chunkedContent = false;
return chunkedContent;
}
if (contentLength == -1) {
String tc = headers.firstValue("Transfer-Encoding")
.orElse("");
@ -111,7 +117,9 @@ class ResponseContent {
if (contentChunked()) {
return new ChunkedBodyParser(onComplete);
} else {
return new FixedLengthBodyParser(contentLength, onComplete);
return contentLength == -2
? new UnknownLengthBodyParser(onComplete)
: new FixedLengthBodyParser(contentLength, onComplete);
}
}
@ -392,6 +400,79 @@ class ResponseContent {
}
class UnknownLengthBodyParser implements BodyParser {
final Consumer<Throwable> onComplete;
final Logger debug = Utils.getDebugLogger(this::dbgString, Utils.DEBUG);
final String dbgTag = ResponseContent.this.dbgTag + "/UnknownLengthBodyParser";
volatile Throwable closedExceptionally;
volatile AbstractSubscription sub;
volatile int breceived = 0;
UnknownLengthBodyParser(Consumer<Throwable> onComplete) {
this.onComplete = onComplete;
}
String dbgString() {
return dbgTag;
}
@Override
public void onSubscribe(AbstractSubscription sub) {
if (debug.on())
debug.log("onSubscribe: " + pusher.getClass().getName());
pusher.onSubscribe(this.sub = sub);
}
@Override
public String currentStateMessage() {
return format("http1_0 content, bytes received: %d", breceived);
}
@Override
public void accept(ByteBuffer b) {
if (closedExceptionally != null) {
if (debug.on())
debug.log("already closed: " + closedExceptionally);
return;
}
boolean completed = false;
try {
if (debug.on())
debug.log("Parser got %d bytes ", b.remaining());
if (b.hasRemaining()) {
// only reduce demand if we actually push something.
// we would not have come here if there was no
// demand.
boolean hasDemand = sub.demand().tryDecrement();
assert hasDemand;
breceived += b.remaining();
pusher.onNext(List.of(b.asReadOnlyBuffer()));
}
} catch (Throwable t) {
if (debug.on()) debug.log("Unexpected exception", t);
closedExceptionally = t;
if (!completed) {
onComplete.accept(t);
}
}
}
/**
* Must be called externally when connection has closed
* and therefore no more bytes can be read
*/
public void complete() {
// We're done! All data has been received.
if (debug.on())
debug.log("Parser got all expected bytes: completing");
assert closedExceptionally == null;
onFinished.run();
pusher.onComplete();
onComplete.accept(closedExceptionally); // should be null
}
}
class FixedLengthBodyParser implements BodyParser {
final int contentLength;
final Consumer<Throwable> onComplete;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -55,7 +55,8 @@ public final class GathererFactory {
Properties osProperty = Utils.getProperties(osName);
try {
ActionHelper helper = new ActionHelper(workdir, "config", osProperty, jdks);
return new ToolKit(helper, log, osName, "common");
// os-specific action set must be last, b/c they can kill the process
return new ToolKit(helper, log, "common", osName);
} catch (InvalidValueException e) {
throw new IllegalStateException("can't create tool kit", e);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -56,9 +56,6 @@ public class ToolKit implements EnvironmentInfoGatherer, ProcessInfoGatherer {
pids.add(pid);
for (Long p = pids.poll(); p != null; p = pids.poll()) {
HtmlSection pidSection = section.createChildren("" + p);
for (ActionSet set : actions) {
set.gatherProcessInfo(pidSection, p);
}
List<Long> children = helper.getChildren(pidSection, p);
if (!children.isEmpty()) {
HtmlSection s = pidSection.createChildren("children");
@ -67,6 +64,9 @@ public class ToolKit implements EnvironmentInfoGatherer, ProcessInfoGatherer {
}
pids.addAll(children);
}
for (ActionSet set : actions) {
set.gatherProcessInfo(pidSection, p);
}
}
}
}

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -52,9 +52,9 @@ native.stack.args=--pid=%p\0-batch\0-ex\0thread apply all backtrace
native.stack.args.delimiter=\0
native.stack.params.repeat=6
native.core.app=gcore
native.core.args=-o ./core.%p %p
native.core.params.timeout=3600000
# has to be the last command
native.core.app=kill
native.core.args=-ABRT %p
################################################################################
# environment info to gather
################################################################################

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -61,11 +61,9 @@ native.stack.delimiter=\0
native.stack.params.repeat=6
native.stack.args=-c\0DevToolsSecurity --status | grep -q enabled && lldb -o 'attach %p' -o 'thread backtrace all' -o 'detach' -o 'quit'
native.core.app=bash
native.core.delimiter=\0
native.core.args=-c\0gcore -o ./core.%p %p || \
(DevToolsSecurity --status | grep -q enabled && lldb --batch -o 'attach %p' -o 'process save-core core.%p' -o 'detach' -o 'quit')
native.core.params.timeout=3600000
# has to be the last command
native.core.app=kill
native.core.args=-ABRT %p
################################################################################
# environment info to gather
################################################################################

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -51,9 +51,9 @@ native.stack.app=pstack
native.stack.args=-F %p
native.stack.params.repeat=6
native.core.app=gcore
native.core.args=-F -o ./core %p
native.core.params.timeout=3600000
# has to be the last command
native.core.app=kill
native.core.args=-ABRT %p
################################################################################
# environment info to gather
################################################################################

View File

@ -62,8 +62,6 @@ gc/g1/plab/TestPLABEvacuationFailure.java 8191048 generi
gc/g1/plab/TestPLABPromotion.java 8191048 generic-all
gc/g1/plab/TestPLABResize.java 8191048 generic-all
gc/TestNUMAPageSize.java 8194949 generic-all
compiler/compilercontrol/directives/LogTest.java 8181753 generic-all
gc/parallel/TestPrintGCDetailsVerbose.java 8200186 macosx-all

View File

@ -147,7 +147,7 @@ java/awt/event/KeyEvent/CorrectTime/CorrectTime.java 6626492 generic-all
java/awt/EventQueue/6980209/bug6980209.java 8198615 macosx-all
java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java 8198237 macosx-all
java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java 8144030 macosx-all
java/awt/Frame/UnfocusableMaximizedFrameResizablity/UnfocusableMaximizedFrameResizablity.java 7158623 macosx-all
java/awt/Frame/UnfocusableMaximizedFrameResizablity/UnfocusableMaximizedFrameResizablity.java 8208290 macosx-all
java/awt/grab/EmbeddedFrameTest1/EmbeddedFrameTest1.java 7080150 macosx-all
java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java 8168646 generic-all
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java 8198623 macosx-all
@ -639,7 +639,7 @@ sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java 8204203 windows-
sun/security/pkcs11/KeyGenerator/DESParity.java 8204203 windows-all
sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java 8204203 windows-all
sun/security/pkcs11/KeyPairGenerator/TestDH2048.java 8204203 windows-all
sun/security/pkcs11/KeyStore/SecretKeysBasic.sh 8204203 windows-all
sun/security/pkcs11/KeyStore/SecretKeysBasic.sh 8204203,8209398 generic-all
sun/security/pkcs11/Mac/MacKAT.java 8204203 windows-all
sun/security/pkcs11/Mac/MacSameTest.java 8204203 windows-all
sun/security/pkcs11/Mac/ReinitMac.java 8204203 windows-all

View File

@ -24,7 +24,7 @@
/*
@test
@key headful
@bug 4980161 7158623 8204860
@bug 4980161 7158623 8204860 8208125
@summary Setting focusable window state to false makes the maximized frame resizable
@compile UnfocusableMaximizedFrameResizablity.java
@run main UnfocusableMaximizedFrameResizablity
@ -36,13 +36,10 @@ import java.awt.Rectangle;
import java.awt.AWTException;
import java.awt.event.InputEvent;
import java.awt.Robot;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class UnfocusableMaximizedFrameResizablity {
private static Frame frame;
private static JFrame jframe;
private static Robot robot;
private static boolean isProgInterruption = false;
private static Thread mainThread = null;
@ -55,65 +52,13 @@ public class UnfocusableMaximizedFrameResizablity {
return;
}
//Case 1: Setting frame resizable to true followed by focusable to false
frame = createFrame("Resizable Unfocusable frame");
frame.setResizable(true);
frame.setFocusableWindowState(false);
tryToResizeFrame(frame);
//Case 2: Setting frame focusable to false followed by resizable to true
frame = createFrame("Unfocusable Resizable frame");
frame.setFocusableWindowState(false);
frame.setResizable(true);
tryToResizeFrame(frame);
//Case 3: Testing JFrame fullscreen behaviour only on Mac OS
if (System.getProperty("os.name").toLowerCase().startsWith("mac")) {
SwingUtilities.invokeAndWait(new Runnable() {
Override
public void run() {
jframe = createJFrame("Unfocusable Resizable JFrame");
jframe.setFocusableWindowState(false);
jframe.setResizable(true);
Object prop1 = jframe.getRootPane().getClientProperty("apple.awt.fullscreenable");
jframe.setVisible(false);
jframe.setVisible(true);
Object prop2 = jframe.getRootPane().getClientProperty("apple.awt.fullscreenable");
if((prop1 != null && prop2 != null) && (!prop1.equals(prop2))) {
jframe.dispose();
cleanup();
throw new RuntimeException("Non-focusable resizable JFrame is fullscreenable!!");
}
}
});
}
cleanup();
}
private static JFrame createJFrame(String title) {
JFrame jframe = new JFrame(title);
jframe.setMaximizedBounds(new Rectangle(0, 0, 300, 300));
jframe.setSize(200, 200);
jframe.setVisible(true);
jframe.setExtendedState(Frame.MAXIMIZED_BOTH);
return jframe;
}
private static Frame createFrame(String title) {
Frame frame = new Frame(title);
frame = new Frame("Unfocusable frame");
frame.setMaximizedBounds(new Rectangle(0, 0, 300, 300));
frame.setSize(200, 200);
frame.setVisible(true);
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setFocusableWindowState(false);
return frame;
}
private static void tryToResizeFrame(Frame frame) {
try {
robot = new Robot();
} catch (AWTException e) {
@ -144,11 +89,11 @@ public class UnfocusableMaximizedFrameResizablity {
cleanup();
throw new RuntimeException("The maximized unfocusable frame can be resized.");
}
frame.dispose();
cleanup();
}
private static void cleanup() {
frame.dispose();
isProgInterruption = true;
mainThread.interrupt();
}

View File

@ -0,0 +1,164 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URI;
import java.net.SocketTimeoutException;
import java.time.Duration;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ServerSocketFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLParameters;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import jdk.testlibrary.SimpleSSLContext;
/**
* @test
* @bug 8207966
* @library /lib/testlibrary
* @build jdk.testlibrary.SimpleSSLContext
* @run main/othervm -Djdk.tls.acknowledgeCloseNotify=true UnknownBodyLengthTest plain false
* @run main/othervm -Djdk.tls.acknowledgeCloseNotify=true UnknownBodyLengthTest SSL false
* @run main/othervm -Djdk.tls.acknowledgeCloseNotify=true UnknownBodyLengthTest plain true
* @run main/othervm -Djdk.tls.acknowledgeCloseNotify=true UnknownBodyLengthTest SSL true
*/
public class UnknownBodyLengthTest {
static final byte[] BUF = new byte[32 * 10234 + 2];
volatile SSLContext ctx;
volatile ServerSocketFactory factory;
volatile String clientURL;
volatile int port;
final ServerSocket ss;
UnknownBodyLengthTest(boolean useSSL) throws Exception {
ctx = new SimpleSSLContext().get();
SSLContext.setDefault(ctx);
factory = useSSL ? SSLServerSocketFactory.getDefault()
: ServerSocketFactory.getDefault();
ss = factory.createServerSocket();
ss.setReuseAddress(true);
ss.bind(new InetSocketAddress("127.0.0.1", 0));
System.out.println("ServerSocket = " + ss.getClass() + " " + ss);
port = ss.getLocalPort();
clientURL = (useSSL ? "https" : "http") + "://localhost:"
+ Integer.toString(port) + "/test";
}
static void fillBuf(byte[] buf) {
for (int i=0; i<buf.length; i++)
buf[i] = (byte)i;
}
static void checkBuf(byte[] buf) {
if (buf.length != BUF.length)
throw new RuntimeException("buffer lengths not the same");
for (int i=0; i<buf.length; i++)
if (buf[i] != BUF[i])
throw new RuntimeException("error at position " + i);
}
void server(final boolean withContentLength) {
fillBuf(BUF);
try {
Socket s = ss.accept();
s.setTcpNoDelay(true);
s.setSoLinger(true, 1);
System.out.println("Accepted: "+s.getRemoteSocketAddress());
System.out.println("Accepted: "+s);
OutputStream os = s.getOutputStream();
InputStream is = s.getInputStream();
boolean done = false;
byte[] buf = new byte[1024];
String rsp = "";
while (!done) {
int c = is.read(buf);
if (c < 0) break;
String s1 = new String(buf, 0, c, "ISO-8859-1");
rsp += s1;
done = rsp.endsWith("!#!#");
}
String r = "HTTP/1.0 200 OK\r\nConnection: close\r\nContent-Type:" +
" text/xml; charset=UTF-8\r\n";
os.write(r.getBytes());
String chdr = "Content-Length: " + Integer.toString(BUF.length) +
"\r\n";
System.out.println(chdr);
if(withContentLength)
os.write(chdr.getBytes());
os.write("\r\n".getBytes());
os.write(BUF);
if (is.available() > 0)
is.read(buf);
os.flush();
os.close();
s.shutdownOutput();
s.close();
} catch(final Throwable t) {
t.printStackTrace();
} finally {
try {ss.close(); } catch (Exception e) {}
}
}
void client(boolean useSSL) throws Exception {
SSLContext ctx = SSLContext.getDefault();
HttpClient.Builder clientB = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_2);
if (useSSL) {
clientB = clientB.sslContext(ctx)
.sslParameters(ctx.getSupportedSSLParameters());
}
final HttpClient client = clientB.build();
System.out.println("URL: " + clientURL);
final HttpResponse<byte[]> response = client
.send(HttpRequest
.newBuilder(new URI(clientURL))
.timeout(Duration.ofMillis(120_000))
.POST(HttpRequest.BodyPublishers.ofString("body!#!#"))
.build(), HttpResponse.BodyHandlers.ofByteArray());
System.out.println("Received reply: " + response.statusCode());
byte[] bb = response.body();
checkBuf(bb);
}
public static void main(final String[] args) throws Exception {
boolean ssl = args[0].equals("SSL");
boolean fixedlen = args[1].equals("true");
UnknownBodyLengthTest test = new UnknownBodyLengthTest(ssl);
test.run(ssl, fixedlen);
}
public void run(boolean ssl, boolean fixedlen) throws Exception {
new Thread(()->server(fixedlen)).start();
client(ssl);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @key headful
* @library ../../regtesthelpers
* @build Util
* @bug 8033699 8154043 8167160
* @bug 8033699 8154043 8167160 8208640
* @summary Incorrect radio button behavior when pressing tab key
* @run main bug8033699
*/
@ -59,12 +59,9 @@ public class bug8033699 {
private static JRadioButton radioBtnSingle;
public static void main(String args[]) throws Throwable {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
SwingUtilities.invokeAndWait(() -> {
changeLAF();
createAndShowGUI();
}
});
robot = new Robot();
@ -96,19 +93,14 @@ public class bug8033699 {
// down key circle back to first button in grouped radio button
runTest8();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
mainFrame.dispose();
}
});
SwingUtilities.invokeAndWait(() -> mainFrame.dispose());
}
private static void changeLAF() {
String currentLAF = UIManager.getLookAndFeel().toString();
System.out.println(currentLAF);
currentLAF = currentLAF.toLowerCase();
if (currentLAF.contains("aqua") || currentLAF.contains("nimbus")) {
if (currentLAF.contains("nimbus")) {
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception ex) {
@ -167,13 +159,10 @@ public class bug8033699 {
hitKey(robot, KeyEvent.VK_TAB);
hitKey(robot, KeyEvent.VK_TAB);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
System.out.println("Radio Button Group Go To Next Component through Tab Key failed");
throw new RuntimeException("Focus is not on Radio Button Single as Expected");
}
SwingUtilities.invokeAndWait(() -> {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
System.out.println("Radio Button Group Go To Next Component through Tab Key failed");
throw new RuntimeException("Focus is not on Radio Button Single as Expected");
}
});
}
@ -181,13 +170,10 @@ public class bug8033699 {
// Non-Grouped Radio button as a single component when traversing through tab key
private static void runTest2() throws Exception {
hitKey(robot, KeyEvent.VK_TAB);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnEnd) {
System.out.println("Non Grouped Radio Button Go To Next Component through Tab Key failed");
throw new RuntimeException("Focus is not on Button End as Expected");
}
SwingUtilities.invokeAndWait(() -> {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnEnd) {
System.out.println("Non Grouped Radio Button Go To Next Component through Tab Key failed");
throw new RuntimeException("Focus is not on Button End as Expected");
}
});
}
@ -197,13 +183,10 @@ public class bug8033699 {
hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
System.out.println("Radio button Group/Non Grouped Radio Button SHIFT-Tab Key Test failed");
throw new RuntimeException("Focus is not on Radio Button A as Expected");
}
SwingUtilities.invokeAndWait(() -> {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
System.out.println("Radio button Group/Non Grouped Radio Button SHIFT-Tab Key Test failed");
throw new RuntimeException("Focus is not on Radio Button A as Expected");
}
});
}
@ -212,13 +195,10 @@ public class bug8033699 {
private static void runTest4() throws Exception {
hitKey(robot, KeyEvent.VK_DOWN);
hitKey(robot, KeyEvent.VK_RIGHT);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
System.out.println("Radio button Group UP/LEFT Arrow Key Move Focus Failed");
throw new RuntimeException("Focus is not on Radio Button C as Expected");
}
SwingUtilities.invokeAndWait(() -> {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
System.out.println("Radio button Group UP/LEFT Arrow Key Move Focus Failed");
throw new RuntimeException("Focus is not on Radio Button C as Expected");
}
});
}
@ -226,13 +206,10 @@ public class bug8033699 {
private static void runTest5() throws Exception {
hitKey(robot, KeyEvent.VK_UP);
hitKey(robot, KeyEvent.VK_LEFT);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
System.out.println("Radio button Group Left/Up Arrow Key Move Focus Failed");
throw new RuntimeException("Focus is not on Radio Button A as Expected");
}
SwingUtilities.invokeAndWait(() -> {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
System.out.println("Radio button Group Left/Up Arrow Key Move Focus Failed");
throw new RuntimeException("Focus is not on Radio Button A as Expected");
}
});
}
@ -240,39 +217,30 @@ public class bug8033699 {
private static void runTest6() throws Exception {
hitKey(robot, KeyEvent.VK_UP);
hitKey(robot, KeyEvent.VK_UP);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn2) {
System.out.println("Radio button Group Circle Back To First Button Test");
throw new RuntimeException("Focus is not on Radio Button B as Expected");
}
SwingUtilities.invokeAndWait(() -> {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn2) {
System.out.println("Radio button Group Circle Back To First Button Test");
throw new RuntimeException("Focus is not on Radio Button B as Expected");
}
});
}
private static void runTest7() throws Exception {
hitKey(robot, KeyEvent.VK_TAB);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnMiddle) {
System.out.println("Separate Component added in button group layout");
throw new RuntimeException("Focus is not on Middle Button as Expected");
}
SwingUtilities.invokeAndWait(() -> {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnMiddle) {
System.out.println("Separate Component added in button group layout");
throw new RuntimeException("Focus is not on Middle Button as Expected");
}
});
}
private static void runTest8() throws Exception {
hitKey(robot, KeyEvent.VK_TAB);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
System.out.println("Separate Component added in button group layout");
throw new RuntimeException("Focus is not on Radio Button Single as Expected");
}
SwingUtilities.invokeAndWait(() -> {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
System.out.println("Separate Component added in button group layout");
throw new RuntimeException("Focus is not on Radio Button Single as Expected");
}
});
}

View File

@ -25,6 +25,7 @@
/**
* @test
* @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 8209452
* 8209506
* @summary Check root CA entries in cacerts file
*/
import java.io.File;
@ -41,7 +42,7 @@ public class VerifyCACerts {
+ File.separator + "security" + File.separator + "cacerts";
// The numbers of certs now.
private static final int COUNT = 90;
private static final int COUNT = 92;
// map of cert alias to SHA-256 fingerprint
private static final Map<String, String> FINGERPRINT_MAP
@ -227,6 +228,10 @@ public class VerifyCACerts {
"CB:B5:22:D7:B7:F1:27:AD:6A:01:13:86:5B:DF:1C:D4:10:2E:7D:07:59:AF:63:5A:7C:F4:72:0D:C9:63:C5:3B");
put("globalsigneccrootcar5 [jdk]",
"17:9F:BC:14:8A:3D:D0:0F:D2:4E:A1:34:58:CC:43:BF:A7:F5:9C:81:82:D7:83:A5:13:F6:EB:EC:10:0C:89:24");
put("globalsigneccrootcar4 [jdk]",
"BE:C9:49:11:C2:95:56:76:DB:6C:0A:55:09:86:D7:6E:3B:A0:05:66:7C:44:2C:97:62:B4:FB:B7:73:DE:22:8C");
put("globalsignr2ca [jdk]",
"CA:42:DD:41:74:5F:D0:B8:1E:B9:02:36:2C:F9:D8:BF:71:9D:A1:BD:1B:1E:FC:94:6F:5B:4C:99:F4:2C:1B:9E");
}
};

View File

@ -30,6 +30,7 @@
* @test
* @bug 6840752 8168078
* @summary Provide out-of-the-box support for ECC algorithms
* @library /test/lib
* @library ../pkcs11
* @library ../pkcs11/ec
* @library ../pkcs11/sslecc

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
/*
* @test
* @bug 8063700
* @library /test/lib
* @run main/othervm -Xcheck:jni JNICheck
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4856966
* @summary
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm ReinitCipher

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6687725
* @summary Test internal PKCS5Padding impl with various error conditions.
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestPKCS5PaddingError
* @run main/othervm TestPKCS5PaddingError sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4898468 6994008
* @summary basic test for RSA cipher
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestRSACipher

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6572331 6994008
* @summary basic test for RSA cipher key wrapping functionality
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestRSACipherWrap
* @run main/othervm TestRSACipherWrap sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6994008
* @summary basic test for RSA/ECB/NoPadding cipher
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestRawRSACipher

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4898461 6604496
* @summary basic test for symmetric ciphers with padding
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestSymmCiphers

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4898484 6604496 8001284
* @summary basic test for symmetric ciphers with no padding
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestSymmCiphersNoPad

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
# @test
# @bug 8187023
# @summary Pkcs11 config file should be assumed in ISO-8859-1
# @library /test/lib
# @build ReadConfInUTF16Env
# @run shell ReadConfInUTF16Env.sh

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
* @test
* @bug 8072452
* @summary Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm SupportedDHKeys
* @run main/othervm SupportedDHKeys sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4921804 6324825
* @summary Verify that DH works properly
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true TestDH
* @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true TestDH sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
* @test
* @bug 7146728
* @summary Interop test for DH with secret that has a leading 0x00 byte
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestInterop
* @run main/othervm TestInterop sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4942494 7146728
* @summary KAT test for DH (normal and with secret that has leading a 0x00 byte)
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestShort
* @run main/othervm TestShort sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
* @test
* @bug 8072452
* @summary Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm UnsupportedDHKeys
* @run main/othervm UnsupportedDHKeys sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4898479
* @summary Verify that the parity bits are set correctly
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm DESParity

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4917233 6461727 6490213 6720456
* @summary test the KeyGenerator
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestKeyGenerator
* @run main/othervm TestKeyGenerator sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 7196382 8072452
* @summary Ensure that DH key pairs can be generated for 512 - 8192 bits
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestDH2048
* @run main/othervm TestDH2048 sm

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,7 @@
# @test
# @bug 4938185
# @library /test/lib
# @summary KeyStore support for NSS cert/key databases
#
# @run shell Basic.sh
@ -60,7 +61,8 @@ fi
echo TESTSRC=${TESTSRC}
echo TESTCLASSES=${TESTCLASSES}
echo TESTJAVA=${TESTJAVA}
echo echo COMPILEJAVA=${COMPILEJAVA}
echo COMPILEJAVA=${COMPILEJAVA}
echo CPAPPEND=${CPAPPEND}
echo ""
# get command from input args -
@ -168,16 +170,17 @@ fi
if [ "${RECOMPILE}" = "yes" ] ; then
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
${TESTSRC}${FS}Basic.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
${TESTSRC}${FS}Basic.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
fi
# run test
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \
-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar${PS}${CPAPPEND} \
-DDIR=${TESTSRC}${FS}BasicData \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-${TOKEN}.txt \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
# @bug 4938185 7106773
# @summary KeyStore support for NSS cert/key databases
# 512 bits RSA key cannot work with SHA384 and SHA512
#
# @library /test/lib
# @run shell ClientAuth.sh
# set a few environment variables so that the shell-script can run stand-alone
@ -47,6 +47,7 @@ echo TESTSRC=${TESTSRC}
echo TESTCLASSES=${TESTCLASSES}
echo TESTJAVA=${TESTJAVA}
echo COMPILEJAVA=${COMPILEJAVA}
echo CPAPPEND=${CPAPPEND}
echo ""
OS=`uname -s`
@ -128,13 +129,14 @@ ${CHMOD} +w ${TESTCLASSES}${FS}key3.db
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC} \
-d ${TESTCLASSES} \
${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
${TESTSRC}${FS}ClientAuth.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
# run test
echo "Run ClientAuth TLSv1 ..."
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES} \
-classpath ${TESTCLASSES}${PS}${CPAPPEND} \
-DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \
@ -155,7 +157,7 @@ fi
# run test
echo "Run ClientAuth TLSv1.1 ..."
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES} \
-classpath ${TESTCLASSES}${PS}${CPAPPEND} \
-DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \
@ -176,7 +178,7 @@ fi
# run test with specified TLS protocol and cipher suite
echo "Run ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA"
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES} \
-classpath ${TESTCLASSES}${PS}${CPAPPEND} \
-DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
# @bug 6599979
# @summary Ensure that re-assigning the alias works
#
# @library ..
# @library /test/lib ..
# @build SecretKeysBasic
# @run shell SecretKeysBasic.sh
#
@ -52,6 +52,7 @@ fi
echo TESTSRC=${TESTSRC}
echo TESTCLASSES=${TESTCLASSES}
echo TESTJAVA=${TESTJAVA}
echo CPAPPEND=${CPAPPEND}
echo ""
#DEBUG=sunpkcs11,pkcs11keystore
@ -130,9 +131,9 @@ then
${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}public
echo ${CP} ${TESTSRC}${FS}BasicData${FS}pkcs11_softtoken${FS}objstore_info \
${TESTCLASSES}${FS}pkcs11_softtoken
${TESTCLASSES}${FS}pkcs11_softtoken
${CP} ${TESTSRC}${FS}BasicData${FS}pkcs11_softtoken${FS}objstore_info \
${TESTCLASSES}${FS}pkcs11_softtoken
${TESTCLASSES}${FS}pkcs11_softtoken
echo ${CHMOD} +w ${TESTCLASSES}${FS}pkcs11_softtoken${FS}objstore_info
${CHMOD} 600 ${TESTCLASSES}${FS}pkcs11_softtoken${FS}objstore_info
@ -142,16 +143,16 @@ fi
# run test
cd ${TESTSRC}
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-DDIR=${TESTSRC}${FS}BasicData${FS} \
-DDIR=${TESTSRC}${FS}BasicData${FS} \
-classpath \
${TESTCLASSES}${PS}${TESTCLASSES}${FS}..${PS}${TESTSRC}${FS}loader.jar \
${TESTCLASSES}${PS}${TESTCLASSES}${FS}..${PS}${TESTSRC}${FS}loader.jar${PS}${CPAPPEND} \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-${token}.txt \
-DNO_DEFAULT=true \
-DNO_DEIMOS=true \
-DTOKEN=${token} \
-Djava.security.debug=${DEBUG} \
SecretKeysBasic
-DNO_DEFAULT=true \
-DNO_DEIMOS=true \
-DTOKEN=${token} \
-Djava.security.debug=${DEBUG} \
SecretKeysBasic
# -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-${token}.txt \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,7 @@
# @test
# @bug 5038659
# @library /test/lib
# @summary Enable PKCS#11 KeyStore for SunPKCS11-Solaris
#
# @run shell Solaris.sh
@ -138,17 +139,18 @@ if [ "${RECOMPILE}" = "yes" ] ; then
cd ${TESTCLASSES}
${RM} *.class
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
${TESTSRC}${FS}Basic.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
${TESTSRC}${FS}Basic.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
fi
# run test
cd ${TESTSRC}
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \
-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar${PS}${CPAPPEND} \
-DDIR=${TESTSRC}${FS}BasicData${FS} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-solaris.txt \
-DNO_DEFAULT=true \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4846410 6313661 4963723
* @summary Basic known-answer-test for Hmac algorithms
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm MacKAT
* @run main/othervm MacKAT sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 8048603
* @summary Check if doFinal and update operation result in same Mac
* @author Yu-Ching Valerie Peng, Bill Situ, Alexander Fomin
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm MacSameTest
* @run main/othervm MacSameTest sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4856966
* @summary
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm ReinitMac

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4856966
* @summary Test the MessageDigest.update(ByteBuffer) method
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm ByteBuffers

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4856966
* @summary Basic known-answer-test for all our MessageDigest algorithms
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm DigestKAT
* @run main/othervm DigestKAT sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4856966
* @summary
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm ReinitDigest

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6414899
* @summary Ensure the cloning functionality works.
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestCloning

View File

@ -53,6 +53,10 @@ import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.Set;
import jdk.test.lib.artifacts.Artifact;
import jdk.test.lib.artifacts.ArtifactResolver;
import jdk.test.lib.artifacts.ArtifactResolverException;
public abstract class PKCS11Test {
private boolean enableSM = false;
@ -300,15 +304,8 @@ public abstract class PKCS11Test {
}
static String getNSSLibDir(String library) throws Exception {
String osName = props.getProperty("os.name");
if (osName.startsWith("Win")) {
osName = "Windows";
} else if (osName.equals("Mac OS X")) {
osName = "MacOSX";
}
String osid = osName + "-"
+ props.getProperty("os.arch") + "-" + props.getProperty("sun.arch.data.model");
String[] nssLibDirs = osMap.get(osid);
String osid = getOsId();
String[] nssLibDirs = getNssLibPaths(osid);
if (nssLibDirs == null) {
System.out.println("Warning: unsupported OS: " + osid
+ ", please initialize NSS librarys location firstly, skipping test");
@ -323,6 +320,7 @@ public abstract class PKCS11Test {
if (new File(dir).exists() &&
new File(dir + System.mapLibraryName(library)).exists()) {
nssLibDir = dir;
System.out.println("nssLibDir: " + nssLibDir);
System.setProperty("pkcs11test.nss.libdir", nssLibDir);
break;
}
@ -334,6 +332,18 @@ public abstract class PKCS11Test {
return nssLibDir;
}
private static String getOsId() {
String osName = props.getProperty("os.name");
if (osName.startsWith("Win")) {
osName = "Windows";
} else if (osName.equals("Mac OS X")) {
osName = "MacOSX";
}
String osid = osName + "-" + props.getProperty("os.arch") + "-"
+ props.getProperty("sun.arch.data.model");
return osid;
}
static boolean isBadNSSVersion(Provider p) {
double nssVersion = getNSSVersion();
if (isNSS(p) && nssVersion >= 3.11 && nssVersion < 3.12) {
@ -644,34 +654,74 @@ public abstract class PKCS11Test {
return false;
}
private static final Map<String,String[]> osMap;
private static Map<String,String[]> osMap;
// Location of the NSS libraries on each supported platform
static {
private static Map<String, String[]> getOsMap() {
if (osMap != null) {
return osMap;
}
osMap = new HashMap<>();
osMap.put("SunOS-sparc-32", new String[]{"/usr/lib/mps/"});
osMap.put("SunOS-sparcv9-64", new String[]{"/usr/lib/mps/64/"});
osMap.put("SunOS-x86-32", new String[]{"/usr/lib/mps/"});
osMap.put("SunOS-amd64-64", new String[]{"/usr/lib/mps/64/"});
osMap.put("Linux-i386-32", new String[]{
"/usr/lib/i386-linux-gnu/", "/usr/lib32/", "/usr/lib/"});
osMap.put("Linux-amd64-64", new String[]{
"/usr/lib/x86_64-linux-gnu/", "/usr/lib/x86_64-linux-gnu/nss/",
"/usr/lib64/"});
osMap.put("Linux-ppc64-64", new String[]{"/usr/lib64/"});
osMap.put("Linux-ppc64le-64", new String[]{"/usr/lib64/"});
osMap.put("Linux-s390x-64", new String[]{"/usr/lib64/"});
osMap.put("Windows-x86-32", new String[]{
PKCS11_BASE + "/nss/lib/windows-i586/".replace('/', SEP)});
osMap.put("Windows-amd64-64", new String[]{
PKCS11_BASE + "/nss/lib/windows-amd64/".replace('/', SEP)});
osMap.put("MacOSX-x86_64-64", new String[]{
PKCS11_BASE + "/nss/lib/macosx-x86_64/"});
osMap.put("Linux-arm-32", new String[]{
"/usr/lib/arm-linux-gnueabi/nss/",
"/usr/lib/arm-linux-gnueabihf/nss/"});
osMap.put("Linux-aarch64-64", new String[]{
"/usr/lib/aarch64-linux-gnu/", "/usr/lib/aarch64-linux-gnu/nss/"});
osMap.put("SunOS-sparc-32", new String[] { "/usr/lib/mps/" });
osMap.put("SunOS-sparcv9-64", new String[] { "/usr/lib/mps/64/" });
osMap.put("SunOS-x86-32", new String[] { "/usr/lib/mps/" });
osMap.put("SunOS-amd64-64", new String[] { "/usr/lib/mps/64/" });
osMap.put("Linux-i386-32", new String[] {
"/usr/lib/i386-linux-gnu/",
"/usr/lib32/",
"/usr/lib/" });
osMap.put("Linux-amd64-64", new String[] {
"/usr/lib/x86_64-linux-gnu/",
"/usr/lib/x86_64-linux-gnu/nss/",
"/usr/lib64/" });
osMap.put("Linux-ppc64-64", new String[] { "/usr/lib64/" });
osMap.put("Linux-ppc64le-64", new String[] { "/usr/lib64/" });
osMap.put("Linux-s390x-64", new String[] { "/usr/lib64/" });
osMap.put("Windows-x86-32", new String[] {});
osMap.put("Windows-amd64-64", new String[] {});
osMap.put("MacOSX-x86_64-64", new String[] {});
osMap.put("Linux-arm-32", new String[] {
"/usr/lib/arm-linux-gnueabi/nss/",
"/usr/lib/arm-linux-gnueabihf/nss/" });
osMap.put("Linux-aarch64-64", new String[] {
"/usr/lib/aarch64-linux-gnu/",
"/usr/lib/aarch64-linux-gnu/nss/" });
return osMap;
}
private static String[] getNssLibPaths(String osId) {
String[] preferablePaths = getPreferableNssLibPaths(osId);
if (preferablePaths.length != 0) {
return preferablePaths;
} else {
return getOsMap().get(osId);
}
}
private static String[] getPreferableNssLibPaths(String osId) {
List<String> nssLibPaths = new ArrayList<>();
String customNssLibPaths = System.getProperty("test.nss.lib.paths");
if (customNssLibPaths == null) {
// If custom local NSS lib path is not provided,
// try to download NSS libs from artifactory
String path = fetchNssLib(osId);
if (path != null) {
nssLibPaths.add(path);
}
} else {
String[] paths = customNssLibPaths.split(",");
for (String path : paths) {
if (!path.endsWith(File.separator)) {
nssLibPaths.add(path + File.separator);
} else {
nssLibPaths.add(path);
}
}
}
return nssLibPaths.toArray(new String[nssLibPaths.size()]);
}
private final static char[] hexDigits = "0123456789abcdef".toCharArray();
@ -797,4 +847,60 @@ public abstract class PKCS11Test {
}
return data;
}
private static String fetchNssLib(String osId) {
switch (osId) {
case "Windows-x86-32":
return fetchNssLib(WINDOWS_X86.class);
case "Windows-amd64-64":
return fetchNssLib(WINDOWS_X64.class);
case "MacOSX-x86_64-64":
return fetchNssLib(MACOSX_X64.class);
default:
return null;
}
}
private static String fetchNssLib(Class<?> clazz) {
String path = null;
try {
path = ArtifactResolver.resolve(clazz).entrySet().stream()
.findAny().get().getValue() + File.separator + "nsslib"
+ File.separator;
} catch (ArtifactResolverException e) {
Throwable cause = e.getCause();
if (cause == null) {
System.out.println("Cannot resolve artifact, "
+ "please check if JIB jar is present in classpath.");
} else {
throw new RuntimeException("Fetch artifact failed: " + clazz
+ "\nPlease make sure the artifact is available.");
}
}
return path;
}
@Artifact(
organization = "jpg.tests.jdk.nsslib",
name = "nsslib-windows_x64",
revision = "3.35",
extension = "zip")
private static class WINDOWS_X64 { }
@Artifact(
organization = "jpg.tests.jdk.nsslib",
name = "nsslib-windows_x86",
revision = "3.35",
extension = "zip")
private static class WINDOWS_X86 { }
@Artifact(
organization = "jpg.tests.jdk.nsslib",
name = "nsslib-macosx_x64",
revision = "3.35",
extension = "zip")
private static class MACOSX_X64 { }
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/*
* @test
* @bug 7003952 7191662
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @summary load DLLs and launch executables using fully qualified path
*/

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -48,6 +48,7 @@ echo TESTSRC=${TESTSRC}
echo TESTCLASSES=${TESTCLASSES}
echo TESTJAVA=${TESTJAVA}
echo COMPILEJAVA=${COMPILEJAVA}
echo CPAPPEND=${CPAPPEND}
echo ""
# let java test exit if platform unsupported
@ -105,13 +106,14 @@ esac
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}.. \
-d ${TESTCLASSES} \
${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
${TESTSRC}${FS}ConfigQuotedString.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
# run test
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES} \
-classpath ${TESTCLASSES}${PS}${CPAPPEND} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ConfigQuotedString-nss.txt \
-Dtest.src=${TESTSRC} \
-Dtest.classes=${TESTCLASSES} \

View File

@ -49,6 +49,7 @@ echo TESTSRC=${TESTSRC}
echo TESTCLASSES=${TESTCLASSES}
echo TESTJAVA=${TESTJAVA}
echo COMPILEJAVA=${COMPILEJAVA}
echo CPAPPEND=${CPAPPEND}
echo ""
# let java test exit if platform unsupported
@ -114,13 +115,14 @@ ${CHMOD} +w ${TESTCLASSES}${FS}key3.db
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}.. \
-d ${TESTCLASSES} \
${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
${TESTSRC}${FS}Login.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
# run test
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES} \
-classpath ${TESTCLASSES}${PS}${CPAPPEND} \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}Login-nss.txt \
-DNO_DEFAULT=true \

View File

@ -1,13 +1,33 @@
This README is to keep a list facts and known workaround for the pkcs11 java tests
perform as a result of bugs or features in NSS or other pkcs11 libraries.
- How to get NSS libraries?
The libraries come from the following sources.
1. Specified by system property test.nss.lib.paths
System property test.nss.lib.paths can specify a set of absolute paths to
the local NSS library directories. The paths are separated by comma.
2. Pre-built NSS libraries from artifactory server
If the value of system property test.nss.lib.paths is not set, the tests will try
to download pre-built NSS libraries from artifactory server. Currently, the
tests only looks for libraries for Windows and MacOSX platforms on artifactory.
Please note that JIB jar MUST be present in classpath when downloading the
libraries.
3. System NSS libraries
If both of the above sources are not available, the tests will try to search
for the libraries in some system paths. The paths are platform-specific. Note
that, there is no such system path on Windows and MacOSX platforms. On these
platforms, it has to use source 1 or 2.
- NSS ECC None/Basic/Extended
The tests detect the NSS library support for Elliptic Curves as to not
report incorrect failures. PKCS11 reports back CKR_DOMAIN_PARAMS_INVALID
when the curve is not supported.
- Default libsoftokn3.so
By default PKCS11Test.java will look for libsoftokn3.so. There are a number of
By default PKCS11Test.java will look for libsoftokn3.so. There are a number of
tests, particularly in Secmod, that need libnss3.so. The method useNSS() in
PKCS11test.java is to change the search and version checking to libnss3.
@ -17,6 +37,6 @@ ECC Basic supports is secp256r1, secp384r1, and secp521r1.
read incorrectly. KeyStore/SecretKeysBasic.java tiggers this bug and
knows to avoid it.
- A number of EC tests fail because of a DER bug in NSS 3.11. The best guess
- A number of EC tests fail because of a DER bug in NSS 3.11. The best guess
is Mozilla bug 480280. Those tests that abort execution with a PASS result
are: TestECDH2, TestECDSA, TestECDSA2 and TestECGenSpec.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4000000
* @summary XXX todo
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6414980
* @summary Test that the PKCS#11 KeyStore handles RSA, DSA, and EC keys
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm AddPrivateKey
* @run main/othervm AddPrivateKey sm policy
@ -63,6 +63,11 @@ public class AddPrivateKey extends SecmodTest {
private static final byte[] DATA = generateData(DATA_LENGTH);
public static void main(String[] args) throws Exception {
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
}
if (initSecmod() == false) {
return;
}
@ -77,8 +82,6 @@ public class AddPrivateKey extends SecmodTest {
Security.addProvider(p);
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
System.setSecurityManager(new SecurityManager());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6298106
* @summary make sure we can add a trusted cert to the NSS KeyStore module
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm AddTrustedCert
* @run main/othervm AddTrustedCert sm policy
@ -48,6 +48,11 @@ import java.util.TreeSet;
public class AddTrustedCert extends SecmodTest {
public static void main(String[] args) throws Exception {
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
}
if (initSecmod() == false) {
return;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6329006
* @summary verify that NSS no-db mode works correctly
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm Crypto
* @run main/othervm Crypto sm policy

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@
* @summary make sure we can access the NSS softtoken KeyStore
* and use a private key
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm GetPrivateKey
* @run main/othervm GetPrivateKey sm policy
@ -47,6 +47,11 @@ import java.util.TreeSet;
public class GetPrivateKey extends SecmodTest {
public static void main(String[] args) throws Exception {
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
}
if (initSecmod() == false) {
return;
}
@ -58,8 +63,6 @@ public class GetPrivateKey extends SecmodTest {
Security.addProvider(p);
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
System.setSecurityManager(new SecurityManager());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6269847
* @summary store a NSS PKCS11 PrivateKeyEntry to JKS KeyStore throws confusing NPE
* @author Wang Weijun
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm JksSetPrivateKey
* @run main/othervm JksSetPrivateKey sm policy
@ -46,6 +46,11 @@ import java.util.TreeSet;
public class JksSetPrivateKey extends SecmodTest {
public static void main(String[] args) throws Exception {
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
}
if (initSecmod() == false) {
return;
}
@ -57,8 +62,6 @@ public class JksSetPrivateKey extends SecmodTest {
Security.addProvider(p);
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
System.setSecurityManager(new SecurityManager());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
* @test
* @bug 8048622 8134232
* @summary Checks that PKCS#11 keystore can't be loaded with wrong password
* @library ../
* @library /test/lib ../
* @modules jdk.crypto.cryptoki
* @run main/othervm LoadKeystore
* @run main/othervm LoadKeystore sm policy
@ -43,6 +43,11 @@ import java.util.Collections;
public class LoadKeystore extends SecmodTest {
public static void main(String[] args) throws Exception {
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
}
if (!initSecmod()) {
return;
}
@ -55,8 +60,6 @@ public class LoadKeystore extends SecmodTest {
Security.addProvider(p);
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
System.setSecurityManager(new SecurityManager());
}

View File

@ -28,7 +28,7 @@
* @summary Test NSS DB Sqlite
* @comment There is no NSS on Aix.
* @requires os.family != "aix"
* @library ../
* @library /test/lib ../
* @modules java.base/sun.security.rsa
* java.base/sun.security.provider
* java.base/sun.security.jca

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6298106 6275523 6420252 8059627
* @summary make sure we can access the NSS trust anchor module
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TrustAnchors
* @run main/othervm TrustAnchors sm policy

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6246411
* @summary basic test for PKCS#11 SecureRandom
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm Basic

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
* @test
* @bug 6837847
* @summary Ensure a deserialized PKCS#11 SecureRandom is functional.
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4921802
* @summary Test that the SunPKCS11 provider can be serialized
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4856966
* @summary Test the Signature.update(ByteBuffer) method
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm ByteBuffers

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4856966
* @summary test that reinitializing Signatures works correctly
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main ReinitSignature

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 4856966
* @summary basic test of SHA1withDSA and RawDSA signing/verifying
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestDSA

View File

@ -26,7 +26,7 @@
* @bug 7200306 8029158
* @summary verify that P11Signature impl will error out when initialized
* with unsupported key sizes
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestDSAKeyLength

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6695485
* @summary Make sure initSign/initVerify() check RSA key lengths
* @author Yu-Ching Valerie Peng
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestRSAKeyLength
* @run main/othervm TestRSAKeyLength sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@
* @summary Make sure that we can parse certificates using various named curves
* and verify their signatures
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @modules jdk.crypto.cryptoki
* @run main/othervm ReadCertificates

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6405536
* @summary Verify that we can parse ECPrivateKeys from PKCS#12 and use them
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @key randomness
* @modules jdk.crypto.cryptoki

View File

@ -26,7 +26,7 @@
* @bug 6405536 6414980
* @summary Basic consistency test for all curves using ECDSA and ECDH
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki/sun.security.pkcs11.wrapper
* @run main/othervm TestCurves
* @run main/othervm TestCurves sm

View File

@ -26,7 +26,7 @@
* @bug 6405536
* @summary Basic known answer test for ECDH
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @modules jdk.crypto.cryptoki
* @run main/othervm TestECDH

View File

@ -26,7 +26,7 @@
* @bug 6405536
* @summary basic test of ECDSA signatures for P-256 and P-384 from the
* example data in "Suite B Implementer's Guide to FIPS 186-3".
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @modules java.base/sun.security.util
* jdk.crypto.cryptoki

View File

@ -26,7 +26,7 @@
* @bug 6405536 8042967
* @summary basic test of SHA1withECDSA and NONEwithECDSA signing/verifying
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @key randomness
* @modules jdk.crypto.cryptoki

View File

@ -26,7 +26,7 @@
* @bug 6405536
* @summary basic test of ECDSA signatures for P-256 and P-384 from the
* example data in "Suite B Implementer's Guide to FIPS 186-3".
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @modules java.base/sun.security.util
* jdk.crypto.cryptoki

View File

@ -26,7 +26,7 @@
* @bug 6405536
* @summary Verify that we can use ECGenParameterSpec
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestECGenSpec
* @run main/othervm TestECGenSpec sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6405536
* @summary Test the P11ECKeyFactory
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestKeyFactory
* @run main/othervm TestKeyFactory sm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
* @test
* @bug 6313675 6323647 8028192
* @summary Verify that all ciphersuites work in FIPS mode
* @library ..
* @library /test/lib ..
* @author Andreas Sterbenz
* @modules java.base/com.sun.net.ssl.internal.ssl
* @run main/manual ClientJSSEServerJSSE

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @bug 6323647
* @summary Verify that the SunJSSE trustmanager works correctly in FIPS mode
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules java.base/com.sun.net.ssl.internal.ssl
* @run main/othervm TrustManagerTest
* @run main/othervm TrustManagerTest sm TrustManagerTest.policy

Some files were not shown because too many files have changed in this diff Show More