# include <openssl/ssl.h>
# include <openssl/symhacks.h>
+#include "record/ssl3_buffer.h"
+#include "record/ssl3_record.h"
#include "record/rec_layer.h"
# ifdef OPENSSL_BUILD_SHLIBSSL
int type;
/* SSLv3 */
const SSL_METHOD *method;
-
- RECORD_LAYER rlayer;
/*
* There are 2 BIO's even though they are normally both the same. This
* is so data can be read and written to different handlers
* basis, depending on the chosen cipher.
*/
int (*not_resumable_session_cb) (SSL *ssl, int is_forward_secure);
+
+ RECORD_LAYER rlayer;
};
-typedef struct ssl3_record_st {
- /* type of record */
- /*
- * r
- */ int type;
- /* How many bytes available */
- /*
- * rw
- */ unsigned int length;
- /*
- * How many bytes were available before padding was removed? This is used
- * to implement the MAC check in constant time for CBC records.
- */
- /*
- * rw
- */ unsigned int orig_len;
- /* read/write offset into 'buf' */
- /*
- * r
- */ unsigned int off;
- /* pointer to the record data */
- /*
- * rw
- */ unsigned char *data;
- /* where the decode bytes are */
- /*
- * rw
- */ unsigned char *input;
- /* only used with decompression - malloc()ed */
- /*
- * r
- */ unsigned char *comp;
- /* epoch number, needed by DTLS1 */
- /*
- * r
- */ unsigned long epoch;
- /* sequence number, needed by DTLS1 */
- /*
- * r
- */ unsigned char seq_num[8];
-} SSL3_RECORD;
-
-typedef struct ssl3_buffer_st {
- /* at least SSL3_RT_MAX_PACKET_SIZE bytes, see ssl3_setup_buffers() */
- unsigned char *buf;
- /* buffer size */
- size_t len;
- /* where to 'copy from' */
- int offset;
- /* how many bytes left */
- int left;
-} SSL3_BUFFER;
typedef struct ssl3_state_st {
long flags;
int empty_fragment_done;
/* The value of 'extra' when the buffers were initialized */
int init_extra;
- SSL3_BUFFER rbuf; /* read IO goes into here */
- SSL3_BUFFER wbuf; /* write IO goes into here */
- SSL3_RECORD rrec; /* each decoded record goes in here */
- SSL3_RECORD wrec; /* goes out from here */
/*
* storage for Alert/Handshake protocol data received but not yet
* processed by ssl3_read_bytes:
__owur unsigned long ssl3_output_cert_chain(SSL *s, CERT_PKEY *cpk);
__owur SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt,
STACK_OF(SSL_CIPHER) *srvr);
-__owur int ssl3_setup_buffers(SSL *s);
-__owur int ssl3_setup_read_buffer(SSL *s);
-__owur int ssl3_setup_write_buffer(SSL *s);
-int ssl3_release_read_buffer(SSL *s);
-int ssl3_release_write_buffer(SSL *s);
__owur int ssl3_digest_cached_records(SSL *s);
__owur int ssl3_new(SSL *s);
void ssl3_free(SSL *s);
__owur int dtls1_do_write(SSL *s, int type);
__owur int ssl3_read_n(SSL *s, int n, int max, int extend);
__owur int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
-__owur int ssl3_do_compress(SSL *ssl);
-__owur int ssl3_do_uncompress(SSL *ssl);
__owur int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
unsigned int len);
void dtls1_set_message_header(SSL *s,
__owur unsigned int dtls1_min_mtu(SSL *s);
__owur unsigned int dtls1_link_min_mtu(void);
void dtls1_hm_fragment_free(hm_fragment *frag);
+int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap);
+void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap);
+DTLS1_BITMAP *dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr,
+ unsigned int *is_next_epoch);
+int dtls1_process_buffered_records(SSL *s);
+int dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue);
+int dtls1_buffer_record(SSL *s, record_pqueue *q,
+ unsigned char *priority);
/* some client-only functions */
__owur int ssl3_client_hello(SSL *s);
long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg);
__owur int dtls1_shutdown(SSL *s);
+<<<<<<< HEAD
__owur long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
__owur int dtls1_get_record(SSL *s);
__owur int do_dtls1_write(SSL *s, int type, const unsigned char *buf,
+=======
+long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
+int do_dtls1_write(SSL *s, int type, const unsigned char *buf,
+>>>>>>> Move SSL3_RECORD oriented functions into ssl3_record.c
unsigned int len, int create_empty_fragement);
__owur int dtls1_dispatch_alert(SSL *s);