Standardise type for epoch

The value for epoch was being represented internally via various types:
uint16_t, unsigned short, unsigned int, unsigned long

We standardise on uint16_t

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18132)
This commit is contained in:
Matt Caswell 2022-07-27 14:37:27 +01:00
parent 9007412c1e
commit 279754d419
8 changed files with 12 additions and 12 deletions

View File

@ -629,7 +629,7 @@ static int dtls_free(OSSL_RECORD_LAYER *rl)
static int
dtls_new_record_layer(OSSL_LIB_CTX *libctx, const char *propq, int vers,
int role, int direction, int level, unsigned int epoch,
int role, int direction, int level, uint16_t epoch,
unsigned char *key, size_t keylen, unsigned char *iv,
size_t ivlen, unsigned char *mackey, size_t mackeylen,
const EVP_CIPHER *ciph, size_t taglen,

View File

@ -481,7 +481,7 @@ static struct record_functions_st ossl_ktls_funcs = {
static int
ktls_new_record_layer(OSSL_LIB_CTX *libctx, const char *propq, int vers,
int role, int direction, int level, unsigned int epoch,
int role, int direction, int level, uint16_t epoch,
unsigned char *key, size_t keylen, unsigned char *iv,
size_t ivlen, unsigned char *mackey, size_t mackeylen,
const EVP_CIPHER *ciph, size_t taglen,

View File

@ -68,7 +68,7 @@ struct ossl_record_layer_st
int direction;
int level;
/* DTLS only */
unsigned int epoch;
uint16_t epoch;
/*
* A BIO containing any data read in the previous epoch that was destined

View File

@ -967,7 +967,7 @@ int tls_read_record(OSSL_RECORD_LAYER *rl, void **rechandle, int *rversion,
*data = rec->data + rec->off;
*datalen = rec->length;
if (rl->isdtls) {
*epoch = (uint16_t)rec->epoch;
*epoch = rec->epoch;
memcpy(seq_num, rec->seq_num, sizeof(rec->seq_num));
}
@ -1160,7 +1160,7 @@ tls_int_new_record_layer(OSSL_LIB_CTX *libctx, const char *propq, int vers,
static int
tls_new_record_layer(OSSL_LIB_CTX *libctx, const char *propq, int vers,
int role, int direction, int level, unsigned int epoch,
int role, int direction, int level, uint16_t epoch,
unsigned char *key, size_t keylen, unsigned char *iv,
size_t ivlen, unsigned char *mackey, size_t mackeylen,
const EVP_CIPHER *ciph, size_t taglen,

View File

@ -67,7 +67,7 @@ typedef struct ssl3_record_st {
unsigned char *comp;
/* epoch number, needed by DTLS1 */
/* r */
unsigned long epoch;
uint16_t epoch;
/* sequence number, needed by DTLS1 */
/* r */
unsigned char seq_num[SEQ_NUM_SIZE];
@ -100,7 +100,7 @@ typedef struct dtls1_bitmap_st {
} DTLS1_BITMAP;
typedef struct record_pqueue_st {
unsigned short epoch;
uint16_t epoch;
struct pqueue_st *q;
} record_pqueue;
@ -110,8 +110,8 @@ typedef struct dtls_record_layer_st {
* undefined, and starts at zero once the initial handshake is
* completed
*/
unsigned short r_epoch;
unsigned short w_epoch;
uint16_t r_epoch;
uint16_t w_epoch;
/*
* Buffered application records. Only for records between CCS and

View File

@ -147,7 +147,7 @@ struct ossl_record_method_st {
const char *propq, int vers,
int role, int direction,
int level,
unsigned int epoch,
uint16_t epoch,
unsigned char *key,
size_t keylen,
unsigned char *iv,

View File

@ -1909,7 +1909,7 @@ struct dtls1_retransmit_state {
EVP_MD_CTX *write_hash; /* used for mac generation */
COMP_CTX *compress; /* compression */
SSL_SESSION *session;
unsigned short epoch;
uint16_t epoch;
};
struct hm_header_st {

View File

@ -263,7 +263,7 @@ static void mempacket_free(MEMPACKET *pkt)
typedef struct mempacket_test_ctx_st {
STACK_OF(MEMPACKET) *pkts;
unsigned int epoch;
uint16_t epoch;
unsigned int currrec;
unsigned int currpkt;
unsigned int lastpkt;