diff options
author | Matt Caswell <matt@openssl.org> | 2015-03-26 13:12:24 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-03-26 17:25:48 +0000 |
commit | e5bf62f716f71e4df6995a07d1fbc4cad82a2637 (patch) | |
tree | 51e3b4d40c88d232744a055aed3527d1fcadf729 | |
parent | 3497ac5d333af98947d0356146a0898e2398d321 (diff) |
Define SEQ_NUM_SIZE
Replace the hard coded value 8 (the size of the sequence number) with a
constant defined in a macro.
Reviewed-by: Richard Levitte <levitte@openssl.org>
-rw-r--r-- | ssl/record/dtls1_bitmap.c | 2 | ||||
-rw-r--r-- | ssl/record/record.h | 12 | ||||
-rw-r--r-- | ssl/record/ssl3_record.c | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/ssl/record/dtls1_bitmap.c b/ssl/record/dtls1_bitmap.c index eef6b246e0..9d2d681fbf 100644 --- a/ssl/record/dtls1_bitmap.c +++ b/ssl/record/dtls1_bitmap.c @@ -209,7 +209,7 @@ void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap) bitmap->map <<= shift, bitmap->map |= 1UL; else bitmap->map = 1UL; - memcpy(bitmap->max_seq_num, seq, 8); + memcpy(bitmap->max_seq_num, seq, SEQ_NUM_SIZE); } else { shift = -cmp; if (shift < sizeof(bitmap->map) * 8) diff --git a/ssl/record/record.h b/ssl/record/record.h index 29fc752e6a..99af914b5b 100644 --- a/ssl/record/record.h +++ b/ssl/record/record.h @@ -127,6 +127,8 @@ typedef struct ssl3_buffer_st { int left; } SSL3_BUFFER; +#define SEQ_NUM_SIZE 8 + typedef struct ssl3_record_st { /* type of record */ /* @@ -166,15 +168,15 @@ typedef struct ssl3_record_st { /* sequence number, needed by DTLS1 */ /* * r - */ unsigned char seq_num[8]; + */ unsigned char seq_num[SEQ_NUM_SIZE]; } SSL3_RECORD; typedef struct dtls1_bitmap_st { - unsigned long map; /* track 32 packets on 32-bit systems and 64 - * - on 64-bit systems */ + /* Track 32 packets on 32-bit systems and 64 - on 64-bit systems */ + unsigned long map; - unsigned char max_seq_num[8]; /* max record number seen so far, 64-bit - * value in big-endian encoding */ + /* Max record number seen so far, 64-bit value in big-endian encoding */ + unsigned char max_seq_num[SEQ_NUM_SIZE]; } DTLS1_BITMAP; typedef struct record_pqueue_st { diff --git a/ssl/record/ssl3_record.c b/ssl/record/ssl3_record.c index 8bad125780..cfd8290d33 100644 --- a/ssl/record/ssl3_record.c +++ b/ssl/record/ssl3_record.c @@ -156,7 +156,7 @@ int SSL3_RECORD_setup(SSL3_RECORD *r) void SSL3_RECORD_set_seq_num(SSL3_RECORD *r, const unsigned char *seq_num) { - memcpy(r->seq_num, seq_num, 8); + memcpy(r->seq_num, seq_num, SEQ_NUM_SIZE); } /* |