summaryrefslogtreecommitdiff
path: root/src/lib/libssl/dtls1.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/dtls1.h')
-rw-r--r--src/lib/libssl/dtls1.h61
1 files changed, 55 insertions, 6 deletions
diff --git a/src/lib/libssl/dtls1.h b/src/lib/libssl/dtls1.h
index f159d37110..2900d1d8ae 100644
--- a/src/lib/libssl/dtls1.h
+++ b/src/lib/libssl/dtls1.h
@@ -62,6 +62,18 @@
62 62
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64#include <openssl/pqueue.h> 64#include <openssl/pqueue.h>
65#ifdef OPENSSL_SYS_VMS
66#include <resource.h>
67#include <sys/timeb.h>
68#endif
69#ifdef OPENSSL_SYS_WIN32
70/* Needed for struct timeval */
71#include <winsock.h>
72#elif defined(OPENSSL_SYS_NETWARE) && !defined(_WINSOCK2API_)
73#include <sys/timeval.h>
74#else
75#include <sys/time.h>
76#endif
65 77
66#ifdef __cplusplus 78#ifdef __cplusplus
67extern "C" { 79extern "C" {
@@ -76,7 +88,7 @@ extern "C" {
76#endif 88#endif
77 89
78/* lengths of messages */ 90/* lengths of messages */
79#define DTLS1_COOKIE_LENGTH 32 91#define DTLS1_COOKIE_LENGTH 256
80 92
81#define DTLS1_RT_HEADER_LENGTH 13 93#define DTLS1_RT_HEADER_LENGTH 13
82 94
@@ -96,11 +108,26 @@ extern "C" {
96 108
97typedef struct dtls1_bitmap_st 109typedef struct dtls1_bitmap_st
98 { 110 {
99 PQ_64BIT map; 111 unsigned long map; /* track 32 packets on 32-bit systems
100 unsigned long length; /* sizeof the bitmap in bits */ 112 and 64 - on 64-bit systems */
101 PQ_64BIT max_seq_num; /* max record number seen so far */ 113 unsigned char max_seq_num[8]; /* max record number seen so far,
114 64-bit value in big-endian
115 encoding */
102 } DTLS1_BITMAP; 116 } DTLS1_BITMAP;
103 117
118struct dtls1_retransmit_state
119 {
120 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
121 EVP_MD_CTX *write_hash; /* used for mac generation */
122#ifndef OPENSSL_NO_COMP
123 COMP_CTX *compress; /* compression */
124#else
125 char *compress;
126#endif
127 SSL_SESSION *session;
128 unsigned short epoch;
129 };
130
104struct hm_header_st 131struct hm_header_st
105 { 132 {
106 unsigned char type; 133 unsigned char type;
@@ -109,6 +136,7 @@ struct hm_header_st
109 unsigned long frag_off; 136 unsigned long frag_off;
110 unsigned long frag_len; 137 unsigned long frag_len;
111 unsigned int is_ccs; 138 unsigned int is_ccs;
139 struct dtls1_retransmit_state saved_retransmit_state;
112 }; 140 };
113 141
114struct ccs_header_st 142struct ccs_header_st
@@ -139,6 +167,7 @@ typedef struct hm_fragment_st
139 { 167 {
140 struct hm_header_st msg_header; 168 struct hm_header_st msg_header;
141 unsigned char *fragment; 169 unsigned char *fragment;
170 unsigned char *reassembly;
142 } hm_fragment; 171 } hm_fragment;
143 172
144typedef struct dtls1_state_st 173typedef struct dtls1_state_st
@@ -168,6 +197,9 @@ typedef struct dtls1_state_st
168 197
169 unsigned short handshake_read_seq; 198 unsigned short handshake_read_seq;
170 199
200 /* save last sequence number for retransmissions */
201 unsigned char last_write_sequence[8];
202
171 /* Received handshake records (processed and unprocessed) */ 203 /* Received handshake records (processed and unprocessed) */
172 record_pqueue unprocessed_rcds; 204 record_pqueue unprocessed_rcds;
173 record_pqueue processed_rcds; 205 record_pqueue processed_rcds;
@@ -178,13 +210,29 @@ typedef struct dtls1_state_st
178 /* Buffered (sent) handshake records */ 210 /* Buffered (sent) handshake records */
179 pqueue sent_messages; 211 pqueue sent_messages;
180 212
181 unsigned int mtu; /* max wire packet size */ 213 /* Buffered application records.
214 * Only for records between CCS and Finished
215 * to prevent either protocol violation or
216 * unnecessary message loss.
217 */
218 record_pqueue buffered_app_data;
219
220 /* Is set when listening for new connections with dtls1_listen() */
221 unsigned int listen;
222
223 unsigned int mtu; /* max DTLS packet size */
182 224
183 struct hm_header_st w_msg_hdr; 225 struct hm_header_st w_msg_hdr;
184 struct hm_header_st r_msg_hdr; 226 struct hm_header_st r_msg_hdr;
185 227
186 struct dtls1_timeout_st timeout; 228 struct dtls1_timeout_st timeout;
187 229
230 /* Indicates when the last handshake msg sent will timeout */
231 struct timeval next_timeout;
232
233 /* Timeout duration */
234 unsigned short timeout_duration;
235
188 /* storage for Alert/Handshake protocol data received but not 236 /* storage for Alert/Handshake protocol data received but not
189 * yet processed by ssl3_read_bytes: */ 237 * yet processed by ssl3_read_bytes: */
190 unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH]; 238 unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH];
@@ -193,6 +241,7 @@ typedef struct dtls1_state_st
193 unsigned int handshake_fragment_len; 241 unsigned int handshake_fragment_len;
194 242
195 unsigned int retransmitting; 243 unsigned int retransmitting;
244 unsigned int change_cipher_spec_ok;
196 245
197 } DTLS1_STATE; 246 } DTLS1_STATE;
198 247