Avoid issues with endianness when type is used in SSL_trace()

The TLS record type is a single byte value so we can
use uint8_t for it. This allows passing its address
directly to SSL_trace() instead of converting it to
a single byte type first.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21823)
This commit is contained in:
Tomas Mraz 2023-08-23 18:12:32 +02:00 committed by Hugo Landau
parent 675481ee7a
commit 1cc8c53b0f
6 changed files with 6 additions and 6 deletions

View File

@ -507,7 +507,7 @@ struct ossl_record_method_st {
* multiple records in one go and buffer them.
*/
int (*read_record)(OSSL_RECORD_LAYER *rl, void **rechandle, int *rversion,
int *type, unsigned char **data, size_t *datalen,
uint8_t *type, unsigned char **data, size_t *datalen,
uint16_t *epoch, unsigned char *seq_num);
/*
* Release a buffer associated with a record previously read with

View File

@ -232,7 +232,7 @@ struct ossl_record_method_st {
* multiple records in one go and buffer them.
*/
int (*read_record)(OSSL_RECORD_LAYER *rl, void **rechandle, int *rversion,
int *type, const unsigned char **data, size_t *datalen,
uint8_t *type, const unsigned char **data, size_t *datalen,
uint16_t *epoch, unsigned char *seq_num);
/*
* Release length bytes from a buffer associated with a record previously

View File

@ -356,7 +356,7 @@ static int quic_retry_write_records(OSSL_RECORD_LAYER *rl)
}
static int quic_read_record(OSSL_RECORD_LAYER *rl, void **rechandle,
int *rversion, int *type, const unsigned char **data,
int *rversion, uint8_t *type, const unsigned char **data,
size_t *datalen, uint16_t *epoch,
unsigned char *seq_num)
{

View File

@ -459,7 +459,7 @@ int tls_retry_write_records(OSSL_RECORD_LAYER *rl);
int tls_get_alert_code(OSSL_RECORD_LAYER *rl);
int tls_set1_bio(OSSL_RECORD_LAYER *rl, BIO *bio);
int tls_read_record(OSSL_RECORD_LAYER *rl, void **rechandle, int *rversion,
int *type, const unsigned char **data, size_t *datalen,
uint8_t *type, const unsigned char **data, size_t *datalen,
uint16_t *epoch, unsigned char *seq_num);
int tls_release_record(OSSL_RECORD_LAYER *rl, void *rechandle, size_t length);
int tls_default_set_protocol_version(OSSL_RECORD_LAYER *rl, int version);

View File

@ -1088,7 +1088,7 @@ int tls13_common_post_process_record(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec)
}
int tls_read_record(OSSL_RECORD_LAYER *rl, void **rechandle, int *rversion,
int *type, const unsigned char **data, size_t *datalen,
uint8_t *type, const unsigned char **data, size_t *datalen,
uint16_t *epoch, unsigned char *seq_num)
{
TLS_RL_RECORD *rec;

View File

@ -22,7 +22,7 @@
typedef struct tls_record_st {
void *rechandle;
int version;
int type;
uint8_t type;
/* The data buffer containing bytes from the record */
const unsigned char *data;
/*