mirror of
https://github.com/facebookincubator/mvfst.git
synced 2026-10-23 17:08:55 +03:00
Summary: Quic uses Fizz dependencies to parse TLS errors into strings. When using Quic as part of MNS, it makes more sense to use the same functionality we already have in MNS (at least until we move to Fizz-mobile at some point). This diff creates the MNS/Mbed based version and still keeps a Fizz based version for non mobile builds. The MNS version was updated to cover all the same alert values that are present in the Fizz version. Reviewed By: lnicco Differential Revision: D79828300 fbshipit-source-id: 4495b267100b90af017d52c1fa1b478ad0fb2687
26 lines
723 B
C++
26 lines
723 B
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include <quic/QuicTLSException.h>
|
|
|
|
#include <fizz/record/Types.h>
|
|
#include <quic/QuicConstants.h>
|
|
|
|
namespace quic {
|
|
|
|
std::string cryptoErrorToString(TransportErrorCode code) {
|
|
auto codeVal = static_cast<std::underlying_type_t<TransportErrorCode>>(code);
|
|
auto alertDescNum = codeVal -
|
|
static_cast<std::underlying_type_t<TransportErrorCode>>(
|
|
TransportErrorCode::CRYPTO_ERROR);
|
|
|
|
return "Crypto error: " +
|
|
toString(static_cast<fizz::AlertDescription>(alertDescNum));
|
|
}
|
|
|
|
} // namespace quic
|