* exit the record layer may update this to an alternative fragment size to
* be used. This must always be less than or equal to |maxfrag|.
*/
- size_t (*get_max_records)(OSSL_RECORD_LAYER *rl, int type, size_t len,
+ size_t (*get_max_records)(OSSL_RECORD_LAYER *rl, uint8_t type, size_t len,
size_t maxfrag, size_t *preffrag);
/*
* exit the record layer may update this to an alternative fragment size to
* be used. This must always be less than or equal to |maxfrag|.
*/
- size_t (*get_max_records)(OSSL_RECORD_LAYER *rl, int type, size_t len,
+ size_t (*get_max_records)(OSSL_RECORD_LAYER *rl, uint8_t type, size_t len,
size_t maxfrag, size_t *preffrag);
/*
#include "ssl_local.h"
-int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, size_t len,
- size_t *written)
+int dtls1_write_app_data_bytes(SSL *s, uint8_t type, const void *buf_,
+ size_t len, size_t *written)
{
int i;
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);
return 0;
}
-static size_t quic_get_max_records(OSSL_RECORD_LAYER *rl, int type, size_t len,
+static size_t quic_get_max_records(OSSL_RECORD_LAYER *rl, uint8_t type,
+ size_t len,
size_t maxfrag, size_t *preffrag)
{
return 1;
int dtls_prepare_record_header(OSSL_RECORD_LAYER *rl,
WPACKET *thispkt,
OSSL_RECORD_TEMPLATE *templ,
- unsigned int rectype,
+ uint8_t rectype,
unsigned char **recdata)
{
size_t maxcomplen;
static int ktls_prepare_record_header(OSSL_RECORD_LAYER *rl,
WPACKET *thispkt,
OSSL_RECORD_TEMPLATE *templ,
- unsigned int rectype,
+ uint8_t rectype,
unsigned char **recdata)
{
/* The kernel writes the record header, so nothing to do */
/* Write related functions */
- size_t (*get_max_records)(OSSL_RECORD_LAYER *rl, int type, size_t len,
+ size_t (*get_max_records)(OSSL_RECORD_LAYER *rl, uint8_t type, size_t len,
size_t maxfrag, size_t *preffrag);
/* Return 1 for success or 0 for error */
size_t *wpinited);
/* Get the actual record type to be used for a given template */
- unsigned int (*get_record_type)(OSSL_RECORD_LAYER *rl,
- OSSL_RECORD_TEMPLATE *template);
+ uint8_t (*get_record_type)(OSSL_RECORD_LAYER *rl,
+ OSSL_RECORD_TEMPLATE *template);
/* Write the record header data to the WPACKET */
int (*prepare_record_header)(OSSL_RECORD_LAYER *rl, WPACKET *thispkt,
OSSL_RECORD_TEMPLATE *templ,
- unsigned int rectype,
+ uint8_t rectype,
unsigned char **recdata);
int (*add_record_padding)(OSSL_RECORD_LAYER *rl,
int dtls_prepare_record_header(OSSL_RECORD_LAYER *rl,
WPACKET *thispkt,
OSSL_RECORD_TEMPLATE *templ,
- unsigned int rectype,
+ uint8_t rectype,
unsigned char **recdata);
int dtls_post_encryption_processing(OSSL_RECORD_LAYER *rl,
size_t mac_size,
int tls_unprocessed_read_pending(OSSL_RECORD_LAYER *rl);
int tls_processed_read_pending(OSSL_RECORD_LAYER *rl);
size_t tls_app_data_pending(OSSL_RECORD_LAYER *rl);
-size_t tls_get_max_records(OSSL_RECORD_LAYER *rl, int type, size_t len,
+size_t tls_get_max_records(OSSL_RECORD_LAYER *rl, uint8_t type, size_t len,
size_t maxfrag, size_t *preffrag);
int tls_write_records(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE *templates,
size_t numtempl);
OSSL_RECORD_TEMPLATE *templates,
size_t numtempl);
-size_t tls_get_max_records_default(OSSL_RECORD_LAYER *rl, int type, size_t len,
+size_t tls_get_max_records_default(OSSL_RECORD_LAYER *rl, uint8_t type,
+ size_t len,
size_t maxfrag, size_t *preffrag);
-size_t tls_get_max_records_multiblock(OSSL_RECORD_LAYER *rl, int type,
+size_t tls_get_max_records_multiblock(OSSL_RECORD_LAYER *rl, uint8_t type,
size_t len, size_t maxfrag,
size_t *preffrag);
int tls_allocate_write_buffers_default(OSSL_RECORD_LAYER *rl,
int tls_prepare_record_header_default(OSSL_RECORD_LAYER *rl,
WPACKET *thispkt,
OSSL_RECORD_TEMPLATE *templ,
- unsigned int rectype,
+ uint8_t rectype,
unsigned char **recdata);
int tls_prepare_for_encryption_default(OSSL_RECORD_LAYER *rl,
size_t mac_size,
return 1;
}
-static unsigned int tls13_get_record_type(OSSL_RECORD_LAYER *rl,
- OSSL_RECORD_TEMPLATE *template)
+static uint8_t tls13_get_record_type(OSSL_RECORD_LAYER *rl,
+ OSSL_RECORD_TEMPLATE *template)
{
if (rl->allow_plain_alerts && template->type == SSL3_RT_ALERT)
- return SSL3_RT_ALERT;
+ return SSL3_RT_ALERT;
/*
* Aside from the above case we always use the application data record type
return num;
}
-size_t tls_get_max_records_default(OSSL_RECORD_LAYER *rl, int type, size_t len,
+size_t tls_get_max_records_default(OSSL_RECORD_LAYER *rl, uint8_t type,
+ size_t len,
size_t maxfrag, size_t *preffrag)
{
/*
return 1;
}
-size_t tls_get_max_records(OSSL_RECORD_LAYER *rl, int type, size_t len,
+size_t tls_get_max_records(OSSL_RECORD_LAYER *rl, uint8_t type, size_t len,
size_t maxfrag, size_t *preffrag)
{
return rl->funcs->get_max_records(rl, type, len, maxfrag, preffrag);
int tls_prepare_record_header_default(OSSL_RECORD_LAYER *rl,
WPACKET *thispkt,
OSSL_RECORD_TEMPLATE *templ,
- unsigned int rectype,
+ uint8_t rectype,
unsigned char **recdata)
{
size_t maxcomplen;
memset(wr, 0, sizeof(wr));
for (j = 0; j < numtempl + prefix; j++) {
unsigned char *compressdata = NULL;
- unsigned int rectype;
+ uint8_t rectype;
thispkt = &pkt[j];
thiswr = &wr[j];
# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0
#endif
-static int tls_is_multiblock_capable(OSSL_RECORD_LAYER *rl, int type,
+static int tls_is_multiblock_capable(OSSL_RECORD_LAYER *rl, uint8_t type,
size_t len, size_t fraglen)
{
#if !defined(OPENSSL_NO_MULTIBLOCK) && EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK
return 0;
}
-size_t tls_get_max_records_multiblock(OSSL_RECORD_LAYER *rl, int type,
+size_t tls_get_max_records_multiblock(OSSL_RECORD_LAYER *rl, uint8_t type,
size_t len, size_t maxfrag,
size_t *preffrag)
{
* Application data protocol
* none of our business
*/
-int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
- size_t len, int peek, size_t *readbytes)
+int dtls1_read_bytes(SSL *s, uint8_t type, uint8_t *recvd_type,
+ unsigned char *buf, size_t len,
+ int peek, size_t *readbytes)
{
int i, j, ret;
size_t n;
* Call this to write data in records of type 'type' It will return <= 0 if
* not all data has been sent or non-blocking IO.
*/
-int dtls1_write_bytes(SSL_CONNECTION *s, int type, const void *buf,
+int dtls1_write_bytes(SSL_CONNECTION *s, uint8_t type, const void *buf,
size_t len, size_t *written)
{
int i;
return i;
}
-int do_dtls1_write(SSL_CONNECTION *sc, int type, const unsigned char *buf,
+int do_dtls1_write(SSL_CONNECTION *sc, uint8_t type, const unsigned char *buf,
size_t len, size_t *written)
{
int i;
return shrt;
}
-static int tls_write_check_pending(SSL_CONNECTION *s, int type,
+static int tls_write_check_pending(SSL_CONNECTION *s, uint8_t type,
const unsigned char *buf, size_t len)
{
if (s->rlayer.wpend_tot == 0)
* Call this to write data in records of type 'type' It will return <= 0 if
* not all data has been sent or non-blocking IO.
*/
-int ssl3_write_bytes(SSL *ssl, int type, const void *buf_, size_t len,
+int ssl3_write_bytes(SSL *ssl, uint8_t type, const void *buf_, size_t len,
size_t *written)
{
const unsigned char *buf = buf_;
* Application data protocol
* none of our business
*/
-int ssl3_read_bytes(SSL *ssl, int type, int *recvd_type, unsigned char *buf,
- size_t len, int peek, size_t *readbytes)
+int ssl3_read_bytes(SSL *ssl, uint8_t type, uint8_t *recvd_type,
+ unsigned char *buf, size_t len,
+ int peek, size_t *readbytes)
{
int i, j, ret;
size_t n, curr_rec, totalbytes;
/* partial write - check the numbers match */
/* number bytes written */
size_t wpend_tot;
- int wpend_type;
+ uint8_t wpend_type;
/* number of bytes submitted */
size_t wpend_ret;
const unsigned char *wpend_buf;
int RECORD_LAYER_write_pending(const RECORD_LAYER *rl);
int RECORD_LAYER_is_sslv2_record(RECORD_LAYER *rl);
__owur size_t ssl3_pending(const SSL *s);
-__owur int ssl3_write_bytes(SSL *s, int type, const void *buf, size_t len,
+__owur int ssl3_write_bytes(SSL *s, uint8_t type, const void *buf, size_t len,
size_t *written);
-__owur int ssl3_read_bytes(SSL *s, int type, int *recvd_type,
+__owur int ssl3_read_bytes(SSL *s, uint8_t type, uint8_t *recvd_type,
unsigned char *buf, size_t len, int peek,
size_t *readbytes);
int DTLS_RECORD_LAYER_new(RECORD_LAYER *rl);
void DTLS_RECORD_LAYER_free(RECORD_LAYER *rl);
void DTLS_RECORD_LAYER_clear(RECORD_LAYER *rl);
-__owur int dtls1_read_bytes(SSL *s, int type, int *recvd_type,
+__owur int dtls1_read_bytes(SSL *s, uint8_t type, uint8_t *recvd_type,
unsigned char *buf, size_t len, int peek,
size_t *readbytes);
-__owur int dtls1_write_bytes(SSL_CONNECTION *s, int type, const void *buf,
+__owur int dtls1_write_bytes(SSL_CONNECTION *s, uint8_t type, const void *buf,
size_t len, size_t *written);
-int do_dtls1_write(SSL_CONNECTION *s, int type, const unsigned char *buf,
+int do_dtls1_write(SSL_CONNECTION *s, uint8_t type, const unsigned char *buf,
size_t len, size_t *written);
void dtls1_increment_epoch(SSL_CONNECTION *s, int rw);
int ssl_release_record(SSL_CONNECTION *s, TLS_RECORD *rr, size_t length);
int (*ssl_shutdown) (SSL *s);
int (*ssl_renegotiate) (SSL *s);
int (*ssl_renegotiate_check) (SSL *s, int);
- int (*ssl_read_bytes) (SSL *s, int type, int *recvd_type,
+ int (*ssl_read_bytes) (SSL *s, uint8_t type, uint8_t *recvd_type,
unsigned char *buf, size_t len, int peek,
size_t *readbytes);
- int (*ssl_write_bytes) (SSL *s, int type, const void *buf_, size_t len,
+ int (*ssl_write_bytes) (SSL *s, uint8_t type, const void *buf_, size_t len,
size_t *written);
int (*ssl_dispatch_alert) (SSL *s);
long (*ssl_ctrl) (SSL *s, int cmd, long larg, void *parg);
__owur int ssl3_setup_key_block(SSL_CONNECTION *s);
__owur int ssl3_change_cipher_state(SSL_CONNECTION *s, int which);
void ssl3_cleanup_key_block(SSL_CONNECTION *s);
-__owur int ssl3_do_write(SSL_CONNECTION *s, int type);
+__owur int ssl3_do_write(SSL_CONNECTION *s, uint8_t type);
int ssl3_send_alert(SSL_CONNECTION *s, int level, int desc);
__owur int ssl3_generate_master_secret(SSL_CONNECTION *s, unsigned char *out,
unsigned char *p, size_t len,
int *max_version, int *real_max);
__owur OSSL_TIME tls1_default_timeout(void);
-__owur int dtls1_do_write(SSL_CONNECTION *s, int type);
+__owur int dtls1_do_write(SSL_CONNECTION *s, uint8_t type);
void dtls1_set_message_header(SSL_CONNECTION *s,
unsigned char mt,
size_t len,
size_t frag_off, size_t frag_len);
-int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, size_t len,
- size_t *written);
+int dtls1_write_app_data_bytes(SSL *s, uint8_t type, const void *buf_,
+ size_t len, size_t *written);
__owur int dtls1_read_failed(SSL_CONNECTION *s, int code);
__owur int dtls1_buffer_message(SSL_CONNECTION *s, int ccs);
* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or
* SSL3_RT_CHANGE_CIPHER_SPEC)
*/
-int dtls1_do_write(SSL_CONNECTION *s, int type)
+int dtls1_do_write(SSL_CONNECTION *s, uint8_t type)
{
int ret;
size_t written;
{
unsigned char wire[DTLS1_HM_HEADER_LENGTH];
size_t mlen, frag_off, frag_len;
- int i, ret, recvd_type;
+ int i, ret;
+ uint8_t recvd_type;
struct hm_header_st msg_hdr;
size_t readbytes;
SSL *ssl = SSL_CONNECTION_GET_SSL(s);
* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or
* SSL3_RT_CHANGE_CIPHER_SPEC)
*/
-int ssl3_do_write(SSL_CONNECTION *s, int type)
+int ssl3_do_write(SSL_CONNECTION *s, uint8_t type)
{
int ret;
size_t written = 0;
int tls_get_message_header(SSL_CONNECTION *s, int *mt)
{
/* s->init_num < SSL3_HM_HEADER_LENGTH */
- int skip_message, i, recvd_type;
+ int skip_message, i;
+ uint8_t recvd_type;
unsigned char *p;
size_t l, readbytes;
SSL *ssl = SSL_CONNECTION_GET_SSL(s);
#define TOTAL_RECORD_OVERFLOW_TESTS 6
-static int write_record(BIO *b, size_t len, int rectype, int recversion)
+static int write_record(BIO *b, size_t len, uint8_t rectype, int recversion)
{
unsigned char header[SSL3_RT_HEADER_LENGTH];
size_t written;