mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-05-01 12:09:42 +00:00
Indent ssl/
Run util/openssl-format-source on ssl/ Some comments and hand-formatted tables were fixed up manually by disabling auto-formatting. Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
parent
604f6eff31
commit
a230b26e09
17
ssl/d1_lib.c
17
ssl/d1_lib.c
@ -338,8 +338,7 @@ int dtls1_check_timeout_num(SSL *s)
|
|||||||
if (s->d1->timeout.num_alerts > 2
|
if (s->d1->timeout.num_alerts > 2
|
||||||
&& !(SSL_get_options(s) & SSL_OP_NO_QUERY_MTU)) {
|
&& !(SSL_get_options(s) & SSL_OP_NO_QUERY_MTU)) {
|
||||||
mtu =
|
mtu =
|
||||||
BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_GET_FALLBACK_MTU, 0,
|
BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_GET_FALLBACK_MTU, 0, NULL);
|
||||||
NULL);
|
|
||||||
if (mtu < s->d1->mtu)
|
if (mtu < s->d1->mtu)
|
||||||
s->d1->mtu = mtu;
|
s->d1->mtu = mtu;
|
||||||
}
|
}
|
||||||
@ -391,10 +390,13 @@ static void get_current_time(struct timeval *t)
|
|||||||
|
|
||||||
GetSystemTime(&st);
|
GetSystemTime(&st);
|
||||||
SystemTimeToFileTime(&st, &now.ft);
|
SystemTimeToFileTime(&st, &now.ft);
|
||||||
|
/* re-bias to 1/1/1970 */
|
||||||
# ifdef __MINGW32__
|
# ifdef __MINGW32__
|
||||||
now.ul -= 116444736000000000ULL;
|
now.ul -= 116444736000000000ULL;
|
||||||
# else
|
# else
|
||||||
now.ul -= 116444736000000000UI64; /* re-bias to 1/1/1970 */
|
/* *INDENT-OFF* */
|
||||||
|
now.ul -= 116444736000000000UI64;
|
||||||
|
/* *INDENT-ON* */
|
||||||
# endif
|
# endif
|
||||||
t->tv_sec = (long)(now.ul / 10000000);
|
t->tv_sec = (long)(now.ul / 10000000);
|
||||||
t->tv_usec = ((int)(now.ul % 10000000)) / 10;
|
t->tv_usec = ((int)(now.ul % 10000000)) / 10;
|
||||||
@ -408,7 +410,6 @@ static void get_current_time(struct timeval *t)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define LISTEN_SUCCESS 2
|
#define LISTEN_SUCCESS 2
|
||||||
#define LISTEN_SEND_VERIFY_REQUEST 1
|
#define LISTEN_SEND_VERIFY_REQUEST 1
|
||||||
|
|
||||||
@ -744,7 +745,6 @@ int DTLSv1_listen(SSL *s, BIO_ADDR *client)
|
|||||||
s->msg_callback(1, 0, SSL3_RT_HEADER, buf,
|
s->msg_callback(1, 0, SSL3_RT_HEADER, buf,
|
||||||
DTLS1_RT_HEADER_LENGTH, s, s->msg_callback_arg);
|
DTLS1_RT_HEADER_LENGTH, s, s->msg_callback_arg);
|
||||||
|
|
||||||
|
|
||||||
if ((tmpclient = BIO_ADDR_new()) == NULL) {
|
if ((tmpclient = BIO_ADDR_new()) == NULL) {
|
||||||
SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_MALLOC_FAILURE);
|
||||||
goto end;
|
goto end;
|
||||||
@ -805,7 +805,9 @@ int DTLSv1_listen(SSL *s, BIO_ADDR *client)
|
|||||||
*/
|
*/
|
||||||
ossl_statem_set_hello_verify_done(s);
|
ossl_statem_set_hello_verify_done(s);
|
||||||
|
|
||||||
/* Some BIOs may not support this. If we fail we clear the client address */
|
/*
|
||||||
|
* Some BIOs may not support this. If we fail we clear the client address
|
||||||
|
*/
|
||||||
if (BIO_dgram_get_peer(rbio, client) <= 0)
|
if (BIO_dgram_get_peer(rbio, client) <= 0)
|
||||||
BIO_ADDR_clear(client);
|
BIO_ADDR_clear(client);
|
||||||
|
|
||||||
@ -987,8 +989,7 @@ int dtls1_heartbeat(SSL *s)
|
|||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
if (s->msg_callback)
|
if (s->msg_callback)
|
||||||
s->msg_callback(1, s->version, DTLS1_RT_HEARTBEAT,
|
s->msg_callback(1, s->version, DTLS1_RT_HEARTBEAT,
|
||||||
buf, size,
|
buf, size, s, s->msg_callback_arg);
|
||||||
s, s->msg_callback_arg);
|
|
||||||
|
|
||||||
dtls1_start_timer(s);
|
dtls1_start_timer(s);
|
||||||
s->tlsext_hb_pending = 1;
|
s->tlsext_hb_pending = 1;
|
||||||
|
@ -30,11 +30,11 @@ static SRTP_PROTECTION_PROFILE srtp_known_profiles[] = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"SRTP_AEAD_AES_128_GCM",
|
"SRTP_AEAD_AES_128_GCM",
|
||||||
SRTP_AEAD_AES_128_GCM
|
SRTP_AEAD_AES_128_GCM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"SRTP_AEAD_AES_256_GCM",
|
"SRTP_AEAD_AES_256_GCM",
|
||||||
SRTP_AEAD_AES_256_GCM
|
SRTP_AEAD_AES_256_GCM,
|
||||||
},
|
},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
@ -76,8 +76,7 @@ static int ssl_ctx_make_profiles(const char *profiles_string,
|
|||||||
do {
|
do {
|
||||||
col = strchr(ptr, ':');
|
col = strchr(ptr, ':');
|
||||||
|
|
||||||
if (!find_profile_by_name(ptr, &p,
|
if (!find_profile_by_name(ptr, &p, col ? col - ptr : (int)strlen(ptr))) {
|
||||||
col ? col - ptr : (int)strlen(ptr))) {
|
|
||||||
if (sk_SRTP_PROTECTION_PROFILE_find(profiles, p) >= 0) {
|
if (sk_SRTP_PROTECTION_PROFILE_find(profiles, p) >= 0) {
|
||||||
SSLerr(SSL_F_SSL_CTX_MAKE_PROFILES,
|
SSLerr(SSL_F_SSL_CTX_MAKE_PROFILES,
|
||||||
SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
|
SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
|
||||||
@ -190,8 +189,7 @@ int ssl_parse_clienthello_use_srtp_ext(SSL *s, PACKET *pkt, int *al)
|
|||||||
|
|
||||||
/* Pull off the length of the cipher suite list and check it is even */
|
/* Pull off the length of the cipher suite list and check it is even */
|
||||||
if (!PACKET_get_net_2(pkt, &ct)
|
if (!PACKET_get_net_2(pkt, &ct)
|
||||||
|| (ct & 1) != 0
|
|| (ct & 1) != 0 || !PACKET_get_sub_packet(pkt, &subpkt, ct)) {
|
||||||
|| !PACKET_get_sub_packet(pkt, &subpkt, ct)) {
|
|
||||||
SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,
|
SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,
|
||||||
SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
|
SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
|
||||||
*al = SSL_AD_DECODE_ERROR;
|
*al = SSL_AD_DECODE_ERROR;
|
||||||
@ -281,8 +279,7 @@ int ssl_parse_serverhello_use_srtp_ext(SSL *s, PACKET *pkt, int *al)
|
|||||||
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_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT,
|
SSLerr(SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT,
|
||||||
|
108
ssl/methods.c
108
ssl/methods.c
@ -11,7 +11,7 @@
|
|||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include "ssl_locl.h"
|
#include "ssl_locl.h"
|
||||||
|
|
||||||
/*
|
/*-
|
||||||
* TLS/SSLv3 methods
|
* TLS/SSLv3 methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -19,201 +19,148 @@ IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
|
|||||||
TLS_method,
|
TLS_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ossl_statem_connect, TLSv1_2_enc_data)
|
ossl_statem_connect, TLSv1_2_enc_data)
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_TLS1_2_METHOD
|
#ifndef OPENSSL_NO_TLS1_2_METHOD
|
||||||
IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
|
IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
|
||||||
tlsv1_2_method,
|
tlsv1_2_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ossl_statem_connect, TLSv1_2_enc_data)
|
ossl_statem_connect, TLSv1_2_enc_data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_TLS1_1_METHOD
|
#ifndef OPENSSL_NO_TLS1_1_METHOD
|
||||||
IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
|
IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
|
||||||
tlsv1_1_method,
|
tlsv1_1_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ossl_statem_connect, TLSv1_1_enc_data)
|
ossl_statem_connect, TLSv1_1_enc_data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_TLS1_METHOD
|
#ifndef OPENSSL_NO_TLS1_METHOD
|
||||||
IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
|
IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
|
||||||
tlsv1_method,
|
tlsv1_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept, ossl_statem_connect, TLSv1_enc_data)
|
||||||
ossl_statem_connect, TLSv1_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SSL3_METHOD
|
#ifndef OPENSSL_NO_SSL3_METHOD
|
||||||
IMPLEMENT_ssl3_meth_func(sslv3_method, ossl_statem_accept, ossl_statem_connect)
|
IMPLEMENT_ssl3_meth_func(sslv3_method, ossl_statem_accept, ossl_statem_connect)
|
||||||
#endif
|
#endif
|
||||||
|
/*-
|
||||||
|
|
||||||
/*
|
|
||||||
* TLS/SSLv3 server methods
|
* TLS/SSLv3 server methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
|
IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
|
||||||
TLS_server_method,
|
TLS_server_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function, TLSv1_2_enc_data)
|
||||||
TLSv1_2_enc_data)
|
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_TLS1_2_METHOD
|
#ifndef OPENSSL_NO_TLS1_2_METHOD
|
||||||
IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
|
IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
|
||||||
tlsv1_2_server_method,
|
tlsv1_2_server_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function, TLSv1_2_enc_data)
|
||||||
TLSv1_2_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_TLS1_1_METHOD
|
#ifndef OPENSSL_NO_TLS1_1_METHOD
|
||||||
IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
|
IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
|
||||||
tlsv1_1_server_method,
|
tlsv1_1_server_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function, TLSv1_1_enc_data)
|
||||||
TLSv1_1_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_TLS1_METHOD
|
#ifndef OPENSSL_NO_TLS1_METHOD
|
||||||
IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
|
IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
|
||||||
tlsv1_server_method,
|
tlsv1_server_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function, TLSv1_enc_data)
|
||||||
TLSv1_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SSL3_METHOD
|
#ifndef OPENSSL_NO_SSL3_METHOD
|
||||||
IMPLEMENT_ssl3_meth_func(sslv3_server_method,
|
IMPLEMENT_ssl3_meth_func(sslv3_server_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept, ssl_undefined_function)
|
||||||
ssl_undefined_function)
|
|
||||||
#endif
|
#endif
|
||||||
|
/*-
|
||||||
|
|
||||||
/*
|
|
||||||
* TLS/SSLv3 client methods
|
* TLS/SSLv3 client methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
|
IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
|
||||||
TLS_client_method,
|
TLS_client_method,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, TLSv1_2_enc_data)
|
||||||
TLSv1_2_enc_data)
|
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_TLS1_2_METHOD
|
#ifndef OPENSSL_NO_TLS1_2_METHOD
|
||||||
IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
|
IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
|
||||||
tlsv1_2_client_method,
|
tlsv1_2_client_method,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, TLSv1_2_enc_data)
|
||||||
TLSv1_2_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_TLS1_1_METHOD
|
#ifndef OPENSSL_NO_TLS1_1_METHOD
|
||||||
IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
|
IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
|
||||||
tlsv1_1_client_method,
|
tlsv1_1_client_method,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, TLSv1_1_enc_data)
|
||||||
TLSv1_1_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_TLS1_METHOD
|
#ifndef OPENSSL_NO_TLS1_METHOD
|
||||||
IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
|
IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
|
||||||
tlsv1_client_method,
|
tlsv1_client_method,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, TLSv1_enc_data)
|
||||||
TLSv1_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SSL3_METHOD
|
#ifndef OPENSSL_NO_SSL3_METHOD
|
||||||
IMPLEMENT_ssl3_meth_func(sslv3_client_method,
|
IMPLEMENT_ssl3_meth_func(sslv3_client_method,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function, ossl_statem_connect)
|
||||||
ossl_statem_connect)
|
|
||||||
#endif
|
#endif
|
||||||
|
/*-
|
||||||
|
|
||||||
/*
|
|
||||||
* DTLS methods
|
* DTLS methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DTLS1_METHOD
|
#ifndef OPENSSL_NO_DTLS1_METHOD
|
||||||
IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
||||||
dtlsv1_method,
|
dtlsv1_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, DTLSv1_enc_data)
|
||||||
DTLSv1_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DTLS1_2_METHOD
|
#ifndef OPENSSL_NO_DTLS1_2_METHOD
|
||||||
IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
|
IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
|
||||||
dtlsv1_2_method,
|
dtlsv1_2_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, DTLSv1_2_enc_data)
|
||||||
DTLSv1_2_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
|
IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
|
||||||
DTLS_method,
|
DTLS_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, DTLSv1_2_enc_data)
|
||||||
DTLSv1_2_enc_data)
|
|
||||||
|
|
||||||
/*
|
/*-
|
||||||
* DTLS server methods
|
* DTLS server methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DTLS1_METHOD
|
#ifndef OPENSSL_NO_DTLS1_METHOD
|
||||||
IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
||||||
dtlsv1_server_method,
|
dtlsv1_server_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function, DTLSv1_enc_data)
|
||||||
DTLSv1_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DTLS1_2_METHOD
|
#ifndef OPENSSL_NO_DTLS1_2_METHOD
|
||||||
IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
|
IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
|
||||||
dtlsv1_2_server_method,
|
dtlsv1_2_server_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function, DTLSv1_2_enc_data)
|
||||||
DTLSv1_2_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
|
IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
|
||||||
DTLS_server_method,
|
DTLS_server_method,
|
||||||
ossl_statem_accept,
|
ossl_statem_accept,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function, DTLSv1_2_enc_data)
|
||||||
DTLSv1_2_enc_data)
|
|
||||||
|
|
||||||
|
/*-
|
||||||
/*
|
|
||||||
* DTLS client methods
|
* DTLS client methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DTLS1_METHOD
|
#ifndef OPENSSL_NO_DTLS1_METHOD
|
||||||
IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
||||||
dtlsv1_client_method,
|
dtlsv1_client_method,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, DTLSv1_enc_data)
|
||||||
DTLSv1_enc_data)
|
|
||||||
IMPLEMENT_dtls1_meth_func(DTLS1_BAD_VER, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
IMPLEMENT_dtls1_meth_func(DTLS1_BAD_VER, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
||||||
dtls_bad_ver_client_method,
|
dtls_bad_ver_client_method,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, DTLSv1_enc_data)
|
||||||
DTLSv1_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DTLS1_2_METHOD
|
#ifndef OPENSSL_NO_DTLS1_2_METHOD
|
||||||
IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
|
IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
|
||||||
dtlsv1_2_client_method,
|
dtlsv1_2_client_method,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, DTLSv1_2_enc_data)
|
||||||
DTLSv1_2_enc_data)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
|
IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
|
||||||
DTLS_client_method,
|
DTLS_client_method,
|
||||||
ssl_undefined_function,
|
ssl_undefined_function,
|
||||||
ossl_statem_connect,
|
ossl_statem_connect, DTLSv1_2_enc_data)
|
||||||
DTLSv1_2_enc_data)
|
|
||||||
|
|
||||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||||
|
|
||||||
# ifndef OPENSSL_NO_TLS1_2_METHOD
|
# ifndef OPENSSL_NO_TLS1_2_METHOD
|
||||||
const SSL_METHOD *TLSv1_2_method(void)
|
const SSL_METHOD *TLSv1_2_method(void)
|
||||||
{
|
{
|
||||||
@ -317,4 +264,3 @@ const SSL_METHOD *DTLSv1_client_method(void)
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ static ossl_inline const unsigned char *PACKET_end(const PACKET *pkt)
|
|||||||
{
|
{
|
||||||
return pkt->curr + pkt->remaining;
|
return pkt->curr + pkt->remaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns a pointer to the PACKET's current position.
|
* Returns a pointer to the PACKET's current position.
|
||||||
* For use in non-PACKETized APIs.
|
* For use in non-PACKETized APIs.
|
||||||
@ -107,8 +108,7 @@ __owur static ossl_inline int PACKET_equal(const PACKET *pkt, const void *ptr,
|
|||||||
* the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
|
* the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
|
||||||
*/
|
*/
|
||||||
__owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt,
|
__owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt,
|
||||||
PACKET *subpkt,
|
PACKET *subpkt, size_t len)
|
||||||
size_t len)
|
|
||||||
{
|
{
|
||||||
if (PACKET_remaining(pkt) < len)
|
if (PACKET_remaining(pkt) < len)
|
||||||
return 0;
|
return 0;
|
||||||
@ -122,8 +122,7 @@ __owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt,
|
|||||||
* original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
|
* original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
|
||||||
*/
|
*/
|
||||||
__owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt,
|
__owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt,
|
||||||
PACKET *subpkt,
|
PACKET *subpkt, size_t len)
|
||||||
size_t len)
|
|
||||||
{
|
{
|
||||||
if (!PACKET_peek_sub_packet(pkt, subpkt, len))
|
if (!PACKET_peek_sub_packet(pkt, subpkt, len))
|
||||||
return 0;
|
return 0;
|
||||||
@ -151,8 +150,7 @@ __owur static ossl_inline int PACKET_peek_net_2(const PACKET *pkt,
|
|||||||
|
|
||||||
/* Equivalent of n2s */
|
/* Equivalent of n2s */
|
||||||
/* Get 2 bytes in network order from |pkt| and store the value in |*data| */
|
/* Get 2 bytes in network order from |pkt| and store the value in |*data| */
|
||||||
__owur static ossl_inline int PACKET_get_net_2(PACKET *pkt,
|
__owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data)
|
||||||
unsigned int *data)
|
|
||||||
{
|
{
|
||||||
if (!PACKET_peek_net_2(pkt, data))
|
if (!PACKET_peek_net_2(pkt, data))
|
||||||
return 0;
|
return 0;
|
||||||
@ -181,8 +179,7 @@ __owur static ossl_inline int PACKET_peek_net_3(const PACKET *pkt,
|
|||||||
|
|
||||||
/* Equivalent of n2l3 */
|
/* Equivalent of n2l3 */
|
||||||
/* Get 3 bytes in network order from |pkt| and store the value in |*data| */
|
/* Get 3 bytes in network order from |pkt| and store the value in |*data| */
|
||||||
__owur static ossl_inline int PACKET_get_net_3(PACKET *pkt,
|
__owur static ossl_inline int PACKET_get_net_3(PACKET *pkt, unsigned long *data)
|
||||||
unsigned long *data)
|
|
||||||
{
|
{
|
||||||
if (!PACKET_peek_net_3(pkt, data))
|
if (!PACKET_peek_net_3(pkt, data))
|
||||||
return 0;
|
return 0;
|
||||||
@ -212,8 +209,7 @@ __owur static ossl_inline int PACKET_peek_net_4(const PACKET *pkt,
|
|||||||
|
|
||||||
/* Equivalent of n2l */
|
/* Equivalent of n2l */
|
||||||
/* Get 4 bytes in network order from |pkt| and store the value in |*data| */
|
/* Get 4 bytes in network order from |pkt| and store the value in |*data| */
|
||||||
__owur static ossl_inline int PACKET_get_net_4(PACKET *pkt,
|
__owur static ossl_inline int PACKET_get_net_4(PACKET *pkt, unsigned long *data)
|
||||||
unsigned long *data)
|
|
||||||
{
|
{
|
||||||
if (!PACKET_peek_net_4(pkt, data))
|
if (!PACKET_peek_net_4(pkt, data))
|
||||||
return 0;
|
return 0;
|
||||||
@ -333,8 +329,7 @@ __owur static ossl_inline int PACKET_peek_copy_bytes(const PACKET *pkt,
|
|||||||
* The caller is responsible for ensuring that |data| can hold |len| bytes.
|
* The caller is responsible for ensuring that |data| can hold |len| bytes.
|
||||||
*/
|
*/
|
||||||
__owur static ossl_inline int PACKET_copy_bytes(PACKET *pkt,
|
__owur static ossl_inline int PACKET_copy_bytes(PACKET *pkt,
|
||||||
unsigned char *data,
|
unsigned char *data, size_t len)
|
||||||
size_t len)
|
|
||||||
{
|
{
|
||||||
if (!PACKET_peek_copy_bytes(pkt, data, len))
|
if (!PACKET_peek_copy_bytes(pkt, data, len))
|
||||||
return 0;
|
return 0;
|
||||||
@ -460,7 +455,8 @@ __owur static ossl_inline int PACKET_get_length_prefixed_1(PACKET *pkt,
|
|||||||
* Like PACKET_get_length_prefixed_1, but additionally, fails when there are
|
* Like PACKET_get_length_prefixed_1, but additionally, fails when there are
|
||||||
* leftover bytes in |pkt|.
|
* leftover bytes in |pkt|.
|
||||||
*/
|
*/
|
||||||
__owur static ossl_inline int PACKET_as_length_prefixed_1(PACKET *pkt, PACKET *subpkt)
|
__owur static ossl_inline int PACKET_as_length_prefixed_1(PACKET *pkt,
|
||||||
|
PACKET *subpkt)
|
||||||
{
|
{
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
const unsigned char *data;
|
const unsigned char *data;
|
||||||
|
@ -22,7 +22,6 @@ int DTLS_RECORD_LAYER_new(RECORD_LAYER *rl)
|
|||||||
if ((d = OPENSSL_malloc(sizeof(*d))) == NULL)
|
if ((d = OPENSSL_malloc(sizeof(*d))) == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
|
|
||||||
rl->d = d;
|
rl->d = d;
|
||||||
|
|
||||||
d->unprocessed_rcds.q = pqueue_new();
|
d->unprocessed_rcds.q = pqueue_new();
|
||||||
@ -97,18 +96,14 @@ void DTLS_RECORD_LAYER_set_saved_w_epoch(RECORD_LAYER *rl, unsigned short e)
|
|||||||
{
|
{
|
||||||
if (e == rl->d->w_epoch - 1) {
|
if (e == rl->d->w_epoch - 1) {
|
||||||
memcpy(rl->d->curr_write_sequence,
|
memcpy(rl->d->curr_write_sequence,
|
||||||
rl->write_sequence,
|
rl->write_sequence, sizeof(rl->write_sequence));
|
||||||
sizeof(rl->write_sequence));
|
|
||||||
memcpy(rl->write_sequence,
|
memcpy(rl->write_sequence,
|
||||||
rl->d->last_write_sequence,
|
rl->d->last_write_sequence, sizeof(rl->write_sequence));
|
||||||
sizeof(rl->write_sequence));
|
|
||||||
} else if (e == rl->d->w_epoch + 1) {
|
} else if (e == rl->d->w_epoch + 1) {
|
||||||
memcpy(rl->d->last_write_sequence,
|
memcpy(rl->d->last_write_sequence,
|
||||||
rl->write_sequence,
|
rl->write_sequence, sizeof(unsigned char[8]));
|
||||||
sizeof(unsigned char[8]));
|
|
||||||
memcpy(rl->write_sequence,
|
memcpy(rl->write_sequence,
|
||||||
rl->d->curr_write_sequence,
|
rl->d->curr_write_sequence, sizeof(rl->write_sequence));
|
||||||
sizeof(rl->write_sequence));
|
|
||||||
}
|
}
|
||||||
rl->d->w_epoch = e;
|
rl->d->w_epoch = e;
|
||||||
}
|
}
|
||||||
@ -118,7 +113,6 @@ void DTLS_RECORD_LAYER_resync_write(RECORD_LAYER *rl)
|
|||||||
memcpy(rl->write_sequence, rl->read_sequence, sizeof(rl->write_sequence));
|
memcpy(rl->write_sequence, rl->read_sequence, sizeof(rl->write_sequence));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DTLS_RECORD_LAYER_set_write_sequence(RECORD_LAYER *rl, unsigned char *seq)
|
void DTLS_RECORD_LAYER_set_write_sequence(RECORD_LAYER *rl, unsigned char *seq)
|
||||||
{
|
{
|
||||||
memcpy(rl->write_sequence, seq, SEQ_NUM_SIZE);
|
memcpy(rl->write_sequence, seq, SEQ_NUM_SIZE);
|
||||||
@ -232,7 +226,6 @@ int dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue)
|
|||||||
dtls1_retrieve_buffered_record((s), \
|
dtls1_retrieve_buffered_record((s), \
|
||||||
&((s)->rlayer.d->unprocessed_rcds))
|
&((s)->rlayer.d->unprocessed_rcds))
|
||||||
|
|
||||||
|
|
||||||
int dtls1_process_buffered_records(SSL *s)
|
int dtls1_process_buffered_records(SSL *s)
|
||||||
{
|
{
|
||||||
pitem *item;
|
pitem *item;
|
||||||
@ -249,7 +242,8 @@ int dtls1_process_buffered_records(SSL *s)
|
|||||||
if (!dtls1_process_record(s))
|
if (!dtls1_process_record(s))
|
||||||
return (0);
|
return (0);
|
||||||
if (dtls1_buffer_record(s, &(s->rlayer.d->processed_rcds),
|
if (dtls1_buffer_record(s, &(s->rlayer.d->processed_rcds),
|
||||||
SSL3_RECORD_get_seq_num(s->rlayer.rrec)) < 0)
|
SSL3_RECORD_get_seq_num(s->rlayer.rrec)) <
|
||||||
|
0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,7 +258,6 @@ int dtls1_process_buffered_records(SSL *s)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Return up to 'len' payload bytes received in 'type' records.
|
* Return up to 'len' payload bytes received in 'type' records.
|
||||||
* 'type' is one of the following:
|
* 'type' is one of the following:
|
||||||
@ -570,7 +563,7 @@ int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
|
|||||||
* dest_maxlen is 7 if we were to handle this
|
* dest_maxlen is 7 if we were to handle this
|
||||||
* non-existing alert...
|
* non-existing alert...
|
||||||
*/
|
*/
|
||||||
FIX ME
|
FIX ME;
|
||||||
#endif
|
#endif
|
||||||
s->rlayer.rstate = SSL_ST_READ_HEADER;
|
s->rlayer.rstate = SSL_ST_READ_HEADER;
|
||||||
SSL3_RECORD_set_length(rr, 0);
|
SSL3_RECORD_set_length(rr, 0);
|
||||||
@ -628,8 +621,7 @@ int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
|
|||||||
if (i < 0)
|
if (i < 0)
|
||||||
return (i);
|
return (i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
SSLerr(SSL_F_DTLS1_READ_BYTES,
|
SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE);
|
||||||
SSL_R_SSL_HANDSHAKE_FAILURE);
|
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,8 +726,7 @@ int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
|
|||||||
|
|
||||||
s->rwstate = SSL_NOTHING;
|
s->rwstate = SSL_NOTHING;
|
||||||
s->s3->fatal_alert = alert_descr;
|
s->s3->fatal_alert = alert_descr;
|
||||||
SSLerr(SSL_F_DTLS1_READ_BYTES,
|
SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr);
|
||||||
SSL_AD_REASON_OFFSET + alert_descr);
|
|
||||||
BIO_snprintf(tmp, sizeof tmp, "%d", alert_descr);
|
BIO_snprintf(tmp, sizeof tmp, "%d", alert_descr);
|
||||||
ERR_add_error_data(2, "SSL alert number ", tmp);
|
ERR_add_error_data(2, "SSL alert number ", tmp);
|
||||||
s->shutdown |= SSL_RECEIVED_SHUTDOWN;
|
s->shutdown |= SSL_RECEIVED_SHUTDOWN;
|
||||||
@ -874,7 +865,6 @@ int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this only happens when a client hello is received and a handshake
|
* this only happens when a client hello is received and a handshake
|
||||||
* is started.
|
* is started.
|
||||||
@ -1040,7 +1030,8 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf,
|
|||||||
|
|
||||||
if (mac_size != 0) {
|
if (mac_size != 0) {
|
||||||
if (s->method->ssl3_enc->mac(s, &wr,
|
if (s->method->ssl3_enc->mac(s, &wr,
|
||||||
&(p[SSL3_RECORD_get_length(&wr) + eivlen]), 1) < 0)
|
&(p[SSL3_RECORD_get_length(&wr) + eivlen]),
|
||||||
|
1) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
SSL3_RECORD_add_length(&wr, mac_size);
|
SSL3_RECORD_add_length(&wr, mac_size);
|
||||||
}
|
}
|
||||||
@ -1144,8 +1135,7 @@ void dtls1_reset_seq_numbers(SSL *s, int rw)
|
|||||||
s->rlayer.d->r_epoch++;
|
s->rlayer.d->r_epoch++;
|
||||||
memcpy(&s->rlayer.d->bitmap, &s->rlayer.d->next_bitmap,
|
memcpy(&s->rlayer.d->bitmap, &s->rlayer.d->next_bitmap,
|
||||||
sizeof(s->rlayer.d->bitmap));
|
sizeof(s->rlayer.d->bitmap));
|
||||||
memset(&s->rlayer.d->next_bitmap, 0,
|
memset(&s->rlayer.d->next_bitmap, 0, sizeof(s->rlayer.d->next_bitmap));
|
||||||
sizeof(s->rlayer.d->next_bitmap));
|
|
||||||
} else {
|
} else {
|
||||||
seq = s->rlayer.write_sequence;
|
seq = s->rlayer.write_sequence;
|
||||||
memcpy(s->rlayer.d->last_write_sequence, seq,
|
memcpy(s->rlayer.d->last_write_sequence, seq,
|
||||||
|
@ -43,7 +43,8 @@ void RECORD_LAYER_clear(RECORD_LAYER *rl)
|
|||||||
|
|
||||||
rl->rstate = SSL_ST_READ_HEADER;
|
rl->rstate = SSL_ST_READ_HEADER;
|
||||||
|
|
||||||
/* Do I need to clear read_ahead? As far as I can tell read_ahead did not
|
/*
|
||||||
|
* Do I need to clear read_ahead? As far as I can tell read_ahead did not
|
||||||
* previously get reset by SSL_clear...so I'll keep it that way..but is
|
* previously get reset by SSL_clear...so I'll keep it that way..but is
|
||||||
* that right?
|
* that right?
|
||||||
*/
|
*/
|
||||||
@ -327,7 +328,6 @@ int ssl3_read_n(SSL *s, int n, int max, int extend, int clearold)
|
|||||||
return (n);
|
return (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call this to write data in records of type 'type' It will return <= 0 if
|
* Call this to write data in records of type 'type' It will return <= 0 if
|
||||||
* not all data has been sent or non-blocking IO.
|
* not all data has been sent or non-blocking IO.
|
||||||
@ -365,7 +365,6 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
s->rlayer.wnum = 0;
|
s->rlayer.wnum = 0;
|
||||||
|
|
||||||
if (SSL_in_init(s) && !ossl_statem_get_in_handshake(s)) {
|
if (SSL_in_init(s) && !ossl_statem_get_in_handshake(s)) {
|
||||||
@ -658,8 +657,7 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
|||||||
sess = s->session;
|
sess = s->session;
|
||||||
|
|
||||||
if ((sess == NULL) ||
|
if ((sess == NULL) ||
|
||||||
(s->enc_write_ctx == NULL) ||
|
(s->enc_write_ctx == NULL) || (EVP_MD_CTX_md(s->write_hash) == NULL)) {
|
||||||
(EVP_MD_CTX_md(s->write_hash) == NULL)) {
|
|
||||||
clear = s->enc_write_ctx ? 0 : 1; /* must be AEAD cipher */
|
clear = s->enc_write_ctx ? 0 : 1; /* must be AEAD cipher */
|
||||||
mac_size = 0;
|
mac_size = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -691,8 +689,7 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (prefix_len >
|
if (prefix_len >
|
||||||
(SSL3_RT_HEADER_LENGTH + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD))
|
(SSL3_RT_HEADER_LENGTH + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD)) {
|
||||||
{
|
|
||||||
/* insufficient space */
|
/* insufficient space */
|
||||||
SSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR);
|
||||||
goto err;
|
goto err;
|
||||||
@ -749,7 +746,6 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
|||||||
} else
|
} else
|
||||||
eivlen = 0;
|
eivlen = 0;
|
||||||
|
|
||||||
|
|
||||||
totlen = 0;
|
totlen = 0;
|
||||||
/* Clear our SSL3_RECORD structures */
|
/* Clear our SSL3_RECORD structures */
|
||||||
memset(wr, 0, sizeof wr);
|
memset(wr, 0, sizeof wr);
|
||||||
@ -802,12 +798,12 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
|||||||
|
|
||||||
if (!SSL_USE_ETM(s) && mac_size != 0) {
|
if (!SSL_USE_ETM(s) && mac_size != 0) {
|
||||||
if (s->method->ssl3_enc->mac(s, &wr[j],
|
if (s->method->ssl3_enc->mac(s, &wr[j],
|
||||||
&(outbuf[j][wr[j].length + eivlen]), 1) < 0)
|
&(outbuf[j][wr[j].length + eivlen]),
|
||||||
|
1) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
SSL3_RECORD_add_length(&wr[j], mac_size);
|
SSL3_RECORD_add_length(&wr[j], mac_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SSL3_RECORD_set_data(&wr[j], outbuf[j]);
|
SSL3_RECORD_set_data(&wr[j], outbuf[j]);
|
||||||
SSL3_RECORD_reset_input(&wr[j]);
|
SSL3_RECORD_reset_input(&wr[j]);
|
||||||
|
|
||||||
@ -841,7 +837,8 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
|||||||
* we should now have wr->data pointing to the encrypted data, which is
|
* we should now have wr->data pointing to the encrypted data, which is
|
||||||
* wr->length long
|
* wr->length long
|
||||||
*/
|
*/
|
||||||
SSL3_RECORD_set_type(&wr[j], type); /* not needed but helps for debugging */
|
SSL3_RECORD_set_type(&wr[j], type); /* not needed but helps for
|
||||||
|
* debugging */
|
||||||
SSL3_RECORD_add_length(&wr[j], SSL3_RT_HEADER_LENGTH);
|
SSL3_RECORD_add_length(&wr[j], SSL3_RT_HEADER_LENGTH);
|
||||||
|
|
||||||
if (create_empty_fragment) {
|
if (create_empty_fragment) {
|
||||||
@ -862,8 +859,6 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
|||||||
prefix_len + SSL3_RECORD_get_length(&wr[j]));
|
prefix_len + SSL3_RECORD_get_length(&wr[j]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* memorize arguments so that ssl3_write_pending can detect bad write
|
* memorize arguments so that ssl3_write_pending can detect bad write
|
||||||
* retries later
|
* retries later
|
||||||
@ -906,9 +901,9 @@ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
|
|||||||
clear_sys_error();
|
clear_sys_error();
|
||||||
if (s->wbio != NULL) {
|
if (s->wbio != NULL) {
|
||||||
s->rwstate = SSL_WRITING;
|
s->rwstate = SSL_WRITING;
|
||||||
i = BIO_write(s->wbio,
|
i = BIO_write(s->wbio, (char *)
|
||||||
(char *)&(SSL3_BUFFER_get_buf(&wb[currbuf])[
|
&(SSL3_BUFFER_get_buf(&wb[currbuf])
|
||||||
SSL3_BUFFER_get_offset(&wb[currbuf])]),
|
[SSL3_BUFFER_get_offset(&wb[currbuf])]),
|
||||||
(unsigned int)SSL3_BUFFER_get_left(&wb[currbuf]));
|
(unsigned int)SSL3_BUFFER_get_left(&wb[currbuf]));
|
||||||
} else {
|
} else {
|
||||||
SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET);
|
SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET);
|
||||||
@ -1273,8 +1268,7 @@ int ssl3_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
|
|||||||
if (i < 0)
|
if (i < 0)
|
||||||
return (i);
|
return (i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
SSLerr(SSL_F_SSL3_READ_BYTES,
|
SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE);
|
||||||
SSL_R_SSL_HANDSHAKE_FAILURE);
|
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,46 +33,36 @@ typedef struct ssl3_record_st {
|
|||||||
/* Record layer version */
|
/* Record layer version */
|
||||||
/* r */
|
/* r */
|
||||||
int rec_version;
|
int rec_version;
|
||||||
|
|
||||||
/* type of record */
|
/* type of record */
|
||||||
/* r */
|
/* r */
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
/* How many bytes available */
|
/* How many bytes available */
|
||||||
/* rw */
|
/* rw */
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* How many bytes were available before padding was removed? This is used
|
* How many bytes were available before padding was removed? This is used
|
||||||
* to implement the MAC check in constant time for CBC records.
|
* to implement the MAC check in constant time for CBC records.
|
||||||
*/
|
*/
|
||||||
/* rw */
|
/* rw */
|
||||||
unsigned int orig_len;
|
unsigned int orig_len;
|
||||||
|
|
||||||
/* read/write offset into 'buf' */
|
/* read/write offset into 'buf' */
|
||||||
/* r */
|
/* r */
|
||||||
unsigned int off;
|
unsigned int off;
|
||||||
|
|
||||||
/* pointer to the record data */
|
/* pointer to the record data */
|
||||||
/* rw */
|
/* rw */
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
/* where the decode bytes are */
|
/* where the decode bytes are */
|
||||||
/* rw */
|
/* rw */
|
||||||
unsigned char *input;
|
unsigned char *input;
|
||||||
|
|
||||||
/* only used with decompression - malloc()ed */
|
/* only used with decompression - malloc()ed */
|
||||||
/* r */
|
/* r */
|
||||||
unsigned char *comp;
|
unsigned char *comp;
|
||||||
|
|
||||||
/* Whether the data from this record has already been read or not */
|
/* Whether the data from this record has already been read or not */
|
||||||
/* r */
|
/* r */
|
||||||
unsigned int read;
|
unsigned int read;
|
||||||
|
|
||||||
/* epoch number, needed by DTLS1 */
|
/* epoch number, needed by DTLS1 */
|
||||||
/* r */
|
/* r */
|
||||||
unsigned long epoch;
|
unsigned long epoch;
|
||||||
|
|
||||||
/* sequence number, needed by DTLS1 */
|
/* sequence number, needed by DTLS1 */
|
||||||
/* r */
|
/* r */
|
||||||
unsigned char seq_num[SEQ_NUM_SIZE];
|
unsigned char seq_num[SEQ_NUM_SIZE];
|
||||||
@ -81,7 +71,6 @@ typedef struct ssl3_record_st {
|
|||||||
typedef struct dtls1_bitmap_st {
|
typedef struct dtls1_bitmap_st {
|
||||||
/* Track 32 packets on 32-bit systems and 64 - on 64-bit systems */
|
/* Track 32 packets on 32-bit systems and 64 - on 64-bit systems */
|
||||||
unsigned long map;
|
unsigned long map;
|
||||||
|
|
||||||
/* Max record number seen so far, 64-bit value in big-endian encoding */
|
/* Max record number seen so far, 64-bit value in big-endian encoding */
|
||||||
unsigned char max_seq_num[SEQ_NUM_SIZE];
|
unsigned char max_seq_num[SEQ_NUM_SIZE];
|
||||||
} DTLS1_BITMAP;
|
} DTLS1_BITMAP;
|
||||||
@ -101,7 +90,6 @@ typedef struct dtls1_record_data_st {
|
|||||||
#endif
|
#endif
|
||||||
} DTLS1_RECORD_DATA;
|
} DTLS1_RECORD_DATA;
|
||||||
|
|
||||||
|
|
||||||
typedef struct dtls_record_layer_st {
|
typedef struct dtls_record_layer_st {
|
||||||
/*
|
/*
|
||||||
* The current data and handshake epoch. This is initially
|
* The current data and handshake epoch. This is initially
|
||||||
@ -110,12 +98,10 @@ typedef struct dtls_record_layer_st {
|
|||||||
*/
|
*/
|
||||||
unsigned short r_epoch;
|
unsigned short r_epoch;
|
||||||
unsigned short w_epoch;
|
unsigned short w_epoch;
|
||||||
|
|
||||||
/* records being received in the current epoch */
|
/* records being received in the current epoch */
|
||||||
DTLS1_BITMAP bitmap;
|
DTLS1_BITMAP bitmap;
|
||||||
/* renegotiation starts a new set of sequence numbers */
|
/* renegotiation starts a new set of sequence numbers */
|
||||||
DTLS1_BITMAP next_bitmap;
|
DTLS1_BITMAP next_bitmap;
|
||||||
|
|
||||||
/* Received handshake records (processed and unprocessed) */
|
/* Received handshake records (processed and unprocessed) */
|
||||||
record_pqueue unprocessed_rcds;
|
record_pqueue unprocessed_rcds;
|
||||||
record_pqueue processed_rcds;
|
record_pqueue processed_rcds;
|
||||||
@ -133,7 +119,6 @@ typedef struct dtls_record_layer_st {
|
|||||||
unsigned int alert_fragment_len;
|
unsigned int alert_fragment_len;
|
||||||
unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];
|
unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];
|
||||||
unsigned int handshake_fragment_len;
|
unsigned int handshake_fragment_len;
|
||||||
|
|
||||||
/* save last and current sequence numbers for retransmissions */
|
/* save last and current sequence numbers for retransmissions */
|
||||||
unsigned char last_write_sequence[8];
|
unsigned char last_write_sequence[8];
|
||||||
unsigned char curr_write_sequence[8];
|
unsigned char curr_write_sequence[8];
|
||||||
@ -157,7 +142,6 @@ typedef struct record_layer_st {
|
|||||||
int read_ahead;
|
int read_ahead;
|
||||||
/* where we are when reading */
|
/* where we are when reading */
|
||||||
int rstate;
|
int rstate;
|
||||||
|
|
||||||
/* How many pipelines can be used to read data */
|
/* How many pipelines can be used to read data */
|
||||||
unsigned int numrpipes;
|
unsigned int numrpipes;
|
||||||
/* How many pipelines can be used to write data */
|
/* How many pipelines can be used to write data */
|
||||||
@ -168,14 +152,11 @@ typedef struct record_layer_st {
|
|||||||
SSL3_BUFFER wbuf[SSL_MAX_PIPELINES];
|
SSL3_BUFFER wbuf[SSL_MAX_PIPELINES];
|
||||||
/* each decoded record goes in here */
|
/* each decoded record goes in here */
|
||||||
SSL3_RECORD rrec[SSL_MAX_PIPELINES];
|
SSL3_RECORD rrec[SSL_MAX_PIPELINES];
|
||||||
|
|
||||||
/* used internally to point at a raw packet */
|
/* used internally to point at a raw packet */
|
||||||
unsigned char *packet;
|
unsigned char *packet;
|
||||||
unsigned int packet_length;
|
unsigned int packet_length;
|
||||||
|
|
||||||
/* number of bytes sent so far */
|
/* number of bytes sent so far */
|
||||||
unsigned int wnum;
|
unsigned int wnum;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* storage for Alert/Handshake protocol data received but not yet
|
* storage for Alert/Handshake protocol data received but not yet
|
||||||
* processed by ssl3_read_bytes:
|
* processed by ssl3_read_bytes:
|
||||||
@ -184,10 +165,8 @@ typedef struct record_layer_st {
|
|||||||
unsigned int alert_fragment_len;
|
unsigned int alert_fragment_len;
|
||||||
unsigned char handshake_fragment[4];
|
unsigned char handshake_fragment[4];
|
||||||
unsigned int handshake_fragment_len;
|
unsigned int handshake_fragment_len;
|
||||||
|
|
||||||
/* The number of consecutive empty records we have received */
|
/* The number of consecutive empty records we have received */
|
||||||
unsigned int empty_record_count;
|
unsigned int empty_record_count;
|
||||||
|
|
||||||
/* partial write - check the numbers match */
|
/* partial write - check the numbers match */
|
||||||
/* number bytes written */
|
/* number bytes written */
|
||||||
int wpend_tot;
|
int wpend_tot;
|
||||||
@ -195,17 +174,13 @@ typedef struct record_layer_st {
|
|||||||
/* number of bytes submitted */
|
/* number of bytes submitted */
|
||||||
int wpend_ret;
|
int wpend_ret;
|
||||||
const unsigned char *wpend_buf;
|
const unsigned char *wpend_buf;
|
||||||
|
|
||||||
unsigned char read_sequence[SEQ_NUM_SIZE];
|
unsigned char read_sequence[SEQ_NUM_SIZE];
|
||||||
unsigned char write_sequence[SEQ_NUM_SIZE];
|
unsigned char write_sequence[SEQ_NUM_SIZE];
|
||||||
|
|
||||||
/* Set to true if this is the first record in a connection */
|
/* Set to true if this is the first record in a connection */
|
||||||
unsigned int is_first_record;
|
unsigned int is_first_record;
|
||||||
|
|
||||||
DTLS_RECORD_LAYER *d;
|
DTLS_RECORD_LAYER *d;
|
||||||
} RECORD_LAYER;
|
} RECORD_LAYER;
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* *
|
* *
|
||||||
* The following macros/functions represent the libssl internal API to the *
|
* The following macros/functions represent the libssl internal API to the *
|
||||||
@ -263,4 +238,3 @@ __owur int dtls1_write_bytes(SSL *s, int type, const void *buf, int len);
|
|||||||
__owur int do_dtls1_write(SSL *s, int type, const unsigned char *buf,
|
__owur int do_dtls1_write(SSL *s, int type, const unsigned char *buf,
|
||||||
unsigned int len, int create_empty_fragement);
|
unsigned int len, int create_empty_fragement);
|
||||||
void dtls1_reset_seq_numbers(SSL *s, int rw);
|
void dtls1_reset_seq_numbers(SSL *s, int rw);
|
||||||
|
|
||||||
|
@ -43,8 +43,7 @@ DTLS1_BITMAP *dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr,
|
|||||||
unsigned int *is_next_epoch);
|
unsigned int *is_next_epoch);
|
||||||
int dtls1_process_buffered_records(SSL *s);
|
int dtls1_process_buffered_records(SSL *s);
|
||||||
int dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue);
|
int dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue);
|
||||||
int dtls1_buffer_record(SSL *s, record_pqueue *q,
|
int dtls1_buffer_record(SSL *s, record_pqueue *q, unsigned char *priority);
|
||||||
unsigned char *priority);
|
|
||||||
void ssl3_record_sequence_update(unsigned char *seq);
|
void ssl3_record_sequence_update(unsigned char *seq);
|
||||||
|
|
||||||
/* Functions provided by the DTLS1_BITMAP component */
|
/* Functions provided by the DTLS1_BITMAP component */
|
||||||
@ -52,7 +51,6 @@ void ssl3_record_sequence_update(unsigned char *seq);
|
|||||||
int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap);
|
int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap);
|
||||||
void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap);
|
void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap);
|
||||||
|
|
||||||
|
|
||||||
/* Macros/functions provided by the SSL3_BUFFER component */
|
/* Macros/functions provided by the SSL3_BUFFER component */
|
||||||
|
|
||||||
#define SSL3_BUFFER_get_buf(b) ((b)->buf)
|
#define SSL3_BUFFER_get_buf(b) ((b)->buf)
|
||||||
|
@ -61,7 +61,6 @@ void SSL3_RECORD_set_seq_num(SSL3_RECORD *r, const unsigned char *seq_num)
|
|||||||
memcpy(r->seq_num, seq_num, SEQ_NUM_SIZE);
|
memcpy(r->seq_num, seq_num, SEQ_NUM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Peeks ahead into "read_ahead" data to see if we have a whole record waiting
|
* Peeks ahead into "read_ahead" data to see if we have a whole record waiting
|
||||||
* for us in the buffer.
|
* for us in the buffer.
|
||||||
@ -151,7 +150,8 @@ int ssl3_get_record(SSL *s)
|
|||||||
(RECORD_LAYER_get_packet_length(&s->rlayer)
|
(RECORD_LAYER_get_packet_length(&s->rlayer)
|
||||||
< SSL3_RT_HEADER_LENGTH)) {
|
< SSL3_RT_HEADER_LENGTH)) {
|
||||||
n = ssl3_read_n(s, SSL3_RT_HEADER_LENGTH,
|
n = ssl3_read_n(s, SSL3_RT_HEADER_LENGTH,
|
||||||
SSL3_BUFFER_get_len(rbuf), 0, num_recs == 0 ? 1 : 0);
|
SSL3_BUFFER_get_len(rbuf), 0,
|
||||||
|
num_recs == 0 ? 1 : 0);
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
return (n); /* error or non-blocking */
|
return (n); /* error or non-blocking */
|
||||||
RECORD_LAYER_set_rstate(&s->rlayer, SSL_ST_READ_BODY);
|
RECORD_LAYER_set_rstate(&s->rlayer, SSL_ST_READ_BODY);
|
||||||
@ -342,7 +342,6 @@ int ssl3_get_record(SSL *s)
|
|||||||
& EVP_CIPH_FLAG_PIPELINE)
|
& EVP_CIPH_FLAG_PIPELINE)
|
||||||
&& ssl3_record_app_data_waiting(s));
|
&& ssl3_record_app_data_waiting(s));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If in encrypt-then-mac mode calculate mac from encrypted record. All
|
* If in encrypt-then-mac mode calculate mac from encrypted record. All
|
||||||
* the details below are public so no timing details can leak.
|
* the details below are public so no timing details can leak.
|
||||||
@ -527,8 +526,7 @@ int ssl3_do_uncompress(SSL *ssl, SSL3_RECORD *rr)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
i = COMP_expand_block(ssl->expand, rr->comp,
|
i = COMP_expand_block(ssl->expand, rr->comp,
|
||||||
SSL3_RT_MAX_PLAIN_LENGTH, rr->data,
|
SSL3_RT_MAX_PLAIN_LENGTH, rr->data, (int)rr->length);
|
||||||
(int)rr->length);
|
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
@ -977,8 +975,7 @@ int tls1_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int send)
|
|||||||
mac_ctx = hash;
|
mac_ctx = hash;
|
||||||
} else {
|
} else {
|
||||||
hmac = EVP_MD_CTX_new();
|
hmac = EVP_MD_CTX_new();
|
||||||
if (hmac == NULL
|
if (hmac == NULL || !EVP_MD_CTX_copy(hmac, hash))
|
||||||
|| !EVP_MD_CTX_copy(hmac, hash))
|
|
||||||
return -1;
|
return -1;
|
||||||
mac_ctx = hmac;
|
mac_ctx = hmac;
|
||||||
}
|
}
|
||||||
@ -1138,7 +1135,8 @@ int tls1_cbc_remove_padding(const SSL *s,
|
|||||||
|
|
||||||
padding_length = rec->data[rec->length - 1];
|
padding_length = rec->data[rec->length - 1];
|
||||||
|
|
||||||
if (EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(s->enc_read_ctx)) & EVP_CIPH_FLAG_AEAD_CIPHER) {
|
if (EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(s->enc_read_ctx)) &
|
||||||
|
EVP_CIPH_FLAG_AEAD_CIPHER) {
|
||||||
/* padding is already verified */
|
/* padding is already verified */
|
||||||
rec->length -= padding_length + 1;
|
rec->length -= padding_length + 1;
|
||||||
return 1;
|
return 1;
|
||||||
@ -1439,7 +1437,6 @@ int dtls1_process_record(SSL *s)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* retrieve a buffered record that belongs to the current epoch, ie,
|
* retrieve a buffered record that belongs to the current epoch, ie,
|
||||||
* processed
|
* processed
|
||||||
@ -1493,7 +1490,8 @@ int dtls1_get_record(SSL *s)
|
|||||||
return (n); /* error or non-blocking */
|
return (n); /* error or non-blocking */
|
||||||
|
|
||||||
/* this packet contained a partial record, dump it */
|
/* this packet contained a partial record, dump it */
|
||||||
if (RECORD_LAYER_get_packet_length(&s->rlayer) != DTLS1_RT_HEADER_LENGTH) {
|
if (RECORD_LAYER_get_packet_length(&s->rlayer) !=
|
||||||
|
DTLS1_RT_HEADER_LENGTH) {
|
||||||
RECORD_LAYER_reset_packet_length(&s->rlayer);
|
RECORD_LAYER_reset_packet_length(&s->rlayer);
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
*/
|
*/
|
||||||
#define MAX_HASH_BLOCK_SIZE 128
|
#define MAX_HASH_BLOCK_SIZE 128
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* u32toLE serialises an unsigned, 32-bit number (n) as four bytes at (p) in
|
* u32toLE serialises an unsigned, 32-bit number (n) as four bytes at (p) in
|
||||||
* little-endian order. The value of p is advanced by four.
|
* little-endian order. The value of p is advanced by four.
|
||||||
|
10
ssl/s3_enc.c
10
ssl/s3_enc.c
@ -374,7 +374,8 @@ int ssl3_digest_cached_records(SSL *s, int keep)
|
|||||||
if (s->s3->handshake_dgst == NULL) {
|
if (s->s3->handshake_dgst == NULL) {
|
||||||
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
|
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
|
||||||
if (hdatalen <= 0) {
|
if (hdatalen <= 0) {
|
||||||
SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS, SSL_R_BAD_HANDSHAKE_LENGTH);
|
SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS,
|
||||||
|
SSL_R_BAD_HANDSHAKE_LENGTH);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,10 +386,8 @@ int ssl3_digest_cached_records(SSL *s, int keep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
md = ssl_handshake_md(s);
|
md = ssl_handshake_md(s);
|
||||||
if ( md == NULL
|
if (md == NULL || !EVP_DigestInit_ex(s->s3->handshake_dgst, md, NULL)
|
||||||
|| !EVP_DigestInit_ex(s->s3->handshake_dgst, md, NULL)
|
|| !EVP_DigestUpdate(s->s3->handshake_dgst, hdata, hdatalen)) {
|
||||||
|| !EVP_DigestUpdate(s->s3->handshake_dgst, hdata, hdatalen))
|
|
||||||
{
|
|
||||||
SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS, ERR_R_INTERNAL_ERROR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -480,7 +479,6 @@ int ssl3_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
|
|||||||
|| EVP_DigestUpdate(ctx, &(s->s3->server_random[0]),
|
|| EVP_DigestUpdate(ctx, &(s->s3->server_random[0]),
|
||||||
SSL3_RANDOM_SIZE) <= 0
|
SSL3_RANDOM_SIZE) <= 0
|
||||||
|| EVP_DigestFinal_ex(ctx, buf, &n) <= 0
|
|| EVP_DigestFinal_ex(ctx, buf, &n) <= 0
|
||||||
|
|
||||||
|| EVP_DigestInit_ex(ctx, s->ctx->md5, NULL) <= 0
|
|| EVP_DigestInit_ex(ctx, s->ctx->md5, NULL) <= 0
|
||||||
|| EVP_DigestUpdate(ctx, p, len) <= 0
|
|| EVP_DigestUpdate(ctx, p, len) <= 0
|
||||||
|| EVP_DigestUpdate(ctx, buf, n) <= 0
|
|| EVP_DigestUpdate(ctx, buf, n) <= 0
|
||||||
|
66
ssl/s3_lib.c
66
ssl/s3_lib.c
@ -66,8 +66,7 @@
|
|||||||
* Cipher families: Chacha/poly, Camellila, Gost, IDEA, SEED
|
* Cipher families: Chacha/poly, Camellila, Gost, IDEA, SEED
|
||||||
* Weak ciphers
|
* Weak ciphers
|
||||||
*/
|
*/
|
||||||
static SSL_CIPHER ssl3_ciphers[] =
|
static SSL_CIPHER ssl3_ciphers[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
SSL3_TXT_RSA_NULL_MD5,
|
SSL3_TXT_RSA_NULL_MD5,
|
||||||
@ -1964,7 +1963,8 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
256,
|
256,
|
||||||
},
|
},
|
||||||
# endif /* OPENSSL_NO_PSK */
|
# endif /* OPENSSL_NO_PSK */
|
||||||
#endif /* !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) */
|
#endif /* !defined(OPENSSL_NO_CHACHA) &&
|
||||||
|
* !defined(OPENSSL_NO_POLY1305) */
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_CAMELLIA
|
#ifndef OPENSSL_NO_CAMELLIA
|
||||||
{
|
{
|
||||||
@ -2222,7 +2222,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
|
SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
|
||||||
128,
|
128,
|
||||||
128
|
128,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2237,7 +2237,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
||||||
256,
|
256,
|
||||||
256
|
256,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2252,7 +2252,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
|
SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
|
||||||
128,
|
128,
|
||||||
128
|
128,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2267,7 +2267,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
||||||
256,
|
256,
|
||||||
256
|
256,
|
||||||
},
|
},
|
||||||
# endif /* OPENSSL_NO_EC */
|
# endif /* OPENSSL_NO_EC */
|
||||||
|
|
||||||
@ -2285,7 +2285,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
|
SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
|
||||||
128,
|
128,
|
||||||
128
|
128,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2300,7 +2300,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
||||||
256,
|
256,
|
||||||
256
|
256,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2315,7 +2315,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
|
SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
|
||||||
128,
|
128,
|
||||||
128
|
128,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2330,7 +2330,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
||||||
256,
|
256,
|
||||||
256
|
256,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2345,7 +2345,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
|
SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
|
||||||
128,
|
128,
|
||||||
128
|
128,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2360,7 +2360,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
||||||
256,
|
256,
|
||||||
256
|
256,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2375,7 +2375,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
|
SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
|
||||||
128,
|
128,
|
||||||
128
|
128,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2390,7 +2390,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_NOT_DEFAULT | SSL_HIGH,
|
SSL_NOT_DEFAULT | SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
|
||||||
256,
|
256,
|
||||||
256
|
256,
|
||||||
},
|
},
|
||||||
# endif /* OPENSSL_NO_PSK */
|
# endif /* OPENSSL_NO_PSK */
|
||||||
|
|
||||||
@ -2410,7 +2410,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_HIGH,
|
SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_GOST94 | TLS1_PRF_GOST94 | TLS1_STREAM_MAC,
|
SSL_HANDSHAKE_MAC_GOST94 | TLS1_PRF_GOST94 | TLS1_STREAM_MAC,
|
||||||
256,
|
256,
|
||||||
256
|
256,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2425,7 +2425,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_STRONG_NONE,
|
SSL_STRONG_NONE,
|
||||||
SSL_HANDSHAKE_MAC_GOST94 | TLS1_PRF_GOST94,
|
SSL_HANDSHAKE_MAC_GOST94 | TLS1_PRF_GOST94,
|
||||||
0,
|
0,
|
||||||
0
|
0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2440,7 +2440,7 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_HIGH,
|
SSL_HIGH,
|
||||||
SSL_HANDSHAKE_MAC_GOST12_256 | TLS1_PRF_GOST12_256 | TLS1_STREAM_MAC,
|
SSL_HANDSHAKE_MAC_GOST12_256 | TLS1_PRF_GOST12_256 | TLS1_STREAM_MAC,
|
||||||
256,
|
256,
|
||||||
256
|
256,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
@ -2455,7 +2455,8 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
SSL_STRONG_NONE,
|
SSL_STRONG_NONE,
|
||||||
SSL_HANDSHAKE_MAC_GOST12_256 | TLS1_PRF_GOST12_256 | TLS1_STREAM_MAC,
|
SSL_HANDSHAKE_MAC_GOST12_256 | TLS1_PRF_GOST12_256 | TLS1_STREAM_MAC,
|
||||||
0,
|
0,
|
||||||
0},
|
0,
|
||||||
|
},
|
||||||
#endif /* OPENSSL_NO_GOST */
|
#endif /* OPENSSL_NO_GOST */
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_IDEA
|
#ifndef OPENSSL_NO_IDEA
|
||||||
@ -2701,7 +2702,6 @@ static SSL_CIPHER ssl3_ciphers[] =
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int cipher_compare(const void *a, const void *b)
|
static int cipher_compare(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const SSL_CIPHER *ap = (const SSL_CIPHER *)a;
|
const SSL_CIPHER *ap = (const SSL_CIPHER *)a;
|
||||||
@ -2716,7 +2716,6 @@ void ssl_sort_cipher_list(void)
|
|||||||
cipher_compare);
|
cipher_compare);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const SSL3_ENC_METHOD SSLv3_enc_data = {
|
const SSL3_ENC_METHOD SSLv3_enc_data = {
|
||||||
ssl3_enc,
|
ssl3_enc,
|
||||||
n_ssl3_mac,
|
n_ssl3_mac,
|
||||||
@ -2861,8 +2860,7 @@ static char *srp_password_from_info_cb(SSL *s, void *arg)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int ssl3_set_req_cert_type(CERT *c, const unsigned char *p,
|
static int ssl3_set_req_cert_type(CERT *c, const unsigned char *p, size_t len);
|
||||||
size_t len);
|
|
||||||
|
|
||||||
long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
|
long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
|
||||||
{
|
{
|
||||||
@ -3102,13 +3100,11 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
|
|||||||
|
|
||||||
case SSL_CTRL_SET_CURVES:
|
case SSL_CTRL_SET_CURVES:
|
||||||
return tls1_set_curves(&s->tlsext_ellipticcurvelist,
|
return tls1_set_curves(&s->tlsext_ellipticcurvelist,
|
||||||
&s->tlsext_ellipticcurvelist_length,
|
&s->tlsext_ellipticcurvelist_length, parg, larg);
|
||||||
parg, larg);
|
|
||||||
|
|
||||||
case SSL_CTRL_SET_CURVES_LIST:
|
case SSL_CTRL_SET_CURVES_LIST:
|
||||||
return tls1_set_curves_list(&s->tlsext_ellipticcurvelist,
|
return tls1_set_curves_list(&s->tlsext_ellipticcurvelist,
|
||||||
&s->tlsext_ellipticcurvelist_length,
|
&s->tlsext_ellipticcurvelist_length, parg);
|
||||||
parg);
|
|
||||||
|
|
||||||
case SSL_CTRL_GET_SHARED_CURVE:
|
case SSL_CTRL_GET_SHARED_CURVE:
|
||||||
return tls1_shared_curve(s, larg);
|
return tls1_shared_curve(s, larg);
|
||||||
@ -3300,7 +3296,8 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
|
|||||||
{
|
{
|
||||||
unsigned char *keys = parg;
|
unsigned char *keys = parg;
|
||||||
long tlsext_tick_keylen = (sizeof(ctx->tlsext_tick_key_name) +
|
long tlsext_tick_keylen = (sizeof(ctx->tlsext_tick_key_name) +
|
||||||
sizeof(ctx->tlsext_tick_hmac_key) + sizeof(ctx->tlsext_tick_aes_key));
|
sizeof(ctx->tlsext_tick_hmac_key) +
|
||||||
|
sizeof(ctx->tlsext_tick_aes_key));
|
||||||
if (keys == NULL)
|
if (keys == NULL)
|
||||||
return tlsext_tick_keylen;
|
return tlsext_tick_keylen;
|
||||||
if (larg != tlsext_tick_keylen) {
|
if (larg != tlsext_tick_keylen) {
|
||||||
@ -3314,7 +3311,8 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
|
|||||||
keys + sizeof(ctx->tlsext_tick_key_name),
|
keys + sizeof(ctx->tlsext_tick_key_name),
|
||||||
sizeof(ctx->tlsext_tick_hmac_key));
|
sizeof(ctx->tlsext_tick_hmac_key));
|
||||||
memcpy(ctx->tlsext_tick_aes_key,
|
memcpy(ctx->tlsext_tick_aes_key,
|
||||||
keys + sizeof(ctx->tlsext_tick_key_name) + sizeof(ctx->tlsext_tick_hmac_key),
|
keys + sizeof(ctx->tlsext_tick_key_name) +
|
||||||
|
sizeof(ctx->tlsext_tick_hmac_key),
|
||||||
sizeof(ctx->tlsext_tick_aes_key));
|
sizeof(ctx->tlsext_tick_aes_key));
|
||||||
} else {
|
} else {
|
||||||
memcpy(keys, ctx->tlsext_tick_key_name,
|
memcpy(keys, ctx->tlsext_tick_key_name,
|
||||||
@ -3322,7 +3320,8 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
|
|||||||
memcpy(keys + sizeof(ctx->tlsext_tick_key_name),
|
memcpy(keys + sizeof(ctx->tlsext_tick_key_name),
|
||||||
ctx->tlsext_tick_hmac_key,
|
ctx->tlsext_tick_hmac_key,
|
||||||
sizeof(ctx->tlsext_tick_hmac_key));
|
sizeof(ctx->tlsext_tick_hmac_key));
|
||||||
memcpy(keys + sizeof(ctx->tlsext_tick_key_name) + sizeof(ctx->tlsext_tick_hmac_key),
|
memcpy(keys + sizeof(ctx->tlsext_tick_key_name) +
|
||||||
|
sizeof(ctx->tlsext_tick_hmac_key),
|
||||||
ctx->tlsext_tick_aes_key,
|
ctx->tlsext_tick_aes_key,
|
||||||
sizeof(ctx->tlsext_tick_aes_key));
|
sizeof(ctx->tlsext_tick_aes_key));
|
||||||
}
|
}
|
||||||
@ -3355,8 +3354,7 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
|
|||||||
ctx->srp_ctx.login = NULL;
|
ctx->srp_ctx.login = NULL;
|
||||||
if (parg == NULL)
|
if (parg == NULL)
|
||||||
break;
|
break;
|
||||||
if (strlen((const char *)parg) > 255
|
if (strlen((const char *)parg) > 255 || strlen((const char *)parg) < 1) {
|
||||||
|| strlen((const char *)parg) < 1) {
|
|
||||||
SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_INVALID_SRP_USERNAME);
|
SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_INVALID_SRP_USERNAME);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3803,8 +3801,7 @@ int ssl3_write(SSL *s, const void *buf, int len)
|
|||||||
if (s->s3->renegotiate)
|
if (s->s3->renegotiate)
|
||||||
ssl3_renegotiate_check(s);
|
ssl3_renegotiate_check(s);
|
||||||
|
|
||||||
return s->method->ssl_write_bytes(s, SSL3_RT_APPLICATION_DATA,
|
return s->method->ssl_write_bytes(s, SSL3_RT_APPLICATION_DATA, buf, len);
|
||||||
buf, len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ssl3_read_internal(SSL *s, void *buf, int len, int peek)
|
static int ssl3_read_internal(SSL *s, void *buf, int len, int peek)
|
||||||
@ -4045,6 +4042,7 @@ EVP_PKEY *ssl_generate_pkey_curve(int id)
|
|||||||
return pkey;
|
return pkey;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Derive premaster or master secret for ECDH/DH */
|
/* Derive premaster or master secret for ECDH/DH */
|
||||||
int ssl_derive(SSL *s, EVP_PKEY *privkey, EVP_PKEY *pubkey)
|
int ssl_derive(SSL *s, EVP_PKEY *privkey, EVP_PKEY *pubkey)
|
||||||
{
|
{
|
||||||
|
@ -24,8 +24,7 @@ int ssl3_do_change_cipher_spec(SSL *s)
|
|||||||
if (s->s3->tmp.key_block == NULL) {
|
if (s->s3->tmp.key_block == NULL) {
|
||||||
if (s->session == NULL || s->session->master_key_length == 0) {
|
if (s->session == NULL || s->session->master_key_length == 0) {
|
||||||
/* might happen if dtls1_read_bytes() calls this */
|
/* might happen if dtls1_read_bytes() calls this */
|
||||||
SSLerr(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC,
|
SSLerr(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC, SSL_R_CCS_RECEIVED_EARLY);
|
||||||
SSL_R_CCS_RECEIVED_EARLY);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
#include "ssl_locl.h"
|
#include "ssl_locl.h"
|
||||||
#include "internal/thread_once.h"
|
#include "internal/thread_once.h"
|
||||||
|
|
||||||
static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx, int op,
|
static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx,
|
||||||
int bits, int nid, void *other,
|
int op, int bits, int nid, void *other,
|
||||||
void *ex);
|
void *ex);
|
||||||
|
|
||||||
static CRYPTO_ONCE ssl_x509_store_ctx_once = CRYPTO_ONCE_STATIC_INIT;
|
static CRYPTO_ONCE ssl_x509_store_ctx_once = CRYPTO_ONCE_STATIC_INIT;
|
||||||
@ -96,7 +96,6 @@ CERT *ssl_cert_dup(CERT *cert)
|
|||||||
OPENSSL_free(ret);
|
OPENSSL_free(ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DH
|
#ifndef OPENSSL_NO_DH
|
||||||
if (cert->dh_tmp != NULL) {
|
if (cert->dh_tmp != NULL) {
|
||||||
ret->dh_tmp = cert->dh_tmp;
|
ret->dh_tmp = cert->dh_tmp;
|
||||||
@ -134,11 +133,9 @@ CERT *ssl_cert_dup(CERT *cert)
|
|||||||
SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
ret->pkeys[i].serverinfo_length =
|
ret->pkeys[i].serverinfo_length = cert->pkeys[i].serverinfo_length;
|
||||||
cert->pkeys[i].serverinfo_length;
|
|
||||||
memcpy(ret->pkeys[i].serverinfo,
|
memcpy(ret->pkeys[i].serverinfo,
|
||||||
cert->pkeys[i].serverinfo,
|
cert->pkeys[i].serverinfo, cert->pkeys[i].serverinfo_length);
|
||||||
cert->pkeys[i].serverinfo_length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +409,8 @@ int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk)
|
|||||||
|
|
||||||
/* Set suite B flags if needed */
|
/* Set suite B flags if needed */
|
||||||
X509_STORE_CTX_set_flags(ctx, tls1_suiteb(s));
|
X509_STORE_CTX_set_flags(ctx, tls1_suiteb(s));
|
||||||
if (!X509_STORE_CTX_set_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx(), s)) {
|
if (!X509_STORE_CTX_set_ex_data
|
||||||
|
(ctx, SSL_get_ex_data_X509_STORE_CTX_idx(), s)) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,8 +574,7 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
|
|||||||
X509 *x = NULL;
|
X509 *x = NULL;
|
||||||
X509_NAME *xn = NULL;
|
X509_NAME *xn = NULL;
|
||||||
STACK_OF(X509_NAME) *ret = NULL;
|
STACK_OF(X509_NAME) *ret = NULL;
|
||||||
LHASH_OF(X509_NAME) *name_hash =
|
LHASH_OF(X509_NAME) *name_hash = lh_X509_NAME_new(xname_hash, xname_cmp);
|
||||||
lh_X509_NAME_new(xname_hash, xname_cmp);
|
|
||||||
|
|
||||||
if ((name_hash == NULL) || (in == NULL)) {
|
if ((name_hash == NULL) || (in == NULL)) {
|
||||||
SSLerr(SSL_F_SSL_LOAD_CLIENT_CA_FILE, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL_LOAD_CLIENT_CA_FILE, ERR_R_MALLOC_FAILURE);
|
||||||
@ -651,8 +648,7 @@ int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
|
|||||||
in = BIO_new(BIO_s_file());
|
in = BIO_new(BIO_s_file());
|
||||||
|
|
||||||
if (in == NULL) {
|
if (in == NULL) {
|
||||||
SSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,
|
SSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK, ERR_R_MALLOC_FAILURE);
|
||||||
ERR_R_MALLOC_FAILURE);
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -892,8 +888,7 @@ int ssl_build_cert_chain(SSL *s, SSL_CTX *ctx, int flags)
|
|||||||
if (!X509_STORE_add_cert(chain_store, x)) {
|
if (!X509_STORE_add_cert(chain_store, x)) {
|
||||||
error = ERR_peek_last_error();
|
error = ERR_peek_last_error();
|
||||||
if (ERR_GET_LIB(error) != ERR_LIB_X509 ||
|
if (ERR_GET_LIB(error) != ERR_LIB_X509 ||
|
||||||
ERR_GET_REASON(error) !=
|
ERR_GET_REASON(error) != X509_R_CERT_ALREADY_IN_HASH_TABLE)
|
||||||
X509_R_CERT_ALREADY_IN_HASH_TABLE)
|
|
||||||
goto err;
|
goto err;
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
}
|
}
|
||||||
@ -1001,8 +996,8 @@ int ssl_cert_set_cert_store(CERT *c, X509_STORE *store, int chain, int ref)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx, int op,
|
static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx,
|
||||||
int bits, int nid, void *other,
|
int op, int bits, int nid, void *other,
|
||||||
void *ex)
|
void *ex)
|
||||||
{
|
{
|
||||||
int level, minbits;
|
int level, minbits;
|
||||||
|
@ -143,6 +143,7 @@ static const EVP_MD *ssl_digest_methods[SSL_MD_NUM_IDX] = {
|
|||||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
static const ssl_cipher_table ssl_cipher_table_kx[] = {
|
static const ssl_cipher_table ssl_cipher_table_kx[] = {
|
||||||
{SSL_kRSA, NID_kx_rsa},
|
{SSL_kRSA, NID_kx_rsa},
|
||||||
{SSL_kECDHE, NID_kx_ecdhe},
|
{SSL_kECDHE, NID_kx_ecdhe},
|
||||||
@ -165,6 +166,7 @@ static const ssl_cipher_table ssl_cipher_table_auth[] = {
|
|||||||
{SSL_aSRP, NID_auth_srp},
|
{SSL_aSRP, NID_auth_srp},
|
||||||
{SSL_aNULL, NID_auth_null}
|
{SSL_aNULL, NID_auth_null}
|
||||||
};
|
};
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
/* Utility function for table lookup */
|
/* Utility function for table lookup */
|
||||||
static int ssl_cipher_info_find(const ssl_cipher_table * table,
|
static int ssl_cipher_info_find(const ssl_cipher_table * table,
|
||||||
@ -286,9 +288,11 @@ static const SSL_CIPHER cipher_aliases[] = {
|
|||||||
{0, SSL_TXT_eNULL, 0, 0, 0, SSL_eNULL, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
{0, SSL_TXT_eNULL, 0, 0, 0, SSL_eNULL, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
{0, SSL_TXT_GOST, 0, 0, 0, SSL_eGOST2814789CNT | SSL_eGOST2814789CNT12, 0,
|
{0, SSL_TXT_GOST, 0, 0, 0, SSL_eGOST2814789CNT | SSL_eGOST2814789CNT12, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
{0, SSL_TXT_AES128, 0, 0, 0, SSL_AES128 | SSL_AES128GCM | SSL_AES128CCM | SSL_AES128CCM8, 0,
|
{0, SSL_TXT_AES128, 0, 0, 0,
|
||||||
|
SSL_AES128 | SSL_AES128GCM | SSL_AES128CCM | SSL_AES128CCM8, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
{0, SSL_TXT_AES256, 0, 0, 0, SSL_AES256 | SSL_AES256GCM | SSL_AES256CCM | SSL_AES256CCM8, 0,
|
{0, SSL_TXT_AES256, 0, 0, 0,
|
||||||
|
SSL_AES256 | SSL_AES256GCM | SSL_AES256CCM | SSL_AES256CCM8, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
{0, SSL_TXT_AES, 0, 0, 0, SSL_AES, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
{0, SSL_TXT_AES, 0, 0, 0, SSL_AES, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
{0, SSL_TXT_AES_GCM, 0, 0, 0, SSL_AES128GCM | SSL_AES256GCM, 0, 0, 0, 0,
|
{0, SSL_TXT_AES_GCM, 0, 0, 0, SSL_AES128GCM | SSL_AES256GCM, 0, 0, 0, 0,
|
||||||
@ -453,7 +457,8 @@ void ssl_load_ciphers(void)
|
|||||||
disabled_mac_mask |= SSL_GOST89MAC;
|
disabled_mac_mask |= SSL_GOST89MAC;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssl_mac_pkey_id[SSL_MD_GOST89MAC12_IDX] = get_optional_pkey_id("gost-mac-12");
|
ssl_mac_pkey_id[SSL_MD_GOST89MAC12_IDX] =
|
||||||
|
get_optional_pkey_id("gost-mac-12");
|
||||||
if (ssl_mac_pkey_id[SSL_MD_GOST89MAC12_IDX]) {
|
if (ssl_mac_pkey_id[SSL_MD_GOST89MAC12_IDX]) {
|
||||||
ssl_mac_secret_size[SSL_MD_GOST89MAC12_IDX] = 32;
|
ssl_mac_secret_size[SSL_MD_GOST89MAC12_IDX] = 32;
|
||||||
} else {
|
} else {
|
||||||
@ -469,7 +474,8 @@ void ssl_load_ciphers(void)
|
|||||||
/*
|
/*
|
||||||
* Disable GOST key exchange if no GOST signature algs are available *
|
* Disable GOST key exchange if no GOST signature algs are available *
|
||||||
*/
|
*/
|
||||||
if ((disabled_auth_mask & (SSL_aGOST01 | SSL_aGOST12)) == (SSL_aGOST01 | SSL_aGOST12))
|
if ((disabled_auth_mask & (SSL_aGOST01 | SSL_aGOST12)) ==
|
||||||
|
(SSL_aGOST01 | SSL_aGOST12))
|
||||||
disabled_mkey_mask |= SSL_kGOST;
|
disabled_mkey_mask |= SSL_kGOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,8 +830,8 @@ static void ssl_cipher_apply_rule(uint32_t cipher_id, uint32_t alg_mkey,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (rule == CIPHER_DEL || rule == CIPHER_BUMP)
|
if (rule == CIPHER_DEL || rule == CIPHER_BUMP)
|
||||||
reverse = 1; /* needed to maintain sorting between
|
reverse = 1; /* needed to maintain sorting between currently
|
||||||
* currently deleted ciphers */
|
* deleted ciphers */
|
||||||
|
|
||||||
head = *head_p;
|
head = *head_p;
|
||||||
tail = *tail_p;
|
tail = *tail_p;
|
||||||
@ -1057,8 +1063,7 @@ static int ssl_cipher_process_rulestr(const char *rule_str,
|
|||||||
* it is no command or separator nor
|
* it is no command or separator nor
|
||||||
* alphanumeric, so we call this an error.
|
* alphanumeric, so we call this an error.
|
||||||
*/
|
*/
|
||||||
SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR,
|
SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND);
|
||||||
SSL_R_INVALID_COMMAND);
|
|
||||||
retval = found = 0;
|
retval = found = 0;
|
||||||
l++;
|
l++;
|
||||||
break;
|
break;
|
||||||
@ -1216,8 +1221,7 @@ static int ssl_cipher_process_rulestr(const char *rule_str,
|
|||||||
ok = 1;
|
ok = 1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR,
|
SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND);
|
||||||
SSL_R_INVALID_COMMAND);
|
|
||||||
if (ok == 0)
|
if (ok == 0)
|
||||||
retval = 0;
|
retval = 0;
|
||||||
/*
|
/*
|
||||||
@ -1293,8 +1297,7 @@ static int check_suiteb_cipher_list(const SSL_METHOD *meth, CERT *c,
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
# else
|
# else
|
||||||
SSLerr(SSL_F_CHECK_SUITEB_CIPHER_LIST,
|
SSLerr(SSL_F_CHECK_SUITEB_CIPHER_LIST, SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE);
|
||||||
SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE);
|
|
||||||
return 0;
|
return 0;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
@ -1347,8 +1350,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, STACK
|
|||||||
|
|
||||||
ssl_cipher_collect_ciphers(ssl_method, num_of_ciphers,
|
ssl_cipher_collect_ciphers(ssl_method, num_of_ciphers,
|
||||||
disabled_mkey, disabled_auth, disabled_enc,
|
disabled_mkey, disabled_auth, disabled_enc,
|
||||||
disabled_mac, co_list, &head,
|
disabled_mac, co_list, &head, &tail);
|
||||||
&tail);
|
|
||||||
|
|
||||||
/* Now arrange all ciphers by preference. */
|
/* Now arrange all ciphers by preference. */
|
||||||
|
|
||||||
@ -1366,7 +1368,6 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, STACK
|
|||||||
ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head,
|
ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head,
|
||||||
&tail);
|
&tail);
|
||||||
|
|
||||||
|
|
||||||
/* Within each strength group, we prefer GCM over CHACHA... */
|
/* Within each strength group, we prefer GCM over CHACHA... */
|
||||||
ssl_cipher_apply_rule(0, 0, 0, SSL_AESGCM, 0, 0, 0, CIPHER_ADD, -1,
|
ssl_cipher_apply_rule(0, 0, 0, SSL_AESGCM, 0, 0, 0, CIPHER_ADD, -1,
|
||||||
&head, &tail);
|
&head, &tail);
|
||||||
@ -1530,8 +1531,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, STACK
|
|||||||
if (*cipher_list_by_id != NULL)
|
if (*cipher_list_by_id != NULL)
|
||||||
sk_SSL_CIPHER_free(*cipher_list_by_id);
|
sk_SSL_CIPHER_free(*cipher_list_by_id);
|
||||||
*cipher_list_by_id = tmp_cipher_list;
|
*cipher_list_by_id = tmp_cipher_list;
|
||||||
(void)sk_SSL_CIPHER_set_cmp_func(*cipher_list_by_id,
|
(void)sk_SSL_CIPHER_set_cmp_func(*cipher_list_by_id, ssl_cipher_ptr_id_cmp);
|
||||||
ssl_cipher_ptr_id_cmp);
|
|
||||||
|
|
||||||
sk_SSL_CIPHER_sort(*cipher_list_by_id);
|
sk_SSL_CIPHER_sort(*cipher_list_by_id);
|
||||||
return (cipherstack);
|
return (cipherstack);
|
||||||
@ -1542,8 +1542,7 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
|
|||||||
const char *ver;
|
const char *ver;
|
||||||
const char *kx, *au, *enc, *mac;
|
const char *kx, *au, *enc, *mac;
|
||||||
uint32_t alg_mkey, alg_auth, alg_enc, alg_mac;
|
uint32_t alg_mkey, alg_auth, alg_enc, alg_mac;
|
||||||
static const char *format =
|
static const char *format = "%-23s %s Kx=%-8s Au=%-4s Enc=%-9s Mac=%-4s\n";
|
||||||
"%-23s %s Kx=%-8s Au=%-4s Enc=%-9s Mac=%-4s\n";
|
|
||||||
|
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
len = 128;
|
len = 128;
|
||||||
@ -1785,11 +1784,13 @@ STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP)
|
STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP)
|
||||||
*meths)
|
*meths)
|
||||||
{
|
{
|
||||||
return meths;
|
return meths;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
|
int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
@ -1861,8 +1862,7 @@ int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
|
|||||||
SSL_R_DUPLICATE_COMPRESSION_ID);
|
SSL_R_DUPLICATE_COMPRESSION_ID);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
if (ssl_comp_methods == NULL
|
if (ssl_comp_methods == NULL || !sk_SSL_COMP_push(ssl_comp_methods, comp)) {
|
||||||
|| !sk_SSL_COMP_push(ssl_comp_methods, comp)) {
|
|
||||||
OPENSSL_free(comp);
|
OPENSSL_free(comp);
|
||||||
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
|
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
|
||||||
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE);
|
||||||
|
@ -142,8 +142,7 @@ static int ssl_match_option(SSL_CONF_CTX *cctx, const ssl_flag_tbl *tbl,
|
|||||||
if (namelen == -1) {
|
if (namelen == -1) {
|
||||||
if (strcmp(tbl->name, name))
|
if (strcmp(tbl->name, name))
|
||||||
return 0;
|
return 0;
|
||||||
} else if (tbl->namelen != namelen
|
} else if (tbl->namelen != namelen || strncasecmp(tbl->name, name, namelen))
|
||||||
|| strncasecmp(tbl->name, name, namelen))
|
|
||||||
return 0;
|
return 0;
|
||||||
ssl_set_option(cctx, tbl->name_flags, tbl->option_value, onoff);
|
ssl_set_option(cctx, tbl->name_flags, tbl->option_value, onoff);
|
||||||
return 1;
|
return 1;
|
||||||
@ -192,8 +191,7 @@ static int cmd_SignatureAlgorithms(SSL_CONF_CTX *cctx, const char *value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set supported client signature algorithms */
|
/* Set supported client signature algorithms */
|
||||||
static int cmd_ClientSignatureAlgorithms(SSL_CONF_CTX *cctx,
|
static int cmd_ClientSignatureAlgorithms(SSL_CONF_CTX *cctx, const char *value)
|
||||||
const char *value)
|
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
if (cctx->ssl)
|
if (cctx->ssl)
|
||||||
@ -285,7 +283,8 @@ static int protocol_from_string(const char *value)
|
|||||||
{"TLSv1.1", TLS1_1_VERSION},
|
{"TLSv1.1", TLS1_1_VERSION},
|
||||||
{"TLSv1.2", TLS1_2_VERSION},
|
{"TLSv1.2", TLS1_2_VERSION},
|
||||||
{"DTLSv1", DTLS1_VERSION},
|
{"DTLSv1", DTLS1_VERSION},
|
||||||
{"DTLSv1.2", DTLS1_2_VERSION}};
|
{"DTLSv1.2", DTLS1_2_VERSION}
|
||||||
|
};
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t n = OSSL_NELEM(versions);
|
size_t n = OSSL_NELEM(versions);
|
||||||
|
|
||||||
@ -625,8 +624,7 @@ static int ssl_conf_cmd_skip_prefix(SSL_CONF_CTX *cctx, const char **pcmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Determine if a command is allowed according to cctx flags */
|
/* Determine if a command is allowed according to cctx flags */
|
||||||
static int ssl_conf_cmd_allowed(SSL_CONF_CTX *cctx,
|
static int ssl_conf_cmd_allowed(SSL_CONF_CTX *cctx, const ssl_conf_cmd_tbl * t)
|
||||||
const ssl_conf_cmd_tbl * t)
|
|
||||||
{
|
{
|
||||||
unsigned int tfl = t->flags;
|
unsigned int tfl = t->flags;
|
||||||
unsigned int cfl = cctx->flags;
|
unsigned int cfl = cctx->flags;
|
||||||
@ -664,8 +662,7 @@ static const ssl_conf_cmd_tbl *ssl_conf_cmd_lookup(SSL_CONF_CTX *cctx,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ctrl_switch_option(SSL_CONF_CTX *cctx,
|
static int ctrl_switch_option(SSL_CONF_CTX *cctx, const ssl_conf_cmd_tbl * cmd)
|
||||||
const ssl_conf_cmd_tbl * cmd)
|
|
||||||
{
|
{
|
||||||
/* Find index of command in table */
|
/* Find index of command in table */
|
||||||
size_t idx = cmd - ssl_conf_cmds;
|
size_t idx = cmd - ssl_conf_cmds;
|
||||||
|
@ -169,7 +169,6 @@ static void ssl_library_stop(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this function is called with a non NULL settings value then it must be
|
* If this function is called with a non NULL settings value then it must be
|
||||||
* called prior to any threads making calls to any OpenSSL functions,
|
* called prior to any threads making calls to any OpenSSL functions,
|
||||||
@ -209,4 +208,3 @@ int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
127
ssl/ssl_lib.c
127
ssl/ssl_lib.c
@ -95,9 +95,15 @@ static const struct {
|
|||||||
uint8_t ord;
|
uint8_t ord;
|
||||||
int nid;
|
int nid;
|
||||||
} dane_mds[] = {
|
} dane_mds[] = {
|
||||||
{ DANETLS_MATCHING_FULL, 0, NID_undef },
|
{
|
||||||
{ DANETLS_MATCHING_2256, 1, NID_sha256 },
|
DANETLS_MATCHING_FULL, 0, NID_undef
|
||||||
{ DANETLS_MATCHING_2512, 2, NID_sha512 },
|
},
|
||||||
|
{
|
||||||
|
DANETLS_MATCHING_2256, 1, NID_sha256
|
||||||
|
},
|
||||||
|
{
|
||||||
|
DANETLS_MATCHING_2512, 2, NID_sha512
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int dane_ctx_enable(struct dane_ctx_st *dctx)
|
static int dane_ctx_enable(struct dane_ctx_st *dctx)
|
||||||
@ -205,17 +211,13 @@ static int ssl_dane_dup(SSL *to, SSL *from)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dane_mtype_set(
|
static int dane_mtype_set(struct dane_ctx_st *dctx,
|
||||||
struct dane_ctx_st *dctx,
|
const EVP_MD *md, uint8_t mtype, uint8_t ord)
|
||||||
const EVP_MD *md,
|
|
||||||
uint8_t mtype,
|
|
||||||
uint8_t ord)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (mtype == DANETLS_MATCHING_FULL && md != NULL) {
|
if (mtype == DANETLS_MATCHING_FULL && md != NULL) {
|
||||||
SSLerr(SSL_F_DANE_MTYPE_SET,
|
SSLerr(SSL_F_DANE_MTYPE_SET, SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL);
|
||||||
SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,13 +263,10 @@ static const EVP_MD *tlsa_md_get(SSL_DANE *dane, uint8_t mtype)
|
|||||||
return dane->dctx->mdevp[mtype];
|
return dane->dctx->mdevp[mtype];
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dane_tlsa_add(
|
static int dane_tlsa_add(SSL_DANE *dane,
|
||||||
SSL_DANE *dane,
|
|
||||||
uint8_t usage,
|
uint8_t usage,
|
||||||
uint8_t selector,
|
uint8_t selector,
|
||||||
uint8_t mtype,
|
uint8_t mtype, unsigned char *data, size_t dlen)
|
||||||
unsigned char *data,
|
|
||||||
size_t dlen)
|
|
||||||
{
|
{
|
||||||
danetls_record *t;
|
danetls_record *t;
|
||||||
const EVP_MD *md = NULL;
|
const EVP_MD *md = NULL;
|
||||||
@ -512,8 +511,7 @@ int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth)
|
|||||||
&(ctx->cipher_list_by_id),
|
&(ctx->cipher_list_by_id),
|
||||||
SSL_DEFAULT_CIPHER_LIST, ctx->cert);
|
SSL_DEFAULT_CIPHER_LIST, ctx->cert);
|
||||||
if ((sk == NULL) || (sk_SSL_CIPHER_num(sk) <= 0)) {
|
if ((sk == NULL) || (sk_SSL_CIPHER_num(sk) <= 0)) {
|
||||||
SSLerr(SSL_F_SSL_CTX_SET_SSL_VERSION,
|
SSLerr(SSL_F_SSL_CTX_SET_SSL_VERSION, SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS);
|
||||||
SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
@ -930,7 +928,8 @@ int SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector,
|
|||||||
return dane_tlsa_add(&s->dane, usage, selector, mtype, data, dlen);
|
return dane_tlsa_add(&s->dane, usage, selector, mtype, data, dlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md, uint8_t mtype, uint8_t ord)
|
int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md, uint8_t mtype,
|
||||||
|
uint8_t ord)
|
||||||
{
|
{
|
||||||
return dane_mtype_set(&ctx->dane, md, mtype, ord);
|
return dane_mtype_set(&ctx->dane, md, mtype, ord);
|
||||||
}
|
}
|
||||||
@ -1389,15 +1388,12 @@ int SSL_copy_session_id(SSL *t, const SSL *f)
|
|||||||
/* Fix this so it checks all the valid key/cert options */
|
/* Fix this so it checks all the valid key/cert options */
|
||||||
int SSL_CTX_check_private_key(const SSL_CTX *ctx)
|
int SSL_CTX_check_private_key(const SSL_CTX *ctx)
|
||||||
{
|
{
|
||||||
if ((ctx == NULL) ||
|
if ((ctx == NULL) || (ctx->cert->key->x509 == NULL)) {
|
||||||
(ctx->cert->key->x509 == NULL)) {
|
SSLerr(SSL_F_SSL_CTX_CHECK_PRIVATE_KEY, SSL_R_NO_CERTIFICATE_ASSIGNED);
|
||||||
SSLerr(SSL_F_SSL_CTX_CHECK_PRIVATE_KEY,
|
|
||||||
SSL_R_NO_CERTIFICATE_ASSIGNED);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
if (ctx->cert->key->privatekey == NULL) {
|
if (ctx->cert->key->privatekey == NULL) {
|
||||||
SSLerr(SSL_F_SSL_CTX_CHECK_PRIVATE_KEY,
|
SSLerr(SSL_F_SSL_CTX_CHECK_PRIVATE_KEY, SSL_R_NO_PRIVATE_KEY_ASSIGNED);
|
||||||
SSL_R_NO_PRIVATE_KEY_ASSIGNED);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
return (X509_check_private_key
|
return (X509_check_private_key
|
||||||
@ -1477,7 +1473,8 @@ long SSL_get_default_timeout(const SSL *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ssl_start_async_job(SSL *s, struct ssl_async_args *args,
|
static int ssl_start_async_job(SSL *s, struct ssl_async_args *args,
|
||||||
int (*func)(void *)) {
|
int (*func) (void *))
|
||||||
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (s->waitctx == NULL) {
|
if (s->waitctx == NULL) {
|
||||||
s->waitctx = ASYNC_WAIT_CTX_new();
|
s->waitctx = ASYNC_WAIT_CTX_new();
|
||||||
@ -2122,8 +2119,7 @@ int SSL_get_servername_type(const SSL *s)
|
|||||||
int SSL_select_next_proto(unsigned char **out, unsigned char *outlen,
|
int SSL_select_next_proto(unsigned char **out, unsigned char *outlen,
|
||||||
const unsigned char *server,
|
const unsigned char *server,
|
||||||
unsigned int server_len,
|
unsigned int server_len,
|
||||||
const unsigned char *client,
|
const unsigned char *client, unsigned int client_len)
|
||||||
unsigned int client_len)
|
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
const unsigned char *result;
|
const unsigned char *result;
|
||||||
@ -2294,7 +2290,6 @@ void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data,
|
|||||||
*len = ssl->s3->alpn_selected_len;
|
*len = ssl->s3->alpn_selected_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
|
int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
|
||||||
const char *label, size_t llen,
|
const char *label, size_t llen,
|
||||||
const unsigned char *p, size_t plen,
|
const unsigned char *p, size_t plen,
|
||||||
@ -2433,9 +2428,12 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
|
|||||||
ret->split_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH;
|
ret->split_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH;
|
||||||
|
|
||||||
/* Setup RFC5077 ticket keys */
|
/* Setup RFC5077 ticket keys */
|
||||||
if ((RAND_bytes(ret->tlsext_tick_key_name, sizeof(ret->tlsext_tick_key_name)) <= 0)
|
if ((RAND_bytes(ret->tlsext_tick_key_name,
|
||||||
|| (RAND_bytes(ret->tlsext_tick_hmac_key, sizeof(ret->tlsext_tick_hmac_key)) <= 0)
|
sizeof(ret->tlsext_tick_key_name)) <= 0)
|
||||||
|| (RAND_bytes(ret->tlsext_tick_aes_key, sizeof(ret->tlsext_tick_aes_key)) <= 0))
|
|| (RAND_bytes(ret->tlsext_tick_hmac_key,
|
||||||
|
sizeof(ret->tlsext_tick_hmac_key)) <= 0)
|
||||||
|
|| (RAND_bytes(ret->tlsext_tick_aes_key,
|
||||||
|
sizeof(ret->tlsext_tick_aes_key)) <= 0))
|
||||||
ret->options |= SSL_OP_NO_TICKET;
|
ret->options |= SSL_OP_NO_TICKET;
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SRP
|
#ifndef OPENSSL_NO_SRP
|
||||||
@ -2616,8 +2614,7 @@ void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth)
|
|||||||
X509_VERIFY_PARAM_set_depth(ctx->param, depth);
|
X509_VERIFY_PARAM_set_depth(ctx->param, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg),
|
void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg), void *arg)
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
ssl_cert_set_cert_cb(c->cert, cb, arg);
|
ssl_cert_set_cert_cb(c->cert, cb, arg);
|
||||||
}
|
}
|
||||||
@ -2802,8 +2799,7 @@ EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,
|
|||||||
alg_a = cipher->algorithm_auth;
|
alg_a = cipher->algorithm_auth;
|
||||||
c = s->cert;
|
c = s->cert;
|
||||||
|
|
||||||
if ((alg_a & SSL_aDSS) &&
|
if ((alg_a & SSL_aDSS) && (c->pkeys[SSL_PKEY_DSA_SIGN].privatekey != NULL))
|
||||||
(c->pkeys[SSL_PKEY_DSA_SIGN].privatekey != NULL))
|
|
||||||
idx = SSL_PKEY_DSA_SIGN;
|
idx = SSL_PKEY_DSA_SIGN;
|
||||||
else if (alg_a & SSL_aRSA) {
|
else if (alg_a & SSL_aRSA) {
|
||||||
if (c->pkeys[SSL_PKEY_RSA_SIGN].privatekey != NULL)
|
if (c->pkeys[SSL_PKEY_RSA_SIGN].privatekey != NULL)
|
||||||
@ -3587,8 +3583,7 @@ void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*dh) (SSL *ssl, int is_export,
|
|||||||
int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint)
|
int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint)
|
||||||
{
|
{
|
||||||
if (identity_hint != NULL && strlen(identity_hint) > PSK_MAX_IDENTITY_LEN) {
|
if (identity_hint != NULL && strlen(identity_hint) > PSK_MAX_IDENTITY_LEN) {
|
||||||
SSLerr(SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT,
|
SSLerr(SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT, SSL_R_DATA_LENGTH_TOO_LONG);
|
||||||
SSL_R_DATA_LENGTH_TOO_LONG);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
OPENSSL_free(ctx->cert->psk_identity_hint);
|
OPENSSL_free(ctx->cert->psk_identity_hint);
|
||||||
@ -3641,8 +3636,7 @@ void SSL_set_psk_client_callback(SSL *s,
|
|||||||
unsigned int
|
unsigned int
|
||||||
max_identity_len,
|
max_identity_len,
|
||||||
unsigned char *psk,
|
unsigned char *psk,
|
||||||
unsigned int
|
unsigned int max_psk_len))
|
||||||
max_psk_len))
|
|
||||||
{
|
{
|
||||||
s->psk_client_callback = cb;
|
s->psk_client_callback = cb;
|
||||||
}
|
}
|
||||||
@ -3664,8 +3658,7 @@ void SSL_set_psk_server_callback(SSL *s,
|
|||||||
unsigned int (*cb) (SSL *ssl,
|
unsigned int (*cb) (SSL *ssl,
|
||||||
const char *identity,
|
const char *identity,
|
||||||
unsigned char *psk,
|
unsigned char *psk,
|
||||||
unsigned int
|
unsigned int max_psk_len))
|
||||||
max_psk_len))
|
|
||||||
{
|
{
|
||||||
s->psk_server_callback = cb;
|
s->psk_server_callback = cb;
|
||||||
}
|
}
|
||||||
@ -3783,7 +3776,6 @@ void SSL_set_debug(SSL *s, int debug)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void SSL_set_security_level(SSL *s, int level)
|
void SSL_set_security_level(SSL *s, int level)
|
||||||
{
|
{
|
||||||
s->cert->sec_level = level;
|
s->cert->sec_level = level;
|
||||||
@ -3795,16 +3787,17 @@ int SSL_get_security_level(const SSL *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SSL_set_security_callback(SSL *s,
|
void SSL_set_security_callback(SSL *s,
|
||||||
int (*cb) (const SSL *s, const SSL_CTX *ctx, int op,
|
int (*cb) (const SSL *s, const SSL_CTX *ctx,
|
||||||
int bits, int nid, void *other,
|
int op, int bits, int nid,
|
||||||
void *ex))
|
void *other, void *ex))
|
||||||
{
|
{
|
||||||
s->cert->sec_cb = cb;
|
s->cert->sec_cb = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
int (*SSL_get_security_callback(const SSL *s)) (const SSL *s, const SSL_CTX *ctx, int op,
|
int (*SSL_get_security_callback(const SSL *s)) (const SSL *s,
|
||||||
int bits, int nid,
|
const SSL_CTX *ctx, int op,
|
||||||
void *other, void *ex) {
|
int bits, int nid, void *other,
|
||||||
|
void *ex) {
|
||||||
return s->cert->sec_cb;
|
return s->cert->sec_cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3829,9 +3822,9 @@ int SSL_CTX_get_security_level(const SSL_CTX *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SSL_CTX_set_security_callback(SSL_CTX *ctx,
|
void SSL_CTX_set_security_callback(SSL_CTX *ctx,
|
||||||
int (*cb) (const SSL *s, const SSL_CTX *ctx, int op,
|
int (*cb) (const SSL *s, const SSL_CTX *ctx,
|
||||||
int bits, int nid, void *other,
|
int op, int bits, int nid,
|
||||||
void *ex))
|
void *other, void *ex))
|
||||||
{
|
{
|
||||||
ctx->cert->sec_cb = cb;
|
ctx->cert->sec_cb = cb;
|
||||||
}
|
}
|
||||||
@ -3855,7 +3848,6 @@ void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx)
|
|||||||
return ctx->cert->sec_ex;
|
return ctx->cert->sec_ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get/Set/Clear options in SSL_CTX or SSL, formerly macros, now functions that
|
* Get/Set/Clear options in SSL_CTX or SSL, formerly macros, now functions that
|
||||||
* can return unsigned long, instead of the generic long return value from the
|
* can return unsigned long, instead of the generic long return value from the
|
||||||
@ -3865,22 +3857,27 @@ unsigned long SSL_CTX_get_options(const SSL_CTX *ctx)
|
|||||||
{
|
{
|
||||||
return ctx->options;
|
return ctx->options;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long SSL_get_options(const SSL *s)
|
unsigned long SSL_get_options(const SSL *s)
|
||||||
{
|
{
|
||||||
return s->options;
|
return s->options;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op)
|
unsigned long SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op)
|
||||||
{
|
{
|
||||||
return ctx->options |= op;
|
return ctx->options |= op;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long SSL_set_options(SSL *s, unsigned long op)
|
unsigned long SSL_set_options(SSL *s, unsigned long op)
|
||||||
{
|
{
|
||||||
return s->options |= op;
|
return s->options |= op;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op)
|
unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op)
|
||||||
{
|
{
|
||||||
return ctx->options &= ~op;
|
return ctx->options &= ~op;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long SSL_clear_options(SSL *s, unsigned long op)
|
unsigned long SSL_clear_options(SSL *s, unsigned long op)
|
||||||
{
|
{
|
||||||
return s->options &= ~op;
|
return s->options &= ~op;
|
||||||
@ -3902,7 +3899,8 @@ IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id);
|
|||||||
* the caller.
|
* the caller.
|
||||||
* Returns the number of SCTs moved, or a negative integer if an error occurs.
|
* Returns the number of SCTs moved, or a negative integer if an error occurs.
|
||||||
*/
|
*/
|
||||||
static int ct_move_scts(STACK_OF(SCT) **dst, STACK_OF(SCT) *src, sct_source_t origin)
|
static int ct_move_scts(STACK_OF(SCT) **dst, STACK_OF(SCT) *src,
|
||||||
|
sct_source_t origin)
|
||||||
{
|
{
|
||||||
int scts_moved = 0;
|
int scts_moved = 0;
|
||||||
SCT *sct = NULL;
|
SCT *sct = NULL;
|
||||||
@ -3987,9 +3985,10 @@ static int ct_extract_ocsp_response_scts(SSL *s)
|
|||||||
if (single == NULL)
|
if (single == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
scts = OCSP_SINGLERESP_get1_ext_d2i(single, NID_ct_cert_scts, NULL, NULL);
|
scts =
|
||||||
scts_extracted = ct_move_scts(&s->scts, scts,
|
OCSP_SINGLERESP_get1_ext_d2i(single, NID_ct_cert_scts, NULL, NULL);
|
||||||
SCT_SOURCE_OCSP_STAPLED_RESPONSE);
|
scts_extracted =
|
||||||
|
ct_move_scts(&s->scts, scts, SCT_SOURCE_OCSP_STAPLED_RESPONSE);
|
||||||
if (scts_extracted < 0)
|
if (scts_extracted < 0)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -4078,14 +4077,17 @@ int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback,
|
|||||||
* for this and throw an error if they have already registered to use CT.
|
* for this and throw an error if they have already registered to use CT.
|
||||||
*/
|
*/
|
||||||
if (callback != NULL && SSL_CTX_has_client_custom_ext(s->ctx,
|
if (callback != NULL && SSL_CTX_has_client_custom_ext(s->ctx,
|
||||||
TLSEXT_TYPE_signed_certificate_timestamp)) {
|
TLSEXT_TYPE_signed_certificate_timestamp))
|
||||||
|
{
|
||||||
SSLerr(SSL_F_SSL_SET_CT_VALIDATION_CALLBACK,
|
SSLerr(SSL_F_SSL_SET_CT_VALIDATION_CALLBACK,
|
||||||
SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED);
|
SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callback != NULL) {
|
if (callback != NULL) {
|
||||||
/* If we are validating CT, then we MUST accept SCTs served via OCSP */
|
/*
|
||||||
|
* If we are validating CT, then we MUST accept SCTs served via OCSP
|
||||||
|
*/
|
||||||
if (!SSL_set_tlsext_status_type(s, TLSEXT_STATUSTYPE_ocsp))
|
if (!SSL_set_tlsext_status_type(s, TLSEXT_STATUSTYPE_ocsp))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4097,15 +4099,15 @@ int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx,
|
int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx,
|
||||||
ssl_ct_validation_cb callback,
|
ssl_ct_validation_cb callback, void *arg)
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Since code exists that uses the custom extension handler for CT, look for
|
* Since code exists that uses the custom extension handler for CT, look for
|
||||||
* this and throw an error if they have already registered to use CT.
|
* this and throw an error if they have already registered to use CT.
|
||||||
*/
|
*/
|
||||||
if (callback != NULL && SSL_CTX_has_client_custom_ext(ctx,
|
if (callback != NULL && SSL_CTX_has_client_custom_ext(ctx,
|
||||||
TLSEXT_TYPE_signed_certificate_timestamp)) {
|
TLSEXT_TYPE_signed_certificate_timestamp))
|
||||||
|
{
|
||||||
SSLerr(SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK,
|
SSLerr(SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK,
|
||||||
SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED);
|
SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED);
|
||||||
return 0;
|
return 0;
|
||||||
@ -4148,8 +4150,7 @@ int ssl_validate_ct(SSL *s)
|
|||||||
*/
|
*/
|
||||||
if (s->ct_validation_callback == NULL || cert == NULL ||
|
if (s->ct_validation_callback == NULL || cert == NULL ||
|
||||||
s->verify_result != X509_V_OK ||
|
s->verify_result != X509_V_OK ||
|
||||||
s->verified_chain == NULL ||
|
s->verified_chain == NULL || sk_X509_num(s->verified_chain) <= 1)
|
||||||
sk_X509_num(s->verified_chain) <= 1)
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
123
ssl/ssl_locl.h
123
ssl/ssl_locl.h
@ -164,8 +164,10 @@
|
|||||||
(c)[1]=(unsigned char)(((l)>> 8)&0xff), \
|
(c)[1]=(unsigned char)(((l)>> 8)&0xff), \
|
||||||
(c)[2]=(unsigned char)(((l) )&0xff)),(c)+=3)
|
(c)[2]=(unsigned char)(((l) )&0xff)),(c)+=3)
|
||||||
|
|
||||||
/* DTLS version numbers are strange because they're inverted. Except
|
/*
|
||||||
* for DTLS1_BAD_VER, which should be considered "lower" than the rest. */
|
* DTLS version numbers are strange because they're inverted. Except for
|
||||||
|
* DTLS1_BAD_VER, which should be considered "lower" than the rest.
|
||||||
|
*/
|
||||||
# define dtls_ver_ordinal(v1) (((v1) == DTLS1_BAD_VER) ? 0xff00 : (v1))
|
# define dtls_ver_ordinal(v1) (((v1) == DTLS1_BAD_VER) ? 0xff00 : (v1))
|
||||||
# define DTLS_VERSION_GT(v1, v2) (dtls_ver_ordinal(v1) < dtls_ver_ordinal(v2))
|
# define DTLS_VERSION_GT(v1, v2) (dtls_ver_ordinal(v1) < dtls_ver_ordinal(v2))
|
||||||
# define DTLS_VERSION_GE(v1, v2) (dtls_ver_ordinal(v1) <= dtls_ver_ordinal(v2))
|
# define DTLS_VERSION_GE(v1, v2) (dtls_ver_ordinal(v1) <= dtls_ver_ordinal(v2))
|
||||||
@ -407,7 +409,6 @@
|
|||||||
#define CERT_PRIVATE_KEY 2
|
#define CERT_PRIVATE_KEY 2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* CipherSuite length. SSLv3 and all TLS versions. */
|
/* CipherSuite length. SSLv3 and all TLS versions. */
|
||||||
# define TLS_CIPHER_LEN 2
|
# define TLS_CIPHER_LEN 2
|
||||||
/* used to hold info on the particular ciphers used */
|
/* used to hold info on the particular ciphers used */
|
||||||
@ -494,8 +495,8 @@ struct ssl_method_st {
|
|||||||
* I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
|
* I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
|
||||||
*/
|
*/
|
||||||
struct ssl_session_st {
|
struct ssl_session_st {
|
||||||
int ssl_version; /* what ssl version session info is being
|
int ssl_version; /* what ssl version session info is being kept
|
||||||
* kept in here? */
|
* in here? */
|
||||||
int master_key_length;
|
int master_key_length;
|
||||||
unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];
|
unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];
|
||||||
/* session_id - valid? */
|
/* session_id - valid? */
|
||||||
@ -533,8 +534,8 @@ struct ssl_session_st {
|
|||||||
long time;
|
long time;
|
||||||
unsigned int compress_meth; /* Need to lookup the method */
|
unsigned int compress_meth; /* Need to lookup the method */
|
||||||
const SSL_CIPHER *cipher;
|
const SSL_CIPHER *cipher;
|
||||||
unsigned long cipher_id; /* when ASN.1 loaded, this needs to be used
|
unsigned long cipher_id; /* when ASN.1 loaded, this needs to be used to
|
||||||
* to load the 'cipher' structure */
|
* load the 'cipher' structure */
|
||||||
STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */
|
STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */
|
||||||
CRYPTO_EX_DATA ex_data; /* application specific data */
|
CRYPTO_EX_DATA ex_data; /* application specific data */
|
||||||
/*
|
/*
|
||||||
@ -552,7 +553,8 @@ struct ssl_session_st {
|
|||||||
/* RFC4507 info */
|
/* RFC4507 info */
|
||||||
unsigned char *tlsext_tick; /* Session ticket */
|
unsigned char *tlsext_tick; /* Session ticket */
|
||||||
size_t tlsext_ticklen; /* Session ticket length */
|
size_t tlsext_ticklen; /* Session ticket length */
|
||||||
unsigned long tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */
|
unsigned long tlsext_tick_lifetime_hint; /* Session lifetime hint in
|
||||||
|
* seconds */
|
||||||
# ifndef OPENSSL_NO_SRP
|
# ifndef OPENSSL_NO_SRP
|
||||||
char *srp_username;
|
char *srp_username;
|
||||||
# endif
|
# endif
|
||||||
@ -563,7 +565,6 @@ struct ssl_session_st {
|
|||||||
/* Extended master secret support */
|
/* Extended master secret support */
|
||||||
# define SSL_SESS_FLAG_EXTMS 0x1
|
# define SSL_SESS_FLAG_EXTMS 0x1
|
||||||
|
|
||||||
|
|
||||||
# ifndef OPENSSL_NO_SRP
|
# ifndef OPENSSL_NO_SRP
|
||||||
|
|
||||||
typedef struct srp_ctx_st {
|
typedef struct srp_ctx_st {
|
||||||
@ -650,9 +651,9 @@ struct ssl_ctx_st {
|
|||||||
int sess_hit; /* session reuse actually done */
|
int sess_hit; /* session reuse actually done */
|
||||||
int sess_cb_hit; /* session-id that was not in the cache was
|
int sess_cb_hit; /* session-id that was not in the cache was
|
||||||
* passed back via the callback. This
|
* passed back via the callback. This
|
||||||
* indicates that the application is
|
* indicates that the application is supplying
|
||||||
* supplying session-id's from other
|
* session-id's from other processes - spooky
|
||||||
* processes - spooky :-) */
|
* :-) */
|
||||||
} stats;
|
} stats;
|
||||||
|
|
||||||
int references;
|
int references;
|
||||||
@ -774,8 +775,7 @@ struct ssl_ctx_st {
|
|||||||
/* Callback to support customisation of ticket key setting */
|
/* Callback to support customisation of ticket key setting */
|
||||||
int (*tlsext_ticket_key_cb) (SSL *ssl,
|
int (*tlsext_ticket_key_cb) (SSL *ssl,
|
||||||
unsigned char *name, unsigned char *iv,
|
unsigned char *name, unsigned char *iv,
|
||||||
EVP_CIPHER_CTX *ectx,
|
EVP_CIPHER_CTX *ectx, HMAC_CTX *hctx, int enc);
|
||||||
HMAC_CTX *hctx, int enc);
|
|
||||||
|
|
||||||
/* certificate status request info */
|
/* certificate status request info */
|
||||||
/* Callback for status request */
|
/* Callback for status request */
|
||||||
@ -871,14 +871,12 @@ struct ssl_ctx_st {
|
|||||||
CRYPTO_RWLOCK *lock;
|
CRYPTO_RWLOCK *lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ssl_st {
|
struct ssl_st {
|
||||||
/*
|
/*
|
||||||
* protocol version (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION,
|
* protocol version (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION,
|
||||||
* DTLS1_VERSION)
|
* DTLS1_VERSION)
|
||||||
*/
|
*/
|
||||||
int version;
|
int version;
|
||||||
|
|
||||||
/* SSLv3 */
|
/* SSLv3 */
|
||||||
const SSL_METHOD *method;
|
const SSL_METHOD *method;
|
||||||
/*
|
/*
|
||||||
@ -897,7 +895,6 @@ struct ssl_st {
|
|||||||
* request needs re-doing when in SSL_accept or SSL_connect
|
* request needs re-doing when in SSL_accept or SSL_connect
|
||||||
*/
|
*/
|
||||||
int rwstate;
|
int rwstate;
|
||||||
|
|
||||||
int (*handshake_func) (SSL *);
|
int (*handshake_func) (SSL *);
|
||||||
/*
|
/*
|
||||||
* Imagine that here's a boolean member "init" that is switched as soon
|
* Imagine that here's a boolean member "init" that is switched as soon
|
||||||
@ -921,26 +918,21 @@ struct ssl_st {
|
|||||||
int shutdown;
|
int shutdown;
|
||||||
/* where we are */
|
/* where we are */
|
||||||
OSSL_STATEM statem;
|
OSSL_STATEM statem;
|
||||||
|
|
||||||
BUF_MEM *init_buf; /* buffer used during init */
|
BUF_MEM *init_buf; /* buffer used during init */
|
||||||
void *init_msg; /* pointer to handshake message body, set by
|
void *init_msg; /* pointer to handshake message body, set by
|
||||||
* ssl3_get_message() */
|
* ssl3_get_message() */
|
||||||
int init_num; /* amount read/written */
|
int init_num; /* amount read/written */
|
||||||
int init_off; /* amount read/written */
|
int init_off; /* amount read/written */
|
||||||
|
|
||||||
struct ssl3_state_st *s3; /* SSLv3 variables */
|
struct ssl3_state_st *s3; /* SSLv3 variables */
|
||||||
struct dtls1_state_st *d1; /* DTLSv1 variables */
|
struct dtls1_state_st *d1; /* DTLSv1 variables */
|
||||||
|
|
||||||
/* callback that allows applications to peek at protocol messages */
|
/* callback that allows applications to peek at protocol messages */
|
||||||
void (*msg_callback) (int write_p, int version, int content_type,
|
void (*msg_callback) (int write_p, int version, int content_type,
|
||||||
const void *buf, size_t len, SSL *ssl, void *arg);
|
const void *buf, size_t len, SSL *ssl, void *arg);
|
||||||
void *msg_callback_arg;
|
void *msg_callback_arg;
|
||||||
int hit; /* reusing a previous session */
|
int hit; /* reusing a previous session */
|
||||||
X509_VERIFY_PARAM *param;
|
X509_VERIFY_PARAM *param;
|
||||||
|
|
||||||
/* Per connection DANE state */
|
/* Per connection DANE state */
|
||||||
SSL_DANE dane;
|
SSL_DANE dane;
|
||||||
|
|
||||||
/* crypto */
|
/* crypto */
|
||||||
STACK_OF(SSL_CIPHER) *cipher_list;
|
STACK_OF(SSL_CIPHER) *cipher_list;
|
||||||
STACK_OF(SSL_CIPHER) *cipher_list_by_id;
|
STACK_OF(SSL_CIPHER) *cipher_list_by_id;
|
||||||
@ -1012,7 +1004,6 @@ struct ssl_st {
|
|||||||
int first_packet;
|
int first_packet;
|
||||||
/* what was passed, used for SSLv3/TLS rollback check */
|
/* what was passed, used for SSLv3/TLS rollback check */
|
||||||
int client_version;
|
int client_version;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're using more than one pipeline how should we divide the data
|
* If we're using more than one pipeline how should we divide the data
|
||||||
* up between the pipes?
|
* up between the pipes?
|
||||||
@ -1023,10 +1014,8 @@ struct ssl_st {
|
|||||||
* be more than this due to padding and MAC overheads.
|
* be more than this due to padding and MAC overheads.
|
||||||
*/
|
*/
|
||||||
unsigned int max_send_fragment;
|
unsigned int max_send_fragment;
|
||||||
|
|
||||||
/* Up to how many pipelines should we use? If 0 then 1 is assumed */
|
/* Up to how many pipelines should we use? If 0 then 1 is assumed */
|
||||||
unsigned int max_pipelines;
|
unsigned int max_pipelines;
|
||||||
|
|
||||||
/* TLS extension debug callback */
|
/* TLS extension debug callback */
|
||||||
void (*tlsext_debug_cb) (SSL *s, int client_server, int type,
|
void (*tlsext_debug_cb) (SSL *s, int client_server, int type,
|
||||||
const unsigned char *data, int len, void *arg);
|
const unsigned char *data, int len, void *arg);
|
||||||
@ -1122,7 +1111,6 @@ struct ssl_st {
|
|||||||
*/
|
*/
|
||||||
unsigned char *alpn_client_proto_list;
|
unsigned char *alpn_client_proto_list;
|
||||||
unsigned alpn_client_proto_list_len;
|
unsigned alpn_client_proto_list_len;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* 1 if we are renegotiating.
|
* 1 if we are renegotiating.
|
||||||
* 2 if we are a server and are inside a handshake
|
* 2 if we are a server and are inside a handshake
|
||||||
@ -1138,23 +1126,17 @@ struct ssl_st {
|
|||||||
* basis, depending on the chosen cipher.
|
* basis, depending on the chosen cipher.
|
||||||
*/
|
*/
|
||||||
int (*not_resumable_session_cb) (SSL *ssl, int is_forward_secure);
|
int (*not_resumable_session_cb) (SSL *ssl, int is_forward_secure);
|
||||||
|
|
||||||
RECORD_LAYER rlayer;
|
RECORD_LAYER rlayer;
|
||||||
|
|
||||||
/* Default password callback. */
|
/* Default password callback. */
|
||||||
pem_password_cb *default_passwd_callback;
|
pem_password_cb *default_passwd_callback;
|
||||||
|
|
||||||
/* Default password callback user data. */
|
/* Default password callback user data. */
|
||||||
void *default_passwd_callback_userdata;
|
void *default_passwd_callback_userdata;
|
||||||
|
|
||||||
/* Async Job info */
|
/* Async Job info */
|
||||||
ASYNC_JOB *job;
|
ASYNC_JOB *job;
|
||||||
ASYNC_WAIT_CTX *waitctx;
|
ASYNC_WAIT_CTX *waitctx;
|
||||||
|
|
||||||
CRYPTO_RWLOCK *lock;
|
CRYPTO_RWLOCK *lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct ssl3_state_st {
|
typedef struct ssl3_state_st {
|
||||||
long flags;
|
long flags;
|
||||||
int read_mac_secret_size;
|
int read_mac_secret_size;
|
||||||
@ -1318,7 +1300,6 @@ typedef struct ssl3_state_st {
|
|||||||
|
|
||||||
} SSL3_STATE;
|
} SSL3_STATE;
|
||||||
|
|
||||||
|
|
||||||
/* DTLS structures */
|
/* DTLS structures */
|
||||||
|
|
||||||
# ifndef OPENSSL_NO_SCTP
|
# ifndef OPENSSL_NO_SCTP
|
||||||
@ -1394,17 +1375,14 @@ typedef struct dtls1_state_st {
|
|||||||
unsigned char cookie[DTLS1_COOKIE_LENGTH];
|
unsigned char cookie[DTLS1_COOKIE_LENGTH];
|
||||||
unsigned int cookie_len;
|
unsigned int cookie_len;
|
||||||
unsigned int cookie_verified;
|
unsigned int cookie_verified;
|
||||||
|
|
||||||
/* handshake message numbers */
|
/* handshake message numbers */
|
||||||
unsigned short handshake_write_seq;
|
unsigned short handshake_write_seq;
|
||||||
unsigned short next_handshake_write_seq;
|
unsigned short next_handshake_write_seq;
|
||||||
unsigned short handshake_read_seq;
|
unsigned short handshake_read_seq;
|
||||||
|
|
||||||
/* Buffered handshake messages */
|
/* Buffered handshake messages */
|
||||||
pqueue *buffered_messages;
|
pqueue *buffered_messages;
|
||||||
/* Buffered (sent) handshake records */
|
/* Buffered (sent) handshake records */
|
||||||
pqueue *sent_messages;
|
pqueue *sent_messages;
|
||||||
|
|
||||||
unsigned int link_mtu; /* max on-the-wire DTLS packet size */
|
unsigned int link_mtu; /* max on-the-wire DTLS packet size */
|
||||||
unsigned int mtu; /* max DTLS packet size */
|
unsigned int mtu; /* max DTLS packet size */
|
||||||
struct hm_header_st w_msg_hdr;
|
struct hm_header_st w_msg_hdr;
|
||||||
@ -1416,15 +1394,12 @@ typedef struct dtls1_state_st {
|
|||||||
struct timeval next_timeout;
|
struct timeval next_timeout;
|
||||||
/* Timeout duration */
|
/* Timeout duration */
|
||||||
unsigned short timeout_duration;
|
unsigned short timeout_duration;
|
||||||
|
|
||||||
unsigned int retransmitting;
|
unsigned int retransmitting;
|
||||||
# ifndef OPENSSL_NO_SCTP
|
# ifndef OPENSSL_NO_SCTP
|
||||||
int shutdown_received;
|
int shutdown_received;
|
||||||
# endif
|
# endif
|
||||||
} DTLS1_STATE;
|
} DTLS1_STATE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ifndef OPENSSL_NO_EC
|
# ifndef OPENSSL_NO_EC
|
||||||
/*
|
/*
|
||||||
* From ECC-TLS draft, used in encoding the curve type in ECParameters
|
* From ECC-TLS draft, used in encoding the curve type in ECParameters
|
||||||
@ -1439,7 +1414,6 @@ typedef struct cert_pkey_st {
|
|||||||
EVP_PKEY *privatekey;
|
EVP_PKEY *privatekey;
|
||||||
/* Chain for this certificate */
|
/* Chain for this certificate */
|
||||||
STACK_OF(X509) *chain;
|
STACK_OF(X509) *chain;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* serverinfo data for this certificate. The data is in TLS Extension
|
* serverinfo data for this certificate. The data is in TLS Extension
|
||||||
* wire format, specifically it's a series of records like:
|
* wire format, specifically it's a series of records like:
|
||||||
@ -1825,14 +1799,18 @@ __owur int ssl_cipher_ptr_id_cmp(const SSL_CIPHER *const *ap,
|
|||||||
const SSL_CIPHER *const *bp);
|
const SSL_CIPHER *const *bp);
|
||||||
__owur STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
|
__owur STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
|
||||||
STACK_OF(SSL_CIPHER) **pref,
|
STACK_OF(SSL_CIPHER) **pref,
|
||||||
STACK_OF(SSL_CIPHER) **sorted,
|
STACK_OF(SSL_CIPHER)
|
||||||
const char *rule_str, CERT *c);
|
**sorted,
|
||||||
|
const char *rule_str,
|
||||||
|
CERT *c);
|
||||||
void ssl_update_cache(SSL *s, int mode);
|
void ssl_update_cache(SSL *s, int mode);
|
||||||
__owur int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
|
__owur int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
|
||||||
const EVP_MD **md, int *mac_pkey_type,
|
const EVP_MD **md, int *mac_pkey_type,
|
||||||
int *mac_secret_size, SSL_COMP **comp, int use_etm);
|
int *mac_secret_size, SSL_COMP **comp,
|
||||||
|
int use_etm);
|
||||||
__owur int ssl_cipher_get_cert_index(const SSL_CIPHER *c);
|
__owur int ssl_cipher_get_cert_index(const SSL_CIPHER *c);
|
||||||
__owur const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr);
|
__owur const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl,
|
||||||
|
const unsigned char *ptr);
|
||||||
__owur int ssl_cert_set0_chain(SSL *s, SSL_CTX *ctx, STACK_OF(X509) *chain);
|
__owur int ssl_cert_set0_chain(SSL *s, SSL_CTX *ctx, STACK_OF(X509) *chain);
|
||||||
__owur int ssl_cert_set1_chain(SSL *s, SSL_CTX *ctx, STACK_OF(X509) *chain);
|
__owur int ssl_cert_set1_chain(SSL *s, SSL_CTX *ctx, STACK_OF(X509) *chain);
|
||||||
__owur int ssl_cert_add0_chain_cert(SSL *s, SSL_CTX *ctx, X509 *x);
|
__owur int ssl_cert_add0_chain_cert(SSL *s, SSL_CTX *ctx, X509 *x);
|
||||||
@ -1840,31 +1818,35 @@ __owur int ssl_cert_add1_chain_cert(SSL *s, SSL_CTX *ctx, X509 *x);
|
|||||||
__owur int ssl_cert_select_current(CERT *c, X509 *x);
|
__owur int ssl_cert_select_current(CERT *c, X509 *x);
|
||||||
__owur int ssl_cert_set_current(CERT *c, long arg);
|
__owur int ssl_cert_set_current(CERT *c, long arg);
|
||||||
__owur X509 *ssl_cert_get0_next_certificate(CERT *c, int first);
|
__owur X509 *ssl_cert_get0_next_certificate(CERT *c, int first);
|
||||||
void ssl_cert_set_cert_cb(CERT *c, int (*cb) (SSL *ssl, void *arg),
|
void ssl_cert_set_cert_cb(CERT *c, int (*cb) (SSL *ssl, void *arg), void *arg);
|
||||||
void *arg);
|
|
||||||
|
|
||||||
__owur int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk);
|
__owur int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk);
|
||||||
__owur int ssl_add_cert_chain(SSL *s, CERT_PKEY *cpk, unsigned long *l);
|
__owur int ssl_add_cert_chain(SSL *s, CERT_PKEY *cpk, unsigned long *l);
|
||||||
__owur int ssl_build_cert_chain(SSL *s, SSL_CTX *ctx, int flags);
|
__owur int ssl_build_cert_chain(SSL *s, SSL_CTX *ctx, int flags);
|
||||||
__owur int ssl_cert_set_cert_store(CERT *c, X509_STORE *store, int chain, int ref);
|
__owur int ssl_cert_set_cert_store(CERT *c, X509_STORE *store, int chain,
|
||||||
|
int ref);
|
||||||
|
|
||||||
__owur int ssl_security(const SSL *s, int op, int bits, int nid, void *other);
|
__owur int ssl_security(const SSL *s, int op, int bits, int nid, void *other);
|
||||||
__owur int ssl_ctx_security(const SSL_CTX *ctx, int op, int bits, int nid, void *other);
|
__owur int ssl_ctx_security(const SSL_CTX *ctx, int op, int bits, int nid,
|
||||||
|
void *other);
|
||||||
|
|
||||||
int ssl_undefined_function(SSL *s);
|
int ssl_undefined_function(SSL *s);
|
||||||
__owur int ssl_undefined_void_function(void);
|
__owur int ssl_undefined_void_function(void);
|
||||||
__owur int ssl_undefined_const_function(const SSL *s);
|
__owur int ssl_undefined_const_function(const SSL *s);
|
||||||
__owur CERT_PKEY *ssl_get_server_send_pkey(SSL *s);
|
__owur CERT_PKEY *ssl_get_server_send_pkey(SSL *s);
|
||||||
__owur int ssl_get_server_cert_serverinfo(SSL *s, const unsigned char **serverinfo,
|
__owur int ssl_get_server_cert_serverinfo(SSL *s,
|
||||||
|
const unsigned char **serverinfo,
|
||||||
size_t *serverinfo_length);
|
size_t *serverinfo_length);
|
||||||
__owur EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *c, const EVP_MD **pmd);
|
__owur EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *c,
|
||||||
|
const EVP_MD **pmd);
|
||||||
__owur int ssl_cert_type(const X509 *x, const EVP_PKEY *pkey);
|
__owur int ssl_cert_type(const X509 *x, const EVP_PKEY *pkey);
|
||||||
void ssl_set_masks(SSL *s);
|
void ssl_set_masks(SSL *s);
|
||||||
__owur STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s);
|
__owur STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s);
|
||||||
__owur int ssl_verify_alarm_type(long type);
|
__owur int ssl_verify_alarm_type(long type);
|
||||||
void ssl_sort_cipher_list(void);
|
void ssl_sort_cipher_list(void);
|
||||||
void ssl_load_ciphers(void);
|
void ssl_load_ciphers(void);
|
||||||
__owur int ssl_fill_hello_random(SSL *s, int server, unsigned char *field, int len);
|
__owur int ssl_fill_hello_random(SSL *s, int server, unsigned char *field,
|
||||||
|
int len);
|
||||||
__owur int ssl_generate_master_secret(SSL *s, unsigned char *pms, size_t pmslen,
|
__owur int ssl_generate_master_secret(SSL *s, unsigned char *pms, size_t pmslen,
|
||||||
int free_pms);
|
int free_pms);
|
||||||
__owur EVP_PKEY *ssl_generate_pkey(EVP_PKEY *pm);
|
__owur EVP_PKEY *ssl_generate_pkey(EVP_PKEY *pm);
|
||||||
@ -1923,17 +1905,18 @@ __owur int ssl_check_version_downgrade(SSL *s);
|
|||||||
__owur int ssl_set_version_bound(int method_version, int version, int *bound);
|
__owur int ssl_set_version_bound(int method_version, int version, int *bound);
|
||||||
__owur int ssl_choose_server_version(SSL *s);
|
__owur int ssl_choose_server_version(SSL *s);
|
||||||
__owur int ssl_choose_client_version(SSL *s, int version);
|
__owur int ssl_choose_client_version(SSL *s, int version);
|
||||||
int ssl_get_client_min_max_version(const SSL *s, int *min_version, int *max_version);
|
int ssl_get_client_min_max_version(const SSL *s, int *min_version,
|
||||||
|
int *max_version);
|
||||||
|
|
||||||
__owur long tls1_default_timeout(void);
|
__owur long tls1_default_timeout(void);
|
||||||
__owur int dtls1_do_write(SSL *s, int type);
|
__owur int dtls1_do_write(SSL *s, int type);
|
||||||
void dtls1_set_message_header(SSL *s,
|
void dtls1_set_message_header(SSL *s,
|
||||||
unsigned char mt,
|
unsigned char mt,
|
||||||
unsigned long len,
|
unsigned long len,
|
||||||
unsigned long frag_off,
|
unsigned long frag_off, unsigned long frag_len);
|
||||||
unsigned long frag_len);
|
|
||||||
|
|
||||||
__owur int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len);
|
__owur int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf,
|
||||||
|
int len);
|
||||||
|
|
||||||
__owur int dtls1_read_failed(SSL *s, int code);
|
__owur int dtls1_read_failed(SSL *s, int code);
|
||||||
__owur int dtls1_buffer_message(SSL *s, int ccs);
|
__owur int dtls1_buffer_message(SSL *s, int ccs);
|
||||||
@ -2032,7 +2015,8 @@ __owur int ssl_prepare_serverhello_tlsext(SSL *s);
|
|||||||
|
|
||||||
# ifndef OPENSSL_NO_HEARTBEATS
|
# ifndef OPENSSL_NO_HEARTBEATS
|
||||||
__owur int dtls1_heartbeat(SSL *s);
|
__owur int dtls1_heartbeat(SSL *s);
|
||||||
__owur int dtls1_process_heartbeat(SSL *s, unsigned char *p, unsigned int length);
|
__owur int dtls1_process_heartbeat(SSL *s, unsigned char *p,
|
||||||
|
unsigned int length);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
__owur int tls_check_serverhello_tlsext_early(SSL *s, const PACKET *ext,
|
__owur int tls_check_serverhello_tlsext_early(SSL *s, const PACKET *ext,
|
||||||
@ -2046,7 +2030,8 @@ __owur const EVP_MD *tls12_get_hash(unsigned char hash_alg);
|
|||||||
void ssl_set_sig_mask(uint32_t *pmask_a, SSL *s, int op);
|
void ssl_set_sig_mask(uint32_t *pmask_a, SSL *s, int op);
|
||||||
|
|
||||||
__owur int tls1_set_sigalgs_list(CERT *c, const char *str, int client);
|
__owur int tls1_set_sigalgs_list(CERT *c, const char *str, int client);
|
||||||
__owur int tls1_set_sigalgs(CERT *c, const int *salg, size_t salglen, int client);
|
__owur int tls1_set_sigalgs(CERT *c, const int *salg, size_t salglen,
|
||||||
|
int client);
|
||||||
int tls1_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain,
|
int tls1_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain,
|
||||||
int idx);
|
int idx);
|
||||||
void tls1_set_cert_validity(SSL *s);
|
void tls1_set_cert_validity(SSL *s);
|
||||||
@ -2060,16 +2045,16 @@ __owur DH *ssl_get_auto_dh(SSL *s);
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
__owur int ssl_security_cert(SSL *s, SSL_CTX *ctx, X509 *x, int vfy, int is_ee);
|
__owur int ssl_security_cert(SSL *s, SSL_CTX *ctx, X509 *x, int vfy, int is_ee);
|
||||||
__owur int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *ex, int vfy);
|
__owur int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *ex,
|
||||||
|
int vfy);
|
||||||
|
|
||||||
__owur EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md);
|
__owur EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md);
|
||||||
void ssl_clear_hash_ctx(EVP_MD_CTX **hash);
|
void ssl_clear_hash_ctx(EVP_MD_CTX **hash);
|
||||||
__owur int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p, int *len,
|
__owur int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p,
|
||||||
int maxlen);
|
int *len, int maxlen);
|
||||||
__owur int ssl_parse_serverhello_renegotiate_ext(SSL *s, PACKET *pkt,
|
__owur int ssl_parse_serverhello_renegotiate_ext(SSL *s, PACKET *pkt, int *al);
|
||||||
int *al);
|
__owur int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p,
|
||||||
__owur int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p, int *len,
|
int *len, int maxlen);
|
||||||
int maxlen);
|
|
||||||
__owur int ssl_parse_clienthello_renegotiate_ext(SSL *s, PACKET *pkt, int *al);
|
__owur int ssl_parse_clienthello_renegotiate_ext(SSL *s, PACKET *pkt, int *al);
|
||||||
__owur long ssl_get_algorithm2(SSL *s);
|
__owur long ssl_get_algorithm2(SSL *s);
|
||||||
__owur size_t tls12_copy_sigalgs(SSL *s, unsigned char *out,
|
__owur size_t tls12_copy_sigalgs(SSL *s, unsigned char *out,
|
||||||
@ -2120,11 +2105,13 @@ void custom_ext_init(custom_ext_methods *meths);
|
|||||||
|
|
||||||
__owur int custom_ext_parse(SSL *s, int server,
|
__owur int custom_ext_parse(SSL *s, int server,
|
||||||
unsigned int ext_type,
|
unsigned int ext_type,
|
||||||
const unsigned char *ext_data, size_t ext_size, int *al);
|
const unsigned char *ext_data, size_t ext_size,
|
||||||
__owur int custom_ext_add(SSL *s, int server,
|
int *al);
|
||||||
unsigned char **pret, unsigned char *limit, int *al);
|
__owur int custom_ext_add(SSL *s, int server, unsigned char **pret,
|
||||||
|
unsigned char *limit, int *al);
|
||||||
|
|
||||||
__owur int custom_exts_copy(custom_ext_methods *dst, const custom_ext_methods *src);
|
__owur int custom_exts_copy(custom_ext_methods *dst,
|
||||||
|
const custom_ext_methods *src);
|
||||||
void custom_exts_free(custom_ext_methods *exts);
|
void custom_exts_free(custom_ext_methods *exts);
|
||||||
|
|
||||||
void ssl_comp_free_compression_methods_int(void);
|
void ssl_comp_free_compression_methods_int(void);
|
||||||
|
@ -77,7 +77,8 @@ static int ssl_module_init(CONF_IMODULE *md, const CONF *cnf)
|
|||||||
STACK_OF(CONF_VALUE) *cmds = NCONF_get_section(cnf, sect->value);
|
STACK_OF(CONF_VALUE) *cmds = NCONF_get_section(cnf, sect->value);
|
||||||
if (sk_CONF_VALUE_num(cmds) <= 0) {
|
if (sk_CONF_VALUE_num(cmds) <= 0) {
|
||||||
if (cmds == NULL)
|
if (cmds == NULL)
|
||||||
SSLerr(SSL_F_SSL_MODULE_INIT, SSL_R_SSL_COMMAND_SECTION_NOT_FOUND);
|
SSLerr(SSL_F_SSL_MODULE_INIT,
|
||||||
|
SSL_R_SSL_COMMAND_SECTION_NOT_FOUND);
|
||||||
else
|
else
|
||||||
SSLerr(SSL_F_SSL_MODULE_INIT, SSL_R_SSL_COMMAND_SECTION_EMPTY);
|
SSLerr(SSL_F_SSL_MODULE_INIT, SSL_R_SSL_COMMAND_SECTION_EMPTY);
|
||||||
ERR_add_error_data(4, "name=", sect->name, ", value=", sect->value);
|
ERR_add_error_data(4, "name=", sect->name, ", value=", sect->value);
|
||||||
|
@ -410,8 +410,7 @@ int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len,
|
int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d)
|
||||||
const unsigned char *d)
|
|
||||||
{
|
{
|
||||||
X509 *x;
|
X509 *x;
|
||||||
int ret;
|
int ret;
|
||||||
@ -892,8 +891,7 @@ int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
|
|||||||
size_t num_extensions = 0;
|
size_t num_extensions = 0;
|
||||||
|
|
||||||
if (ctx == NULL || file == NULL) {
|
if (ctx == NULL || file == NULL) {
|
||||||
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE,
|
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, ERR_R_PASSED_NULL_PARAMETER);
|
||||||
ERR_R_PASSED_NULL_PARAMETER);
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -922,8 +920,7 @@ int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
|
|||||||
}
|
}
|
||||||
/* Check that PEM name starts with "BEGIN SERVERINFO FOR " */
|
/* Check that PEM name starts with "BEGIN SERVERINFO FOR " */
|
||||||
if (strlen(name) < strlen(namePrefix)) {
|
if (strlen(name) < strlen(namePrefix)) {
|
||||||
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE,
|
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, SSL_R_PEM_NAME_TOO_SHORT);
|
||||||
SSL_R_PEM_NAME_TOO_SHORT);
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (strncmp(name, namePrefix, strlen(namePrefix)) != 0) {
|
if (strncmp(name, namePrefix, strlen(namePrefix)) != 0) {
|
||||||
@ -940,8 +937,7 @@ int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
/* Append the decoded extension to the serverinfo buffer */
|
/* Append the decoded extension to the serverinfo buffer */
|
||||||
tmp =
|
tmp = OPENSSL_realloc(serverinfo, serverinfo_length + extension_length);
|
||||||
OPENSSL_realloc(serverinfo, serverinfo_length + extension_length);
|
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, ERR_R_MALLOC_FAILURE);
|
||||||
goto end;
|
goto end;
|
||||||
|
@ -158,7 +158,6 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket)
|
|||||||
if (dest->peer_chain == NULL)
|
if (dest->peer_chain == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_PSK
|
#ifndef OPENSSL_NO_PSK
|
||||||
if (src->psk_identity_hint) {
|
if (src->psk_identity_hint) {
|
||||||
dest->psk_identity_hint = OPENSSL_strdup(src->psk_identity_hint);
|
dest->psk_identity_hint = OPENSSL_strdup(src->psk_identity_hint);
|
||||||
@ -209,7 +208,8 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ticket != 0) {
|
if (ticket != 0) {
|
||||||
dest->tlsext_tick = OPENSSL_memdup(src->tlsext_tick, src->tlsext_ticklen);
|
dest->tlsext_tick =
|
||||||
|
OPENSSL_memdup(src->tlsext_tick, src->tlsext_ticklen);
|
||||||
if (dest->tlsext_tick == NULL)
|
if (dest->tlsext_tick == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
} else {
|
} else {
|
||||||
@ -233,8 +233,7 @@ err:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,
|
const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len)
|
||||||
unsigned int *len)
|
|
||||||
{
|
{
|
||||||
if (len)
|
if (len)
|
||||||
*len = s->session_id_length;
|
*len = s->session_id_length;
|
||||||
@ -481,8 +480,7 @@ int ssl_get_prev_session(SSL *s, const PACKET *ext, const PACKET *session_id)
|
|||||||
data.ssl_version = s->version;
|
data.ssl_version = s->version;
|
||||||
memset(data.session_id, 0, sizeof(data.session_id));
|
memset(data.session_id, 0, sizeof(data.session_id));
|
||||||
if (!PACKET_copy_all(session_id, data.session_id,
|
if (!PACKET_copy_all(session_id, data.session_id,
|
||||||
sizeof(data.session_id),
|
sizeof(data.session_id), &local_len)) {
|
||||||
&local_len)) {
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
data.session_id_length = local_len;
|
data.session_id_length = local_len;
|
||||||
@ -684,8 +682,7 @@ int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c)
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
||||||
if (SSL_CTX_sess_get_cache_size(ctx) > 0) {
|
if (SSL_CTX_sess_get_cache_size(ctx) > 0) {
|
||||||
while (SSL_CTX_sess_number(ctx) >
|
while (SSL_CTX_sess_number(ctx) > SSL_CTX_sess_get_cache_size(ctx)) {
|
||||||
SSL_CTX_sess_get_cache_size(ctx)) {
|
|
||||||
if (!remove_session_lock(ctx, ctx->session_cache_tail, 0))
|
if (!remove_session_lock(ctx, ctx->session_cache_tail, 0))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
@ -1068,8 +1065,7 @@ static void SSL_SESSION_list_add(SSL_CTX *ctx, SSL_SESSION *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,
|
void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,
|
||||||
int (*cb) (struct ssl_st *ssl,
|
int (*cb) (struct ssl_st *ssl, SSL_SESSION *sess))
|
||||||
SSL_SESSION *sess))
|
|
||||||
{
|
{
|
||||||
ctx->new_session_cb = cb;
|
ctx->new_session_cb = cb;
|
||||||
}
|
}
|
||||||
@ -1098,8 +1094,9 @@ void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (SSL *ssl,
|
SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (SSL *ssl,
|
||||||
const unsigned char *data,
|
const unsigned char
|
||||||
int len, int *copy) {
|
*data, int len,
|
||||||
|
int *copy) {
|
||||||
return ctx->get_session_cb;
|
return ctx->get_session_cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,11 +1150,11 @@ void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
|
void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
|
||||||
int (*cb) (SSL *ssl, const unsigned char *cookie,
|
int (*cb) (SSL *ssl,
|
||||||
|
const unsigned char *cookie,
|
||||||
unsigned int cookie_len))
|
unsigned int cookie_len))
|
||||||
{
|
{
|
||||||
ctx->app_verify_cookie_cb = cb;
|
ctx->app_verify_cookie_cb = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPLEMENT_PEM_rw(SSL_SESSION, SSL_SESSION, PEM_STRING_SSL_SESSION,
|
IMPLEMENT_PEM_rw(SSL_SESSION, SSL_SESSION, PEM_STRING_SSL_SESSION, SSL_SESSION)
|
||||||
SSL_SESSION)
|
|
||||||
|
@ -110,7 +110,6 @@ const char *SSL_state_string_long(const SSL *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *SSL_state_string(const SSL *s)
|
const char *SSL_state_string(const SSL *s)
|
||||||
{
|
{
|
||||||
if (ossl_statem_in_error(s))
|
if (ossl_statem_in_error(s))
|
||||||
|
@ -128,11 +128,11 @@ int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x)
|
|||||||
if (x->tlsext_tick) {
|
if (x->tlsext_tick) {
|
||||||
if (BIO_puts(bp, "\n TLS session ticket:\n") <= 0)
|
if (BIO_puts(bp, "\n TLS session ticket:\n") <= 0)
|
||||||
goto err;
|
goto err;
|
||||||
if (BIO_dump_indent(bp, (const char *)x->tlsext_tick, x->tlsext_ticklen, 4)
|
if (BIO_dump_indent
|
||||||
|
(bp, (const char *)x->tlsext_tick, x->tlsext_ticklen, 4)
|
||||||
<= 0)
|
<= 0)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_COMP
|
#ifndef OPENSSL_NO_COMP
|
||||||
if (x->compress_meth != 0) {
|
if (x->compress_meth != 0) {
|
||||||
SSL_COMP *comp = NULL;
|
SSL_COMP *comp = NULL;
|
||||||
@ -140,8 +140,7 @@ int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x)
|
|||||||
if (!ssl_cipher_get_evp(x, NULL, NULL, NULL, NULL, &comp, 0))
|
if (!ssl_cipher_get_evp(x, NULL, NULL, NULL, NULL, &comp, 0))
|
||||||
goto err;
|
goto err;
|
||||||
if (comp == NULL) {
|
if (comp == NULL) {
|
||||||
if (BIO_printf(bp, "\n Compression: %d", x->compress_meth) <=
|
if (BIO_printf(bp, "\n Compression: %d", x->compress_meth) <= 0)
|
||||||
0)
|
|
||||||
goto err;
|
goto err;
|
||||||
} else {
|
} else {
|
||||||
if (BIO_printf(bp, "\n Compression: %d (%s)", comp->id,
|
if (BIO_printf(bp, "\n Compression: %d (%s)", comp->id,
|
||||||
|
@ -165,7 +165,8 @@ void ossl_statem_set_hello_verify_done(SSL *s)
|
|||||||
s->statem.hand_state = TLS_ST_SR_CLNT_HELLO;
|
s->statem.hand_state = TLS_ST_SR_CLNT_HELLO;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ossl_statem_connect(SSL *s) {
|
int ossl_statem_connect(SSL *s)
|
||||||
|
{
|
||||||
return state_machine(s, 0);
|
return state_machine(s, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +175,9 @@ int ossl_statem_accept(SSL *s)
|
|||||||
return state_machine(s, 1);
|
return state_machine(s, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void (*get_callback(SSL *s))(const SSL *, int, int)
|
typedef void (*info_cb) (const SSL *, int, int);
|
||||||
|
|
||||||
|
static info_cb get_callback(SSL *s)
|
||||||
{
|
{
|
||||||
if (s->info_callback != NULL)
|
if (s->info_callback != NULL)
|
||||||
return s->info_callback;
|
return s->info_callback;
|
||||||
@ -237,7 +240,6 @@ static int state_machine(SSL *s, int server)
|
|||||||
if (!SSL_clear(s))
|
if (!SSL_clear(s))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SCTP
|
#ifndef OPENSSL_NO_SCTP
|
||||||
if (SSL_IS_DTLS(s)) {
|
if (SSL_IS_DTLS(s)) {
|
||||||
/*
|
/*
|
||||||
@ -282,8 +284,7 @@ static int state_machine(SSL *s, int server)
|
|||||||
|
|
||||||
if (SSL_IS_DTLS(s)) {
|
if (SSL_IS_DTLS(s)) {
|
||||||
if ((s->version & 0xff00) != (DTLS1_VERSION & 0xff00) &&
|
if ((s->version & 0xff00) != (DTLS1_VERSION & 0xff00) &&
|
||||||
(server
|
(server || (s->version & 0xff00) != (DTLS1_BAD_VER & 0xff00))) {
|
||||||
|| (s->version & 0xff00) != (DTLS1_BAD_VER & 0xff00))) {
|
|
||||||
SSLerr(SSL_F_STATE_MACHINE, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_STATE_MACHINE, ERR_R_INTERNAL_ERROR);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -320,7 +321,6 @@ static int state_machine(SSL *s, int server)
|
|||||||
*/
|
*/
|
||||||
s->s3->change_cipher_spec = 0;
|
s->s3->change_cipher_spec = 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ok, we now need to push on a buffering BIO ...but not with
|
* Ok, we now need to push on a buffering BIO ...but not with
|
||||||
* SCTP
|
* SCTP
|
||||||
@ -471,7 +471,8 @@ static void init_read_state_machine(SSL *s)
|
|||||||
* control returns to the calling application. When this function is recalled we
|
* control returns to the calling application. When this function is recalled we
|
||||||
* will resume in the same state where we left off.
|
* will resume in the same state where we left off.
|
||||||
*/
|
*/
|
||||||
static SUB_STATE_RETURN read_state_machine(SSL *s) {
|
static SUB_STATE_RETURN read_state_machine(SSL *s)
|
||||||
|
{
|
||||||
OSSL_STATEM *st = &s->statem;
|
OSSL_STATEM *st = &s->statem;
|
||||||
int ret, mt;
|
int ret, mt;
|
||||||
unsigned long len = 0;
|
unsigned long len = 0;
|
||||||
|
@ -71,7 +71,6 @@ typedef enum {
|
|||||||
WRITE_STATE_POST_WORK
|
WRITE_STATE_POST_WORK
|
||||||
} WRITE_STATE;
|
} WRITE_STATE;
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* *
|
* *
|
||||||
* This structure should be considered "opaque" to anything outside of the *
|
* This structure should be considered "opaque" to anything outside of the *
|
||||||
@ -89,13 +88,10 @@ struct ossl_statem_st {
|
|||||||
OSSL_HANDSHAKE_STATE hand_state;
|
OSSL_HANDSHAKE_STATE hand_state;
|
||||||
int in_init;
|
int in_init;
|
||||||
int read_state_first_init;
|
int read_state_first_init;
|
||||||
|
|
||||||
/* true when we are actually in SSL_accept() or SSL_connect() */
|
/* true when we are actually in SSL_accept() or SSL_connect() */
|
||||||
int in_handshake;
|
int in_handshake;
|
||||||
|
|
||||||
/* Should we skip the CertificateVerify message? */
|
/* Should we skip the CertificateVerify message? */
|
||||||
unsigned int no_cert_verify;
|
unsigned int no_cert_verify;
|
||||||
|
|
||||||
int use_timer;
|
int use_timer;
|
||||||
#ifndef OPENSSL_NO_SCTP
|
#ifndef OPENSSL_NO_SCTP
|
||||||
int in_sctp_read_sock;
|
int in_sctp_read_sock;
|
||||||
@ -103,7 +99,6 @@ struct ossl_statem_st {
|
|||||||
};
|
};
|
||||||
typedef struct ossl_statem_st OSSL_STATEM;
|
typedef struct ossl_statem_st OSSL_STATEM;
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* *
|
* *
|
||||||
* The following macros/functions represent the libssl internal API to the *
|
* The following macros/functions represent the libssl internal API to the *
|
||||||
@ -126,5 +121,3 @@ __owur int ossl_statem_app_data_allowed(SSL *s);
|
|||||||
void ossl_statem_set_sctp_read_sock(SSL *s, int read_sock);
|
void ossl_statem_set_sctp_read_sock(SSL *s, int read_sock);
|
||||||
__owur int ossl_statem_in_sctp_read_sock(SSL *s);
|
__owur int ossl_statem_in_sctp_read_sock(SSL *s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ static int ca_dn_cmp(const X509_NAME *const *a, const X509_NAME *const *b);
|
|||||||
static int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
|
static int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
|
||||||
unsigned char *p);
|
unsigned char *p);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is a CertificateRequest message allowed at the moment or not?
|
* Is a CertificateRequest message allowed at the moment or not?
|
||||||
*
|
*
|
||||||
@ -207,8 +206,7 @@ int ossl_statem_client_read_transition(SSL *s, int mt)
|
|||||||
case TLS_ST_CR_CERT_STATUS:
|
case TLS_ST_CR_CERT_STATUS:
|
||||||
ske_expected = key_exchange_expected(s);
|
ske_expected = key_exchange_expected(s);
|
||||||
/* SKE is optional for some PSK ciphersuites */
|
/* SKE is optional for some PSK ciphersuites */
|
||||||
if (ske_expected
|
if (ske_expected || ((s->s3->tmp.new_cipher->algorithm_mkey & SSL_PSK)
|
||||||
|| ((s->s3->tmp.new_cipher->algorithm_mkey & SSL_PSK)
|
|
||||||
&& mt == SSL3_MT_SERVER_KEY_EXCHANGE)) {
|
&& mt == SSL3_MT_SERVER_KEY_EXCHANGE)) {
|
||||||
if (mt == SSL3_MT_SERVER_KEY_EXCHANGE) {
|
if (mt == SSL3_MT_SERVER_KEY_EXCHANGE) {
|
||||||
st->hand_state = TLS_ST_CR_KEY_EXCH;
|
st->hand_state = TLS_ST_CR_KEY_EXCH;
|
||||||
@ -579,9 +577,10 @@ unsigned long ossl_statem_client_max_message_size(SSL *s)
|
|||||||
return SERVER_KEY_EXCH_MAX_LENGTH;
|
return SERVER_KEY_EXCH_MAX_LENGTH;
|
||||||
|
|
||||||
case TLS_ST_CR_CERT_REQ:
|
case TLS_ST_CR_CERT_REQ:
|
||||||
/* Set to s->max_cert_list for compatibility with previous releases.
|
/*
|
||||||
* In practice these messages can get quite long if servers are
|
* Set to s->max_cert_list for compatibility with previous releases. In
|
||||||
* configured to provide a long list of acceptable CAs
|
* practice these messages can get quite long if servers are configured
|
||||||
|
* to provide a long list of acceptable CAs
|
||||||
*/
|
*/
|
||||||
return s->max_cert_list;
|
return s->max_cert_list;
|
||||||
|
|
||||||
@ -711,8 +710,7 @@ int tls_construct_client_hello(SSL *s)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sess == NULL) ||
|
if ((sess == NULL) || !ssl_version_supported(s, sess->ssl_version) ||
|
||||||
!ssl_version_supported(s, sess->ssl_version) ||
|
|
||||||
/*
|
/*
|
||||||
* In the case of EAP-FAST, we can have a pre-shared
|
* In the case of EAP-FAST, we can have a pre-shared
|
||||||
* "ticket" without a session ID.
|
* "ticket" without a session ID.
|
||||||
@ -742,8 +740,7 @@ int tls_construct_client_hello(SSL *s)
|
|||||||
} else
|
} else
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
if (i && ssl_fill_hello_random(s, 0, p,
|
if (i && ssl_fill_hello_random(s, 0, p, sizeof(s->s3->client_random)) <= 0)
|
||||||
sizeof(s->s3->client_random)) <= 0)
|
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/* Do the message type and length last */
|
/* Do the message type and length last */
|
||||||
@ -1145,7 +1142,6 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt)
|
|||||||
SSLerr(SSL_F_TLS_PROCESS_SERVER_HELLO, SSL_R_BAD_PACKET_LENGTH);
|
SSLerr(SSL_F_TLS_PROCESS_SERVER_HELLO, SSL_R_BAD_PACKET_LENGTH);
|
||||||
goto f_err;
|
goto f_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SCTP
|
#ifndef OPENSSL_NO_SCTP
|
||||||
if (SSL_IS_DTLS(s) && s->hit) {
|
if (SSL_IS_DTLS(s) && s->hit) {
|
||||||
unsigned char sctpauthkey[64];
|
unsigned char sctpauthkey[64];
|
||||||
@ -1161,8 +1157,7 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt)
|
|||||||
if (SSL_export_keying_material(s, sctpauthkey,
|
if (SSL_export_keying_material(s, sctpauthkey,
|
||||||
sizeof(sctpauthkey),
|
sizeof(sctpauthkey),
|
||||||
labelbuffer,
|
labelbuffer,
|
||||||
sizeof(labelbuffer), NULL, 0,
|
sizeof(labelbuffer), NULL, 0, 0) <= 0)
|
||||||
0) <= 0)
|
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
BIO_ctrl(SSL_get_wbio(s),
|
BIO_ctrl(SSL_get_wbio(s),
|
||||||
@ -1422,8 +1417,7 @@ static int tls_process_ske_dhe(SSL *s, PACKET *pkt, EVP_PKEY **pkey, int *al)
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = BN_bin2bn(PACKET_data(&prime), PACKET_remaining(&prime), NULL);
|
p = BN_bin2bn(PACKET_data(&prime), PACKET_remaining(&prime), NULL);
|
||||||
g = BN_bin2bn(PACKET_data(&generator), PACKET_remaining(&generator),
|
g = BN_bin2bn(PACKET_data(&generator), PACKET_remaining(&generator), NULL);
|
||||||
NULL);
|
|
||||||
bnpub_key = BN_bin2bn(PACKET_data(&pub_key), PACKET_remaining(&pub_key),
|
bnpub_key = BN_bin2bn(PACKET_data(&pub_key), PACKET_remaining(&pub_key),
|
||||||
NULL);
|
NULL);
|
||||||
if (p == NULL || g == NULL || bnpub_key == NULL) {
|
if (p == NULL || g == NULL || bnpub_key == NULL) {
|
||||||
@ -1689,7 +1683,8 @@ MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt)
|
|||||||
if (PACKET_remaining(&signature) > (size_t)maxsig) {
|
if (PACKET_remaining(&signature) > (size_t)maxsig) {
|
||||||
/* wrong packet length */
|
/* wrong packet length */
|
||||||
al = SSL_AD_DECODE_ERROR;
|
al = SSL_AD_DECODE_ERROR;
|
||||||
SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, SSL_R_WRONG_SIGNATURE_LENGTH);
|
SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE,
|
||||||
|
SSL_R_WRONG_SIGNATURE_LENGTH);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2007,7 +2002,6 @@ MSG_PROCESS_RETURN tls_process_server_done(SSL *s, PACKET *pkt)
|
|||||||
ossl_statem_set_error(s);
|
ossl_statem_set_error(s);
|
||||||
return MSG_PROCESS_ERROR;
|
return MSG_PROCESS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SRP
|
#ifndef OPENSSL_NO_SRP
|
||||||
if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kSRP) {
|
if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kSRP) {
|
||||||
if (SRP_Calc_A_param(s) <= 0) {
|
if (SRP_Calc_A_param(s) <= 0) {
|
||||||
@ -2050,7 +2044,6 @@ MSG_PROCESS_RETURN tls_process_server_done(SSL *s, PACKET *pkt)
|
|||||||
return MSG_PROCESS_ERROR;
|
return MSG_PROCESS_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_CT
|
#ifndef OPENSSL_NO_CT
|
||||||
if (s->ct_validation_callback != NULL) {
|
if (s->ct_validation_callback != NULL) {
|
||||||
/* Note we validate the SCTs whether or not we abort on error */
|
/* Note we validate the SCTs whether or not we abort on error */
|
||||||
@ -2389,8 +2382,7 @@ static int tls_construct_cke_gost(SSL *s, unsigned char **p, int *len, int *al)
|
|||||||
* If we have client certificate, use its secret as peer key
|
* If we have client certificate, use its secret as peer key
|
||||||
*/
|
*/
|
||||||
if (s->s3->tmp.cert_req && s->cert->key->privatekey) {
|
if (s->s3->tmp.cert_req && s->cert->key->privatekey) {
|
||||||
if (EVP_PKEY_derive_set_peer
|
if (EVP_PKEY_derive_set_peer(pkey_ctx, s->cert->key->privatekey) <= 0) {
|
||||||
(pkey_ctx, s->cert->key->privatekey) <= 0) {
|
|
||||||
/*
|
/*
|
||||||
* If there was an error - just ignore it. Ephemeral key
|
* If there was an error - just ignore it. Ephemeral key
|
||||||
* * would be used
|
* * would be used
|
||||||
@ -2917,8 +2909,7 @@ int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
|
int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p)
|
||||||
unsigned char *p)
|
|
||||||
{
|
{
|
||||||
int i, j = 0;
|
int i, j = 0;
|
||||||
const SSL_CIPHER *c;
|
const SSL_CIPHER *c;
|
||||||
|
@ -124,8 +124,7 @@ int dtls1_do_write(SSL *s, int type)
|
|||||||
|
|
||||||
if (s->init_off == 0 && type == SSL3_RT_HANDSHAKE)
|
if (s->init_off == 0 && type == SSL3_RT_HANDSHAKE)
|
||||||
OPENSSL_assert(s->init_num ==
|
OPENSSL_assert(s->init_num ==
|
||||||
(int)s->d1->w_msg_hdr.msg_len +
|
(int)s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH);
|
||||||
DTLS1_HM_HEADER_LENGTH);
|
|
||||||
|
|
||||||
if (s->write_hash) {
|
if (s->write_hash) {
|
||||||
if (s->enc_write_ctx
|
if (s->enc_write_ctx
|
||||||
@ -230,16 +229,14 @@ int dtls1_do_write(SSL *s, int type)
|
|||||||
*/
|
*/
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
dtls1_fix_message_header(s, frag_off,
|
dtls1_fix_message_header(s, frag_off, len - DTLS1_HM_HEADER_LENGTH);
|
||||||
len - DTLS1_HM_HEADER_LENGTH);
|
|
||||||
|
|
||||||
dtls1_write_message_header(s,
|
dtls1_write_message_header(s,
|
||||||
(unsigned char *)&s->init_buf->
|
(unsigned char *)&s->init_buf->
|
||||||
data[s->init_off]);
|
data[s->init_off]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dtls1_write_bytes(s, type, &s->init_buf->data[s->init_off],
|
ret = dtls1_write_bytes(s, type, &s->init_buf->data[s->init_off], len);
|
||||||
len);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/*
|
/*
|
||||||
* might need to update MTU here, but we don't know which
|
* might need to update MTU here, but we don't know which
|
||||||
@ -339,8 +336,7 @@ int dtls_get_message(SSL *s, int *mt, unsigned long *len)
|
|||||||
|
|
||||||
again:
|
again:
|
||||||
ok = dtls_get_reassembled_message(s, &tmplen);
|
ok = dtls_get_reassembled_message(s, &tmplen);
|
||||||
if (tmplen == DTLS1_HM_BAD_FRAGMENT
|
if (tmplen == DTLS1_HM_BAD_FRAGMENT || tmplen == DTLS1_HM_FRAGMENT_RETRY) {
|
||||||
|| tmplen == DTLS1_HM_FRAGMENT_RETRY) {
|
|
||||||
/* bad fragment received */
|
/* bad fragment received */
|
||||||
goto again;
|
goto again;
|
||||||
} else if (tmplen <= 0 && !ok) {
|
} else if (tmplen <= 0 && !ok) {
|
||||||
@ -386,7 +382,6 @@ int dtls_get_message(SSL *s, int *mt, unsigned long *len)
|
|||||||
|
|
||||||
s->d1->handshake_read_seq++;
|
s->d1->handshake_read_seq++;
|
||||||
|
|
||||||
|
|
||||||
s->init_msg = s->init_buf->data + DTLS1_HM_HEADER_LENGTH;
|
s->init_msg = s->init_buf->data + DTLS1_HM_HEADER_LENGTH;
|
||||||
*len = s->init_num;
|
*len = s->init_num;
|
||||||
|
|
||||||
@ -412,8 +407,7 @@ static int dtls1_preprocess_fragment(SSL *s, struct hm_header_st *msg_hdr)
|
|||||||
* msg_len is limited to 2^24, but is effectively checked against max
|
* msg_len is limited to 2^24, but is effectively checked against max
|
||||||
* above
|
* above
|
||||||
*/
|
*/
|
||||||
if (!BUF_MEM_grow_clean
|
if (!BUF_MEM_grow_clean(s->init_buf, msg_len + DTLS1_HM_HEADER_LENGTH)) {
|
||||||
(s->init_buf, msg_len + DTLS1_HM_HEADER_LENGTH)) {
|
|
||||||
SSLerr(SSL_F_DTLS1_PREPROCESS_FRAGMENT, ERR_R_BUF_LIB);
|
SSLerr(SSL_F_DTLS1_PREPROCESS_FRAGMENT, ERR_R_BUF_LIB);
|
||||||
return SSL_AD_INTERNAL_ERROR;
|
return SSL_AD_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
@ -639,8 +633,7 @@ dtls1_process_out_of_seq_message(SSL *s, const struct hm_header_st *msg_hdr,
|
|||||||
*/
|
*/
|
||||||
if (msg_hdr->seq <= s->d1->handshake_read_seq ||
|
if (msg_hdr->seq <= s->d1->handshake_read_seq ||
|
||||||
msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL ||
|
msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL ||
|
||||||
(s->d1->handshake_read_seq == 0 && msg_hdr->type == SSL3_MT_FINISHED))
|
(s->d1->handshake_read_seq == 0 && msg_hdr->type == SSL3_MT_FINISHED)) {
|
||||||
{
|
|
||||||
unsigned char devnull[256];
|
unsigned char devnull[256];
|
||||||
|
|
||||||
while (frag_len) {
|
while (frag_len) {
|
||||||
@ -975,8 +968,7 @@ int dtls1_retransmit_buffered_messages(SSL *s)
|
|||||||
if (dtls1_retransmit_message(s, (unsigned short)
|
if (dtls1_retransmit_message(s, (unsigned short)
|
||||||
dtls1_get_queue_priority
|
dtls1_get_queue_priority
|
||||||
(frag->msg_header.seq,
|
(frag->msg_header.seq,
|
||||||
frag->msg_header.is_ccs),
|
frag->msg_header.is_ccs), &found) <= 0)
|
||||||
&found) <= 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1004,7 +996,8 @@ int dtls1_buffer_message(SSL *s, int is_ccs)
|
|||||||
if (is_ccs) {
|
if (is_ccs) {
|
||||||
/* For DTLS1_BAD_VER the header length is non-standard */
|
/* For DTLS1_BAD_VER the header length is non-standard */
|
||||||
OPENSSL_assert(s->d1->w_msg_hdr.msg_len +
|
OPENSSL_assert(s->d1->w_msg_hdr.msg_len +
|
||||||
((s->version==DTLS1_BAD_VER)?3:DTLS1_CCS_HEADER_LENGTH)
|
((s->version ==
|
||||||
|
DTLS1_BAD_VER) ? 3 : DTLS1_CCS_HEADER_LENGTH)
|
||||||
== (unsigned int)s->init_num);
|
== (unsigned int)s->init_num);
|
||||||
} else {
|
} else {
|
||||||
OPENSSL_assert(s->d1->w_msg_hdr.msg_len +
|
OPENSSL_assert(s->d1->w_msg_hdr.msg_len +
|
||||||
@ -1046,8 +1039,7 @@ int dtls1_buffer_message(SSL *s, int is_ccs)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int dtls1_retransmit_message(SSL *s, unsigned short seq, int *found)
|
||||||
dtls1_retransmit_message(SSL *s, unsigned short seq, int *found)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
/* XDTLS: for now assuming that read/writes are blocking */
|
/* XDTLS: for now assuming that read/writes are blocking */
|
||||||
@ -1106,7 +1098,8 @@ dtls1_retransmit_message(SSL *s, unsigned short seq, int *found)
|
|||||||
s->compress = frag->msg_header.saved_retransmit_state.compress;
|
s->compress = frag->msg_header.saved_retransmit_state.compress;
|
||||||
s->session = frag->msg_header.saved_retransmit_state.session;
|
s->session = frag->msg_header.saved_retransmit_state.session;
|
||||||
DTLS_RECORD_LAYER_set_saved_w_epoch(&s->rlayer,
|
DTLS_RECORD_LAYER_set_saved_w_epoch(&s->rlayer,
|
||||||
frag->msg_header.saved_retransmit_state.epoch);
|
frag->msg_header.
|
||||||
|
saved_retransmit_state.epoch);
|
||||||
|
|
||||||
ret = dtls1_do_write(s, frag->msg_header.is_ccs ?
|
ret = dtls1_do_write(s, frag->msg_header.is_ccs ?
|
||||||
SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE);
|
SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE);
|
||||||
@ -1138,8 +1131,7 @@ void dtls1_clear_record_buffer(SSL *s)
|
|||||||
|
|
||||||
void dtls1_set_message_header(SSL *s,
|
void dtls1_set_message_header(SSL *s,
|
||||||
unsigned char mt, unsigned long len,
|
unsigned char mt, unsigned long len,
|
||||||
unsigned long frag_off,
|
unsigned long frag_off, unsigned long frag_len)
|
||||||
unsigned long frag_len)
|
|
||||||
{
|
{
|
||||||
if (frag_off == 0) {
|
if (frag_off == 0) {
|
||||||
s->d1->handshake_write_seq = s->d1->next_handshake_write_seq;
|
s->d1->handshake_write_seq = s->d1->next_handshake_write_seq;
|
||||||
@ -1166,8 +1158,7 @@ dtls1_set_message_header_int(SSL *s, unsigned char mt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dtls1_fix_message_header(SSL *s, unsigned long frag_off,
|
dtls1_fix_message_header(SSL *s, unsigned long frag_off, unsigned long frag_len)
|
||||||
unsigned long frag_len)
|
|
||||||
{
|
{
|
||||||
struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr;
|
struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr;
|
||||||
|
|
||||||
@ -1189,8 +1180,7 @@ static unsigned char *dtls1_write_message_header(SSL *s, unsigned char *p)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr)
|
||||||
dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr)
|
|
||||||
{
|
{
|
||||||
memset(msg_hdr, 0, sizeof(*msg_hdr));
|
memset(msg_hdr, 0, sizeof(*msg_hdr));
|
||||||
msg_hdr->type = *(data++);
|
msg_hdr->type = *(data++);
|
||||||
@ -1200,5 +1190,3 @@ dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr)
|
|||||||
n2l3(data, msg_hdr->frag_off);
|
n2l3(data, msg_hdr->frag_off);
|
||||||
n2l3(data, msg_hdr->frag_len);
|
n2l3(data, msg_hdr->frag_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -349,7 +349,9 @@ int tls_get_message_header(SSL *s, int *mt)
|
|||||||
do {
|
do {
|
||||||
while (s->init_num < SSL3_HM_HEADER_LENGTH) {
|
while (s->init_num < SSL3_HM_HEADER_LENGTH) {
|
||||||
i = s->method->ssl_read_bytes(s, SSL3_RT_HANDSHAKE, &recvd_type,
|
i = s->method->ssl_read_bytes(s, SSL3_RT_HANDSHAKE, &recvd_type,
|
||||||
&p[s->init_num], SSL3_HM_HEADER_LENGTH - s->init_num, 0);
|
&p[s->init_num],
|
||||||
|
SSL3_HM_HEADER_LENGTH - s->init_num,
|
||||||
|
0);
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
s->rwstate = SSL_READING;
|
s->rwstate = SSL_READING;
|
||||||
return 0;
|
return 0;
|
||||||
@ -522,8 +524,7 @@ int tls_get_message_body(SSL *s, unsigned long *len)
|
|||||||
|
|
||||||
int ssl_cert_type(const X509 *x, const EVP_PKEY *pk)
|
int ssl_cert_type(const X509 *x, const EVP_PKEY *pk)
|
||||||
{
|
{
|
||||||
if (pk == NULL &&
|
if (pk == NULL && (pk = X509_get0_pubkey(x)) == NULL)
|
||||||
(pk = X509_get0_pubkey(x)) == NULL)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
switch (EVP_PKEY_id(pk)) {
|
switch (EVP_PKEY_id(pk)) {
|
||||||
@ -794,8 +795,7 @@ int ssl_check_version_downgrade(SSL *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (vent = table; vent->version != 0; ++vent) {
|
for (vent = table; vent->version != 0; ++vent) {
|
||||||
if (vent->smeth != NULL &&
|
if (vent->smeth != NULL && ssl_method_error(s, vent->smeth()) == 0)
|
||||||
ssl_method_error(s, vent->smeth()) == 0)
|
|
||||||
return s->version == vent->version;
|
return s->version == vent->version;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -995,7 +995,8 @@ int ssl_choose_client_version(SSL *s, int version)
|
|||||||
* Returns 0 on success or an SSL error reason number on failure. On failure
|
* Returns 0 on success or an SSL error reason number on failure. On failure
|
||||||
* min_version and max_version will also be set to 0.
|
* min_version and max_version will also be set to 0.
|
||||||
*/
|
*/
|
||||||
int ssl_get_client_min_max_version(const SSL *s, int *min_version, int *max_version)
|
int ssl_get_client_min_max_version(const SSL *s, int *min_version,
|
||||||
|
int *max_version)
|
||||||
{
|
{
|
||||||
int version;
|
int version;
|
||||||
int hole;
|
int hole;
|
||||||
|
@ -96,8 +96,7 @@ __owur int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey);
|
|||||||
__owur int tls_construct_client_key_exchange(SSL *s);
|
__owur int tls_construct_client_key_exchange(SSL *s);
|
||||||
__owur int tls_client_key_exchange_post_work(SSL *s);
|
__owur int tls_client_key_exchange_post_work(SSL *s);
|
||||||
__owur int tls_construct_cert_status(SSL *s);
|
__owur int tls_construct_cert_status(SSL *s);
|
||||||
__owur MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s,
|
__owur MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt);
|
||||||
PACKET *pkt);
|
|
||||||
__owur MSG_PROCESS_RETURN tls_process_server_certificate(SSL *s, PACKET *pkt);
|
__owur MSG_PROCESS_RETURN tls_process_server_certificate(SSL *s, PACKET *pkt);
|
||||||
__owur int ssl3_check_cert_and_algorithm(SSL *s);
|
__owur int ssl3_check_cert_and_algorithm(SSL *s);
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
* OTHERWISE.
|
* OTHERWISE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "../ssl_locl.h"
|
#include "../ssl_locl.h"
|
||||||
#include "statem_locl.h"
|
#include "statem_locl.h"
|
||||||
@ -64,8 +63,9 @@
|
|||||||
|
|
||||||
static STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,
|
static STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,
|
||||||
PACKET *cipher_suites,
|
PACKET *cipher_suites,
|
||||||
STACK_OF(SSL_CIPHER) **skp,
|
STACK_OF(SSL_CIPHER)
|
||||||
int sslv2format, int *al);
|
**skp, int sslv2format,
|
||||||
|
int *al);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* server_read_transition() encapsulates the logic for the allowed handshake
|
* server_read_transition() encapsulates the logic for the allowed handshake
|
||||||
@ -313,7 +313,7 @@ WRITE_TRAN ossl_statem_server_write_transition(SSL *s)
|
|||||||
|
|
||||||
switch (st->hand_state) {
|
switch (st->hand_state) {
|
||||||
case TLS_ST_BEFORE:
|
case TLS_ST_BEFORE:
|
||||||
/* Just go straight to trying to read from the client */;
|
/* Just go straight to trying to read from the client */
|
||||||
return WRITE_TRAN_FINISHED;
|
return WRITE_TRAN_FINISHED;
|
||||||
|
|
||||||
case TLS_ST_OK:
|
case TLS_ST_OK:
|
||||||
@ -550,7 +550,8 @@ WORK_STATE ossl_statem_server_post_work(SSL *s, WORK_STATE wst)
|
|||||||
|
|
||||||
if (SSL_export_keying_material(s, sctpauthkey,
|
if (SSL_export_keying_material(s, sctpauthkey,
|
||||||
sizeof(sctpauthkey), labelbuffer,
|
sizeof(sctpauthkey), labelbuffer,
|
||||||
sizeof(labelbuffer), NULL, 0, 0) <= 0) {
|
sizeof(labelbuffer), NULL, 0,
|
||||||
|
0) <= 0) {
|
||||||
ossl_statem_set_error(s);
|
ossl_statem_set_error(s);
|
||||||
return WORK_ERROR;
|
return WORK_ERROR;
|
||||||
}
|
}
|
||||||
@ -573,7 +574,8 @@ WORK_STATE ossl_statem_server_post_work(SSL *s, WORK_STATE wst)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!s->method->ssl3_enc->change_cipher_state(s,
|
if (!s->method->ssl3_enc->change_cipher_state(s,
|
||||||
SSL3_CHANGE_CIPHER_SERVER_WRITE)) {
|
SSL3_CHANGE_CIPHER_SERVER_WRITE))
|
||||||
|
{
|
||||||
ossl_statem_set_error(s);
|
ossl_statem_set_error(s);
|
||||||
return WORK_ERROR;
|
return WORK_ERROR;
|
||||||
}
|
}
|
||||||
@ -789,8 +791,7 @@ WORK_STATE ossl_statem_server_post_process_message(SSL *s, WORK_STATE wst)
|
|||||||
if ( /* Is this SCTP? */
|
if ( /* Is this SCTP? */
|
||||||
BIO_dgram_is_sctp(SSL_get_wbio(s))
|
BIO_dgram_is_sctp(SSL_get_wbio(s))
|
||||||
/* Are we renegotiating? */
|
/* Are we renegotiating? */
|
||||||
&& s->renegotiate
|
&& s->renegotiate && BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) {
|
||||||
&& BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) {
|
|
||||||
s->s3->in_read_app_data = 2;
|
s->s3->in_read_app_data = 2;
|
||||||
s->rwstate = SSL_READING;
|
s->rwstate = SSL_READING;
|
||||||
BIO_clear_retry_flags(SSL_get_rbio(s));
|
BIO_clear_retry_flags(SSL_get_rbio(s));
|
||||||
@ -886,8 +887,7 @@ int dtls_construct_hello_verify_request(SSL *s)
|
|||||||
len = dtls_raw_hello_verify_request(&buf[DTLS1_HM_HEADER_LENGTH],
|
len = dtls_raw_hello_verify_request(&buf[DTLS1_HM_HEADER_LENGTH],
|
||||||
s->d1->cookie, s->d1->cookie_len);
|
s->d1->cookie, s->d1->cookie_len);
|
||||||
|
|
||||||
dtls1_set_message_header(s, DTLS1_MT_HELLO_VERIFY_REQUEST, len, 0,
|
dtls1_set_message_header(s, DTLS1_MT_HELLO_VERIFY_REQUEST, len, 0, len);
|
||||||
len);
|
|
||||||
len += DTLS1_HM_HEADER_LENGTH;
|
len += DTLS1_HM_HEADER_LENGTH;
|
||||||
|
|
||||||
/* number of bytes to write */
|
/* number of bytes to write */
|
||||||
@ -1099,7 +1099,8 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt)
|
|||||||
if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) {
|
if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) {
|
||||||
if (s->ctx->app_verify_cookie_cb != NULL) {
|
if (s->ctx->app_verify_cookie_cb != NULL) {
|
||||||
if (s->ctx->app_verify_cookie_cb(s, PACKET_data(&cookie),
|
if (s->ctx->app_verify_cookie_cb(s, PACKET_data(&cookie),
|
||||||
PACKET_remaining(&cookie)) == 0) {
|
PACKET_remaining(&cookie)) ==
|
||||||
|
0) {
|
||||||
al = SSL_AD_HANDSHAKE_FAILURE;
|
al = SSL_AD_HANDSHAKE_FAILURE;
|
||||||
SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO,
|
SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO,
|
||||||
SSL_R_COOKIE_MISMATCH);
|
SSL_R_COOKIE_MISMATCH);
|
||||||
@ -1107,8 +1108,7 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt)
|
|||||||
/* else cookie verification succeeded */
|
/* else cookie verification succeeded */
|
||||||
}
|
}
|
||||||
/* default verification */
|
/* default verification */
|
||||||
} else if (!PACKET_equal(&cookie, s->d1->cookie,
|
} else if (!PACKET_equal(&cookie, s->d1->cookie, s->d1->cookie_len)) {
|
||||||
s->d1->cookie_len)) {
|
|
||||||
al = SSL_AD_HANDSHAKE_FAILURE;
|
al = SSL_AD_HANDSHAKE_FAILURE;
|
||||||
SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH);
|
SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH);
|
||||||
goto f_err;
|
goto f_err;
|
||||||
@ -1183,8 +1183,7 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt)
|
|||||||
id = s->session->cipher->id;
|
id = s->session->cipher->id;
|
||||||
|
|
||||||
#ifdef CIPHER_DEBUG
|
#ifdef CIPHER_DEBUG
|
||||||
fprintf(stderr, "client sent %d ciphers\n",
|
fprintf(stderr, "client sent %d ciphers\n", sk_SSL_CIPHER_num(ciphers));
|
||||||
sk_SSL_CIPHER_num(ciphers));
|
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
|
for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
|
||||||
c = sk_SSL_CIPHER_value(ciphers, i);
|
c = sk_SSL_CIPHER_value(ciphers, i);
|
||||||
@ -1405,7 +1404,8 @@ WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)
|
|||||||
int rv = s->cert->cert_cb(s, s->cert->cert_cb_arg);
|
int rv = s->cert->cert_cb(s, s->cert->cert_cb_arg);
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
al = SSL_AD_INTERNAL_ERROR;
|
al = SSL_AD_INTERNAL_ERROR;
|
||||||
SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO, SSL_R_CERT_CB_ERROR);
|
SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,
|
||||||
|
SSL_R_CERT_CB_ERROR);
|
||||||
goto f_err;
|
goto f_err;
|
||||||
}
|
}
|
||||||
if (rv < 0) {
|
if (rv < 0) {
|
||||||
@ -1414,10 +1414,12 @@ WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)
|
|||||||
}
|
}
|
||||||
s->rwstate = SSL_NOTHING;
|
s->rwstate = SSL_NOTHING;
|
||||||
}
|
}
|
||||||
cipher = ssl3_choose_cipher(s, s->session->ciphers, SSL_get_ciphers(s));
|
cipher =
|
||||||
|
ssl3_choose_cipher(s, s->session->ciphers, SSL_get_ciphers(s));
|
||||||
|
|
||||||
if (cipher == NULL) {
|
if (cipher == NULL) {
|
||||||
SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO, SSL_R_NO_SHARED_CIPHER);
|
SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,
|
||||||
|
SSL_R_NO_SHARED_CIPHER);
|
||||||
goto f_err;
|
goto f_err;
|
||||||
}
|
}
|
||||||
s->s3->tmp.new_cipher = cipher;
|
s->s3->tmp.new_cipher = cipher;
|
||||||
@ -1799,7 +1801,7 @@ int tls_construct_server_key_exchange(SSL *s)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifndef OPENSSL_NO_DH
|
#ifndef OPENSSL_NO_DH
|
||||||
/*
|
/*-
|
||||||
* for interoperability with some versions of the Microsoft TLS
|
* for interoperability with some versions of the Microsoft TLS
|
||||||
* stack, we need to zero pad the DHE pub key to the same length
|
* stack, we need to zero pad the DHE pub key to the same length
|
||||||
* as the prime, so use the length of the prime here
|
* as the prime, so use the length of the prime here
|
||||||
@ -1866,7 +1868,7 @@ int tls_construct_server_key_exchange(SSL *s)
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifndef OPENSSL_NO_DH
|
#ifndef OPENSSL_NO_DH
|
||||||
/*
|
/*-
|
||||||
* for interoperability with some versions of the Microsoft TLS
|
* for interoperability with some versions of the Microsoft TLS
|
||||||
* stack, we need to zero pad the DHE pub key to the same length
|
* stack, we need to zero pad the DHE pub key to the same length
|
||||||
* as the prime
|
* as the prime
|
||||||
@ -2017,10 +2019,8 @@ int tls_construct_certificate_request(SSL *s)
|
|||||||
for (i = 0; i < sk_X509_NAME_num(sk); i++) {
|
for (i = 0; i < sk_X509_NAME_num(sk); i++) {
|
||||||
name = sk_X509_NAME_value(sk, i);
|
name = sk_X509_NAME_value(sk, i);
|
||||||
j = i2d_X509_NAME(name, NULL);
|
j = i2d_X509_NAME(name, NULL);
|
||||||
if (!BUF_MEM_grow_clean
|
if (!BUF_MEM_grow_clean(buf, SSL_HM_HEADER_LENGTH(s) + n + j + 2)) {
|
||||||
(buf, SSL_HM_HEADER_LENGTH(s) + n + j + 2)) {
|
SSLerr(SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST, ERR_R_BUF_LIB);
|
||||||
SSLerr(SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST,
|
|
||||||
ERR_R_BUF_LIB);
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
p = ssl_handshake_start(s) + n;
|
p = ssl_handshake_start(s) + n;
|
||||||
@ -2066,8 +2066,7 @@ static int tls_process_cke_psk_preamble(SSL *s, PACKET *pkt, int *al)
|
|||||||
}
|
}
|
||||||
if (s->psk_server_callback == NULL) {
|
if (s->psk_server_callback == NULL) {
|
||||||
*al = SSL_AD_INTERNAL_ERROR;
|
*al = SSL_AD_INTERNAL_ERROR;
|
||||||
SSLerr(SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE,
|
SSLerr(SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE, SSL_R_PSK_NO_SERVER_CB);
|
||||||
SSL_R_PSK_NO_SERVER_CB);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2115,7 +2114,6 @@ static int tls_process_cke_psk_preamble(SSL *s, PACKET *pkt, int *al)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int tls_process_cke_rsa(SSL *s, PACKET *pkt, int *al)
|
static int tls_process_cke_rsa(SSL *s, PACKET *pkt, int *al)
|
||||||
{
|
{
|
||||||
#ifndef OPENSSL_NO_RSA
|
#ifndef OPENSSL_NO_RSA
|
||||||
@ -2174,8 +2172,7 @@ static int tls_process_cke_rsa(SSL *s, PACKET *pkt, int *al)
|
|||||||
* fails. See https://tools.ietf.org/html/rfc5246#section-7.4.7.1
|
* fails. See https://tools.ietf.org/html/rfc5246#section-7.4.7.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (RAND_bytes(rand_premaster_secret,
|
if (RAND_bytes(rand_premaster_secret, sizeof(rand_premaster_secret)) <= 0)
|
||||||
sizeof(rand_premaster_secret)) <= 0)
|
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2428,8 +2425,7 @@ static int tls_process_cke_srp(SSL *s, PACKET *pkt, int *al)
|
|||||||
SSLerr(SSL_F_TLS_PROCESS_CKE_SRP, ERR_R_BN_LIB);
|
SSLerr(SSL_F_TLS_PROCESS_CKE_SRP, ERR_R_BN_LIB);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (BN_ucmp(s->srp_ctx.A, s->srp_ctx.N) >= 0
|
if (BN_ucmp(s->srp_ctx.A, s->srp_ctx.N) >= 0 || BN_is_zero(s->srp_ctx.A)) {
|
||||||
|| BN_is_zero(s->srp_ctx.A)) {
|
|
||||||
*al = SSL_AD_ILLEGAL_PARAMETER;
|
*al = SSL_AD_ILLEGAL_PARAMETER;
|
||||||
SSLerr(SSL_F_TLS_PROCESS_CKE_SRP, SSL_R_BAD_SRP_PARAMETERS);
|
SSLerr(SSL_F_TLS_PROCESS_CKE_SRP, SSL_R_BAD_SRP_PARAMETERS);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2518,8 +2514,7 @@ static int tls_process_cke_gost(SSL *s, PACKET *pkt, int *al)
|
|||||||
}
|
}
|
||||||
if (ASN1_get_object((const unsigned char **)&data, &Tlen, &Ttag,
|
if (ASN1_get_object((const unsigned char **)&data, &Tlen, &Ttag,
|
||||||
&Tclass, sess_key_len) != V_ASN1_CONSTRUCTED
|
&Tclass, sess_key_len) != V_ASN1_CONSTRUCTED
|
||||||
|| Ttag != V_ASN1_SEQUENCE
|
|| Ttag != V_ASN1_SEQUENCE || Tclass != V_ASN1_UNIVERSAL) {
|
||||||
|| Tclass != V_ASN1_UNIVERSAL) {
|
|
||||||
*al = SSL_AD_DECODE_ERROR;
|
*al = SSL_AD_DECODE_ERROR;
|
||||||
SSLerr(SSL_F_TLS_PROCESS_CKE_GOST, SSL_R_DECRYPTION_FAILED);
|
SSLerr(SSL_F_TLS_PROCESS_CKE_GOST, SSL_R_DECRYPTION_FAILED);
|
||||||
goto err;
|
goto err;
|
||||||
@ -2571,7 +2566,8 @@ MSG_PROCESS_RETURN tls_process_client_key_exchange(SSL *s, PACKET *pkt)
|
|||||||
/* Identity extracted earlier: should be nothing left */
|
/* Identity extracted earlier: should be nothing left */
|
||||||
if (PACKET_remaining(pkt) != 0) {
|
if (PACKET_remaining(pkt) != 0) {
|
||||||
al = SSL_AD_HANDSHAKE_FAILURE;
|
al = SSL_AD_HANDSHAKE_FAILURE;
|
||||||
SSLerr(SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE, SSL_R_LENGTH_MISMATCH);
|
SSLerr(SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE,
|
||||||
|
SSL_R_LENGTH_MISMATCH);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
/* PSK handled by ssl_generate_master_secret */
|
/* PSK handled by ssl_generate_master_secret */
|
||||||
@ -2597,7 +2593,8 @@ MSG_PROCESS_RETURN tls_process_client_key_exchange(SSL *s, PACKET *pkt)
|
|||||||
goto err;
|
goto err;
|
||||||
} else {
|
} else {
|
||||||
al = SSL_AD_HANDSHAKE_FAILURE;
|
al = SSL_AD_HANDSHAKE_FAILURE;
|
||||||
SSLerr(SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE, SSL_R_UNKNOWN_CIPHER_TYPE);
|
SSLerr(SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE,
|
||||||
|
SSL_R_UNKNOWN_CIPHER_TYPE);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2629,7 +2626,8 @@ WORK_STATE tls_post_process_client_key_exchange(SSL *s, WORK_STATE wst)
|
|||||||
|
|
||||||
if (SSL_export_keying_material(s, sctpauthkey,
|
if (SSL_export_keying_material(s, sctpauthkey,
|
||||||
sizeof(sctpauthkey), labelbuffer,
|
sizeof(sctpauthkey), labelbuffer,
|
||||||
sizeof(labelbuffer), NULL, 0, 0) <= 0) {
|
sizeof(labelbuffer), NULL, 0,
|
||||||
|
0) <= 0) {
|
||||||
ossl_statem_set_error(s);
|
ossl_statem_set_error(s);
|
||||||
return WORK_ERROR;;
|
return WORK_ERROR;;
|
||||||
}
|
}
|
||||||
@ -2660,8 +2658,9 @@ WORK_STATE tls_post_process_client_key_exchange(SSL *s, WORK_STATE wst)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (s->statem.no_cert_verify || !s->session->peer) {
|
if (s->statem.no_cert_verify || !s->session->peer) {
|
||||||
/* No certificate verify or no peer certificate so we no longer need the
|
/*
|
||||||
* handshake_buffer
|
* No certificate verify or no peer certificate so we no longer need
|
||||||
|
* the handshake_buffer
|
||||||
*/
|
*/
|
||||||
if (!ssl3_digest_cached_records(s, 0)) {
|
if (!ssl3_digest_cached_records(s, 0)) {
|
||||||
ossl_statem_set_error(s);
|
ossl_statem_set_error(s);
|
||||||
@ -2797,7 +2796,6 @@ MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
|
|||||||
al = SSL_AD_INTERNAL_ERROR;
|
al = SSL_AD_INTERNAL_ERROR;
|
||||||
goto f_err;
|
goto f_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_GOST
|
#ifndef OPENSSL_NO_GOST
|
||||||
{
|
{
|
||||||
int pktype = EVP_PKEY_id(pkey);
|
int pktype = EVP_PKEY_id(pkey);
|
||||||
@ -3067,7 +3065,8 @@ int tls_construct_new_session_ticket(SSL *s)
|
|||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
l2n(0, p); /* timeout */
|
l2n(0, p); /* timeout */
|
||||||
s2n(0, p); /* length */
|
s2n(0, p); /* length */
|
||||||
if (!ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, p - ssl_handshake_start(s)))
|
if (!ssl_set_handshake_header
|
||||||
|
(s, SSL3_MT_NEWSESSION_TICKET, p - ssl_handshake_start(s)))
|
||||||
goto err;
|
goto err;
|
||||||
OPENSSL_free(senc);
|
OPENSSL_free(senc);
|
||||||
EVP_CIPHER_CTX_free(ctx);
|
EVP_CIPHER_CTX_free(ctx);
|
||||||
@ -3205,8 +3204,7 @@ MSG_PROCESS_RETURN tls_process_next_proto(SSL *s, PACKET *pkt)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PACKET_memdup(&next_proto, &s->next_proto_negotiated,
|
if (!PACKET_memdup(&next_proto, &s->next_proto_negotiated, &next_proto_len)) {
|
||||||
&next_proto_len)) {
|
|
||||||
s->next_proto_negotiated_len = 0;
|
s->next_proto_negotiated_len = 0;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -3225,8 +3223,7 @@ err:
|
|||||||
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,
|
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,
|
||||||
PACKET *cipher_suites,
|
PACKET *cipher_suites,
|
||||||
STACK_OF(SSL_CIPHER) **skp,
|
STACK_OF(SSL_CIPHER) **skp,
|
||||||
int sslv2format, int *al
|
int sslv2format, int *al)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const SSL_CIPHER *c;
|
const SSL_CIPHER *c;
|
||||||
STACK_OF(SSL_CIPHER) *sk;
|
STACK_OF(SSL_CIPHER) *sk;
|
||||||
|
20
ssl/t1_enc.c
20
ssl/t1_enc.c
@ -277,7 +277,8 @@ int tls1_change_cipher_state(SSL *s, int which)
|
|||||||
}
|
}
|
||||||
} else if (EVP_CIPHER_mode(c) == EVP_CIPH_CCM_MODE) {
|
} else if (EVP_CIPHER_mode(c) == EVP_CIPH_CCM_MODE) {
|
||||||
int taglen;
|
int taglen;
|
||||||
if (s->s3->tmp.new_cipher->algorithm_enc & (SSL_AES128CCM8|SSL_AES256CCM8))
|
if (s->s3->tmp.
|
||||||
|
new_cipher->algorithm_enc & (SSL_AES128CCM8 | SSL_AES256CCM8))
|
||||||
taglen = 8;
|
taglen = 8;
|
||||||
else
|
else
|
||||||
taglen = 16;
|
taglen = 16;
|
||||||
@ -377,8 +378,7 @@ int tls1_setup_key_block(SSL *s)
|
|||||||
s->s3->tmp.new_hash = hash;
|
s->s3->tmp.new_hash = hash;
|
||||||
s->s3->tmp.new_mac_pkey_type = mac_type;
|
s->s3->tmp.new_mac_pkey_type = mac_type;
|
||||||
s->s3->tmp.new_mac_secret_size = mac_secret_size;
|
s->s3->tmp.new_mac_secret_size = mac_secret_size;
|
||||||
num =
|
num = EVP_CIPHER_key_length(c) + mac_secret_size + EVP_CIPHER_iv_length(c);
|
||||||
EVP_CIPHER_key_length(c) + mac_secret_size + EVP_CIPHER_iv_length(c);
|
|
||||||
num *= 2;
|
num *= 2;
|
||||||
|
|
||||||
ssl3_cleanup_key_block(s);
|
ssl3_cleanup_key_block(s);
|
||||||
@ -449,8 +449,7 @@ int tls1_setup_key_block(SSL *s)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tls1_final_finish_mac(SSL *s, const char *str, int slen,
|
int tls1_final_finish_mac(SSL *s, const char *str, int slen, unsigned char *out)
|
||||||
unsigned char *out)
|
|
||||||
{
|
{
|
||||||
int hashlen;
|
int hashlen;
|
||||||
unsigned char hash[EVP_MAX_MD_SIZE];
|
unsigned char hash[EVP_MAX_MD_SIZE];
|
||||||
@ -477,10 +476,10 @@ int tls1_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
|
|||||||
if (s->session->flags & SSL_SESS_FLAG_EXTMS) {
|
if (s->session->flags & SSL_SESS_FLAG_EXTMS) {
|
||||||
unsigned char hash[EVP_MAX_MD_SIZE * 2];
|
unsigned char hash[EVP_MAX_MD_SIZE * 2];
|
||||||
int hashlen;
|
int hashlen;
|
||||||
/* Digest cached records keeping record buffer (if present):
|
/*
|
||||||
* this won't affect client auth because we're freezing the buffer
|
* Digest cached records keeping record buffer (if present): this wont
|
||||||
* at the same point (after client key exchange and before certificate
|
* affect client auth because we're freezing the buffer at the same
|
||||||
* verify)
|
* point (after client key exchange and before certificate verify)
|
||||||
*/
|
*/
|
||||||
if (!ssl3_digest_cached_records(s, 1))
|
if (!ssl3_digest_cached_records(s, 1))
|
||||||
return -1;
|
return -1;
|
||||||
@ -611,8 +610,7 @@ int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen,
|
|||||||
|
|
||||||
goto ret;
|
goto ret;
|
||||||
err1:
|
err1:
|
||||||
SSLerr(SSL_F_TLS1_EXPORT_KEYING_MATERIAL,
|
SSLerr(SSL_F_TLS1_EXPORT_KEYING_MATERIAL, SSL_R_TLS_ILLEGAL_EXPORTER_LABEL);
|
||||||
SSL_R_TLS_ILLEGAL_EXPORTER_LABEL);
|
|
||||||
rv = 0;
|
rv = 0;
|
||||||
goto ret;
|
goto ret;
|
||||||
err2:
|
err2:
|
||||||
|
10
ssl/t1_ext.c
10
ssl/t1_ext.c
@ -12,7 +12,6 @@
|
|||||||
#include <openssl/ct.h>
|
#include <openssl/ct.h>
|
||||||
#include "ssl_locl.h"
|
#include "ssl_locl.h"
|
||||||
|
|
||||||
|
|
||||||
/* Find a custom extension from the list. */
|
/* Find a custom extension from the list. */
|
||||||
static custom_ext_method *custom_ext_find(const custom_ext_methods *exts,
|
static custom_ext_method *custom_ext_find(const custom_ext_methods *exts,
|
||||||
unsigned int ext_type)
|
unsigned int ext_type)
|
||||||
@ -68,8 +67,7 @@ int custom_ext_parse(SSL *s, int server,
|
|||||||
if (!meth->parse_cb)
|
if (!meth->parse_cb)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return meth->parse_cb(s, ext_type, ext_data, ext_size, al,
|
return meth->parse_cb(s, ext_type, ext_data, ext_size, al, meth->parse_arg);
|
||||||
meth->parse_arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -214,8 +212,7 @@ int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, unsigned int ext_type,
|
|||||||
custom_ext_add_cb add_cb,
|
custom_ext_add_cb add_cb,
|
||||||
custom_ext_free_cb free_cb,
|
custom_ext_free_cb free_cb,
|
||||||
void *add_arg,
|
void *add_arg,
|
||||||
custom_ext_parse_cb parse_cb,
|
custom_ext_parse_cb parse_cb, void *parse_arg)
|
||||||
void *parse_arg)
|
|
||||||
{
|
{
|
||||||
#ifndef OPENSSL_NO_CT
|
#ifndef OPENSSL_NO_CT
|
||||||
/*
|
/*
|
||||||
@ -235,8 +232,7 @@ int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, unsigned int ext_type,
|
|||||||
custom_ext_add_cb add_cb,
|
custom_ext_add_cb add_cb,
|
||||||
custom_ext_free_cb free_cb,
|
custom_ext_free_cb free_cb,
|
||||||
void *add_arg,
|
void *add_arg,
|
||||||
custom_ext_parse_cb parse_cb,
|
custom_ext_parse_cb parse_cb, void *parse_arg)
|
||||||
void *parse_arg)
|
|
||||||
{
|
{
|
||||||
return custom_ext_meth_add(&ctx->cert->srv_ext, ext_type,
|
return custom_ext_meth_add(&ctx->cert->srv_ext, ext_type,
|
||||||
add_cb, free_cb, add_arg, parse_cb, parse_arg);
|
add_cb, free_cb, add_arg, parse_cb, parse_arg);
|
||||||
|
105
ssl/t1_lib.c
105
ssl/t1_lib.c
@ -209,7 +209,6 @@ static const unsigned char eccurves_all[] = {
|
|||||||
0, 3, /* sect163r2 (3) */
|
0, 3, /* sect163r2 (3) */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const unsigned char suiteb_curves[] = {
|
static const unsigned char suiteb_curves[] = {
|
||||||
0, TLSEXT_curve_P_256,
|
0, TLSEXT_curve_P_256,
|
||||||
0, TLSEXT_curve_P_384
|
0, TLSEXT_curve_P_384
|
||||||
@ -250,8 +249,7 @@ int tls1_ec_nid2curve_id(int nid)
|
|||||||
* so cannot happen in the 1.0.x series.)
|
* so cannot happen in the 1.0.x series.)
|
||||||
*/
|
*/
|
||||||
static int tls1_get_curvelist(SSL *s, int sess,
|
static int tls1_get_curvelist(SSL *s, int sess,
|
||||||
const unsigned char **pcurves,
|
const unsigned char **pcurves, size_t *num_curves)
|
||||||
size_t *num_curves)
|
|
||||||
{
|
{
|
||||||
size_t pcurveslen = 0;
|
size_t pcurveslen = 0;
|
||||||
if (sess) {
|
if (sess) {
|
||||||
@ -384,8 +382,7 @@ int tls1_shared_curve(SSL *s, int nmatch)
|
|||||||
/* In practice, NID_undef == 0 but let's be precise. */
|
/* In practice, NID_undef == 0 but let's be precise. */
|
||||||
return nmatch == -1 ? 0 : NID_undef;
|
return nmatch == -1 ? 0 : NID_undef;
|
||||||
if (!tls1_get_curvelist
|
if (!tls1_get_curvelist
|
||||||
(s, !(s->options & SSL_OP_CIPHER_SERVER_PREFERENCE), &pref,
|
(s, !(s->options & SSL_OP_CIPHER_SERVER_PREFERENCE), &pref, &num_pref))
|
||||||
&num_pref))
|
|
||||||
return nmatch == -1 ? 0 : NID_undef;
|
return nmatch == -1 ? 0 : NID_undef;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -489,8 +486,7 @@ static int nid_cb(const char *elem, int len, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set curves based on a colon separate list */
|
/* Set curves based on a colon separate list */
|
||||||
int tls1_set_curves_list(unsigned char **pext, size_t *pextlen,
|
int tls1_set_curves_list(unsigned char **pext, size_t *pextlen, const char *str)
|
||||||
const char *str)
|
|
||||||
{
|
{
|
||||||
nid_cb_st ncb;
|
nid_cb_st ncb;
|
||||||
ncb.nidcnt = 0;
|
ncb.nidcnt = 0;
|
||||||
@ -862,8 +858,7 @@ int tls12_check_peer_sigalg(const EVP_MD **pmd, SSL *s,
|
|||||||
}
|
}
|
||||||
/* Make sure security callback allows algorithm */
|
/* Make sure security callback allows algorithm */
|
||||||
if (!ssl_security(s, SSL_SECOP_SIGALG_CHECK,
|
if (!ssl_security(s, SSL_SECOP_SIGALG_CHECK,
|
||||||
EVP_MD_size(*pmd) * 4, EVP_MD_type(*pmd),
|
EVP_MD_size(*pmd) * 4, EVP_MD_type(*pmd), (void *)sig)) {
|
||||||
(void *)sig)) {
|
|
||||||
SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE);
|
SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -937,7 +932,8 @@ static int tls_use_ticket(SSL *s)
|
|||||||
return ssl_security(s, SSL_SECOP_TICKET, 0, 0, NULL);
|
return ssl_security(s, SSL_SECOP_TICKET, 0, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compare_uint(const void *p1, const void *p2) {
|
static int compare_uint(const void *p1, const void *p2)
|
||||||
|
{
|
||||||
unsigned int u1 = *((const unsigned int *)p1);
|
unsigned int u1 = *((const unsigned int *)p1);
|
||||||
unsigned int u2 = *((const unsigned int *)p2);
|
unsigned int u2 = *((const unsigned int *)p2);
|
||||||
if (u1 < u2)
|
if (u1 < u2)
|
||||||
@ -956,7 +952,8 @@ static int compare_uint(const void *p1, const void *p2) {
|
|||||||
* contain duplicates, could not be successfully parsed, or an internal error
|
* contain duplicates, could not be successfully parsed, or an internal error
|
||||||
* occurred.
|
* occurred.
|
||||||
*/
|
*/
|
||||||
static int tls1_check_duplicate_extensions(const PACKET *packet) {
|
static int tls1_check_duplicate_extensions(const PACKET *packet)
|
||||||
|
{
|
||||||
PACKET extensions = *packet;
|
PACKET extensions = *packet;
|
||||||
size_t num_extensions = 0, i = 0;
|
size_t num_extensions = 0, i = 0;
|
||||||
unsigned int *extension_types = NULL;
|
unsigned int *extension_types = NULL;
|
||||||
@ -1084,8 +1081,7 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *buf,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ((lenmax = limit - ret - 9) < 0
|
if ((lenmax = limit - ret - 9) < 0
|
||||||
|| (size_str =
|
|| (size_str = strlen(s->tlsext_hostname)) > (unsigned long)lenmax)
|
||||||
strlen(s->tlsext_hostname)) > (unsigned long)lenmax)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* extension type and length */
|
/* extension type and length */
|
||||||
@ -1243,7 +1239,6 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *buf,
|
|||||||
s2n(salglen, etmp);
|
s2n(salglen, etmp);
|
||||||
ret += salglen;
|
ret += salglen;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_OCSP
|
#ifndef OPENSSL_NO_OCSP
|
||||||
if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp) {
|
if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp) {
|
||||||
int i;
|
int i;
|
||||||
@ -1499,7 +1494,10 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *buf,
|
|||||||
s2n(TLSEXT_TYPE_session_ticket, ret);
|
s2n(TLSEXT_TYPE_session_ticket, ret);
|
||||||
s2n(0, ret);
|
s2n(0, ret);
|
||||||
} else {
|
} else {
|
||||||
/* if we don't add the above TLSEXT, we can't add a session ticket later */
|
/*
|
||||||
|
* if we don't add the above TLSEXT, we can't add a session ticket
|
||||||
|
* later
|
||||||
|
*/
|
||||||
s->tlsext_ticket_expected = 0;
|
s->tlsext_ticket_expected = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1509,7 +1507,6 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *buf,
|
|||||||
s2n(TLSEXT_TYPE_status_request, ret);
|
s2n(TLSEXT_TYPE_status_request, ret);
|
||||||
s2n(0, ret);
|
s2n(0, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SRTP
|
#ifndef OPENSSL_NO_SRTP
|
||||||
if (SSL_IS_DTLS(s) && s->srtp_profile) {
|
if (SSL_IS_DTLS(s) && s->srtp_profile) {
|
||||||
int el;
|
int el;
|
||||||
@ -1664,8 +1661,7 @@ static int tls1_alpn_handle_client_hello(SSL *s, PACKET *pkt, int *al)
|
|||||||
} while (PACKET_remaining(&protocol_list) != 0);
|
} while (PACKET_remaining(&protocol_list) != 0);
|
||||||
|
|
||||||
if (!PACKET_memdup(&save_protocol_list,
|
if (!PACKET_memdup(&save_protocol_list,
|
||||||
&s->s3->alpn_proposed,
|
&s->s3->alpn_proposed, &s->s3->alpn_proposed_len)) {
|
||||||
&s->s3->alpn_proposed_len)) {
|
|
||||||
*al = TLS1_AD_INTERNAL_ERROR;
|
*al = TLS1_AD_INTERNAL_ERROR;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1962,8 +1958,7 @@ static int ssl_scan_clienthello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
else if (type == TLSEXT_TYPE_ec_point_formats) {
|
else if (type == TLSEXT_TYPE_ec_point_formats) {
|
||||||
PACKET ec_point_format_list;
|
PACKET ec_point_format_list;
|
||||||
|
|
||||||
if (!PACKET_as_length_prefixed_1(&extension,
|
if (!PACKET_as_length_prefixed_1(&extension, &ec_point_format_list)
|
||||||
&ec_point_format_list)
|
|
||||||
|| PACKET_remaining(&ec_point_format_list) == 0) {
|
|| PACKET_remaining(&ec_point_format_list) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1971,7 +1966,8 @@ static int ssl_scan_clienthello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
if (!s->hit) {
|
if (!s->hit) {
|
||||||
if (!PACKET_memdup(&ec_point_format_list,
|
if (!PACKET_memdup(&ec_point_format_list,
|
||||||
&s->session->tlsext_ecpointformatlist,
|
&s->session->tlsext_ecpointformatlist,
|
||||||
&s->session->tlsext_ecpointformatlist_length)) {
|
&s->
|
||||||
|
session->tlsext_ecpointformatlist_length)) {
|
||||||
*al = TLS1_AD_INTERNAL_ERROR;
|
*al = TLS1_AD_INTERNAL_ERROR;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1980,8 +1976,7 @@ static int ssl_scan_clienthello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
PACKET elliptic_curve_list;
|
PACKET elliptic_curve_list;
|
||||||
|
|
||||||
/* Each NamedCurve is 2 bytes and we must have at least 1. */
|
/* Each NamedCurve is 2 bytes and we must have at least 1. */
|
||||||
if (!PACKET_as_length_prefixed_2(&extension,
|
if (!PACKET_as_length_prefixed_2(&extension, &elliptic_curve_list)
|
||||||
&elliptic_curve_list)
|
|
||||||
|| PACKET_remaining(&elliptic_curve_list) == 0
|
|| PACKET_remaining(&elliptic_curve_list) == 0
|
||||||
|| (PACKET_remaining(&elliptic_curve_list) % 2) != 0) {
|
|| (PACKET_remaining(&elliptic_curve_list) % 2) != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -1990,7 +1985,8 @@ static int ssl_scan_clienthello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
if (!s->hit) {
|
if (!s->hit) {
|
||||||
if (!PACKET_memdup(&elliptic_curve_list,
|
if (!PACKET_memdup(&elliptic_curve_list,
|
||||||
&s->session->tlsext_ellipticcurvelist,
|
&s->session->tlsext_ellipticcurvelist,
|
||||||
&s->session->tlsext_ellipticcurvelist_length)) {
|
&s->
|
||||||
|
session->tlsext_ellipticcurvelist_length)) {
|
||||||
*al = TLS1_AD_INTERNAL_ERROR;
|
*al = TLS1_AD_INTERNAL_ERROR;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2001,7 +1997,8 @@ static int ssl_scan_clienthello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
if (s->tls_session_ticket_ext_cb &&
|
if (s->tls_session_ticket_ext_cb &&
|
||||||
!s->tls_session_ticket_ext_cb(s, PACKET_data(&extension),
|
!s->tls_session_ticket_ext_cb(s, PACKET_data(&extension),
|
||||||
PACKET_remaining(&extension),
|
PACKET_remaining(&extension),
|
||||||
s->tls_session_ticket_ext_cb_arg)) {
|
s->tls_session_ticket_ext_cb_arg))
|
||||||
|
{
|
||||||
*al = TLS1_AD_INTERNAL_ERROR;
|
*al = TLS1_AD_INTERNAL_ERROR;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2025,12 +2022,12 @@ static int ssl_scan_clienthello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
(unsigned int *)&s->tlsext_status_type)) {
|
(unsigned int *)&s->tlsext_status_type)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_OCSP
|
#ifndef OPENSSL_NO_OCSP
|
||||||
if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp) {
|
if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp) {
|
||||||
const unsigned char *ext_data;
|
const unsigned char *ext_data;
|
||||||
PACKET responder_id_list, exts;
|
PACKET responder_id_list, exts;
|
||||||
if (!PACKET_get_length_prefixed_2(&extension, &responder_id_list))
|
if (!PACKET_get_length_prefixed_2
|
||||||
|
(&extension, &responder_id_list))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while (PACKET_remaining(&responder_id_list) > 0) {
|
while (PACKET_remaining(&responder_id_list) > 0) {
|
||||||
@ -2177,7 +2174,9 @@ static int ssl_scan_clienthello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PACKET_remaining(pkt) != 0) {
|
if (PACKET_remaining(pkt) != 0) {
|
||||||
/* tls1_check_duplicate_extensions should ensure this never happens. */
|
/*
|
||||||
|
* tls1_check_duplicate_extensions should ensure this never happens.
|
||||||
|
*/
|
||||||
*al = SSL_AD_INTERNAL_ERROR;
|
*al = SSL_AD_INTERNAL_ERROR;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2338,8 +2337,7 @@ static int ssl_scan_serverhello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
s->tlsext_ticket_expected = 1;
|
s->tlsext_ticket_expected = 1;
|
||||||
}
|
} else if (type == TLSEXT_TYPE_status_request) {
|
||||||
else if (type == TLSEXT_TYPE_status_request) {
|
|
||||||
/*
|
/*
|
||||||
* MUST be empty and only sent if we've requested a status
|
* MUST be empty and only sent if we've requested a status
|
||||||
* request message.
|
* request message.
|
||||||
@ -2390,10 +2388,10 @@ static int ssl_scan_serverhello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
*al = TLS1_AD_DECODE_ERROR;
|
*al = TLS1_AD_DECODE_ERROR;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (s->
|
if (s->ctx->next_proto_select_cb(s, &selected, &selected_len, data,
|
||||||
ctx->next_proto_select_cb(s, &selected, &selected_len, data,
|
|
||||||
size,
|
size,
|
||||||
s->ctx->next_proto_select_cb_arg) !=
|
s->
|
||||||
|
ctx->next_proto_select_cb_arg) !=
|
||||||
SSL_TLSEXT_ERR_OK) {
|
SSL_TLSEXT_ERR_OK) {
|
||||||
*al = TLS1_AD_INTERNAL_ERROR;
|
*al = TLS1_AD_INTERNAL_ERROR;
|
||||||
return 0;
|
return 0;
|
||||||
@ -2423,8 +2421,7 @@ static int ssl_scan_serverhello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
* uint8 proto[proto_length];
|
* uint8 proto[proto_length];
|
||||||
*/
|
*/
|
||||||
if (!PACKET_get_net_2(&spkt, &len)
|
if (!PACKET_get_net_2(&spkt, &len)
|
||||||
|| PACKET_remaining(&spkt) != len
|
|| PACKET_remaining(&spkt) != len || !PACKET_get_1(&spkt, &len)
|
||||||
|| !PACKET_get_1(&spkt, &len)
|
|
||||||
|| PACKET_remaining(&spkt) != len) {
|
|| PACKET_remaining(&spkt) != len) {
|
||||||
*al = TLS1_AD_DECODE_ERROR;
|
*al = TLS1_AD_DECODE_ERROR;
|
||||||
return 0;
|
return 0;
|
||||||
@ -2473,8 +2470,7 @@ static int ssl_scan_serverhello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
if (s->s3->tmp.new_cipher->algorithm_mac != SSL_AEAD
|
if (s->s3->tmp.new_cipher->algorithm_mac != SSL_AEAD
|
||||||
&& s->s3->tmp.new_cipher->algorithm_enc != SSL_RC4)
|
&& s->s3->tmp.new_cipher->algorithm_enc != SSL_RC4)
|
||||||
s->s3->flags |= TLS1_FLAGS_ENCRYPT_THEN_MAC;
|
s->s3->flags |= TLS1_FLAGS_ENCRYPT_THEN_MAC;
|
||||||
}
|
} else if (type == TLSEXT_TYPE_extended_master_secret) {
|
||||||
else if (type == TLSEXT_TYPE_extended_master_secret) {
|
|
||||||
s->s3->flags |= TLS1_FLAGS_RECEIVED_EXTMS;
|
s->s3->flags |= TLS1_FLAGS_RECEIVED_EXTMS;
|
||||||
if (!s->hit)
|
if (!s->hit)
|
||||||
s->session->flags |= SSL_SESS_FLAG_EXTMS;
|
s->session->flags |= SSL_SESS_FLAG_EXTMS;
|
||||||
@ -2495,7 +2491,8 @@ static int ssl_scan_serverhello_tlsext(SSL *s, PACKET *pkt, int *al)
|
|||||||
if (!s->hit && tlsext_servername == 1) {
|
if (!s->hit && tlsext_servername == 1) {
|
||||||
if (s->tlsext_hostname) {
|
if (s->tlsext_hostname) {
|
||||||
if (s->session->tlsext_hostname == NULL) {
|
if (s->session->tlsext_hostname == NULL) {
|
||||||
s->session->tlsext_hostname = OPENSSL_strdup(s->tlsext_hostname);
|
s->session->tlsext_hostname =
|
||||||
|
OPENSSL_strdup(s->tlsext_hostname);
|
||||||
if (!s->session->tlsext_hostname) {
|
if (!s->session->tlsext_hostname) {
|
||||||
*al = SSL_AD_UNRECOGNIZED_NAME;
|
*al = SSL_AD_UNRECOGNIZED_NAME;
|
||||||
return 0;
|
return 0;
|
||||||
@ -2593,6 +2590,7 @@ static int ssl_check_clienthello_tlsext_early(SSL *s)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialise digests to default values */
|
/* Initialise digests to default values */
|
||||||
void ssl_set_default_md(SSL *s)
|
void ssl_set_default_md(SSL *s)
|
||||||
{
|
{
|
||||||
@ -3007,7 +3005,8 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
|
|||||||
EVP_sha256(), NULL) <= 0
|
EVP_sha256(), NULL) <= 0
|
||||||
|| EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL,
|
|| EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL,
|
||||||
tctx->tlsext_tick_aes_key,
|
tctx->tlsext_tick_aes_key,
|
||||||
etick + sizeof(tctx->tlsext_tick_key_name)) <= 0) {
|
etick + sizeof(tctx->tlsext_tick_key_name)) <=
|
||||||
|
0) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3035,8 +3034,7 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
|
|||||||
p = etick + 16 + EVP_CIPHER_CTX_iv_length(ctx);
|
p = etick + 16 + EVP_CIPHER_CTX_iv_length(ctx);
|
||||||
eticklen -= 16 + EVP_CIPHER_CTX_iv_length(ctx);
|
eticklen -= 16 + EVP_CIPHER_CTX_iv_length(ctx);
|
||||||
sdec = OPENSSL_malloc(eticklen);
|
sdec = OPENSSL_malloc(eticklen);
|
||||||
if (sdec == NULL
|
if (sdec == NULL || EVP_DecryptUpdate(ctx, sdec, &slen, p, eticklen) <= 0) {
|
||||||
|| EVP_DecryptUpdate(ctx, sdec, &slen, p, eticklen) <= 0) {
|
|
||||||
EVP_CIPHER_CTX_free(ctx);
|
EVP_CIPHER_CTX_free(ctx);
|
||||||
OPENSSL_free(sdec);
|
OPENSSL_free(sdec);
|
||||||
return -1;
|
return -1;
|
||||||
@ -3128,8 +3126,7 @@ static int tls12_find_nid(int id, const tls12_lookup *table, size_t tlen)
|
|||||||
return NID_undef;
|
return NID_undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk,
|
int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, const EVP_MD *md)
|
||||||
const EVP_MD *md)
|
|
||||||
{
|
{
|
||||||
int sig_id, md_id;
|
int sig_id, md_id;
|
||||||
if (!md)
|
if (!md)
|
||||||
@ -3165,8 +3162,10 @@ static const tls12_hash_info tls12_md_info[] = {
|
|||||||
{NID_sha384, 192, SSL_MD_SHA384_IDX, TLSEXT_hash_sha384},
|
{NID_sha384, 192, SSL_MD_SHA384_IDX, TLSEXT_hash_sha384},
|
||||||
{NID_sha512, 256, SSL_MD_SHA512_IDX, TLSEXT_hash_sha512},
|
{NID_sha512, 256, SSL_MD_SHA512_IDX, TLSEXT_hash_sha512},
|
||||||
{NID_id_GostR3411_94, 128, SSL_MD_GOST94_IDX, TLSEXT_hash_gostr3411},
|
{NID_id_GostR3411_94, 128, SSL_MD_GOST94_IDX, TLSEXT_hash_gostr3411},
|
||||||
{NID_id_GostR3411_2012_256, 128, SSL_MD_GOST12_256_IDX, TLSEXT_hash_gostr34112012_256},
|
{NID_id_GostR3411_2012_256, 128, SSL_MD_GOST12_256_IDX,
|
||||||
{NID_id_GostR3411_2012_512, 256, SSL_MD_GOST12_512_IDX, TLSEXT_hash_gostr34112012_512},
|
TLSEXT_hash_gostr34112012_256},
|
||||||
|
{NID_id_GostR3411_2012_512, 256, SSL_MD_GOST12_512_IDX,
|
||||||
|
TLSEXT_hash_gostr34112012_512},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const tls12_hash_info *tls12_get_hash_info(unsigned char hash_alg)
|
static const tls12_hash_info *tls12_get_hash_info(unsigned char hash_alg)
|
||||||
@ -3175,8 +3174,7 @@ static const tls12_hash_info *tls12_get_hash_info(unsigned char hash_alg)
|
|||||||
if (hash_alg == 0)
|
if (hash_alg == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i=0; i < OSSL_NELEM(tls12_md_info); i++)
|
for (i = 0; i < OSSL_NELEM(tls12_md_info); i++) {
|
||||||
{
|
|
||||||
if (tls12_md_info[i].tlsext_hash == hash_alg)
|
if (tls12_md_info[i].tlsext_hash == hash_alg)
|
||||||
return tls12_md_info + i;
|
return tls12_md_info + i;
|
||||||
}
|
}
|
||||||
@ -3243,8 +3241,7 @@ static void tls1_lookup_sigalg(int *phash_nid, int *psign_nid,
|
|||||||
}
|
}
|
||||||
if (psignhash_nid) {
|
if (psignhash_nid) {
|
||||||
if (sign_nid == NID_undef || hash_nid == NID_undef
|
if (sign_nid == NID_undef || hash_nid == NID_undef
|
||||||
|| OBJ_find_sigid_by_algs(psignhash_nid, hash_nid,
|
|| OBJ_find_sigid_by_algs(psignhash_nid, hash_nid, sign_nid) <= 0)
|
||||||
sign_nid) <= 0)
|
|
||||||
*psignhash_nid = NID_undef;
|
*psignhash_nid = NID_undef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3474,9 +3471,11 @@ int tls1_process_sigalgs(SSL *s)
|
|||||||
if (pmd[SSL_PKEY_GOST01] == NULL)
|
if (pmd[SSL_PKEY_GOST01] == NULL)
|
||||||
pmd[SSL_PKEY_GOST01] = EVP_get_digestbynid(NID_id_GostR3411_94);
|
pmd[SSL_PKEY_GOST01] = EVP_get_digestbynid(NID_id_GostR3411_94);
|
||||||
if (pmd[SSL_PKEY_GOST12_256] == NULL)
|
if (pmd[SSL_PKEY_GOST12_256] == NULL)
|
||||||
pmd[SSL_PKEY_GOST12_256] = EVP_get_digestbynid(NID_id_GostR3411_2012_256);
|
pmd[SSL_PKEY_GOST12_256] =
|
||||||
|
EVP_get_digestbynid(NID_id_GostR3411_2012_256);
|
||||||
if (pmd[SSL_PKEY_GOST12_512] == NULL)
|
if (pmd[SSL_PKEY_GOST12_512] == NULL)
|
||||||
pmd[SSL_PKEY_GOST12_512] = EVP_get_digestbynid(NID_id_GostR3411_2012_512);
|
pmd[SSL_PKEY_GOST12_512] =
|
||||||
|
EVP_get_digestbynid(NID_id_GostR3411_2012_512);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -3598,8 +3597,7 @@ int tls1_set_sigalgs_list(CERT *c, const char *str, int client)
|
|||||||
return tls1_set_sigalgs(c, sig.sigalgs, sig.sigalgcnt, client);
|
return tls1_set_sigalgs(c, sig.sigalgs, sig.sigalgcnt, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tls1_set_sigalgs(CERT *c, const int *psig_nids, size_t salglen,
|
int tls1_set_sigalgs(CERT *c, const int *psig_nids, size_t salglen, int client)
|
||||||
int client)
|
|
||||||
{
|
{
|
||||||
unsigned char *sigalgs, *sptr;
|
unsigned char *sigalgs, *sptr;
|
||||||
int rhash, rsign;
|
int rhash, rsign;
|
||||||
@ -3945,7 +3943,6 @@ int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain)
|
|||||||
return tls1_check_chain(s, x, pk, chain, -1);
|
return tls1_check_chain(s, x, pk, chain, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DH
|
#ifndef OPENSSL_NO_DH
|
||||||
DH *ssl_get_auto_dh(SSL *s)
|
DH *ssl_get_auto_dh(SSL *s)
|
||||||
{
|
{
|
||||||
|
@ -657,8 +657,7 @@ static int ssl_print_extension(BIO *bio, int indent, int server, int extype,
|
|||||||
xlen = ext[0];
|
xlen = ext[0];
|
||||||
if (extlen != xlen + 1)
|
if (extlen != xlen + 1)
|
||||||
return 0;
|
return 0;
|
||||||
return ssl_trace_list(bio, indent + 2,
|
return ssl_trace_list(bio, indent + 2, ext + 1, xlen, 1, ssl_point_tbl);
|
||||||
ext + 1, xlen, 1, ssl_point_tbl);
|
|
||||||
|
|
||||||
case TLSEXT_TYPE_elliptic_curves:
|
case TLSEXT_TYPE_elliptic_curves:
|
||||||
if (extlen < 2)
|
if (extlen < 2)
|
||||||
@ -666,8 +665,7 @@ static int ssl_print_extension(BIO *bio, int indent, int server, int extype,
|
|||||||
xlen = (ext[0] << 8) | ext[1];
|
xlen = (ext[0] << 8) | ext[1];
|
||||||
if (extlen != xlen + 2)
|
if (extlen != xlen + 2)
|
||||||
return 0;
|
return 0;
|
||||||
return ssl_trace_list(bio, indent + 2,
|
return ssl_trace_list(bio, indent + 2, ext + 2, xlen, 2, ssl_curve_tbl);
|
||||||
ext + 2, xlen, 2, ssl_curve_tbl);
|
|
||||||
|
|
||||||
case TLSEXT_TYPE_signature_algorithms:
|
case TLSEXT_TYPE_signature_algorithms:
|
||||||
|
|
||||||
@ -705,8 +703,7 @@ static int ssl_print_extension(BIO *bio, int indent, int server, int extype,
|
|||||||
ssl_print_hex(bio, indent + 4, "client_verify_data", ext, xlen);
|
ssl_print_hex(bio, indent + 4, "client_verify_data", ext, xlen);
|
||||||
if (server) {
|
if (server) {
|
||||||
ext += xlen;
|
ext += xlen;
|
||||||
ssl_print_hex(bio, indent + 4,
|
ssl_print_hex(bio, indent + 4, "server_verify_data", ext, xlen);
|
||||||
"server_verify_data", ext, xlen);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BIO_indent(bio, indent + 4, 80);
|
BIO_indent(bio, indent + 4, 80);
|
||||||
@ -758,8 +755,7 @@ static int ssl_print_extensions(BIO *bio, int indent, int server,
|
|||||||
if (msglen < extlen + 4)
|
if (msglen < extlen + 4)
|
||||||
return 0;
|
return 0;
|
||||||
msg += 4;
|
msg += 4;
|
||||||
if (!ssl_print_extension(bio, indent + 2, server,
|
if (!ssl_print_extension(bio, indent + 2, server, extype, msg, extlen))
|
||||||
extype, msg, extlen))
|
|
||||||
return 0;
|
return 0;
|
||||||
msg += extlen;
|
msg += extlen;
|
||||||
msglen -= extlen + 4;
|
msglen -= extlen + 4;
|
||||||
@ -823,8 +819,7 @@ static int ssl_print_client_hello(BIO *bio, SSL *ssl, int indent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int dtls_print_hello_vfyrequest(BIO *bio, int indent,
|
static int dtls_print_hello_vfyrequest(BIO *bio, int indent,
|
||||||
const unsigned char *msg,
|
const unsigned char *msg, size_t msglen)
|
||||||
size_t msglen)
|
|
||||||
{
|
{
|
||||||
if (!ssl_print_version(bio, indent, "server_version", &msg, &msglen))
|
if (!ssl_print_version(bio, indent, "server_version", &msg, &msglen))
|
||||||
return 0;
|
return 0;
|
||||||
@ -928,8 +923,7 @@ static int ssl_print_client_keyex(BIO *bio, int indent, SSL *ssl,
|
|||||||
"EncyptedPreMasterSecret", msg, msglen);
|
"EncyptedPreMasterSecret", msg, msglen);
|
||||||
} else {
|
} else {
|
||||||
if (!ssl_print_hexbuf(bio, indent + 2,
|
if (!ssl_print_hexbuf(bio, indent + 2,
|
||||||
"EncyptedPreMasterSecret", 2,
|
"EncyptedPreMasterSecret", 2, &msg, &msglen))
|
||||||
&msg, &msglen))
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -967,8 +961,7 @@ static int ssl_print_server_keyex(BIO *bio, int indent, SSL *ssl,
|
|||||||
switch (id) {
|
switch (id) {
|
||||||
case SSL_kRSA:
|
case SSL_kRSA:
|
||||||
|
|
||||||
if (!ssl_print_hexbuf(bio, indent + 2, "rsa_modulus", 2,
|
if (!ssl_print_hexbuf(bio, indent + 2, "rsa_modulus", 2, &msg, &msglen))
|
||||||
&msg, &msglen))
|
|
||||||
return 0;
|
return 0;
|
||||||
if (!ssl_print_hexbuf(bio, indent + 2, "rsa_exponent", 2,
|
if (!ssl_print_hexbuf(bio, indent + 2, "rsa_exponent", 2,
|
||||||
&msg, &msglen))
|
&msg, &msglen))
|
||||||
@ -1292,8 +1285,7 @@ void SSL_trace(int write_p, int version, int content_type,
|
|||||||
if (write_p == 2) {
|
if (write_p == 2) {
|
||||||
BIO_puts(bio, "Session ");
|
BIO_puts(bio, "Session ");
|
||||||
ssl_print_hex(bio, 0,
|
ssl_print_hex(bio, 0,
|
||||||
ssl_trace_str(content_type, ssl_crypto_tbl),
|
ssl_trace_str(content_type, ssl_crypto_tbl), msg, msglen);
|
||||||
msg, msglen);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (content_type) {
|
switch (content_type) {
|
||||||
|
@ -325,8 +325,7 @@ int srp_generate_client_master_secret(SSL *s)
|
|||||||
goto err;
|
goto err;
|
||||||
if (!
|
if (!
|
||||||
(passwd =
|
(passwd =
|
||||||
s->srp_ctx.SRP_give_srp_client_pwd_callback(s,
|
s->srp_ctx.SRP_give_srp_client_pwd_callback(s, s->srp_ctx.SRP_cb_arg)))
|
||||||
s->srp_ctx.SRP_cb_arg)))
|
|
||||||
goto err;
|
goto err;
|
||||||
if ((x = SRP_Calc_x(s->srp_ctx.s, s->srp_ctx.login, passwd)) == NULL)
|
if ((x = SRP_Calc_x(s->srp_ctx.s, s->srp_ctx.login, passwd)) == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
@ -388,8 +387,7 @@ int SRP_Calc_A_param(SSL *s)
|
|||||||
s->srp_ctx.a = BN_bin2bn(rnd, sizeof(rnd), s->srp_ctx.a);
|
s->srp_ctx.a = BN_bin2bn(rnd, sizeof(rnd), s->srp_ctx.a);
|
||||||
OPENSSL_cleanse(rnd, sizeof(rnd));
|
OPENSSL_cleanse(rnd, sizeof(rnd));
|
||||||
|
|
||||||
if (!
|
if (!(s->srp_ctx.A = SRP_Calc_A(s->srp_ctx.a, s->srp_ctx.N, s->srp_ctx.g)))
|
||||||
(s->srp_ctx.A = SRP_Calc_A(s->srp_ctx.a, s->srp_ctx.N, s->srp_ctx.g)))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
-i4
|
-i4
|
||||||
-il1
|
-il1
|
||||||
-ip0
|
-ip0
|
||||||
-l78
|
-l80
|
||||||
-lp
|
-lp
|
||||||
-nbad
|
-nbad
|
||||||
-nbc
|
-nbc
|
||||||
@ -107,6 +107,7 @@
|
|||||||
-T BIGNUM
|
-T BIGNUM
|
||||||
-T BIO
|
-T BIO
|
||||||
-T BIO_ACCEPT
|
-T BIO_ACCEPT
|
||||||
|
-T BIO_ADDR
|
||||||
-T BIO_ASN1_BUF_CTX
|
-T BIO_ASN1_BUF_CTX
|
||||||
-T BIO_ASN1_EX_FUNCS
|
-T BIO_ASN1_EX_FUNCS
|
||||||
-T BIO_B64_CTX
|
-T BIO_B64_CTX
|
||||||
@ -362,6 +363,7 @@
|
|||||||
-T OPENSSL_PSTRING
|
-T OPENSSL_PSTRING
|
||||||
-T OPENSSL_STRING
|
-T OPENSSL_STRING
|
||||||
-T OPENSSL_STRING
|
-T OPENSSL_STRING
|
||||||
|
-T OSSL_ASYNC_FD
|
||||||
-T OTHERNAME
|
-T OTHERNAME
|
||||||
-T P256_POINT
|
-T P256_POINT
|
||||||
-T P256_POINT_AFFINE
|
-T P256_POINT_AFFINE
|
||||||
@ -442,6 +444,7 @@
|
|||||||
-T SSL_COMP
|
-T SSL_COMP
|
||||||
-T SSL_CONF_CTX
|
-T SSL_CONF_CTX
|
||||||
-T SSL_CTX
|
-T SSL_CTX
|
||||||
|
-T SSL_DANE
|
||||||
-T SSL_EXCERT
|
-T SSL_EXCERT
|
||||||
-T SSL_METHOD
|
-T SSL_METHOD
|
||||||
-T SSL_SESSION
|
-T SSL_SESSION
|
||||||
@ -727,3 +730,5 @@
|
|||||||
-T ASYNC_JOB
|
-T ASYNC_JOB
|
||||||
-T intmax_t
|
-T intmax_t
|
||||||
-T uintmax_t
|
-T uintmax_t
|
||||||
|
-T pqueue
|
||||||
|
-T danetls_record
|
||||||
|
Loading…
x
Reference in New Issue
Block a user