proxygen
EarlyDataRejectionPolicy.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
10 
11 namespace fizz {
12 namespace client {
13 
14 static bool certIdentityMatch(const Cert* a, const Cert* b) {
15  if (!a || !b) {
16  return a == b;
17  }
18 
19  return a->getIdentity() == b->getIdentity();
20 }
21 
23  if (*state.version() != state.earlyDataParams()->version) {
24  return false;
25  }
26 
27  if (*state.cipher() != state.earlyDataParams()->cipher) {
28  return false;
29  }
30 
31  if (state.alpn() != state.earlyDataParams()->alpn) {
32  return false;
33  }
34 
35  if (!certIdentityMatch(
36  state.serverCert().get(),
37  state.earlyDataParams()->serverCert.get())) {
38  return false;
39  }
40 
41  if (!certIdentityMatch(
42  state.clientCert().get(),
43  state.earlyDataParams()->clientCert.get())) {
44  return false;
45  }
46 
47  return true;
48 }
49 } // namespace client
50 } // namespace fizz
char b
virtual std::string getIdentity() const =0
folly::Optional< ProtocolVersion > version() const
Definition: State.h:106
folly::Optional< CipherSuite > cipher() const
Definition: State.h:113
const folly::Optional< std::string > & alpn() const
Definition: State.h:170
std::shared_ptr< const Cert > clientCert() const
Definition: State.h:84
const folly::Optional< EarlyDataParams > & earlyDataParams() const
Definition: State.h:163
static bool certIdentityMatch(const Cert *a, const Cert *b)
bool earlyParametersMatch(const State &state)
Definition: Actions.h:16
char a
std::shared_ptr< const Cert > serverCert() const
Definition: State.h:77
state
Definition: http_parser.c:272