proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
SSLOptions.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2017-present Facebook, Inc.
3
*
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
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
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.
15
*/
16
17
#include <
folly/io/async/SSLOptions.h
>
18
#include <
folly/Format.h
>
19
#include <glog/logging.h>
20
21
namespace
folly
{
22
namespace
ssl {
23
24
namespace
ssl_options_detail {
25
void
logDfatal
(std::exception
const
& e) {
26
LOG(
DFATAL
) <<
exceptionStr
(e);
27
}
28
}
// namespace ssl_options_detail
29
30
constexpr std::array<const char*, 12>
SSLCommonOptions::kCipherList
;
31
constexpr std::array<const char*, 8>
SSLCommonOptions::kSignatureAlgorithms
;
32
constexpr std::array<const char*, 12>
SSLServerOptions::kCipherList
;
33
34
void
SSLCommonOptions::setClientOptions
(
SSLContext
& ctx) {
35
#ifdef SSL_MODE_HANDSHAKE_CUTTHROUGH
36
ctx.enableFalseStart();
37
#endif
38
39
X509VerifyParam
param(X509_VERIFY_PARAM_new());
40
X509_VERIFY_PARAM_set_flags(param.get(), X509_V_FLAG_X509_STRICT);
41
try
{
42
ctx.
setX509VerifyParam
(param);
43
}
catch
(std::runtime_error
const
& e) {
44
LOG(
DFATAL
) <<
exceptionStr
(e);
45
}
46
47
try
{
48
ctx.
setClientECCurvesList
({
"P-256"
,
"P-384"
});
49
}
catch
(std::runtime_error
const
& e) {
50
LOG(
DFATAL
) <<
exceptionStr
(e);
51
}
52
53
setCipherSuites<SSLCommonOptions>(ctx);
54
setSignatureAlgorithms<SSLCommonOptions>(ctx);
55
}
56
57
}
// namespace ssl
58
}
// namespace folly
folly::exceptionStr
fbstring exceptionStr(const std::exception &e)
Definition:
ExceptionString.h:33
folly::LogLevel::DFATAL
folly
—— Concurrent Priority Queue Implementation ——
Definition:
AtomicBitSet.h:29
folly::SSLContext::setX509VerifyParam
void setX509VerifyParam(const ssl::X509VerifyParam &x509VerifyParam)
Definition:
SSLContext.cpp:135
folly::SSLContext
Definition:
SSLContext.h:89
folly::ssl::SSLCommonOptions::kCipherList
static constexpr auto kCipherList
Definition:
SSLOptions.h:33
Format.h
folly::ssl::SSLCommonOptions::kSignatureAlgorithms
static constexpr auto kSignatureAlgorithms
Definition:
SSLOptions.h:51
folly::ssl::SSLServerOptions::kCipherList
static constexpr auto kCipherList
Definition:
SSLOptions.h:76
folly::SSLContext::setClientECCurvesList
void setClientECCurvesList(const std::vector< std::string > &ecCurves)
Definition:
SSLContext.cpp:92
folly::ssl::SSLCommonOptions::setClientOptions
static void setClientOptions(SSLContext &ctx)
Definition:
SSLOptions.cpp:34
folly::ssl::ssl_options_detail::logDfatal
void logDfatal(std::exception const &e)
Definition:
SSLOptions.cpp:25
folly::ssl::X509VerifyParam
std::unique_ptr< X509_VERIFY_PARAM, X509VerifyParamDeleter > X509VerifyParam
Definition:
OpenSSLPtrTypes.h:51
SSLOptions.h
proxygen
folly
folly
io
async
SSLOptions.cpp
Generated by
1.8.11