2 * Copyright 2016 Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <folly/io/Cursor.h>
20 #include <folly/io/IOBuf.h>
27 // http://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml
28 enum class TLSExtension : uint16_t {
30 MAX_FRAGMENT_LENGTH = 1,
31 CLIENT_CERTIFICATE_URL = 2,
39 SUPPORTED_GROUPS = 10,
40 EC_POINT_FORMATS = 11,
42 SIGNATURE_ALGORITHMS = 13,
45 APPLICATION_LAYER_PROTOCOL_NEGOTIATION = 16,
46 STATUS_REQUEST_V2 = 17,
47 SIGNED_CERTIFICATE_TIMESTAMP = 18,
48 CLIENT_CERTIFICATE_TYPE = 19,
49 SERVER_CERTIFICATE_TYPE = 20,
51 ENCRYPT_THEN_MAC = 22,
52 EXTENDED_MASTER_SECRET = 23,
54 // Facebook-specific, not IANA assigned yet
55 TLS_CACHED_INFO_FB = 60001,
56 // End Facebook-specific
57 RENEGOTIATION_INFO = 65281
60 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-18
61 enum class HashAlgorithm : uint8_t {
71 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-16
72 enum class SignatureAlgorithm : uint8_t {
79 struct ClientHelloInfo {
80 folly::IOBufQueue clientHelloBuf_;
81 uint8_t clientHelloMajorVersion_;
82 uint8_t clientHelloMinorVersion_;
83 std::vector<uint16_t> clientHelloCipherSuites_;
84 std::vector<uint8_t> clientHelloCompressionMethods_;
85 std::vector<TLSExtension> clientHelloExtensions_;
86 std::vector<std::pair<HashAlgorithm, SignatureAlgorithm>> clientHelloSigAlgs_;