SSL_ENC_FLAG_DTLS | SSL_ENC_FLAG_EXPLICIT_IV,
DTLS1_HM_HEADER_LENGTH,
dtls1_set_handshake_header,
+ dtls1_set_handshake_header2,
+ dtls1_close_construct_packet,
dtls1_handshake_write
};
| SSL_ENC_FLAG_SHA256_PRF | SSL_ENC_FLAG_TLS1_2_CIPHERS,
DTLS1_HM_HEADER_LENGTH,
dtls1_set_handshake_header,
+ dtls1_set_handshake_header2,
+ dtls1_close_construct_packet,
dtls1_handshake_write
};
}
static void dtls1_clear_queues(SSL *s)
+{
+ dtls1_clear_received_buffer(s);
+ dtls1_clear_sent_buffer(s);
+}
+
+void dtls1_clear_received_buffer(SSL *s)
{
pitem *item = NULL;
hm_fragment *frag = NULL;
dtls1_hm_fragment_free(frag);
pitem_free(item);
}
+}
+
+void dtls1_clear_sent_buffer(SSL *s)
+{
+ pitem *item = NULL;
+ hm_fragment *frag = NULL;
while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) {
frag = (hm_fragment *)item->data;
}
}
+
void dtls1_free(SSL *s)
{
DTLS_RECORD_LAYER_free(&s->rlayer);
}
ssl3_clear(s);
- if (s->options & SSL_OP_CISCO_ANYCONNECT)
- s->client_version = s->version = DTLS1_BAD_VER;
- else if (s->method->version == DTLS_ANY_VERSION)
+
+ if (s->method->version == DTLS_ANY_VERSION)
s->version = DTLS_MAX_VERSION;
+#ifndef OPENSSL_NO_DTLS1_METHOD
+ else if (s->options & SSL_OP_CISCO_ANYCONNECT)
+ s->client_version = s->version = DTLS1_BAD_VER;
+#endif
else
s->version = s->method->version;
}
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0,
&(s->d1->next_timeout));
/* Clear retransmission buffer */
- dtls1_clear_record_buffer(s);
+ dtls1_clear_sent_buffer(s);
}
int dtls1_check_timeout_num(SSL *s)
if (s->d1->timeout.num_alerts > 2
&& !(SSL_get_options(s) & SSL_OP_NO_QUERY_MTU)) {
mtu =
- BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_GET_FALLBACK_MTU, 0,
- NULL);
+ BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_GET_FALLBACK_MTU, 0, NULL);
if (mtu < s->d1->mtu)
s->d1->mtu = mtu;
}
GetSystemTime(&st);
SystemTimeToFileTime(&st, &now.ft);
+ /* re-bias to 1/1/1970 */
# ifdef __MINGW32__
now.ul -= 116444736000000000ULL;
# else
- now.ul -= 116444736000000000UI64; /* re-bias to 1/1/1970 */
+ /* *INDENT-OFF* */
+ now.ul -= 116444736000000000UI64;
+ /* *INDENT-ON* */
# endif
t->tv_sec = (long)(now.ul / 10000000);
t->tv_usec = ((int)(now.ul % 10000000)) / 10;
#endif
}
-
#define LISTEN_SUCCESS 2
#define LISTEN_SEND_VERIFY_REQUEST 1
goto end;
}
- if (rectype != SSL3_RT_HANDSHAKE) {
+ if (rectype != SSL3_RT_HANDSHAKE) {
SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_UNEXPECTED_MESSAGE);
goto end;
}
s->msg_callback(1, 0, SSL3_RT_HEADER, buf,
DTLS1_RT_HEADER_LENGTH, s, s->msg_callback_arg);
-
if ((tmpclient = BIO_ADDR_new()) == NULL) {
SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_MALLOC_FAILURE);
goto end;
*/
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)
BIO_ADDR_clear(client);
ret = 1;
clearpkt = 0;
-end:
+ end:
BIO_ADDR_free(tmpclient);
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_PEEK_MODE, 0, NULL);
if (clearpkt) {
#ifndef OPENSSL_NO_HEARTBEATS
-#define HEARTBEAT_SIZE(payload, padding) ( \
+# define HEARTBEAT_SIZE(payload, padding) ( \
1 /* heartbeat type */ + \
2 /* heartbeat length */ + \
(payload) + (padding))
-#define HEARTBEAT_SIZE_STD(payload) HEARTBEAT_SIZE(payload, 16)
+# define HEARTBEAT_SIZE_STD(payload) HEARTBEAT_SIZE(payload, 16)
int dtls1_process_heartbeat(SSL *s, unsigned char *p, unsigned int length)
{
if (ret >= 0) {
if (s->msg_callback)
s->msg_callback(1, s->version, DTLS1_RT_HEARTBEAT,
- buf, size,
- s, s->msg_callback_arg);
+ buf, size, s, s->msg_callback_arg);
dtls1_start_timer(s);
s->tlsext_hb_pending = 1;