Skip to content

Commit

Permalink
PskSerializationUtils: change deserialize to take in range
Browse files Browse the repository at this point in the history
Summary:
Do not require the caller to pass in a `std::string` to deserialize. Take in
the buffer as a view type, which allows more flexibility for the caller.

Reviewed By: zalecodez

Differential Revision: D64780788

fbshipit-source-id: 7bd710c981b6dbb4dd7f4d495f8fc3c8bc570d9e
  • Loading branch information
Mingtao Yang authored and facebook-github-bot committed Oct 24, 2024
1 parent d76ddb2 commit 1bd8e3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion proxygen/lib/transport/PersistentFizzPskCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class PersistentFizzPskCache : public fizz::client::PskCache {
if (serialized) {
try {
auto deserialized = fizz::client::deserializePsk(
fizz::openssl::certificateSerializer(), serialized->serialized);
fizz::openssl::certificateSerializer(),
folly::ByteRange(serialized->serialized));
serialized->uses++;
if (maxPskUses_ != 0 && serialized->uses >= maxPskUses_) {
cache_.remove(identity);
Expand Down
5 changes: 3 additions & 2 deletions proxygen/lib/transport/PersistentQuicPskCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ folly::Optional<quic::QuicCachedPsk> PersistentQuicPskCache::getPsk(
}
try {
quic::QuicCachedPsk quicCachedPsk;
quicCachedPsk.cachedPsk = fizz::client::deserializePsk(
fizz::openssl::certificateSerializer(), cachedPsk->fizzPsk);
quicCachedPsk.cachedPsk =
fizz::client::deserializePsk(fizz::openssl::certificateSerializer(),
folly::ByteRange(cachedPsk->fizzPsk));

auto buf = folly::IOBuf::wrapBuffer(cachedPsk->quicParams.data(),
cachedPsk->quicParams.length());
Expand Down

0 comments on commit 1bd8e3c

Please sign in to comment.