diff options
author | jsing <> | 2021-01-13 18:38:34 +0000 |
---|---|---|
committer | jsing <> | 2021-01-13 18:38:34 +0000 |
commit | d5a424e282cee10e2123a6454e4ab9c6df85724d (patch) | |
tree | d0f715c0206ecef2adf84d6571aa65a0ed2a2823 /src/lib | |
parent | 0aa7afb6698c8f133e37044a23318c0af4d8be94 (diff) | |
download | openbsd-d5a424e282cee10e2123a6454e4ab9c6df85724d.tar.gz openbsd-d5a424e282cee10e2123a6454e4ab9c6df85724d.tar.bz2 openbsd-d5a424e282cee10e2123a6454e4ab9c6df85724d.zip |
Clean up dtls1_reset_seq_numbers()
Inline/remove some variables and use sizeof with the correct variables.
ok inoguchi@ tb@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libssl/d1_pkt.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c index 18d0ec5a3f..4f15015145 100644 --- a/src/lib/libssl/d1_pkt.c +++ b/src/lib/libssl/d1_pkt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: d1_pkt.c,v 1.87 2021/01/13 18:32:00 jsing Exp $ */ | 1 | /* $OpenBSD: d1_pkt.c,v 1.88 2021/01/13 18:38:34 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * DTLS implementation written by Nagendra Modadugu | 3 | * DTLS implementation written by Nagendra Modadugu |
4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. | 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. |
@@ -1238,19 +1238,16 @@ dtls1_get_bitmap(SSL *s, SSL3_RECORD_INTERNAL *rr, unsigned int *is_next_epoch) | |||
1238 | void | 1238 | void |
1239 | dtls1_reset_seq_numbers(SSL *s, int rw) | 1239 | dtls1_reset_seq_numbers(SSL *s, int rw) |
1240 | { | 1240 | { |
1241 | unsigned char *seq; | ||
1242 | unsigned int seq_bytes = sizeof(S3I(s)->read_sequence); | ||
1243 | |||
1244 | if (rw & SSL3_CC_READ) { | 1241 | if (rw & SSL3_CC_READ) { |
1245 | D1I(s)->r_epoch++; | 1242 | D1I(s)->r_epoch++; |
1246 | seq = S3I(s)->read_sequence; | 1243 | memcpy(&(D1I(s)->bitmap), &(D1I(s)->next_bitmap), |
1247 | memcpy(&(D1I(s)->bitmap), &(D1I(s)->next_bitmap), sizeof(DTLS1_BITMAP)); | 1244 | sizeof(DTLS1_BITMAP)); |
1248 | memset(&(D1I(s)->next_bitmap), 0, sizeof(DTLS1_BITMAP)); | 1245 | memset(&(D1I(s)->next_bitmap), 0, sizeof(DTLS1_BITMAP)); |
1246 | memset(S3I(s)->read_sequence, 0, sizeof(S3I(s)->read_sequence)); | ||
1249 | } else { | 1247 | } else { |
1250 | D1I(s)->w_epoch++; | 1248 | D1I(s)->w_epoch++; |
1251 | seq = S3I(s)->write_sequence; | 1249 | memcpy(D1I(s)->last_write_sequence, S3I(s)->write_sequence, |
1252 | memcpy(D1I(s)->last_write_sequence, seq, sizeof(S3I(s)->write_sequence)); | 1250 | sizeof(S3I(s)->write_sequence)); |
1251 | memset(S3I(s)->write_sequence, 0, sizeof(S3I(s)->write_sequence)); | ||
1253 | } | 1252 | } |
1254 | |||
1255 | memset(seq, 0, seq_bytes); | ||
1256 | } | 1253 | } |