proxygen
fizz::HandshakeContextImpl< Hash > Class Template Reference

#include <HandshakeContext.h>

Inheritance diagram for fizz::HandshakeContextImpl< Hash >:
fizz::HandshakeContext

Public Member Functions

 HandshakeContextImpl (const std::string &hkdfLabelPrefix)
 
void appendToTranscript (const Buf &data) override
 
Buf getHandshakeContext () const override
 
Buf getFinishedData (folly::ByteRange baseKey) const override
 
folly::ByteRange getBlankContext () const override
 
- Public Member Functions inherited from fizz::HandshakeContext
virtual ~HandshakeContext ()=default
 

Private Attributes

folly::ssl::OpenSSLHash::Digest hashState_
 
std::string hkdfLabelPrefix_
 

Detailed Description

template<typename Hash>
class fizz::HandshakeContextImpl< Hash >

Definition at line 47 of file HandshakeContext.h.

Constructor & Destructor Documentation

template<typename Hash >
fizz::HandshakeContextImpl< Hash >::HandshakeContextImpl ( const std::string hkdfLabelPrefix)

Member Function Documentation

template<typename Hash >
void fizz::HandshakeContextImpl< Hash >::appendToTranscript ( const Buf transcript)
overridevirtual

Appends transcript to the current handshake transcript.

Implements fizz::HandshakeContext.

Definition at line 22 of file HandshakeContext-inl.h.

References folly::ssl::OpenSSLHash::Digest::hash_update(), and fizz::HandshakeContextImpl< Hash >::hashState_.

22  {
24 }
void hash_update(ByteRange data)
Definition: OpenSSLHash.h:53
folly::ssl::OpenSSLHash::Digest hashState_
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
template<typename Hash >
folly::ByteRange fizz::HandshakeContextImpl< Hash >::getBlankContext ( ) const
inlineoverridevirtual

Returns the handshake context for an empty transcript.

Implements fizz::HandshakeContext.

Definition at line 57 of file HandshakeContext.h.

57  {
58  return Hash::BlankHash;
59  }
template<typename Hash >
Buf fizz::HandshakeContextImpl< Hash >::getFinishedData ( folly::ByteRange  baseKey) const
overridevirtual

Returns the finished verify_data from the current handshake context and baseKey.

Implements fizz::HandshakeContext.

Definition at line 37 of file HandshakeContext-inl.h.

References context, folly::IOBuf::create(), data, fizz::HandshakeContextImpl< Hash >::getHandshakeContext(), and fizz::HandshakeContextImpl< Hash >::hkdfLabelPrefix_.

38  {
40  auto finishedKey =
41  KeyDerivationImpl<Hash>(hkdfLabelPrefix_)
42  .expandLabel(
43  baseKey, "finished", folly::IOBuf::create(0), Hash::HashLen);
44  auto data = folly::IOBuf::create(Hash::HashLen);
45  data->append(Hash::HashLen);
46  auto outRange = folly::MutableByteRange(data->writableData(), data->length());
47  Hash::hmac(finishedKey->coalesce(), *context, outRange);
48  return data;
49 }
static std::unique_ptr< IOBuf > create(std::size_t capacity)
Definition: IOBuf.cpp:229
context
Definition: CMakeCache.txt:563
Range< unsigned char * > MutableByteRange
Definition: Range.h:1164
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
Buf getHandshakeContext() const override
template<typename Hash >
Buf fizz::HandshakeContextImpl< Hash >::getHandshakeContext ( ) const
overridevirtual

Returns the handshake context for the current transcript.

Implements fizz::HandshakeContext.

Definition at line 27 of file HandshakeContext-inl.h.

References folly::IOBuf::create(), folly::ssl::OpenSSLHash::Digest::hash_final(), and fizz::HandshakeContextImpl< Hash >::hashState_.

Referenced by fizz::HandshakeContextImpl< Hash >::getFinishedData().

27  {
29  auto out = folly::IOBuf::create(Hash::HashLen);
30  out->append(Hash::HashLen);
31  folly::MutableByteRange outRange(out->writableData(), out->length());
32  copied.hash_final(outRange);
33  return out;
34 }
static std::unique_ptr< IOBuf > create(std::size_t capacity)
Definition: IOBuf.cpp:229
folly::ssl::OpenSSLHash::Digest hashState_

Member Data Documentation

template<typename Hash >
std::string fizz::HandshakeContextImpl< Hash >::hkdfLabelPrefix_
private

The documentation for this class was generated from the following files: