提交 1266eefd 编写于 作者: M Matt Caswell

Various style updates following extensions refactor

Perl changes reviewed by Richard Levitte. Non-perl changes reviewed by Rich
Salz
Reviewed-by: NRich Salz <rsalz@openssl.org>
Reviewed-by: NRichard Levitte <levitte@openssl.org>
上级 89247375
此差异已折叠。
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "../ssl_locl.h" #include "../ssl_locl.h"
#include "statem_locl.h" #include "statem_locl.h"
int tls_construct_client_renegotiate(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_renegotiate(SSL *s, WPACKET *pkt, int *al)
{ {
/* Add RI if renegotiating */ /* Add RI if renegotiating */
if (!s->renegotiate) if (!s->renegotiate)
...@@ -30,7 +30,7 @@ int tls_construct_client_renegotiate(SSL *s, WPACKET *pkt, int *al) ...@@ -30,7 +30,7 @@ int tls_construct_client_renegotiate(SSL *s, WPACKET *pkt, int *al)
return 1; return 1;
} }
int tls_construct_client_server_name(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_server_name(SSL *s, WPACKET *pkt, int *al)
{ {
if (s->tlsext_hostname == NULL) if (s->tlsext_hostname == NULL)
return 1; return 1;
...@@ -54,7 +54,7 @@ int tls_construct_client_server_name(SSL *s, WPACKET *pkt, int *al) ...@@ -54,7 +54,7 @@ int tls_construct_client_server_name(SSL *s, WPACKET *pkt, int *al)
} }
#ifndef OPENSSL_NO_SRP #ifndef OPENSSL_NO_SRP
int tls_construct_client_srp(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_srp(SSL *s, WPACKET *pkt, int *al)
{ {
/* Add SRP username if there is one */ /* Add SRP username if there is one */
if (s->srp_ctx.login == NULL) if (s->srp_ctx.login == NULL)
...@@ -81,8 +81,7 @@ int tls_construct_client_srp(SSL *s, WPACKET *pkt, int *al) ...@@ -81,8 +81,7 @@ int tls_construct_client_srp(SSL *s, WPACKET *pkt, int *al)
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
static int use_ecc(SSL *s) static int use_ecc(SSL *s)
{ {
int using_ecc = 0; int i, end;
int i;
unsigned long alg_k, alg_a; unsigned long alg_k, alg_a;
STACK_OF(SSL_CIPHER) *cipher_stack = NULL; STACK_OF(SSL_CIPHER) *cipher_stack = NULL;
...@@ -90,26 +89,23 @@ static int use_ecc(SSL *s) ...@@ -90,26 +89,23 @@ static int use_ecc(SSL *s)
if (s->version == SSL3_VERSION) if (s->version == SSL3_VERSION)
return 0; return 0;
cipher_stack = SSL_get_ciphers(s); cipher_stack = SSL_get_ciphers(s);
end = sk_SSL_CIPHER_num(cipher_stack);
for (i = 0; i < sk_SSL_CIPHER_num(cipher_stack); i++) { for (i = 0; i < end; i++) {
const SSL_CIPHER *c = sk_SSL_CIPHER_value(cipher_stack, i); const SSL_CIPHER *c = sk_SSL_CIPHER_value(cipher_stack, i);
alg_k = c->algorithm_mkey; alg_k = c->algorithm_mkey;
alg_a = c->algorithm_auth; alg_a = c->algorithm_auth;
if ((alg_k & (SSL_kECDHE | SSL_kECDHEPSK)) if ((alg_k & (SSL_kECDHE | SSL_kECDHEPSK))
|| (alg_a & SSL_aECDSA) || (alg_a & SSL_aECDSA)
|| c->min_tls >= TLS1_3_VERSION) { || c->min_tls >= TLS1_3_VERSION)
using_ecc = 1;
break; break;
}
} }
return using_ecc; return i < end;
} }
int tls_construct_client_ec_pt_formats(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt, int *al)
{ {
const unsigned char *pformats; const unsigned char *pformats;
size_t num_formats; size_t num_formats;
...@@ -118,7 +114,6 @@ int tls_construct_client_ec_pt_formats(SSL *s, WPACKET *pkt, int *al) ...@@ -118,7 +114,6 @@ int tls_construct_client_ec_pt_formats(SSL *s, WPACKET *pkt, int *al)
return 1; return 1;
/* Add TLS extension ECPointFormats to the ClientHello message */ /* Add TLS extension ECPointFormats to the ClientHello message */
tls1_get_formatlist(s, &pformats, &num_formats); tls1_get_formatlist(s, &pformats, &num_formats);
if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats)
...@@ -134,7 +129,7 @@ int tls_construct_client_ec_pt_formats(SSL *s, WPACKET *pkt, int *al) ...@@ -134,7 +129,7 @@ int tls_construct_client_ec_pt_formats(SSL *s, WPACKET *pkt, int *al)
} }
int tls_construct_client_supported_groups(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt, int *al)
{ {
const unsigned char *pcurves = NULL, *pcurvestmp; const unsigned char *pcurves = NULL, *pcurvestmp;
size_t num_curves = 0, i; size_t num_curves = 0, i;
...@@ -183,7 +178,7 @@ int tls_construct_client_supported_groups(SSL *s, WPACKET *pkt, int *al) ...@@ -183,7 +178,7 @@ int tls_construct_client_supported_groups(SSL *s, WPACKET *pkt, int *al)
} }
#endif #endif
int tls_construct_client_session_ticket(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_session_ticket(SSL *s, WPACKET *pkt, int *al)
{ {
size_t ticklen; size_t ticklen;
...@@ -222,7 +217,7 @@ int tls_construct_client_session_ticket(SSL *s, WPACKET *pkt, int *al) ...@@ -222,7 +217,7 @@ int tls_construct_client_session_ticket(SSL *s, WPACKET *pkt, int *al)
return 1; return 1;
} }
int tls_construct_client_sig_algs(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_sig_algs(SSL *s, WPACKET *pkt, int *al)
{ {
size_t salglen; size_t salglen;
const unsigned char *salg; const unsigned char *salg;
...@@ -231,7 +226,6 @@ int tls_construct_client_sig_algs(SSL *s, WPACKET *pkt, int *al) ...@@ -231,7 +226,6 @@ int tls_construct_client_sig_algs(SSL *s, WPACKET *pkt, int *al)
return 1; return 1;
salglen = tls12_get_psigalgs(s, &salg); salglen = tls12_get_psigalgs(s, &salg);
if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_signature_algorithms) if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_signature_algorithms)
/* Sub-packet for sig-algs extension */ /* Sub-packet for sig-algs extension */
|| !WPACKET_start_sub_packet_u16(pkt) || !WPACKET_start_sub_packet_u16(pkt)
...@@ -248,7 +242,7 @@ int tls_construct_client_sig_algs(SSL *s, WPACKET *pkt, int *al) ...@@ -248,7 +242,7 @@ int tls_construct_client_sig_algs(SSL *s, WPACKET *pkt, int *al)
} }
#ifndef OPENSSL_NO_OCSP #ifndef OPENSSL_NO_OCSP
int tls_construct_client_status_request(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_status_request(SSL *s, WPACKET *pkt, int *al)
{ {
int i; int i;
...@@ -266,11 +260,9 @@ int tls_construct_client_status_request(SSL *s, WPACKET *pkt, int *al) ...@@ -266,11 +260,9 @@ int tls_construct_client_status_request(SSL *s, WPACKET *pkt, int *al)
} }
for (i = 0; i < sk_OCSP_RESPID_num(s->tlsext_ocsp_ids); i++) { for (i = 0; i < sk_OCSP_RESPID_num(s->tlsext_ocsp_ids); i++) {
unsigned char *idbytes; unsigned char *idbytes;
int idlen; OCSP_RESPID *id = sk_OCSP_RESPID_value(s->tlsext_ocsp_ids, i);
OCSP_RESPID *id; int idlen = i2d_OCSP_RESPID(id, NULL);
id = sk_OCSP_RESPID_value(s->tlsext_ocsp_ids, i);
idlen = i2d_OCSP_RESPID(id, NULL);
if (idlen <= 0 if (idlen <= 0
/* Sub-packet for an individual id */ /* Sub-packet for an individual id */
|| !WPACKET_sub_allocate_bytes_u16(pkt, idlen, &idbytes) || !WPACKET_sub_allocate_bytes_u16(pkt, idlen, &idbytes)
...@@ -312,7 +304,7 @@ int tls_construct_client_status_request(SSL *s, WPACKET *pkt, int *al) ...@@ -312,7 +304,7 @@ int tls_construct_client_status_request(SSL *s, WPACKET *pkt, int *al)
#endif #endif
#ifndef OPENSSL_NO_NEXTPROTONEG #ifndef OPENSSL_NO_NEXTPROTONEG
int tls_construct_client_npn(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_npn(SSL *s, WPACKET *pkt, int *al)
{ {
if (s->ctx->next_proto_select_cb == NULL || s->s3->tmp.finish_md_len != 0) if (s->ctx->next_proto_select_cb == NULL || s->s3->tmp.finish_md_len != 0)
return 1; return 1;
...@@ -331,7 +323,7 @@ int tls_construct_client_npn(SSL *s, WPACKET *pkt, int *al) ...@@ -331,7 +323,7 @@ int tls_construct_client_npn(SSL *s, WPACKET *pkt, int *al)
} }
#endif #endif
int tls_construct_client_alpn(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_alpn(SSL *s, WPACKET *pkt, int *al)
{ {
s->s3->alpn_sent = 0; s->s3->alpn_sent = 0;
...@@ -359,11 +351,10 @@ int tls_construct_client_alpn(SSL *s, WPACKET *pkt, int *al) ...@@ -359,11 +351,10 @@ int tls_construct_client_alpn(SSL *s, WPACKET *pkt, int *al)
#ifndef OPENSSL_NO_SRTP #ifndef OPENSSL_NO_SRTP
int tls_construct_client_use_srtp(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_use_srtp(SSL *s, WPACKET *pkt, int *al)
{ {
STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = SSL_get_srtp_profiles(s); STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = SSL_get_srtp_profiles(s);
SRTP_PROTECTION_PROFILE *prof; int i, end;
int i, ct;
if (clnt == NULL) if (clnt == NULL)
return 1; return 1;
...@@ -376,9 +367,12 @@ int tls_construct_client_use_srtp(SSL *s, WPACKET *pkt, int *al) ...@@ -376,9 +367,12 @@ int tls_construct_client_use_srtp(SSL *s, WPACKET *pkt, int *al)
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_USE_SRTP, ERR_R_INTERNAL_ERROR); SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_USE_SRTP, ERR_R_INTERNAL_ERROR);
return 0; return 0;
} }
ct = sk_SRTP_PROTECTION_PROFILE_num(clnt);
for (i = 0; i < ct; i++) { end = sk_SRTP_PROTECTION_PROFILE_num(clnt);
prof = sk_SRTP_PROTECTION_PROFILE_value(clnt, i); for (i = 0; i < end; i++) {
const SRTP_PROTECTION_PROFILE *prof =
sk_SRTP_PROTECTION_PROFILE_value(clnt, i);
if (prof == NULL || !WPACKET_put_bytes_u16(pkt, prof->id)) { if (prof == NULL || !WPACKET_put_bytes_u16(pkt, prof->id)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_USE_SRTP, ERR_R_INTERNAL_ERROR); SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_USE_SRTP, ERR_R_INTERNAL_ERROR);
return 0; return 0;
...@@ -396,7 +390,7 @@ int tls_construct_client_use_srtp(SSL *s, WPACKET *pkt, int *al) ...@@ -396,7 +390,7 @@ int tls_construct_client_use_srtp(SSL *s, WPACKET *pkt, int *al)
} }
#endif #endif
int tls_construct_client_etm(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_etm(SSL *s, WPACKET *pkt, int *al)
{ {
if (s->options & SSL_OP_NO_ENCRYPT_THEN_MAC) if (s->options & SSL_OP_NO_ENCRYPT_THEN_MAC)
return 1; return 1;
...@@ -411,7 +405,7 @@ int tls_construct_client_etm(SSL *s, WPACKET *pkt, int *al) ...@@ -411,7 +405,7 @@ int tls_construct_client_etm(SSL *s, WPACKET *pkt, int *al)
} }
#ifndef OPENSSL_NO_CT #ifndef OPENSSL_NO_CT
int tls_construct_client_sct(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_sct(SSL *s, WPACKET *pkt, int *al)
{ {
if (s->ct_validation_callback == NULL) if (s->ct_validation_callback == NULL)
return 1; return 1;
...@@ -426,7 +420,7 @@ int tls_construct_client_sct(SSL *s, WPACKET *pkt, int *al) ...@@ -426,7 +420,7 @@ int tls_construct_client_sct(SSL *s, WPACKET *pkt, int *al)
} }
#endif #endif
int tls_construct_client_ems(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_ems(SSL *s, WPACKET *pkt, int *al)
{ {
if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_extended_master_secret) if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_extended_master_secret)
|| !WPACKET_put_bytes_u16(pkt, 0)) { || !WPACKET_put_bytes_u16(pkt, 0)) {
...@@ -437,7 +431,7 @@ int tls_construct_client_ems(SSL *s, WPACKET *pkt, int *al) ...@@ -437,7 +431,7 @@ int tls_construct_client_ems(SSL *s, WPACKET *pkt, int *al)
return 1; return 1;
} }
int tls_construct_client_supported_versions(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_supported_versions(SSL *s, WPACKET *pkt, int *al)
{ {
int currv, min_version, max_version, reason; int currv, min_version, max_version, reason;
...@@ -484,7 +478,7 @@ int tls_construct_client_supported_versions(SSL *s, WPACKET *pkt, int *al) ...@@ -484,7 +478,7 @@ int tls_construct_client_supported_versions(SSL *s, WPACKET *pkt, int *al)
} }
int tls_construct_client_key_share(SSL *s, WPACKET *pkt, int *al) int tls_construct_ctos_key_share(SSL *s, WPACKET *pkt, int *al)
{ {
size_t i, sharessent = 0, num_curves = 0; size_t i, sharessent = 0, num_curves = 0;
const unsigned char *pcurves = NULL; const unsigned char *pcurves = NULL;
...@@ -569,7 +563,10 @@ int tls_construct_client_key_share(SSL *s, WPACKET *pkt, int *al) ...@@ -569,7 +563,10 @@ int tls_construct_client_key_share(SSL *s, WPACKET *pkt, int *al)
return 1; return 1;
} }
int tls_construct_client_padding(SSL *s, WPACKET *pkt, int *al) #define F5_WORKAROUND_MIN_MSG_LEN 0xff
#define F5_WORKAROUND_MAX_MSG_LEN 0x200
int tls_construct_ctos_padding(SSL *s, WPACKET *pkt, int *al)
{ {
unsigned char *padbytes; unsigned char *padbytes;
size_t hlen; size_t hlen;
...@@ -580,7 +577,7 @@ int tls_construct_client_padding(SSL *s, WPACKET *pkt, int *al) ...@@ -580,7 +577,7 @@ int tls_construct_client_padding(SSL *s, WPACKET *pkt, int *al)
/* /*
* Add padding to workaround bugs in F5 terminators. See * Add padding to workaround bugs in F5 terminators. See
* https://tools.ietf.org/html/draft-agl-tls-padding-03 NB: because this * https://tools.ietf.org/html/draft-agl-tls-padding-03 NB: because this
* code works out the length of all existing extensions it MUST always * code calculates the length of all existing extensions it MUST always
* appear last. * appear last.
*/ */
if (!WPACKET_get_total_written(pkt, &hlen)) { if (!WPACKET_get_total_written(pkt, &hlen)) {
...@@ -588,8 +585,14 @@ int tls_construct_client_padding(SSL *s, WPACKET *pkt, int *al) ...@@ -588,8 +585,14 @@ int tls_construct_client_padding(SSL *s, WPACKET *pkt, int *al)
return 0; return 0;
} }
if (hlen > 0xff && hlen < 0x200) { if (hlen > F5_WORKAROUND_MIN_MSG_LEN && hlen < F5_WORKAROUND_MAX_MSG_LEN) {
hlen = 0x200 - hlen; /* Calculate the amond of padding we need to add */
hlen = F5_WORKAROUND_MAX_MSG_LEN - hlen;
/*
* Take off the size of extension header itself (2 bytes for type and
* 2 bytes for length bytes)
*/
if (hlen >= 4) if (hlen >= 4)
hlen -= 4; hlen -= 4;
else else
...@@ -609,7 +612,7 @@ int tls_construct_client_padding(SSL *s, WPACKET *pkt, int *al) ...@@ -609,7 +612,7 @@ int tls_construct_client_padding(SSL *s, WPACKET *pkt, int *al)
/* /*
* Parse the server's renegotiation binding and abort if it's not right * Parse the server's renegotiation binding and abort if it's not right
*/ */
int tls_parse_server_renegotiate(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_renegotiate(SSL *s, PACKET *pkt, int *al)
{ {
size_t expected_len = s->s3->previous_client_finished_len size_t expected_len = s->s3->previous_client_finished_len
+ s->s3->previous_server_finished_len; + s->s3->previous_server_finished_len;
...@@ -666,7 +669,7 @@ int tls_parse_server_renegotiate(SSL *s, PACKET *pkt, int *al) ...@@ -666,7 +669,7 @@ int tls_parse_server_renegotiate(SSL *s, PACKET *pkt, int *al)
return 1; return 1;
} }
int tls_parse_server_server_name(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_server_name(SSL *s, PACKET *pkt, int *al)
{ {
if (s->tlsext_hostname == NULL || PACKET_remaining(pkt) > 0) { if (s->tlsext_hostname == NULL || PACKET_remaining(pkt) > 0) {
*al = SSL_AD_UNRECOGNIZED_NAME; *al = SSL_AD_UNRECOGNIZED_NAME;
...@@ -689,7 +692,7 @@ int tls_parse_server_server_name(SSL *s, PACKET *pkt, int *al) ...@@ -689,7 +692,7 @@ int tls_parse_server_server_name(SSL *s, PACKET *pkt, int *al)
} }
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
int tls_parse_server_ec_pt_formats(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_ec_pt_formats(SSL *s, PACKET *pkt, int *al)
{ {
unsigned int ecpointformatlist_length; unsigned int ecpointformatlist_length;
PACKET ecptformatlist; PACKET ecptformatlist;
...@@ -724,26 +727,28 @@ int tls_parse_server_ec_pt_formats(SSL *s, PACKET *pkt, int *al) ...@@ -724,26 +727,28 @@ int tls_parse_server_ec_pt_formats(SSL *s, PACKET *pkt, int *al)
} }
#endif #endif
int tls_parse_server_session_ticket(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_session_ticket(SSL *s, PACKET *pkt, int *al)
{ {
if (s->tls_session_ticket_ext_cb && if (s->tls_session_ticket_ext_cb != NULL &&
!s->tls_session_ticket_ext_cb(s, PACKET_data(pkt), !s->tls_session_ticket_ext_cb(s, PACKET_data(pkt),
PACKET_remaining(pkt), PACKET_remaining(pkt),
s->tls_session_ticket_ext_cb_arg)) { s->tls_session_ticket_ext_cb_arg)) {
*al = SSL_AD_INTERNAL_ERROR; *al = SSL_AD_INTERNAL_ERROR;
return 0; return 0;
} }
if (!tls_use_ticket(s) || PACKET_remaining(pkt) > 0) { if (!tls_use_ticket(s) || PACKET_remaining(pkt) > 0) {
*al = SSL_AD_UNSUPPORTED_EXTENSION; *al = SSL_AD_UNSUPPORTED_EXTENSION;
return 0; return 0;
} }
s->tlsext_ticket_expected = 1; s->tlsext_ticket_expected = 1;
return 1; return 1;
} }
#ifndef OPENSSL_NO_OCSP #ifndef OPENSSL_NO_OCSP
int tls_parse_server_status_request(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_status_request(SSL *s, PACKET *pkt, int *al)
{ {
/* /*
* MUST be empty and only sent if we've requested a status * MUST be empty and only sent if we've requested a status
...@@ -762,7 +767,7 @@ int tls_parse_server_status_request(SSL *s, PACKET *pkt, int *al) ...@@ -762,7 +767,7 @@ int tls_parse_server_status_request(SSL *s, PACKET *pkt, int *al)
#ifndef OPENSSL_NO_CT #ifndef OPENSSL_NO_CT
int tls_parse_server_sct(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_sct(SSL *s, PACKET *pkt, int *al)
{ {
/* /*
* Only take it if we asked for it - i.e if there is no CT validation * Only take it if we asked for it - i.e if there is no CT validation
...@@ -773,10 +778,9 @@ int tls_parse_server_sct(SSL *s, PACKET *pkt, int *al) ...@@ -773,10 +778,9 @@ int tls_parse_server_sct(SSL *s, PACKET *pkt, int *al)
size_t size = PACKET_remaining(pkt); size_t size = PACKET_remaining(pkt);
/* Simply copy it off for later processing */ /* Simply copy it off for later processing */
if (s->tlsext_scts != NULL) { OPENSSL_free(s->tlsext_scts);
OPENSSL_free(s->tlsext_scts); s->tlsext_scts = NULL;
s->tlsext_scts = NULL;
}
s->tlsext_scts_len = size; s->tlsext_scts_len = size;
if (size > 0) { if (size > 0) {
s->tlsext_scts = OPENSSL_malloc(size); s->tlsext_scts = OPENSSL_malloc(size);
...@@ -816,12 +820,13 @@ static int ssl_next_proto_validate(PACKET *pkt) ...@@ -816,12 +820,13 @@ static int ssl_next_proto_validate(PACKET *pkt)
return 1; return 1;
} }
int tls_parse_server_npn(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_npn(SSL *s, PACKET *pkt, int *al)
{ {
unsigned char *selected; unsigned char *selected;
unsigned char selected_len; unsigned char selected_len;
PACKET tmppkt; PACKET tmppkt;
/* Check if we are in a renegotiation. If so ignore this extension */
if (s->s3->tmp.finish_md_len != 0) if (s->s3->tmp.finish_md_len != 0)
return 1; return 1;
...@@ -830,6 +835,7 @@ int tls_parse_server_npn(SSL *s, PACKET *pkt, int *al) ...@@ -830,6 +835,7 @@ int tls_parse_server_npn(SSL *s, PACKET *pkt, int *al)
*al = SSL_AD_UNSUPPORTED_EXTENSION; *al = SSL_AD_UNSUPPORTED_EXTENSION;
return 0; return 0;
} }
/* The data must be valid */ /* The data must be valid */
tmppkt = *pkt; tmppkt = *pkt;
if (!ssl_next_proto_validate(&tmppkt)) { if (!ssl_next_proto_validate(&tmppkt)) {
...@@ -844,6 +850,7 @@ int tls_parse_server_npn(SSL *s, PACKET *pkt, int *al) ...@@ -844,6 +850,7 @@ int tls_parse_server_npn(SSL *s, PACKET *pkt, int *al)
*al = SSL_AD_INTERNAL_ERROR; *al = SSL_AD_INTERNAL_ERROR;
return 0; return 0;
} }
/* /*
* Could be non-NULL if server has sent multiple NPN extensions in * Could be non-NULL if server has sent multiple NPN extensions in
* a single Serverhello * a single Serverhello
...@@ -863,7 +870,7 @@ int tls_parse_server_npn(SSL *s, PACKET *pkt, int *al) ...@@ -863,7 +870,7 @@ int tls_parse_server_npn(SSL *s, PACKET *pkt, int *al)
} }
#endif #endif
int tls_parse_server_alpn(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_alpn(SSL *s, PACKET *pkt, int *al)
{ {
size_t len; size_t len;
...@@ -900,17 +907,17 @@ int tls_parse_server_alpn(SSL *s, PACKET *pkt, int *al) ...@@ -900,17 +907,17 @@ int tls_parse_server_alpn(SSL *s, PACKET *pkt, int *al)
} }
#ifndef OPENSSL_NO_SRTP #ifndef OPENSSL_NO_SRTP
int tls_parse_server_use_srtp(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_use_srtp(SSL *s, PACKET *pkt, int *al)
{ {
unsigned int id, ct, mki; unsigned int id, ct, mki;
int i; int i;
STACK_OF(SRTP_PROTECTION_PROFILE) *clnt; STACK_OF(SRTP_PROTECTION_PROFILE) *clnt;
SRTP_PROTECTION_PROFILE *prof; SRTP_PROTECTION_PROFILE *prof;
if (!PACKET_get_net_2(pkt, &ct) if (!PACKET_get_net_2(pkt, &ct) || ct != 2
|| ct != 2 || !PACKET_get_net_2(pkt, &id) || !PACKET_get_net_2(pkt, &id)
|| !PACKET_get_1(pkt, &mki) || !PACKET_get_1(pkt, &mki)
|| PACKET_remaining(pkt) != 0) { || PACKET_remaining(pkt) != 0) {
SSLerr(SSL_F_TLS_PARSE_SERVER_USE_SRTP, SSLerr(SSL_F_TLS_PARSE_SERVER_USE_SRTP,
SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST); SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
*al = SSL_AD_DECODE_ERROR; *al = SSL_AD_DECODE_ERROR;
...@@ -924,9 +931,8 @@ int tls_parse_server_use_srtp(SSL *s, PACKET *pkt, int *al) ...@@ -924,9 +931,8 @@ int tls_parse_server_use_srtp(SSL *s, PACKET *pkt, int *al)
return 0; return 0;
} }
clnt = SSL_get_srtp_profiles(s);
/* Throw an error if the server gave us an unsolicited extension */ /* Throw an error if the server gave us an unsolicited extension */
clnt = SSL_get_srtp_profiles(s);
if (clnt == NULL) { if (clnt == NULL) {
SSLerr(SSL_F_TLS_PARSE_SERVER_USE_SRTP, SSL_R_NO_SRTP_PROFILES); SSLerr(SSL_F_TLS_PARSE_SERVER_USE_SRTP, SSL_R_NO_SRTP_PROFILES);
*al = SSL_AD_DECODE_ERROR; *al = SSL_AD_DECODE_ERROR;
...@@ -954,7 +960,7 @@ int tls_parse_server_use_srtp(SSL *s, PACKET *pkt, int *al) ...@@ -954,7 +960,7 @@ int tls_parse_server_use_srtp(SSL *s, PACKET *pkt, int *al)
} }
#endif #endif
int tls_parse_server_etm(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_etm(SSL *s, PACKET *pkt, int *al)
{ {
/* Ignore if inappropriate ciphersuite */ /* Ignore if inappropriate ciphersuite */
if (!(s->options & SSL_OP_NO_ENCRYPT_THEN_MAC) if (!(s->options & SSL_OP_NO_ENCRYPT_THEN_MAC)
...@@ -965,7 +971,7 @@ int tls_parse_server_etm(SSL *s, PACKET *pkt, int *al) ...@@ -965,7 +971,7 @@ int tls_parse_server_etm(SSL *s, PACKET *pkt, int *al)
return 1; return 1;
} }
int tls_parse_server_ems(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_ems(SSL *s, PACKET *pkt, int *al)
{ {
s->s3->flags |= TLS1_FLAGS_RECEIVED_EXTMS; s->s3->flags |= TLS1_FLAGS_RECEIVED_EXTMS;
if (!s->hit) if (!s->hit)
...@@ -974,7 +980,7 @@ int tls_parse_server_ems(SSL *s, PACKET *pkt, int *al) ...@@ -974,7 +980,7 @@ int tls_parse_server_ems(SSL *s, PACKET *pkt, int *al)
return 1; return 1;
} }
int tls_parse_server_key_share(SSL *s, PACKET *pkt, int *al) int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, int *al)
{ {
unsigned int group_id; unsigned int group_id;
PACKET encoded_pt; PACKET encoded_pt;
......
此差异已折叠。
...@@ -1132,7 +1132,7 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt) ...@@ -1132,7 +1132,7 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt)
* server wants to resume. * server wants to resume.
*/ */
if (s->version >= TLS1_VERSION && !SSL_IS_TLS13(s) if (s->version >= TLS1_VERSION && !SSL_IS_TLS13(s)
&& s->tls_session_secret_cb && s->session->tlsext_tick) { && s->tls_session_secret_cb != NULL && s->session->tlsext_tick) {
const SSL_CIPHER *pref_cipher = NULL; const SSL_CIPHER *pref_cipher = NULL;
/* /*
* s->session->master_key_length is a size_t, but this is an int for * s->session->master_key_length is a size_t, but this is an int for
...@@ -3112,10 +3112,11 @@ static MSG_PROCESS_RETURN tls_process_encrypted_extensions(SSL *s, PACKET *pkt) ...@@ -3112,10 +3112,11 @@ static MSG_PROCESS_RETURN tls_process_encrypted_extensions(SSL *s, PACKET *pkt)
*/ */
if (!tls_collect_extensions(s, &extensions, if (!tls_collect_extensions(s, &extensions,
EXT_TLS1_3_ENCRYPTED_EXTENSIONS EXT_TLS1_3_ENCRYPTED_EXTENSIONS
| EXT_TLS1_3_CERTIFICATE, &rawexts, &al) | EXT_TLS1_3_CERTIFICATE,
&rawexts, &al)
|| !tls_parse_all_extensions(s, || !tls_parse_all_extensions(s,
EXT_TLS1_3_ENCRYPTED_EXTENSIONS EXT_TLS1_3_ENCRYPTED_EXTENSIONS
| EXT_TLS1_3_CERTIFICATE, | EXT_TLS1_3_CERTIFICATE,
rawexts, &al)) rawexts, &al))
goto err; goto err;
......
...@@ -163,106 +163,106 @@ __owur int tls_construct_extensions(SSL *s, WPACKET *pkt, unsigned int context, ...@@ -163,106 +163,106 @@ __owur int tls_construct_extensions(SSL *s, WPACKET *pkt, unsigned int context,
int *al); int *al);
/* Server Extension processing */ /* Server Extension processing */
int tls_parse_client_renegotiate(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_renegotiate(SSL *s, PACKET *pkt, int *al);
int tls_parse_client_server_name(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_server_name(SSL *s, PACKET *pkt, int *al);
#ifndef OPENSSL_NO_SRP #ifndef OPENSSL_NO_SRP
int tls_parse_client_srp(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_srp(SSL *s, PACKET *pkt, int *al);
#endif #endif
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
int tls_parse_client_ec_pt_formats(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_ec_pt_formats(SSL *s, PACKET *pkt, int *al);
int tls_parse_client_supported_groups(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_supported_groups(SSL *s, PACKET *pkt, int *al);
#endif #endif
int tls_parse_client_session_ticket(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_session_ticket(SSL *s, PACKET *pkt, int *al);
int tls_parse_client_sig_algs(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_sig_algs(SSL *s, PACKET *pkt, int *al);
#ifndef OPENSSL_NO_OCSP #ifndef OPENSSL_NO_OCSP
int tls_parse_client_status_request(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_status_request(SSL *s, PACKET *pkt, int *al);
#endif #endif
#ifndef OPENSSL_NO_NEXTPROTONEG #ifndef OPENSSL_NO_NEXTPROTONEG
int tls_parse_client_npn(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_npn(SSL *s, PACKET *pkt, int *al);
#endif #endif
int tls_parse_client_alpn(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_alpn(SSL *s, PACKET *pkt, int *al);
#ifndef OPENSSL_NO_SRTP #ifndef OPENSSL_NO_SRTP
int tls_parse_client_use_srtp(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_use_srtp(SSL *s, PACKET *pkt, int *al);
#endif #endif
int tls_parse_client_etm(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_etm(SSL *s, PACKET *pkt, int *al);
int tls_parse_client_key_share(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_key_share(SSL *s, PACKET *pkt, int *al);
int tls_parse_client_ems(SSL *s, PACKET *pkt, int *al); int tls_parse_ctos_ems(SSL *s, PACKET *pkt, int *al);
int tls_construct_server_renegotiate(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_renegotiate(SSL *s, WPACKET *pkt, int *al);
int tls_construct_server_server_name(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_server_name(SSL *s, WPACKET *pkt, int *al);
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
int tls_construct_server_ec_pt_formats(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_ec_pt_formats(SSL *s, WPACKET *pkt, int *al);
#endif #endif
int tls_construct_server_session_ticket(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_session_ticket(SSL *s, WPACKET *pkt, int *al);
#ifndef OPENSSL_NO_OCSP #ifndef OPENSSL_NO_OCSP
int tls_construct_server_status_request(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_status_request(SSL *s, WPACKET *pkt, int *al);
#endif #endif
#ifndef OPENSSL_NO_NEXTPROTONEG #ifndef OPENSSL_NO_NEXTPROTONEG
int tls_construct_server_next_proto_neg(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_next_proto_neg(SSL *s, WPACKET *pkt, int *al);
#endif #endif
int tls_construct_server_alpn(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_alpn(SSL *s, WPACKET *pkt, int *al);
#ifndef OPENSSL_NO_SRTP #ifndef OPENSSL_NO_SRTP
int tls_construct_server_use_srtp(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_use_srtp(SSL *s, WPACKET *pkt, int *al);
#endif #endif
int tls_construct_server_etm(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_etm(SSL *s, WPACKET *pkt, int *al);
int tls_construct_server_ems(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_ems(SSL *s, WPACKET *pkt, int *al);
int tls_construct_server_key_share(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_key_share(SSL *s, WPACKET *pkt, int *al);
/* /*
* Not in public headers as this is not an official extension. Only used when * Not in public headers as this is not an official extension. Only used when
* SSL_OP_CRYPTOPRO_TLSEXT_BUG is set. * SSL_OP_CRYPTOPRO_TLSEXT_BUG is set.
*/ */
#define TLSEXT_TYPE_cryptopro_bug 0xfde8 #define TLSEXT_TYPE_cryptopro_bug 0xfde8
int tls_construct_server_cryptopro_bug(SSL *s, WPACKET *pkt, int *al); int tls_construct_stoc_cryptopro_bug(SSL *s, WPACKET *pkt, int *al);
/* Client Extension processing */ /* Client Extension processing */
int tls_construct_client_renegotiate(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_renegotiate(SSL *s, WPACKET *pkt, int *al);
int tls_construct_client_server_name(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_server_name(SSL *s, WPACKET *pkt, int *al);
#ifndef OPENSSL_NO_SRP #ifndef OPENSSL_NO_SRP
int tls_construct_client_srp(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_srp(SSL *s, WPACKET *pkt, int *al);
#endif #endif
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
int tls_construct_client_ec_pt_formats(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt, int *al);
int tls_construct_client_supported_groups(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt, int *al);
#endif #endif
int tls_construct_client_session_ticket(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_session_ticket(SSL *s, WPACKET *pkt, int *al);
int tls_construct_client_sig_algs(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_sig_algs(SSL *s, WPACKET *pkt, int *al);
#ifndef OPENSSL_NO_OCSP #ifndef OPENSSL_NO_OCSP
int tls_construct_client_status_request(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_status_request(SSL *s, WPACKET *pkt, int *al);
#endif #endif
#ifndef OPENSSL_NO_NEXTPROTONEG #ifndef OPENSSL_NO_NEXTPROTONEG
int tls_construct_client_npn(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_npn(SSL *s, WPACKET *pkt, int *al);
#endif #endif
int tls_construct_client_alpn(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_alpn(SSL *s, WPACKET *pkt, int *al);
#ifndef OPENSSL_NO_SRTP #ifndef OPENSSL_NO_SRTP
int tls_construct_client_use_srtp(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_use_srtp(SSL *s, WPACKET *pkt, int *al);
#endif #endif
int tls_construct_client_etm(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_etm(SSL *s, WPACKET *pkt, int *al);
#ifndef OPENSSL_NO_CT #ifndef OPENSSL_NO_CT
int tls_construct_client_sct(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_sct(SSL *s, WPACKET *pkt, int *al);
#endif #endif
int tls_construct_client_ems(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_ems(SSL *s, WPACKET *pkt, int *al);
int tls_construct_client_supported_versions(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_supported_versions(SSL *s, WPACKET *pkt, int *al);
int tls_construct_client_key_share(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_key_share(SSL *s, WPACKET *pkt, int *al);
int tls_construct_client_padding(SSL *s, WPACKET *pkt, int *al); int tls_construct_ctos_padding(SSL *s, WPACKET *pkt, int *al);
int tls_parse_server_renegotiate(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_renegotiate(SSL *s, PACKET *pkt, int *al);
int tls_parse_server_server_name(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_server_name(SSL *s, PACKET *pkt, int *al);
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
int tls_parse_server_ec_pt_formats(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_ec_pt_formats(SSL *s, PACKET *pkt, int *al);
#endif #endif
int tls_parse_server_session_ticket(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_session_ticket(SSL *s, PACKET *pkt, int *al);
#ifndef OPENSSL_NO_OCSP #ifndef OPENSSL_NO_OCSP
int tls_parse_server_status_request(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_status_request(SSL *s, PACKET *pkt, int *al);
#endif #endif
#ifndef OPENSSL_NO_CT #ifndef OPENSSL_NO_CT
int tls_parse_server_sct(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_sct(SSL *s, PACKET *pkt, int *al);
#endif #endif
#ifndef OPENSSL_NO_NEXTPROTONEG #ifndef OPENSSL_NO_NEXTPROTONEG
int tls_parse_server_npn(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_npn(SSL *s, PACKET *pkt, int *al);
#endif #endif
int tls_parse_server_alpn(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_alpn(SSL *s, PACKET *pkt, int *al);
#ifndef OPENSSL_NO_SRTP #ifndef OPENSSL_NO_SRTP
int tls_parse_server_use_srtp(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_use_srtp(SSL *s, PACKET *pkt, int *al);
#endif #endif
int tls_parse_server_etm(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_etm(SSL *s, PACKET *pkt, int *al);
int tls_parse_server_ems(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_ems(SSL *s, PACKET *pkt, int *al);
int tls_parse_server_key_share(SSL *s, PACKET *pkt, int *al); int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, int *al);
...@@ -1078,10 +1078,6 @@ int dtls_construct_hello_verify_request(SSL *s, WPACKET *pkt) ...@@ -1078,10 +1078,6 @@ int dtls_construct_hello_verify_request(SSL *s, WPACKET *pkt)
*/ */
static void ssl_check_for_safari(SSL *s, const CLIENTHELLO_MSG *hello) static void ssl_check_for_safari(SSL *s, const CLIENTHELLO_MSG *hello)
{ {
unsigned int type;
PACKET sni, tmppkt;
size_t ext_len;
static const unsigned char kSafariExtensionsBlock[] = { static const unsigned char kSafariExtensionsBlock[] = {
0x00, 0x0a, /* elliptic_curves extension */ 0x00, 0x0a, /* elliptic_curves extension */
0x00, 0x08, /* 8 bytes */ 0x00, 0x08, /* 8 bytes */
...@@ -1104,9 +1100,11 @@ static void ssl_check_for_safari(SSL *s, const CLIENTHELLO_MSG *hello) ...@@ -1104,9 +1100,11 @@ static void ssl_check_for_safari(SSL *s, const CLIENTHELLO_MSG *hello)
0x04, 0x03, /* SHA-256/ECDSA */ 0x04, 0x03, /* SHA-256/ECDSA */
0x02, 0x03, /* SHA-1/ECDSA */ 0x02, 0x03, /* SHA-1/ECDSA */
}; };
/* Length of the common prefix (first two extensions). */ /* Length of the common prefix (first two extensions). */
static const size_t kSafariCommonExtensionsLength = 18; static const size_t kSafariCommonExtensionsLength = 18;
unsigned int type;
PACKET sni, tmppkt;
size_t ext_len;
tmppkt = hello->extensions; tmppkt = hello->extensions;
...@@ -1694,7 +1692,7 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt) ...@@ -1694,7 +1692,7 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt)
/* /*
* Call the status request callback if needed. Upon success, returns 1. * Call the status request callback if needed. Upon success, returns 1.
* Upon failure, returns 0 and sets |al| to the appropriate fatal alert. * Upon failure, returns 0 and sets |*al| to the appropriate fatal alert.
*/ */
static int tls_handle_status_request(SSL *s, int *al) static int tls_handle_status_request(SSL *s, int *al)
{ {
...@@ -1706,10 +1704,11 @@ static int tls_handle_status_request(SSL *s, int *al) ...@@ -1706,10 +1704,11 @@ static int tls_handle_status_request(SSL *s, int *al)
* and must be called after the cipher has been chosen because this may * and must be called after the cipher has been chosen because this may
* influence which certificate is sent * influence which certificate is sent
*/ */
if ((s->tlsext_status_type != -1) && s->ctx && s->ctx->tlsext_status_cb) { if (s->tlsext_status_type != -1 && s->ctx != NULL
&& s->ctx->tlsext_status_cb != NULL) {
int ret; int ret;
CERT_PKEY *certpkey; CERT_PKEY *certpkey = ssl_get_server_send_pkey(s);
certpkey = ssl_get_server_send_pkey(s);
/* If no certificate can't return certificate status */ /* If no certificate can't return certificate status */
if (certpkey != NULL) { if (certpkey != NULL) {
/* /*
...@@ -1912,8 +1911,8 @@ int tls_construct_server_hello(SSL *s, WPACKET *pkt) ...@@ -1912,8 +1911,8 @@ int tls_construct_server_hello(SSL *s, WPACKET *pkt)
&& !WPACKET_put_bytes_u8(pkt, compm)) && !WPACKET_put_bytes_u8(pkt, compm))
|| !tls_construct_extensions(s, pkt, || !tls_construct_extensions(s, pkt,
SSL_IS_TLS13(s) SSL_IS_TLS13(s)
? EXT_TLS1_3_SERVER_HELLO ? EXT_TLS1_3_SERVER_HELLO
: EXT_TLS1_2_SERVER_HELLO, &al)) { : EXT_TLS1_2_SERVER_HELLO, &al)) {
SSLerr(SSL_F_TLS_CONSTRUCT_SERVER_HELLO, ERR_R_INTERNAL_ERROR); SSLerr(SSL_F_TLS_CONSTRUCT_SERVER_HELLO, ERR_R_INTERNAL_ERROR);
goto err; goto err;
} }
......
...@@ -593,6 +593,7 @@ static int ssl_print_version(BIO *bio, int indent, const char *name, ...@@ -593,6 +593,7 @@ static int ssl_print_version(BIO *bio, int indent, const char *name,
unsigned int *version) unsigned int *version)
{ {
int vers; int vers;
if (*pmsglen < 2) if (*pmsglen < 2)
return 0; return 0;
vers = ((*pmsg)[0] << 8) | (*pmsg)[1]; vers = ((*pmsg)[0] << 8) | (*pmsg)[1];
...@@ -867,6 +868,7 @@ static int ssl_print_server_hello(BIO *bio, int indent, ...@@ -867,6 +868,7 @@ static int ssl_print_server_hello(BIO *bio, int indent,
{ {
unsigned int cs; unsigned int cs;
unsigned int vers; unsigned int vers;
if (!ssl_print_version(bio, indent, "server_version", &msg, &msglen, &vers)) if (!ssl_print_version(bio, indent, "server_version", &msg, &msglen, &vers))
return 0; return 0;
if (!ssl_print_random(bio, indent, &msg, &msglen)) if (!ssl_print_random(bio, indent, &msg, &msglen))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册