mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Tightened up closure alerts for v1.2 (7.2.1)
git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@260 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
committed by
Yasuki Ikeuchi
parent
106a59cf23
commit
549bcb478e
16
ssl/tls1.c
16
ssl/tls1.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Cameron Rich
|
||||
* Copyright (c) 2007-2016, Cameron Rich
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -205,7 +205,7 @@ EXP_FUNC void STDCALL ssl_free(SSL *ssl)
|
||||
/* only notify if we weren't notified first */
|
||||
/* spec says we must notify when we are dying */
|
||||
if (!IS_SET_SSL_FLAG(SSL_SENT_CLOSE_NOTIFY))
|
||||
send_alert(ssl, SSL_ALERT_CLOSE_NOTIFY);
|
||||
send_alert(ssl, SSL_ALERT_CLOSE_NOTIFY);
|
||||
|
||||
ssl_ctx = ssl->ssl_ctx;
|
||||
|
||||
@ -1000,6 +1000,9 @@ int send_packet(SSL *ssl, uint8_t protocol, const uint8_t *in, int length)
|
||||
if (ssl->hs_status == SSL_ERROR_DEAD)
|
||||
return SSL_ERROR_CONN_LOST;
|
||||
|
||||
if (IS_SET_SSL_FLAG(SSL_SENT_CLOSE_NOTIFY))
|
||||
return SSL_CLOSE_NOTIFY;
|
||||
|
||||
if (in) /* has the buffer already been initialised? */
|
||||
{
|
||||
memcpy(ssl->bm_data, in, length);
|
||||
@ -1184,6 +1187,9 @@ int basic_read(SSL *ssl, uint8_t **in_data)
|
||||
int read_len, is_client = IS_SET_SSL_FLAG(SSL_IS_CLIENT);
|
||||
uint8_t *buf = ssl->bm_data;
|
||||
|
||||
if (IS_SET_SSL_FLAG(SSL_SENT_CLOSE_NOTIFY))
|
||||
return SSL_CLOSE_NOTIFY;
|
||||
|
||||
read_len = SOCKET_READ(ssl->client_fd, &buf[ssl->bm_read_index],
|
||||
ssl->need_bytes-ssl->got_bytes);
|
||||
|
||||
@ -1335,12 +1341,12 @@ int basic_read(SSL *ssl, uint8_t **in_data)
|
||||
|
||||
case PT_ALERT_PROTOCOL:
|
||||
/* return the alert # with alert bit set */
|
||||
if(buf[0] == SSL_ALERT_TYPE_WARNING &&
|
||||
if (buf[0] == SSL_ALERT_TYPE_WARNING &&
|
||||
buf[1] == SSL_ALERT_CLOSE_NOTIFY)
|
||||
{
|
||||
ret = SSL_CLOSE_NOTIFY;
|
||||
send_alert(ssl, SSL_ALERT_CLOSE_NOTIFY);
|
||||
SET_SSL_FLAG(SSL_SENT_CLOSE_NOTIFY);
|
||||
ssl_free(ssl);
|
||||
SOCKET_CLOSE(ssl->client_fd);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user