diff options
author | jsing <> | 2020-10-03 17:10:09 +0000 |
---|---|---|
committer | jsing <> | 2020-10-03 17:10:09 +0000 |
commit | a35481173a912332211359d38b0864da866bc568 (patch) | |
tree | 72902c94d84a9a1d04e1f2d3ca435dcc315dea4b /src | |
parent | e511526e634fd751108094f3d06cb144d464c5d1 (diff) | |
download | openbsd-a35481173a912332211359d38b0864da866bc568.tar.gz openbsd-a35481173a912332211359d38b0864da866bc568.tar.bz2 openbsd-a35481173a912332211359d38b0864da866bc568.zip |
Inline two macros that are only used in one place each.
This improves readability - while here also add a missing return value
check (although it cannot currently fail).
ok inoguchi@ tb@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/d1_pkt.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c index 31ea52fcae..f115e1a478 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.82 2020/09/24 17:59:54 jsing Exp $ */ | 1 | /* $OpenBSD: d1_pkt.c,v 1.83 2020/10/03 17:10:09 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. |
@@ -279,18 +279,6 @@ dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue) | |||
279 | return (0); | 279 | return (0); |
280 | } | 280 | } |
281 | 281 | ||
282 | |||
283 | /* retrieve a buffered record that belongs to the new epoch, i.e., not processed | ||
284 | * yet */ | ||
285 | #define dtls1_get_unprocessed_record(s) \ | ||
286 | dtls1_retrieve_buffered_record((s), \ | ||
287 | &((D1I(s))->unprocessed_rcds)) | ||
288 | |||
289 | /* retrieve a buffered record that belongs to the current epoch, ie, processed */ | ||
290 | #define dtls1_get_processed_record(s) \ | ||
291 | dtls1_retrieve_buffered_record((s), \ | ||
292 | &((D1I(s))->processed_rcds)) | ||
293 | |||
294 | static int | 282 | static int |
295 | dtls1_process_buffered_records(SSL *s) | 283 | dtls1_process_buffered_records(SSL *s) |
296 | { | 284 | { |
@@ -305,8 +293,10 @@ dtls1_process_buffered_records(SSL *s) | |||
305 | 293 | ||
306 | /* Process all the records. */ | 294 | /* Process all the records. */ |
307 | while (pqueue_peek(D1I(s)->unprocessed_rcds.q)) { | 295 | while (pqueue_peek(D1I(s)->unprocessed_rcds.q)) { |
308 | dtls1_get_unprocessed_record(s); | 296 | if (!dtls1_retrieve_buffered_record((s), |
309 | if (! dtls1_process_record(s)) | 297 | &((D1I(s))->unprocessed_rcds))) |
298 | return (0); | ||
299 | if (!dtls1_process_record(s)) | ||
310 | return (0); | 300 | return (0); |
311 | if (dtls1_buffer_record(s, &(D1I(s)->processed_rcds), | 301 | if (dtls1_buffer_record(s, &(D1I(s)->processed_rcds), |
312 | S3I(s)->rrec.seq_num) < 0) | 302 | S3I(s)->rrec.seq_num) < 0) |
@@ -479,7 +469,7 @@ dtls1_get_record(SSL *s) | |||
479 | return (-1); | 469 | return (-1); |
480 | 470 | ||
481 | /* if we're renegotiating, then there may be buffered records */ | 471 | /* if we're renegotiating, then there may be buffered records */ |
482 | if (dtls1_get_processed_record(s)) | 472 | if (dtls1_retrieve_buffered_record((s), &((D1I(s))->processed_rcds))) |
483 | return 1; | 473 | return 1; |
484 | 474 | ||
485 | /* get something from the wire */ | 475 | /* get something from the wire */ |