diff options
author | jsing <> | 2014-05-30 14:01:11 +0000 |
---|---|---|
committer | jsing <> | 2014-05-30 14:01:11 +0000 |
commit | d7bb67cc99974281f55641afa52a0f9e8f1ff938 (patch) | |
tree | feaa5e2dc937f09df0609d84b0849a48c405df08 /src/lib/libssl/s3_srvr.c | |
parent | 7388822d9393b64a9eb25e34c9bac56fb7f39f15 (diff) | |
download | openbsd-d7bb67cc99974281f55641afa52a0f9e8f1ff938.tar.gz openbsd-d7bb67cc99974281f55641afa52a0f9e8f1ff938.tar.bz2 openbsd-d7bb67cc99974281f55641afa52a0f9e8f1ff938.zip |
Make use of SSL_IS_DTLS, SSL_USE_EXPLICIT_IV, SSL_USE_SIGALGS and
SSL_USE_TLS1_2_CIPHERS.
Largely based on OpenSSL head.
Diffstat (limited to 'src/lib/libssl/s3_srvr.c')
-rw-r--r-- | src/lib/libssl/s3_srvr.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c index 481cf37bef..120f92a9d3 100644 --- a/src/lib/libssl/s3_srvr.c +++ b/src/lib/libssl/s3_srvr.c | |||
@@ -591,13 +591,13 @@ ssl3_accept(SSL *s) | |||
591 | s->state = SSL3_ST_SR_FINISHED_A; | 591 | s->state = SSL3_ST_SR_FINISHED_A; |
592 | #endif | 592 | #endif |
593 | s->init_num = 0; | 593 | s->init_num = 0; |
594 | } else if (TLS1_get_version(s) >= TLS1_2_VERSION) { | 594 | } else if (SSL_USE_SIGALGS(s)) { |
595 | s->state = SSL3_ST_SR_CERT_VRFY_A; | 595 | s->state = SSL3_ST_SR_CERT_VRFY_A; |
596 | s->init_num = 0; | 596 | s->init_num = 0; |
597 | if (!s->session->peer) | 597 | if (!s->session->peer) |
598 | break; | 598 | break; |
599 | /* | 599 | /* |
600 | * For TLS v1.2 freeze the handshake buffer | 600 | * For sigalgs freeze the handshake buffer |
601 | * at this point and digest cached records. | 601 | * at this point and digest cached records. |
602 | */ | 602 | */ |
603 | if (!s->s3->handshake_buffer) { | 603 | if (!s->s3->handshake_buffer) { |
@@ -980,7 +980,7 @@ ssl3_get_client_hello(SSL *s) | |||
980 | * Versions before 0.9.7 always allow clients to resume sessions in | 980 | * Versions before 0.9.7 always allow clients to resume sessions in |
981 | * renegotiation. 0.9.7 and later allow this by default, but optionally | 981 | * renegotiation. 0.9.7 and later allow this by default, but optionally |
982 | * ignore resumption requests with flag | 982 | * ignore resumption requests with flag |
983 | * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION (it's a new flag | 983 | * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION (it's a new flag |
984 | * rather than a change to default behavior so that applications | 984 | * rather than a change to default behavior so that applications |
985 | * relying on this for security won't even compile against older | 985 | * relying on this for security won't even compile against older |
986 | * library versions). | 986 | * library versions). |
@@ -1010,7 +1010,7 @@ ssl3_get_client_hello(SSL *s) | |||
1010 | 1010 | ||
1011 | p += j; | 1011 | p += j; |
1012 | 1012 | ||
1013 | if (s->version == DTLS1_VERSION || s->version == DTLS1_BAD_VER) { | 1013 | if (SSL_IS_DTLS(s)) { |
1014 | /* cookie stuff */ | 1014 | /* cookie stuff */ |
1015 | cookie_len = *(p++); | 1015 | cookie_len = *(p++); |
1016 | 1016 | ||
@@ -1331,8 +1331,7 @@ ssl3_get_client_hello(SSL *s) | |||
1331 | s->s3->tmp.new_cipher = s->session->cipher; | 1331 | s->s3->tmp.new_cipher = s->session->cipher; |
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | if (TLS1_get_version(s) < TLS1_2_VERSION || | 1334 | if (!SSL_USE_SIGALGS(s) || !(s->verify_mode & SSL_VERIFY_PEER)) { |
1335 | !(s->verify_mode & SSL_VERIFY_PEER)) { | ||
1336 | if (!ssl3_digest_cached_records(s)) { | 1335 | if (!ssl3_digest_cached_records(s)) { |
1337 | al = SSL_AD_INTERNAL_ERROR; | 1336 | al = SSL_AD_INTERNAL_ERROR; |
1338 | goto f_err; | 1337 | goto f_err; |
@@ -1819,8 +1818,7 @@ ssl3_send_server_key_exchange(SSL *s) | |||
1819 | * n is the length of the params, they start at &(d[4]) | 1818 | * n is the length of the params, they start at &(d[4]) |
1820 | * and p points to the space at the end. | 1819 | * and p points to the space at the end. |
1821 | */ | 1820 | */ |
1822 | if (pkey->type == EVP_PKEY_RSA | 1821 | if (pkey->type == EVP_PKEY_RSA && !SSL_USE_SIGALGS(s)) { |
1823 | && TLS1_get_version(s) < TLS1_2_VERSION) { | ||
1824 | q = md_buf; | 1822 | q = md_buf; |
1825 | j = 0; | 1823 | j = 0; |
1826 | for (num = 2; num > 0; num--) { | 1824 | for (num = 2; num > 0; num--) { |
@@ -1850,13 +1848,9 @@ ssl3_send_server_key_exchange(SSL *s) | |||
1850 | } | 1848 | } |
1851 | s2n(u, p); | 1849 | s2n(u, p); |
1852 | n += u + 2; | 1850 | n += u + 2; |
1853 | } else | 1851 | } else if (md) { |
1854 | if (md) { | 1852 | /* Send signature algorithm. */ |
1855 | /* | 1853 | if (SSL_USE_SIGALGS(s)) { |
1856 | * For TLS1.2 and later send signature | ||
1857 | * algorithm | ||
1858 | */ | ||
1859 | if (TLS1_get_version(s) >= TLS1_2_VERSION) { | ||
1860 | if (!tls12_get_sigandhash(p, pkey, md)) { | 1854 | if (!tls12_get_sigandhash(p, pkey, md)) { |
1861 | /* Should never happen */ | 1855 | /* Should never happen */ |
1862 | al = SSL_AD_INTERNAL_ERROR; | 1856 | al = SSL_AD_INTERNAL_ERROR; |
@@ -1884,7 +1878,7 @@ ssl3_send_server_key_exchange(SSL *s) | |||
1884 | } | 1878 | } |
1885 | s2n(i, p); | 1879 | s2n(i, p); |
1886 | n += i + 2; | 1880 | n += i + 2; |
1887 | if (TLS1_get_version(s) >= TLS1_2_VERSION) | 1881 | if (SSL_USE_SIGALGS(s)) |
1888 | n += 2; | 1882 | n += 2; |
1889 | } else { | 1883 | } else { |
1890 | /* Is this error check actually needed? */ | 1884 | /* Is this error check actually needed? */ |
@@ -1937,7 +1931,7 @@ ssl3_send_certificate_request(SSL *s) | |||
1937 | p += n; | 1931 | p += n; |
1938 | n++; | 1932 | n++; |
1939 | 1933 | ||
1940 | if (TLS1_get_version(s) >= TLS1_2_VERSION) { | 1934 | if (SSL_USE_SIGALGS(s)) { |
1941 | nl = tls12_get_req_sig_algs(s, p + 2); | 1935 | nl = tls12_get_req_sig_algs(s, p + 2); |
1942 | s2n(nl, p); | 1936 | s2n(nl, p); |
1943 | p += nl + 2; | 1937 | p += nl + 2; |
@@ -2592,7 +2586,7 @@ ssl3_get_cert_verify(SSL *s) | |||
2592 | pkey->type == NID_id_GostR3410_2001) ) { | 2586 | pkey->type == NID_id_GostR3410_2001) ) { |
2593 | i = 64; | 2587 | i = 64; |
2594 | } else { | 2588 | } else { |
2595 | if (TLS1_get_version(s) >= TLS1_2_VERSION) { | 2589 | if (SSL_USE_SIGALGS(s)) { |
2596 | int sigalg = tls12_get_sigid(pkey); | 2590 | int sigalg = tls12_get_sigid(pkey); |
2597 | /* Should never happen */ | 2591 | /* Should never happen */ |
2598 | if (sigalg == -1) { | 2592 | if (sigalg == -1) { |
@@ -2635,7 +2629,7 @@ ssl3_get_cert_verify(SSL *s) | |||
2635 | goto f_err; | 2629 | goto f_err; |
2636 | } | 2630 | } |
2637 | 2631 | ||
2638 | if (TLS1_get_version(s) >= TLS1_2_VERSION) { | 2632 | if (SSL_USE_SIGALGS(s)) { |
2639 | long hdatalen = 0; | 2633 | long hdatalen = 0; |
2640 | void *hdata; | 2634 | void *hdata; |
2641 | hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); | 2635 | hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); |