Skip to content

Commit

Permalink
Remove some redundant code
Browse files Browse the repository at this point in the history
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #18132)
  • Loading branch information
mattcaswell committed Aug 18, 2022
1 parent a16f9d3 commit 19d0044
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 270 deletions.
8 changes: 1 addition & 7 deletions ssl/record/rec_layer_d1.c
Expand Up @@ -184,9 +184,6 @@ static void dtls_unbuffer_record(SSL_CONNECTION *s)
}
#endif

/* Set proper sequence number for mac calculation */
memcpy(&(s->rlayer.read_sequence[2]), &(rdata->seq_num[2]), 6);

OPENSSL_free(item->data);
pitem_free(item);
}
Expand Down Expand Up @@ -854,10 +851,8 @@ int do_dtls1_write(SSL_CONNECTION *sc, int type, const unsigned char *buf,
void dtls1_reset_seq_numbers(SSL_CONNECTION *s, int rw)
{
unsigned char *seq;
unsigned int seq_bytes = sizeof(s->rlayer.read_sequence);

if (rw & SSL3_CC_READ) {
seq = s->rlayer.read_sequence;
s->rlayer.d->r_epoch++;

/*
Expand All @@ -870,7 +865,6 @@ void dtls1_reset_seq_numbers(SSL_CONNECTION *s, int rw)
memcpy(s->rlayer.d->last_write_sequence, seq,
sizeof(s->rlayer.write_sequence));
s->rlayer.d->w_epoch++;
memset(seq, 0, sizeof(s->rlayer.write_sequence));
}

memset(seq, 0, seq_bytes);
}
6 changes: 0 additions & 6 deletions ssl/record/rec_layer_s3.c
Expand Up @@ -44,7 +44,6 @@ void RECORD_LAYER_clear(RECORD_LAYER *rl)

ssl3_release_write_buffer(rl->s);

RECORD_LAYER_reset_read_sequence(rl);
RECORD_LAYER_reset_write_sequence(rl);

if (rl->rrlmethod != NULL)
Expand Down Expand Up @@ -82,11 +81,6 @@ int RECORD_LAYER_write_pending(const RECORD_LAYER *rl)
&& SSL3_BUFFER_get_left(&rl->wbuf[rl->numwpipes - 1]) != 0;
}

void RECORD_LAYER_reset_read_sequence(RECORD_LAYER *rl)
{
memset(rl->read_sequence, 0, sizeof(rl->read_sequence));
}

void RECORD_LAYER_reset_write_sequence(RECORD_LAYER *rl)
{
memset(rl->write_sequence, 0, sizeof(rl->write_sequence));
Expand Down
4 changes: 1 addition & 3 deletions ssl/record/record.h
Expand Up @@ -178,8 +178,7 @@ typedef struct record_layer_st {
/* number of bytes submitted */
size_t wpend_ret;
const unsigned char *wpend_buf;
/* TODO(RECLAYER): Why do we need this */
unsigned char read_sequence[SEQ_NUM_SIZE];

unsigned char write_sequence[SEQ_NUM_SIZE];
/* Count of the number of consecutive warning alerts received */
unsigned int alert_count;
Expand Down Expand Up @@ -223,7 +222,6 @@ void RECORD_LAYER_release(RECORD_LAYER *rl);
int RECORD_LAYER_read_pending(const RECORD_LAYER *rl);
int RECORD_LAYER_processed_read_pending(const RECORD_LAYER *rl);
int RECORD_LAYER_write_pending(const RECORD_LAYER *rl);
void RECORD_LAYER_reset_read_sequence(RECORD_LAYER *rl);
void RECORD_LAYER_reset_write_sequence(RECORD_LAYER *rl);
int RECORD_LAYER_is_sslv2_record(RECORD_LAYER *rl);
__owur size_t ssl3_pending(const SSL *s);
Expand Down
1 change: 0 additions & 1 deletion ssl/record/record_local.h
Expand Up @@ -18,7 +18,6 @@

/* Functions/macros provided by the RECORD_LAYER component */

#define RECORD_LAYER_get_read_sequence(rl) ((rl)->read_sequence)
#define RECORD_LAYER_get_write_sequence(rl) ((rl)->write_sequence)
#define RECORD_LAYER_inc_empty_record_count(rl) ((rl)->empty_record_count++)
#define RECORD_LAYER_reset_empty_record_count(rl) \
Expand Down

0 comments on commit 19d0044

Please sign in to comment.