diff options
author | David Benjamin <davidben@google.com> | 2021-06-22 23:00:49 -0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2021-08-16 18:20:28 +0000 |
commit | 006f20ad7f9a6ce53b44390c0689f3690bf73ad1 (patch) | |
tree | bb51b1761c10616d1fc41534eed1dd0df72e48de /ssl/handshake_server.cc | |
parent | 2e68a05c9943a8dec1758d4a393b2ae906fd3295 (diff) | |
download | boringssl-006f20ad7f9a6ce53b44390c0689f3690bf73ad1.zip boringssl-006f20ad7f9a6ce53b44390c0689f3690bf73ad1.tar.gz boringssl-006f20ad7f9a6ce53b44390c0689f3690bf73ad1.tar.bz2 |
Add Span::first() and Span::last().
absl::Span, base::span, and std::span have first() and last() methods
which give prefixes and suffixes. first() just saves 5 characters, but
last() is nicer to write than subspan() for suffixes.
Unlike subspan(), they also do not have clipping behavior, so we're
guaranteed the length is correct. The clipping behavior comes from
absl::Span::subspan() and is not present in std::span or base::span.
I've left it in, in case we switch to absl::Span in the future, but I
imagine absl::Span will need to migrate this at some point.
Change-Id: I042dd6c566b6d753ec6de9d84e8c09ac7c270267
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48905
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'ssl/handshake_server.cc')
-rw-r--r-- | ssl/handshake_server.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/ssl/handshake_server.cc b/ssl/handshake_server.cc index c8a23a1..29fc3a4 100644 --- a/ssl/handshake_server.cc +++ b/ssl/handshake_server.cc @@ -973,8 +973,7 @@ static enum ssl_hs_wait_t do_select_parameters(SSL_HANDSHAKE *hs) { } static void copy_suffix(Span<uint8_t> out, Span<const uint8_t> in) { - out = out.subspan(out.size() - in.size()); - assert(out.size() == in.size()); + out = out.last(in.size()); OPENSSL_memcpy(out.data(), in.data(), in.size()); } |