|
|
7779df |
diff -up openssl-1.0.2k/crypto/aes/asm/aesni-sha1-x86_64.pl.backports openssl-1.0.2k/crypto/aes/asm/aesni-sha1-x86_64.pl
|
|
|
7779df |
--- openssl-1.0.2k/crypto/aes/asm/aesni-sha1-x86_64.pl.backports 2017-03-09 17:59:26.367233931 +0100
|
|
|
7779df |
+++ openssl-1.0.2k/crypto/aes/asm/aesni-sha1-x86_64.pl 2017-03-27 15:25:28.615014528 +0200
|
|
|
7779df |
@@ -1702,6 +1702,7 @@ $code.=<<___;
|
|
|
7779df |
mov 240($key),$rounds
|
|
|
7779df |
sub $in0,$out
|
|
|
7779df |
movups ($key),$rndkey0 # $key[0]
|
|
|
7779df |
+ movups ($ivp),$iv # load IV
|
|
|
7779df |
movups 16($key),$rndkey[0] # forward reference
|
|
|
7779df |
lea 112($key),$key # size optimization
|
|
|
7779df |
|
|
|
7779df |
diff -up openssl-1.0.2k/crypto/aes/asm/aesni-sha256-x86_64.pl.backports openssl-1.0.2k/crypto/aes/asm/aesni-sha256-x86_64.pl
|
|
|
7779df |
--- openssl-1.0.2k/crypto/aes/asm/aesni-sha256-x86_64.pl.backports 2017-03-09 17:59:26.369233978 +0100
|
|
|
7779df |
+++ openssl-1.0.2k/crypto/aes/asm/aesni-sha256-x86_64.pl 2017-03-27 15:25:28.618014599 +0200
|
|
|
7779df |
@@ -1299,6 +1299,7 @@ $code.=<<___;
|
|
|
7779df |
mov 240($key),$rounds
|
|
|
7779df |
sub $in0,$out
|
|
|
7779df |
movups ($key),$rndkey0 # $key[0]
|
|
|
7779df |
+ movups ($ivp),$iv # load IV
|
|
|
7779df |
movups 16($key),$rndkey[0] # forward reference
|
|
|
7779df |
lea 112($key),$key # size optimization
|
|
|
7779df |
|
|
|
7779df |
diff -up openssl-1.0.2k/crypto/x86cpuid.pl.backports openssl-1.0.2k/crypto/x86cpuid.pl
|
|
|
7779df |
--- openssl-1.0.2k/crypto/x86cpuid.pl.backports 2017-03-09 17:59:26.339233278 +0100
|
|
|
7779df |
+++ openssl-1.0.2k/crypto/x86cpuid.pl 2017-03-27 15:26:06.833916588 +0200
|
|
|
7779df |
@@ -20,10 +20,10 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA3
|
|
|
7779df |
&pop ("eax");
|
|
|
7779df |
&xor ("ecx","eax");
|
|
|
7779df |
&xor ("eax","eax");
|
|
|
7779df |
+ &mov ("esi",&wparam(0));
|
|
|
7779df |
+ &mov (&DWP(8,"esi"),"eax"); # clear extended feature flags
|
|
|
7779df |
&bt ("ecx",21);
|
|
|
7779df |
&jnc (&label("nocpuid"));
|
|
|
7779df |
- &mov ("esi",&wparam(0));
|
|
|
7779df |
- &mov (&DWP(8,"esi"),"eax"); # clear 3rd word
|
|
|
7779df |
&cpuid ();
|
|
|
7779df |
&mov ("edi","eax"); # max value for standard query level
|
|
|
7779df |
|
|
|
7779df |
@@ -81,26 +81,16 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA3
|
|
|
7779df |
&jmp (&label("generic"));
|
|
|
7779df |
|
|
|
7779df |
&set_label("intel");
|
|
|
7779df |
- &cmp ("edi",7);
|
|
|
7779df |
- &jb (&label("cacheinfo"));
|
|
|
7779df |
-
|
|
|
7779df |
- &mov ("esi",&wparam(0));
|
|
|
7779df |
- &mov ("eax",7);
|
|
|
7779df |
- &xor ("ecx","ecx");
|
|
|
7779df |
- &cpuid ();
|
|
|
7779df |
- &mov (&DWP(8,"esi"),"ebx");
|
|
|
7779df |
-
|
|
|
7779df |
-&set_label("cacheinfo");
|
|
|
7779df |
&cmp ("edi",4);
|
|
|
7779df |
- &mov ("edi",-1);
|
|
|
7779df |
+ &mov ("esi",-1);
|
|
|
7779df |
&jb (&label("nocacheinfo"));
|
|
|
7779df |
|
|
|
7779df |
&mov ("eax",4);
|
|
|
7779df |
&mov ("ecx",0); # query L1D
|
|
|
7779df |
&cpuid ();
|
|
|
7779df |
- &mov ("edi","eax");
|
|
|
7779df |
- &shr ("edi",14);
|
|
|
7779df |
- &and ("edi",0xfff); # number of cores -1 per L1D
|
|
|
7779df |
+ &mov ("esi","eax");
|
|
|
7779df |
+ &shr ("esi",14);
|
|
|
7779df |
+ &and ("esi",0xfff); # number of cores -1 per L1D
|
|
|
7779df |
|
|
|
7779df |
&set_label("nocacheinfo");
|
|
|
7779df |
&mov ("eax",1);
|
|
|
7779df |
@@ -118,7 +108,7 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA3
|
|
|
7779df |
&bt ("edx",28); # test hyper-threading bit
|
|
|
7779df |
&jnc (&label("generic"));
|
|
|
7779df |
&and ("edx",0xefffffff);
|
|
|
7779df |
- &cmp ("edi",0);
|
|
|
7779df |
+ &cmp ("esi",0);
|
|
|
7779df |
&je (&label("generic"));
|
|
|
7779df |
|
|
|
7779df |
&or ("edx",0x10000000);
|
|
|
7779df |
@@ -130,10 +120,19 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA3
|
|
|
7779df |
&set_label("generic");
|
|
|
7779df |
&and ("ebp",1<<11); # isolate AMD XOP flag
|
|
|
7779df |
&and ("ecx",0xfffff7ff); # force 11th bit to 0
|
|
|
7779df |
- &mov ("esi","edx");
|
|
|
7779df |
+ &mov ("esi","edx"); # %ebp:%esi is copy of %ecx:%edx
|
|
|
7779df |
&or ("ebp","ecx"); # merge AMD XOP flag
|
|
|
7779df |
|
|
|
7779df |
- &bt ("ecx",27); # check OSXSAVE bit
|
|
|
7779df |
+ &cmp ("edi",7);
|
|
|
7779df |
+ &mov ("edi",&wparam(0));
|
|
|
7779df |
+ &jb (&label("no_extended_info"));
|
|
|
7779df |
+ &mov ("eax",7);
|
|
|
7779df |
+ &xor ("ecx","ecx");
|
|
|
7779df |
+ &cpuid ();
|
|
|
7779df |
+ &mov (&DWP(8,"edi"),"ebx"); # save extended feature flag
|
|
|
7779df |
+&set_label("no_extended_info");
|
|
|
7779df |
+
|
|
|
7779df |
+ &bt ("ebp",27); # check OSXSAVE bit
|
|
|
7779df |
&jnc (&label("clear_avx"));
|
|
|
7779df |
&xor ("ecx","ecx");
|
|
|
7779df |
&data_byte(0x0f,0x01,0xd0); # xgetbv
|
|
|
7779df |
@@ -147,7 +146,6 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA3
|
|
|
7779df |
&and ("esi",0xfeffffff); # clear FXSR
|
|
|
7779df |
&set_label("clear_avx");
|
|
|
7779df |
&and ("ebp",0xefffe7ff); # clear AVX, FMA and AMD XOP bits
|
|
|
7779df |
- &mov ("edi",&wparam(0));
|
|
|
7779df |
&and (&DWP(8,"edi"),0xffffffdf); # clear AVX2
|
|
|
7779df |
&set_label("done");
|
|
|
7779df |
&mov ("eax","esi");
|
|
|
7779df |
diff -up openssl-1.0.2k/crypto/x86_64cpuid.pl.backports openssl-1.0.2k/crypto/x86_64cpuid.pl
|
|
|
7779df |
--- openssl-1.0.2k/crypto/x86_64cpuid.pl.backports 2017-03-09 17:59:26.339233278 +0100
|
|
|
7779df |
+++ openssl-1.0.2k/crypto/x86_64cpuid.pl 2017-03-27 15:26:06.833916588 +0200
|
|
|
7779df |
@@ -59,7 +59,7 @@ OPENSSL_ia32_cpuid:
|
|
|
7779df |
mov %rbx,%r8 # save %rbx
|
|
|
7779df |
|
|
|
7779df |
xor %eax,%eax
|
|
|
7779df |
- mov %eax,8(%rdi) # clear 3rd word
|
|
|
7779df |
+ mov %eax,8(%rdi) # clear extended feature flags
|
|
|
7779df |
cpuid
|
|
|
7779df |
mov %eax,%r11d # max value for standard query level
|
|
|
7779df |
|
|
|
7779df |
@@ -127,14 +127,6 @@ OPENSSL_ia32_cpuid:
|
|
|
7779df |
shr \$14,%r10d
|
|
|
7779df |
and \$0xfff,%r10d # number of cores -1 per L1D
|
|
|
7779df |
|
|
|
7779df |
- cmp \$7,%r11d
|
|
|
7779df |
- jb .Lnocacheinfo
|
|
|
7779df |
-
|
|
|
7779df |
- mov \$7,%eax
|
|
|
7779df |
- xor %ecx,%ecx
|
|
|
7779df |
- cpuid
|
|
|
7779df |
- mov %ebx,8(%rdi)
|
|
|
7779df |
-
|
|
|
7779df |
.Lnocacheinfo:
|
|
|
7779df |
mov \$1,%eax
|
|
|
7779df |
cpuid
|
|
|
7779df |
@@ -164,6 +156,15 @@ OPENSSL_ia32_cpuid:
|
|
|
7779df |
or %ecx,%r9d # merge AMD XOP flag
|
|
|
7779df |
|
|
|
7779df |
mov %edx,%r10d # %r9d:%r10d is copy of %ecx:%edx
|
|
|
7779df |
+
|
|
|
7779df |
+ cmp \$7,%r11d
|
|
|
7779df |
+ jb .Lno_extended_info
|
|
|
7779df |
+ mov \$7,%eax
|
|
|
7779df |
+ xor %ecx,%ecx
|
|
|
7779df |
+ cpuid
|
|
|
7779df |
+ mov %ebx,8(%rdi) # save extended feature flags
|
|
|
7779df |
+.Lno_extended_info:
|
|
|
7779df |
+
|
|
|
7779df |
bt \$27,%r9d # check OSXSAVE bit
|
|
|
7779df |
jnc .Lclear_avx
|
|
|
7779df |
xor %ecx,%ecx # XCR0
|
|
|
7779df |
diff -up openssl-1.0.2k/ssl/ssl_locl.h.backports openssl-1.0.2k/ssl/ssl_locl.h
|
|
|
7779df |
--- openssl-1.0.2k/ssl/ssl_locl.h.backports 2017-03-09 17:59:26.183229642 +0100
|
|
|
7779df |
+++ openssl-1.0.2k/ssl/ssl_locl.h 2017-03-09 17:59:26.311232626 +0100
|
|
|
7779df |
@@ -1430,7 +1430,7 @@ int ssl_parse_clienthello_renegotiate_ex
|
|
|
7779df |
long ssl_get_algorithm2(SSL *s);
|
|
|
7779df |
int tls1_save_sigalgs(SSL *s, const unsigned char *data, int dsize);
|
|
|
7779df |
int tls1_process_sigalgs(SSL *s);
|
|
|
7779df |
-size_t tls12_get_psigalgs(SSL *s, const unsigned char **psigs);
|
|
|
7779df |
+size_t tls12_get_psigalgs(SSL *s, int sent, const unsigned char **psigs);
|
|
|
7779df |
int tls12_check_peer_sigalg(const EVP_MD **pmd, SSL *s,
|
|
|
7779df |
const unsigned char *sig, EVP_PKEY *pkey);
|
|
|
7779df |
void ssl_set_client_disabled(SSL *s);
|
|
|
7779df |
diff -up openssl-1.0.2k/ssl/s3_lib.c.backports openssl-1.0.2k/ssl/s3_lib.c
|
|
|
7779df |
--- openssl-1.0.2k/ssl/s3_lib.c.backports 2017-03-09 17:59:26.294232230 +0100
|
|
|
7779df |
+++ openssl-1.0.2k/ssl/s3_lib.c 2017-03-09 17:59:26.311232626 +0100
|
|
|
7779df |
@@ -4237,7 +4237,7 @@ int ssl3_get_req_cert_type(SSL *s, unsig
|
|
|
7779df |
return (int)s->cert->ctype_num;
|
|
|
7779df |
}
|
|
|
7779df |
/* get configured sigalgs */
|
|
|
7779df |
- siglen = tls12_get_psigalgs(s, &sig);
|
|
|
7779df |
+ siglen = tls12_get_psigalgs(s, 1, &sig);
|
|
|
7779df |
if (s->cert->cert_flags & SSL_CERT_FLAGS_CHECK_TLS_STRICT)
|
|
|
7779df |
nostrict = 0;
|
|
|
7779df |
for (i = 0; i < siglen; i += 2, sig += 2) {
|
|
|
7779df |
diff -up openssl-1.0.2k/ssl/s3_srvr.c.backports openssl-1.0.2k/ssl/s3_srvr.c
|
|
|
7779df |
--- openssl-1.0.2k/ssl/s3_srvr.c.backports 2017-01-26 14:22:04.000000000 +0100
|
|
|
7779df |
+++ openssl-1.0.2k/ssl/s3_srvr.c 2017-03-09 17:59:26.311232626 +0100
|
|
|
7779df |
@@ -2084,7 +2084,7 @@ int ssl3_send_certificate_request(SSL *s
|
|
|
7779df |
|
|
|
7779df |
if (SSL_USE_SIGALGS(s)) {
|
|
|
7779df |
const unsigned char *psigs;
|
|
|
7779df |
- nl = tls12_get_psigalgs(s, &psigs);
|
|
|
7779df |
+ nl = tls12_get_psigalgs(s, 1, &psigs);
|
|
|
7779df |
s2n(nl, p);
|
|
|
7779df |
memcpy(p, psigs, nl);
|
|
|
7779df |
p += nl;
|
|
|
7779df |
diff -up openssl-1.0.2k/ssl/t1_lib.c.backports openssl-1.0.2k/ssl/t1_lib.c
|
|
|
7779df |
--- openssl-1.0.2k/ssl/t1_lib.c.backports 2017-03-09 17:59:26.297232299 +0100
|
|
|
7779df |
+++ openssl-1.0.2k/ssl/t1_lib.c 2017-03-09 17:59:26.312232649 +0100
|
|
|
7779df |
@@ -1015,7 +1015,7 @@ static unsigned char suiteb_sigalgs[] =
|
|
|
7779df |
tlsext_sigalg_ecdsa(TLSEXT_hash_sha384)
|
|
|
7779df |
};
|
|
|
7779df |
# endif
|
|
|
7779df |
-size_t tls12_get_psigalgs(SSL *s, const unsigned char **psigs)
|
|
|
7779df |
+size_t tls12_get_psigalgs(SSL *s, int sent, const unsigned char **psigs)
|
|
|
7779df |
{
|
|
|
7779df |
/*
|
|
|
7779df |
* If Suite B mode use Suite B sigalgs only, ignore any other
|
|
|
7779df |
@@ -1037,7 +1037,7 @@ size_t tls12_get_psigalgs(SSL *s, const
|
|
|
7779df |
}
|
|
|
7779df |
# endif
|
|
|
7779df |
/* If server use client authentication sigalgs if not NULL */
|
|
|
7779df |
- if (s->server && s->cert->client_sigalgs) {
|
|
|
7779df |
+ if (s->server == sent && s->cert->client_sigalgs) {
|
|
|
7779df |
*psigs = s->cert->client_sigalgs;
|
|
|
7779df |
return s->cert->client_sigalgslen;
|
|
|
7779df |
} else if (s->cert->conf_sigalgs) {
|
|
|
7779df |
@@ -1101,7 +1101,7 @@ int tls12_check_peer_sigalg(const EVP_MD
|
|
|
7779df |
# endif
|
|
|
7779df |
|
|
|
7779df |
/* Check signature matches a type we sent */
|
|
|
7779df |
- sent_sigslen = tls12_get_psigalgs(s, &sent_sigs);
|
|
|
7779df |
+ sent_sigslen = tls12_get_psigalgs(s, 1, &sent_sigs);
|
|
|
7779df |
for (i = 0; i < sent_sigslen; i += 2, sent_sigs += 2) {
|
|
|
7779df |
if (sig[0] == sent_sigs[0] && sig[1] == sent_sigs[1])
|
|
|
7779df |
break;
|
|
|
7779df |
@@ -1149,7 +1149,7 @@ void ssl_set_client_disabled(SSL *s)
|
|
|
7779df |
* Now go through all signature algorithms seeing if we support any for
|
|
|
7779df |
* RSA, DSA, ECDSA. Do this for all versions not just TLS 1.2.
|
|
|
7779df |
*/
|
|
|
7779df |
- sigalgslen = tls12_get_psigalgs(s, &sigalgs);
|
|
|
7779df |
+ sigalgslen = tls12_get_psigalgs(s, 1, &sigalgs);
|
|
|
7779df |
for (i = 0; i < sigalgslen; i += 2, sigalgs += 2) {
|
|
|
7779df |
switch (sigalgs[1]) {
|
|
|
7779df |
# ifndef OPENSSL_NO_RSA
|
|
|
7779df |
@@ -1420,7 +1420,7 @@ unsigned char *ssl_add_clienthello_tlsex
|
|
|
7779df |
if (SSL_CLIENT_USE_SIGALGS(s)) {
|
|
|
7779df |
size_t salglen;
|
|
|
7779df |
const unsigned char *salg;
|
|
|
7779df |
- salglen = tls12_get_psigalgs(s, &salg);
|
|
|
7779df |
+ salglen = tls12_get_psigalgs(s, 1, &salg);
|
|
|
7779df |
|
|
|
7779df |
/*-
|
|
|
7779df |
* check for enough space.
|
|
|
7779df |
@@ -3783,7 +3783,7 @@ static int tls1_set_shared_sigalgs(SSL *
|
|
|
7779df |
conf = c->conf_sigalgs;
|
|
|
7779df |
conflen = c->conf_sigalgslen;
|
|
|
7779df |
} else
|
|
|
7779df |
- conflen = tls12_get_psigalgs(s, &conf;;
|
|
|
7779df |
+ conflen = tls12_get_psigalgs(s, 0, &conf;;
|
|
|
7779df |
if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || is_suiteb) {
|
|
|
7779df |
pref = conf;
|
|
|
7779df |
preflen = conflen;
|