Latest update.

This commit is contained in:
2019-01-30 02:25:21 +09:00
parent 87e37412f8
commit afcfc266de
110 changed files with 2906 additions and 1475 deletions
-13
View File
@@ -440,19 +440,6 @@ int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
&& SSL3_RECORD_get_length(rr) != 0)
s->rlayer.alert_count = 0;
if (SSL3_RECORD_get_type(rr) != SSL3_RT_HANDSHAKE
&& SSL3_RECORD_get_type(rr) != SSL3_RT_CHANGE_CIPHER_SPEC
&& !SSL_in_init(s)
&& (s->d1->next_timeout.tv_sec != 0
|| s->d1->next_timeout.tv_usec != 0)) {
/*
* The timer is still running but we've received something that isn't
* handshake data - so the peer must have finished processing our
* last handshake flight. Stop the timer.
*/
dtls1_stop_timer(s);
}
/* we now have a packet which can be read and processed */
if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec,
+48
View File
@@ -831,6 +831,9 @@ SSL *SSL_new(SSL_CTX *ctx)
s->psk_find_session_cb = ctx->psk_find_session_cb;
s->psk_use_session_cb = ctx->psk_use_session_cb;
s->async_cb = ctx->async_cb;
s->async_cb_arg = ctx->async_cb_arg;
s->job = NULL;
#ifndef OPENSSL_NO_CT
@@ -1718,6 +1721,40 @@ int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, size_t *numaddfds,
numdelfds);
}
int SSL_CTX_set_async_callback(SSL_CTX *ctx, SSL_async_callback_fn callback)
{
ctx->async_cb = callback;
return 1;
}
int SSL_CTX_set_async_callback_arg(SSL_CTX *ctx, void *arg)
{
ctx->async_cb_arg = arg;
return 1;
}
int SSL_set_async_callback(SSL *s, SSL_async_callback_fn callback)
{
s->async_cb = callback;
return 1;
}
int SSL_set_async_callback_arg(SSL *s, void *arg)
{
s->async_cb_arg = arg;
return 1;
}
int SSL_get_async_status(SSL *s, int *status)
{
ASYNC_WAIT_CTX *ctx = s->waitctx;
if (ctx == NULL)
return 0;
*status = ASYNC_WAIT_CTX_get_status(ctx);
return 1;
}
int SSL_accept(SSL *s)
{
if (s->handshake_func == NULL) {
@@ -1743,6 +1780,13 @@ long SSL_get_default_timeout(const SSL *s)
return s->method->get_timeout();
}
static int ssl_async_wait_ctx_cb(void *arg)
{
SSL *s = (SSL *)arg;
return s->async_cb(s, s->async_cb_arg);
}
static int ssl_start_async_job(SSL *s, struct ssl_async_args *args,
int (*func) (void *))
{
@@ -1751,6 +1795,10 @@ static int ssl_start_async_job(SSL *s, struct ssl_async_args *args,
s->waitctx = ASYNC_WAIT_CTX_new();
if (s->waitctx == NULL)
return -1;
if (s->async_cb != NULL
&& !ASYNC_WAIT_CTX_set_callback
(s->waitctx, ssl_async_wait_ctx_cb, s))
return -1;
}
switch (ASYNC_start_job(&s->job, s->waitctx, &ret, func, args,
sizeof(struct ssl_async_args))) {
+8
View File
@@ -1114,6 +1114,10 @@ struct ssl_ctx_st {
/* Do we advertise Post-handshake auth support? */
int pha_enabled;
/* Callback for SSL async handling */
SSL_async_callback_fn async_cb;
void *async_cb_arg;
};
struct ssl_st {
@@ -1511,6 +1515,10 @@ struct ssl_st {
/* Callback to determine if early_data is acceptable or not */
SSL_allow_early_data_cb_fn allow_early_data_cb;
void *allow_early_data_cb_data;
/* Callback for SSL async handling */
SSL_async_callback_fn async_cb;
void *async_cb_arg;
};
/*
-18
View File
@@ -1076,15 +1076,6 @@ WORK_STATE tls_finish_handshake(SSL *s, WORK_STATE wst, int clearbufs, int stop)
/* N.B. s->ctx may not equal s->session_ctx */
tsan_counter(&s->ctx->stats.sess_accept_good);
s->handshake_func = ossl_statem_accept;
if (SSL_IS_DTLS(s) && !s->hit) {
/*
* We are finishing after the client. We start the timer going
* in case there are any retransmits of our final flight
* required.
*/
dtls1_start_timer(s);
}
} else {
if (SSL_IS_TLS13(s)) {
/*
@@ -1106,15 +1097,6 @@ WORK_STATE tls_finish_handshake(SSL *s, WORK_STATE wst, int clearbufs, int stop)
s->handshake_func = ossl_statem_connect;
tsan_counter(&s->session_ctx->stats.sess_connect_good);
if (SSL_IS_DTLS(s) && s->hit) {
/*
* We are finishing after the server. We start the timer going
* in case there are any retransmits of our final flight
* required.
*/
dtls1_start_timer(s);
}
}
if (SSL_IS_DTLS(s)) {