Rename SSL3_RECORD to TLS_RL_RECORD

The SSL3 prefix no longer seems appropriate. We choose TLS_RL_RECORD instead
of TLS_RECORD because that type already exists elsewhere.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19586)
This commit is contained in:
Matt Caswell 2022-11-02 15:27:09 +00:00 committed by Hugo Landau
parent e9189cc4af
commit 22094d11a7
10 changed files with 104 additions and 96 deletions

View File

@ -45,7 +45,7 @@ static int dtls_record_replay_check(OSSL_RECORD_LAYER *rl, DTLS_BITMAP *bitmap)
cmp = satsub64be(seq, bitmap->max_seq_num);
if (cmp > 0) {
SSL3_RECORD_set_seq_num(&rl->rrec[0], seq);
ossl_tls_rl_record_set_seq_num(&rl->rrec[0], seq);
return 1; /* this record in new */
}
shift = -cmp;
@ -54,7 +54,7 @@ static int dtls_record_replay_check(OSSL_RECORD_LAYER *rl, DTLS_BITMAP *bitmap)
else if (bitmap->map & ((uint64_t)1 << shift))
return 0; /* record previously received */
SSL3_RECORD_set_seq_num(&rl->rrec[0], seq);
ossl_tls_rl_record_set_seq_num(&rl->rrec[0], seq);
return 1;
}
@ -80,7 +80,7 @@ static void dtls_record_bitmap_update(OSSL_RECORD_LAYER *rl,
}
}
static DTLS_BITMAP *dtls_get_bitmap(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rr,
static DTLS_BITMAP *dtls_get_bitmap(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rr,
unsigned int *is_next_epoch)
{
*is_next_epoch = 0;
@ -113,7 +113,7 @@ static int dtls_process_record(OSSL_RECORD_LAYER *rl, DTLS_BITMAP *bitmap)
{
int i;
int enc_err;
SSL3_RECORD *rr;
TLS_RL_RECORD *rr;
int imac_size;
size_t mac_size = 0;
unsigned char md[EVP_MAX_MD_SIZE];
@ -304,7 +304,7 @@ static int dtls_rlayer_buffer_record(OSSL_RECORD_LAYER *rl, record_pqueue *queue
rdata->packet = rl->packet;
rdata->packet_length = rl->packet_length;
memcpy(&(rdata->rbuf), &rl->rbuf, sizeof(TLS_BUFFER));
memcpy(&(rdata->rrec), &rl->rrec[0], sizeof(SSL3_RECORD));
memcpy(&(rdata->rrec), &rl->rrec[0], sizeof(TLS_RL_RECORD));
item->data = rdata;
@ -343,7 +343,7 @@ static int dtls_copy_rlayer_record(OSSL_RECORD_LAYER *rl, pitem *item)
rl->packet = rdata->packet;
rl->packet_length = rdata->packet_length;
memcpy(&rl->rbuf, &(rdata->rbuf), sizeof(TLS_BUFFER));
memcpy(&rl->rrec[0], &(rdata->rrec), sizeof(SSL3_RECORD));
memcpy(&rl->rrec[0], &(rdata->rrec), sizeof(TLS_RL_RECORD));
/* Set proper sequence number for mac calculation */
memcpy(&(rl->sequence[2]), &(rdata->packet[5]), 6);
@ -383,7 +383,7 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
int ssl_major, ssl_minor;
int rret;
size_t more, n;
SSL3_RECORD *rr;
TLS_RL_RECORD *rr;
unsigned char *p = NULL;
unsigned short version;
DTLS_BITMAP *bitmap;
@ -725,7 +725,7 @@ int dtls_post_encryption_processing(OSSL_RECORD_LAYER *rl,
size_t mac_size,
OSSL_RECORD_TEMPLATE *thistempl,
WPACKET *thispkt,
SSL3_RECORD *thiswr)
TLS_RL_RECORD *thiswr)
{
if (!tls_post_encryption_processing_default(rl, mac_size, thistempl,
thispkt, thiswr)) {

View File

@ -367,13 +367,14 @@ static int ktls_read_n(OSSL_RECORD_LAYER *rl, size_t n, size_t max, int extend,
return ret;
}
static int ktls_cipher(OSSL_RECORD_LAYER *rl, SSL3_RECORD *inrecs, size_t n_recs,
int sending, SSL_MAC_BUF *mac, size_t macsize)
static int ktls_cipher(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *inrecs,
size_t n_recs, int sending, SSL_MAC_BUF *mac,
size_t macsize)
{
return 1;
}
static int ktls_validate_record_header(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
static int ktls_validate_record_header(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec)
{
if (rec->rec_version != TLS1_2_VERSION) {
RLAYERfatal(rl, SSL_AD_DECODE_ERROR, SSL_R_WRONG_VERSION_NUMBER);
@ -383,7 +384,7 @@ static int ktls_validate_record_header(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
return 1;
}
static int ktls_post_process_record(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
static int ktls_post_process_record(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec)
{
if (rl->version == TLS1_3_VERSION)
return tls13_common_post_process_record(rl, rec);
@ -495,7 +496,7 @@ static int ktls_prepare_record_header(OSSL_RECORD_LAYER *rl,
static int ktls_prepare_for_encryption(OSSL_RECORD_LAYER *rl,
size_t mac_size,
WPACKET *thispkt,
SSL3_RECORD *thiswr)
TLS_RL_RECORD *thiswr)
{
/* No encryption, so nothing to do */
return 1;
@ -505,7 +506,7 @@ static int ktls_post_encryption_processing(OSSL_RECORD_LAYER *rl,
size_t mac_size,
OSSL_RECORD_TEMPLATE *templ,
WPACKET *thispkt,
SSL3_RECORD *thiswr)
TLS_RL_RECORD *thiswr)
{
/* The kernel does anything that is needed, so nothing to do here */
return 1;

View File

@ -42,7 +42,7 @@ typedef struct tls_buffer_st {
int type;
} TLS_BUFFER;
typedef struct ssl3_record_st {
typedef struct tls_rl_record_st {
/* Record layer version */
/* r */
int rec_version;
@ -76,18 +76,18 @@ typedef struct ssl3_record_st {
/* sequence number, needed by DTLS1 */
/* r */
unsigned char seq_num[SEQ_NUM_SIZE];
} SSL3_RECORD;
} TLS_RL_RECORD;
/* Macros/functions provided by the SSL3_RECORD component */
/* Macros/functions provided by the TLS_RL_RECORD component */
#define SSL3_RECORD_set_type(r, t) ((r)->type = (t))
#define SSL3_RECORD_set_rec_version(r, v) ((r)->rec_version = (v))
#define SSL3_RECORD_get_length(r) ((r)->length)
#define SSL3_RECORD_set_length(r, l) ((r)->length = (l))
#define SSL3_RECORD_add_length(r, l) ((r)->length += (l))
#define SSL3_RECORD_set_data(r, d) ((r)->data = (d))
#define SSL3_RECORD_set_input(r, i) ((r)->input = (i))
#define SSL3_RECORD_reset_input(r) ((r)->input = (r)->data)
#define TLS_RL_RECORD_set_type(r, t) ((r)->type = (t))
#define TLS_RL_RECORD_set_rec_version(r, v) ((r)->rec_version = (v))
#define TLS_RL_RECORD_get_length(r) ((r)->length)
#define TLS_RL_RECORD_set_length(r, l) ((r)->length = (l))
#define TLS_RL_RECORD_add_length(r, l) ((r)->length += (l))
#define TLS_RL_RECORD_set_data(r, d) ((r)->data = (d))
#define TLS_RL_RECORD_set_input(r, i) ((r)->input = (i))
#define TLS_RL_RECORD_reset_input(r) ((r)->input = (r)->data)
/* Protocol version specific function pointers */
@ -114,10 +114,10 @@ struct record_functions_st
* decryption failed, or EtM decryption failed.
* 1: Success or MtE decryption failed (MAC will be randomised)
*/
int (*cipher)(OSSL_RECORD_LAYER *rl, SSL3_RECORD *recs, size_t n_recs,
int (*cipher)(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *recs, size_t n_recs,
int sending, SSL_MAC_BUF *macs, size_t macsize);
/* Returns 1 for success or 0 for error */
int (*mac)(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec, unsigned char *md,
int (*mac)(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec, unsigned char *md,
int sending);
/* Return 1 for success or 0 for error */
@ -131,10 +131,10 @@ struct record_functions_st
int (*get_more_records)(OSSL_RECORD_LAYER *rl);
/* Return 1 for success or 0 for error */
int (*validate_record_header)(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec);
int (*validate_record_header)(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec);
/* Return 1 for success or 0 for error */
int (*post_process_record)(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec);
int (*post_process_record)(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec);
/* Write related functions */
@ -179,17 +179,17 @@ struct record_functions_st
int (*add_record_padding)(OSSL_RECORD_LAYER *rl,
OSSL_RECORD_TEMPLATE *thistempl,
WPACKET *thispkt,
SSL3_RECORD *thiswr);
TLS_RL_RECORD *thiswr);
/*
* This applies any mac that might be necessary, ensures that we have enough
* space in the WPACKET to perform the encryption and sets up the
* SSL3_RECORD ready for that encryption.
* TLS_RL_RECORD ready for that encryption.
*/
int (*prepare_for_encryption)(OSSL_RECORD_LAYER *rl,
size_t mac_size,
WPACKET *thispkt,
SSL3_RECORD *thiswr);
TLS_RL_RECORD *thiswr);
/*
* Any updates required to the record after encryption has been applied. For
@ -199,7 +199,7 @@ struct record_functions_st
size_t mac_size,
OSSL_RECORD_TEMPLATE *thistempl,
WPACKET *thispkt,
SSL3_RECORD *thiswr);
TLS_RL_RECORD *thiswr);
/*
* Some record layer implementations need to do some custom preparation of
@ -253,7 +253,7 @@ struct ossl_record_layer_st
/* read IO goes into here */
TLS_BUFFER rbuf;
/* each decoded record goes in here */
SSL3_RECORD rrec[SSL_MAX_PIPELINES];
TLS_RL_RECORD rrec[SSL_MAX_PIPELINES];
/* How many records have we got available in the rrec bufer */
size_t num_recs;
@ -376,7 +376,7 @@ typedef struct dtls_rlayer_record_data_st {
unsigned char *packet;
size_t packet_length;
TLS_BUFFER rbuf;
SSL3_RECORD rrec;
TLS_RL_RECORD rrec;
} DTLS_RLAYER_RECORD_DATA;
extern struct record_functions_st ssl_3_0_funcs;
@ -399,7 +399,8 @@ void ossl_rlayer_fatal(OSSL_RECORD_LAYER *rl, int al, int reason,
|| (rl)->version == TLS1_2_VERSION \
|| (rl)->isdtls)
void SSL3_RECORD_set_seq_num(SSL3_RECORD *r, const unsigned char *seq_num);
void ossl_tls_rl_record_set_seq_num(TLS_RL_RECORD *r,
const unsigned char *seq_num);
int ossl_set_tls_provider_parameters(OSSL_RECORD_LAYER *rl,
EVP_CIPHER_CTX *ctx,
@ -454,14 +455,14 @@ int dtls_post_encryption_processing(OSSL_RECORD_LAYER *rl,
size_t mac_size,
OSSL_RECORD_TEMPLATE *thistempl,
WPACKET *thispkt,
SSL3_RECORD *thiswr);
TLS_RL_RECORD *thiswr);
int tls_default_set_protocol_version(OSSL_RECORD_LAYER *rl, int version);
int tls_default_validate_record_header(OSSL_RECORD_LAYER *rl, SSL3_RECORD *re);
int tls_do_compress(OSSL_RECORD_LAYER *rl, SSL3_RECORD *wr);
int tls_do_uncompress(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec);
int tls_default_post_process_record(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec);
int tls13_common_post_process_record(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec);
int tls_default_validate_record_header(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *re);
int tls_do_compress(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *wr);
int tls_do_uncompress(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec);
int tls_default_post_process_record(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec);
int tls13_common_post_process_record(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec);
int
tls_int_new_record_layer(OSSL_LIB_CTX *libctx, const char *propq, int vers,
@ -543,12 +544,12 @@ int tls_prepare_record_header_default(OSSL_RECORD_LAYER *rl,
int tls_prepare_for_encryption_default(OSSL_RECORD_LAYER *rl,
size_t mac_size,
WPACKET *thispkt,
SSL3_RECORD *thiswr);
TLS_RL_RECORD *thiswr);
int tls_post_encryption_processing_default(OSSL_RECORD_LAYER *rl,
size_t mac_size,
OSSL_RECORD_TEMPLATE *thistempl,
WPACKET *thispkt,
SSL3_RECORD *thiswr);
TLS_RL_RECORD *thiswr);
int tls_write_records_default(OSSL_RECORD_LAYER *rl,
OSSL_RECORD_TEMPLATE *templates,
size_t numtempl);

View File

@ -87,10 +87,11 @@ static int ssl3_set_crypto_state(OSSL_RECORD_LAYER *rl, int level,
* 0: if the record is publicly invalid, or an internal error
* 1: Success or Mac-then-encrypt decryption failed (MAC will be randomised)
*/
static int ssl3_cipher(OSSL_RECORD_LAYER *rl, SSL3_RECORD *inrecs, size_t n_recs,
int sending, SSL_MAC_BUF *mac, size_t macsize)
static int ssl3_cipher(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *inrecs,
size_t n_recs, int sending, SSL_MAC_BUF *mac,
size_t macsize)
{
SSL3_RECORD *rec;
TLS_RL_RECORD *rec;
EVP_CIPHER_CTX *ds;
size_t l, i;
size_t bs;
@ -206,7 +207,7 @@ static const unsigned char ssl3_pad_2[48] = {
0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c
};
static int ssl3_mac(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec, unsigned char *md,
static int ssl3_mac(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec, unsigned char *md,
int sending)
{
unsigned char *mac_sec, *seq = rl->sequence;

View File

@ -55,8 +55,9 @@ static int tls13_set_crypto_state(OSSL_RECORD_LAYER *rl, int level,
return OSSL_RECORD_RETURN_SUCCESS;
}
static int tls13_cipher(OSSL_RECORD_LAYER *rl, SSL3_RECORD *recs, size_t n_recs,
int sending, SSL_MAC_BUF *mac, size_t macsize)
static int tls13_cipher(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *recs,
size_t n_recs, int sending, SSL_MAC_BUF *mac,
size_t macsize)
{
EVP_CIPHER_CTX *ctx;
unsigned char iv[EVP_MAX_IV_LENGTH], recheader[SSL3_RT_HEADER_LENGTH];
@ -64,7 +65,7 @@ static int tls13_cipher(OSSL_RECORD_LAYER *rl, SSL3_RECORD *recs, size_t n_recs,
unsigned char *staticiv;
unsigned char *seq = rl->sequence;
int lenu, lenf;
SSL3_RECORD *rec = &recs[0];
TLS_RL_RECORD *rec = &recs[0];
WPACKET wpkt;
const EVP_CIPHER *cipher;
int mode;
@ -174,7 +175,8 @@ static int tls13_cipher(OSSL_RECORD_LAYER *rl, SSL3_RECORD *recs, size_t n_recs,
return 1;
}
static int tls13_validate_record_header(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
static int tls13_validate_record_header(OSSL_RECORD_LAYER *rl,
TLS_RL_RECORD *rec)
{
if (rec->type != SSL3_RT_APPLICATION_DATA
&& (rec->type != SSL3_RT_CHANGE_CIPHER_SPEC
@ -197,7 +199,7 @@ static int tls13_validate_record_header(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
return 1;
}
static int tls13_post_process_record(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
static int tls13_post_process_record(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec)
{
/* Skip this if we've received a plaintext alert */
if (rec->type != SSL3_RT_ALERT) {
@ -248,7 +250,7 @@ static unsigned int tls13_get_record_type(OSSL_RECORD_LAYER *rl,
static int tls13_add_record_padding(OSSL_RECORD_LAYER *rl,
OSSL_RECORD_TEMPLATE *thistempl,
WPACKET *thispkt,
SSL3_RECORD *thiswr)
TLS_RL_RECORD *thiswr)
{
size_t rlen;
@ -260,10 +262,10 @@ static int tls13_add_record_padding(OSSL_RECORD_LAYER *rl,
RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
return 0;
}
SSL3_RECORD_add_length(thiswr, 1);
TLS_RL_RECORD_add_length(thiswr, 1);
/* Add TLS1.3 padding */
rlen = SSL3_RECORD_get_length(thiswr);
rlen = TLS_RL_RECORD_get_length(thiswr);
if (rlen < rl->max_frag_len) {
size_t padding = 0;
size_t max_padding = rl->max_frag_len - rlen;
@ -294,7 +296,7 @@ static int tls13_add_record_padding(OSSL_RECORD_LAYER *rl,
ERR_R_INTERNAL_ERROR);
return 0;
}
SSL3_RECORD_add_length(thiswr, padding);
TLS_RL_RECORD_add_length(thiswr, padding);
}
}

View File

@ -156,8 +156,9 @@ static int tls1_set_crypto_state(OSSL_RECORD_LAYER *rl, int level,
* decryption failed, or Encrypt-then-mac decryption failed.
* 1: Success or Mac-then-encrypt decryption failed (MAC will be randomised)
*/
static int tls1_cipher(OSSL_RECORD_LAYER *rl, SSL3_RECORD *recs, size_t n_recs,
int sending, SSL_MAC_BUF *macs, size_t macsize)
static int tls1_cipher(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *recs,
size_t n_recs, int sending, SSL_MAC_BUF *macs,
size_t macsize)
{
EVP_CIPHER_CTX *ds;
size_t reclen[SSL_MAX_PIPELINES];
@ -447,7 +448,7 @@ static int tls1_cipher(OSSL_RECORD_LAYER *rl, SSL3_RECORD *recs, size_t n_recs,
return 1;
}
static int tls1_mac(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec, unsigned char *md,
static int tls1_mac(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec, unsigned char *md,
int sending)
{
unsigned char *seq = rl->sequence;

View File

@ -28,7 +28,7 @@ void ossl_tls_buffer_release(TLS_BUFFER *b)
b->buf = NULL;
}
static void SSL3_RECORD_release(SSL3_RECORD *r, size_t num_recs)
static void TLS_RL_RECORD_release(TLS_RL_RECORD *r, size_t num_recs)
{
size_t i;
@ -38,7 +38,8 @@ static void SSL3_RECORD_release(SSL3_RECORD *r, size_t num_recs)
}
}
void SSL3_RECORD_set_seq_num(SSL3_RECORD *r, const unsigned char *seq_num)
void ossl_tls_rl_record_set_seq_num(TLS_RL_RECORD *r,
const unsigned char *seq_num)
{
memcpy(r->seq_num, seq_num, SEQ_NUM_SIZE);
}
@ -525,7 +526,7 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl)
int enc_err, rret;
int i;
size_t more, n;
SSL3_RECORD *rr, *thisrr;
TLS_RL_RECORD *rr, *thisrr;
TLS_BUFFER *rbuf;
unsigned char *p;
unsigned char md[EVP_MAX_MD_SIZE];
@ -610,7 +611,7 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl)
} else {
/* SSLv3+ style record */
/* Pull apart the header into the SSL3_RECORD */
/* Pull apart the header into the TLS_RL_RECORD */
if (!PACKET_get_1(&pkt, &type)
|| !PACKET_get_net_2(&pkt, &version)
|| !PACKET_get_net_2_len(&pkt, &thisrr->length)) {
@ -942,7 +943,7 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl)
}
/* Shared by ssl3_meth and tls1_meth */
int tls_default_validate_record_header(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
int tls_default_validate_record_header(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec)
{
size_t len = SSL3_RT_MAX_ENCRYPTED_LENGTH;
@ -969,7 +970,7 @@ int tls_default_validate_record_header(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
return 1;
}
int tls_do_compress(OSSL_RECORD_LAYER *rl, SSL3_RECORD *wr)
int tls_do_compress(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *wr)
{
#ifndef OPENSSL_NO_COMP
int i;
@ -988,7 +989,7 @@ int tls_do_compress(OSSL_RECORD_LAYER *rl, SSL3_RECORD *wr)
#endif
}
int tls_do_uncompress(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
int tls_do_uncompress(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec)
{
#ifndef OPENSSL_NO_COMP
int i;
@ -1014,7 +1015,7 @@ int tls_do_uncompress(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
}
/* Shared by tlsany_meth, ssl3_meth and tls1_meth */
int tls_default_post_process_record(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
int tls_default_post_process_record(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec)
{
if (rl->compctx != NULL) {
if (rec->length > SSL3_RT_MAX_COMPRESSED_LENGTH) {
@ -1038,7 +1039,7 @@ int tls_default_post_process_record(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
}
/* Shared by tls13_meth and ktls_meth */
int tls13_common_post_process_record(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
int tls13_common_post_process_record(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec)
{
if (rec->type != SSL3_RT_APPLICATION_DATA
&& rec->type != SSL3_RT_ALERT
@ -1068,7 +1069,7 @@ int tls_read_record(OSSL_RECORD_LAYER *rl, void **rechandle, int *rversion,
int *type, unsigned char **data, size_t *datalen,
uint16_t *epoch, unsigned char *seq_num)
{
SSL3_RECORD *rec;
TLS_RL_RECORD *rec;
/*
* tls_get_more_records() can return success without actually reading
@ -1392,7 +1393,7 @@ static void tls_int_free(OSSL_RECORD_LAYER *rl)
if (rl->version == SSL3_VERSION)
OPENSSL_cleanse(rl->mac_secret, sizeof(rl->mac_secret));
SSL3_RECORD_release(rl->rrec, SSL_MAX_PIPELINES);
TLS_RL_RECORD_release(rl->rrec, SSL_MAX_PIPELINES);
OPENSSL_free(rl);
}
@ -1566,7 +1567,7 @@ int tls_prepare_record_header_default(OSSL_RECORD_LAYER *rl,
int tls_prepare_for_encryption_default(OSSL_RECORD_LAYER *rl,
size_t mac_size,
WPACKET *thispkt,
SSL3_RECORD *thiswr)
TLS_RL_RECORD *thiswr)
{
size_t len;
unsigned char *recordstart;
@ -1606,9 +1607,9 @@ int tls_prepare_for_encryption_default(OSSL_RECORD_LAYER *rl,
/* Get a pointer to the start of this record excluding header */
recordstart = WPACKET_get_curr(thispkt) - len;
SSL3_RECORD_set_data(thiswr, recordstart);
SSL3_RECORD_reset_input(thiswr);
SSL3_RECORD_set_length(thiswr, len);
TLS_RL_RECORD_set_data(thiswr, recordstart);
TLS_RL_RECORD_reset_input(thiswr);
TLS_RL_RECORD_set_length(thiswr, len);
return 1;
}
@ -1617,7 +1618,7 @@ int tls_post_encryption_processing_default(OSSL_RECORD_LAYER *rl,
size_t mac_size,
OSSL_RECORD_TEMPLATE *thistempl,
WPACKET *thispkt,
SSL3_RECORD *thiswr)
TLS_RL_RECORD *thiswr)
{
size_t origlen, len;
size_t headerlen = rl->isdtls ? DTLS1_RT_HEADER_LENGTH
@ -1646,7 +1647,7 @@ int tls_post_encryption_processing_default(OSSL_RECORD_LAYER *rl,
return 0;
}
SSL3_RECORD_add_length(thiswr, mac_size);
TLS_RL_RECORD_add_length(thiswr, mac_size);
}
if (!WPACKET_get_length(thispkt, &len)
@ -1675,7 +1676,7 @@ int tls_post_encryption_processing_default(OSSL_RECORD_LAYER *rl,
return 0;
}
SSL3_RECORD_add_length(thiswr, headerlen);
TLS_RL_RECORD_add_length(thiswr, headerlen);
return 1;
}
@ -1685,9 +1686,9 @@ int tls_write_records_default(OSSL_RECORD_LAYER *rl,
size_t numtempl)
{
WPACKET pkt[SSL_MAX_PIPELINES + 1];
SSL3_RECORD wr[SSL_MAX_PIPELINES + 1];
TLS_RL_RECORD wr[SSL_MAX_PIPELINES + 1];
WPACKET *thispkt;
SSL3_RECORD *thiswr;
TLS_RL_RECORD *thiswr;
int mac_size = 0, ret = 0;
size_t wpinited = 0;
size_t j, prefix = 0;
@ -1714,7 +1715,7 @@ int tls_write_records_default(OSSL_RECORD_LAYER *rl,
goto err;
}
/* Clear our SSL3_RECORD structures */
/* Clear our TLS_RL_RECORD structures */
memset(wr, 0, sizeof(wr));
for (j = 0; j < numtempl + prefix; j++) {
unsigned char *compressdata = NULL;
@ -1733,8 +1734,8 @@ int tls_write_records_default(OSSL_RECORD_LAYER *rl,
else
rectype = thistempl->type;
SSL3_RECORD_set_type(thiswr, rectype);
SSL3_RECORD_set_rec_version(thiswr, thistempl->version);
TLS_RL_RECORD_set_type(thiswr, rectype);
TLS_RL_RECORD_set_rec_version(thiswr, thistempl->version);
if (!rl->funcs->prepare_record_header(rl, thispkt, thistempl, rectype,
&compressdata)) {
@ -1743,10 +1744,10 @@ int tls_write_records_default(OSSL_RECORD_LAYER *rl,
}
/* lets setup the record stuff. */
SSL3_RECORD_set_data(thiswr, compressdata);
SSL3_RECORD_set_length(thiswr, thistempl->buflen);
TLS_RL_RECORD_set_data(thiswr, compressdata);
TLS_RL_RECORD_set_length(thiswr, thistempl->buflen);
SSL3_RECORD_set_input(thiswr, (unsigned char *)thistempl->buf);
TLS_RL_RECORD_set_input(thiswr, (unsigned char *)thistempl->buf);
/*
* we now 'read' from thiswr->input, thiswr->length bytes into
@ -1765,7 +1766,7 @@ int tls_write_records_default(OSSL_RECORD_LAYER *rl,
RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
goto err;
}
SSL3_RECORD_reset_input(&wr[j]);
TLS_RL_RECORD_reset_input(&wr[j]);
}
if (rl->funcs->add_record_padding != NULL
@ -1809,7 +1810,7 @@ int tls_write_records_default(OSSL_RECORD_LAYER *rl,
}
/* now let's set up wb */
TLS_BUFFER_set_left(&rl->wbuf[j], SSL3_RECORD_get_length(thiswr));
TLS_BUFFER_set_left(&rl->wbuf[j], TLS_RL_RECORD_get_length(thiswr));
}
ret = 1;

View File

@ -34,14 +34,14 @@ static int tls_any_set_crypto_state(OSSL_RECORD_LAYER *rl, int level,
return OSSL_RECORD_RETURN_SUCCESS;
}
static int tls_any_cipher(OSSL_RECORD_LAYER *rl, SSL3_RECORD *recs,
static int tls_any_cipher(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *recs,
size_t n_recs, int sending, SSL_MAC_BUF *macs,
size_t macsize)
{
return 1;
}
static int tls_validate_record_header(OSSL_RECORD_LAYER *rl, SSL3_RECORD *rec)
static int tls_validate_record_header(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec)
{
if (rec->rec_version == SSL2_VERSION) {
/* SSLv2 format ClientHello */
@ -139,7 +139,7 @@ static int tls_any_set_protocol_version(OSSL_RECORD_LAYER *rl, int vers)
static int tls_any_prepare_for_encryption(OSSL_RECORD_LAYER *rl,
size_t mac_size,
WPACKET *thispkt,
SSL3_RECORD *thiswr)
TLS_RL_RECORD *thiswr)
{
/* No encryption, so nothing to do */
return 1;

View File

@ -238,8 +238,9 @@ static unsigned char *multihexstr2buf(const char *str[3], size_t *len)
return outbuf;
}
static int load_record(SSL3_RECORD *rec, RECORD_DATA *recd, unsigned char **key,
unsigned char *iv, size_t ivlen, unsigned char *seq)
static int load_record(TLS_RL_RECORD *rec, RECORD_DATA *recd,
unsigned char **key, unsigned char *iv, size_t ivlen,
unsigned char *seq)
{
unsigned char *pt = NULL, *sq = NULL, *ivtmp = NULL;
size_t ptlen;
@ -275,7 +276,7 @@ static int load_record(SSL3_RECORD *rec, RECORD_DATA *recd, unsigned char **key,
return 0;
}
static int test_record(SSL3_RECORD *rec, RECORD_DATA *recd, int enc)
static int test_record(TLS_RL_RECORD *rec, RECORD_DATA *recd, int enc)
{
int ret = 0;
unsigned char *refd;
@ -305,7 +306,7 @@ static int test_record(SSL3_RECORD *rec, RECORD_DATA *recd, int enc)
static int test_tls13_encryption(void)
{
SSL3_RECORD rec;
TLS_RL_RECORD rec;
unsigned char *key = NULL;
const EVP_CIPHER *ciph = EVP_aes_128_gcm();
int ret = 0;

View File

@ -384,7 +384,7 @@
-T TLS_BUFFER
-T SSL3_COMP
-T SSL3_ENC_METHOD
-T SSL3_RECORD
-T TLS_RL_RECORD
-T SSL3_STATE
-T SSL_CIPHER
-T SSL_COMP