diff options
author | jsing <> | 2021-09-04 14:24:28 +0000 |
---|---|---|
committer | jsing <> | 2021-09-04 14:24:28 +0000 |
commit | dee1e6cf24ed6de39feac8e8be7b300789269839 (patch) | |
tree | 30ff1d6ccf31f3c51cfc256334e43e5e1cf91810 /src/lib/libssl/d1_pkt.c | |
parent | a9d8853125301b55e45f0243ec734a0fb4f3a8f3 (diff) | |
download | openbsd-dee1e6cf24ed6de39feac8e8be7b300789269839.tar.gz openbsd-dee1e6cf24ed6de39feac8e8be7b300789269839.tar.bz2 openbsd-dee1e6cf24ed6de39feac8e8be7b300789269839.zip |
Change dtls1_get_message_header() to take a CBS.
The callers know the actual length and can initialise a CBS correctly.
ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/d1_pkt.c')
-rw-r--r-- | src/lib/libssl/d1_pkt.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c index 11e6d7f8f8..0b952cf5f3 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.110 2021/09/04 14:15:52 jsing Exp $ */ | 1 | /* $OpenBSD: d1_pkt.c,v 1.111 2021/09/04 14:24:28 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. |
@@ -807,9 +807,11 @@ dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) | |||
807 | rr->length >= DTLS1_HM_HEADER_LENGTH && rr->off == 0 && | 807 | rr->length >= DTLS1_HM_HEADER_LENGTH && rr->off == 0 && |
808 | !s->internal->in_handshake) { | 808 | !s->internal->in_handshake) { |
809 | struct hm_header_st msg_hdr; | 809 | struct hm_header_st msg_hdr; |
810 | CBS cbs; | ||
810 | 811 | ||
811 | /* this may just be a stale retransmit */ | 812 | /* this may just be a stale retransmit */ |
812 | if (!dtls1_get_message_header(rr->data, &msg_hdr)) | 813 | CBS_init(&cbs, rr->data, rr->length); |
814 | if (!dtls1_get_message_header(&cbs, &msg_hdr)) | ||
813 | return -1; | 815 | return -1; |
814 | if (rr->epoch != tls12_record_layer_read_epoch(s->internal->rl)) { | 816 | if (rr->epoch != tls12_record_layer_read_epoch(s->internal->rl)) { |
815 | rr->length = 0; | 817 | rr->length = 0; |