proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
Types.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
9
#include <
fizz/protocol/Types.h
>
10
11
namespace
fizz
{
12
13
HashFunction
getHashFunction
(
CipherSuite
cipher
) {
14
switch
(cipher) {
15
case
CipherSuite::TLS_AES_128_GCM_SHA256
:
16
case
CipherSuite::TLS_AES_128_OCB_SHA256_EXPERIMENTAL
:
17
case
CipherSuite::TLS_CHACHA20_POLY1305_SHA256
:
18
return
HashFunction::Sha256
;
19
case
CipherSuite::TLS_AES_256_GCM_SHA384
:
20
return
HashFunction::Sha384
;
21
}
22
throw
std::runtime_error(
"unknown cipher suite"
);
23
}
24
25
size_t
getHashSize
(
HashFunction
hash) {
26
switch
(hash) {
27
case
HashFunction::Sha256
:
28
return
32;
29
case
HashFunction::Sha384
:
30
return
48;
31
}
32
throw
std::runtime_error(
"unknown hash function"
);
33
}
34
35
folly::StringPiece
toString
(
HashFunction
hash) {
36
switch
(hash) {
37
case
HashFunction::Sha256
:
38
return
"Sha256"
;
39
case
HashFunction::Sha384
:
40
return
"Sha384"
;
41
}
42
return
"Invalid HashFunction"
;
43
}
44
45
folly::StringPiece
toString
(
PskType
pskType) {
46
switch
(pskType) {
47
case
PskType::NotSupported
:
48
return
"NotSupported"
;
49
case
PskType::NotAttempted
:
50
return
"NotAttempted"
;
51
case
PskType::Rejected
:
52
return
"Rejected"
;
53
case
PskType::External
:
54
return
"External"
;
55
case
PskType::Resumption
:
56
return
"Resumption"
;
57
}
58
return
"Invalid PskType"
;
59
}
60
61
folly::StringPiece
toString
(
KeyExchangeType
kexType) {
62
switch
(kexType) {
63
case
KeyExchangeType::None
:
64
return
"None"
;
65
case
KeyExchangeType::OneRtt
:
66
return
"OneRtt"
;
67
case
KeyExchangeType::HelloRetryRequest
:
68
return
"HelloRetryRequest"
;
69
}
70
return
"Invalid kex type"
;
71
}
72
73
folly::StringPiece
toString
(
EarlyDataType
earlyDataType) {
74
switch
(earlyDataType) {
75
case
EarlyDataType::NotAttempted
:
76
return
"NotAttempted"
;
77
case
EarlyDataType::Attempted
:
78
return
"Attempted"
;
79
case
EarlyDataType::Rejected
:
80
return
"Rejected"
;
81
case
EarlyDataType::Accepted
:
82
return
"Accepted"
;
83
}
84
return
"Invalid EarlyDataType"
;
85
}
86
}
// namespace fizz
fizz::CipherSuite::TLS_CHACHA20_POLY1305_SHA256
fizz::CipherSuite::TLS_AES_128_GCM_SHA256
fizz::toString
folly::StringPiece toString(StateEnum state)
Definition:
State.cpp:16
fizz::EarlyDataType
EarlyDataType
Definition:
Types.h:33
fizz::getHashSize
size_t getHashSize(HashFunction hash)
Definition:
Types.cpp:25
fizz::CipherSuite
CipherSuite
Definition:
Types.h:153
fizz::KeyExchangeType::None
fizz::PskType::NotSupported
cipher
CipherSuite cipher
Definition:
ClientProtocol.cpp:1006
Types.h
fizz::KeyExchangeType::OneRtt
fizz::Event::HelloRetryRequest
fizz::getHashFunction
HashFunction getHashFunction(CipherSuite cipher)
Definition:
Types.cpp:13
fizz::HashFunction
HashFunction
Definition:
Types.h:16
fizz::EarlyDataType::Accepted
fizz
Definition:
Actions.h:16
folly::Range< const char * >
fizz::PskType::Rejected
fizz::CipherSuite::TLS_AES_256_GCM_SHA384
fizz::PskType::Resumption
fizz::PskType
PskType
Definition:
Types.h:18
fizz::PskType::External
fizz::PskType::NotAttempted
fizz::EarlyDataType::Attempted
fizz::HashFunction::Sha256
fizz::HashFunction::Sha384
fizz::KeyExchangeType
KeyExchangeType
Definition:
Types.h:31
fizz::CipherSuite::TLS_AES_128_OCB_SHA256_EXPERIMENTAL
proxygen
fizz
fizz
protocol
Types.cpp
Generated by
1.8.11