#include <openssl/ssl.h>
#include <assert.h>
#include <algorithm>
#include <openssl/bytestring.h>
#include <openssl/err.h>
#include <openssl/span.h>
#include "internal.h"
#include "../crypto/internal.h"
BSSL_NAMESPACE_BEGIN
bool ssl_protocol_version_from_wire(uint16_t *out, uint16_t version) { … }
static const uint16_t kTLSVersions[] = …;
static const uint16_t kDTLSVersions[] = …;
static Span<const uint16_t> get_method_versions(
const SSL_PROTOCOL_METHOD *method) { … }
bool ssl_method_supports_version(const SSL_PROTOCOL_METHOD *method,
uint16_t version) { … }
static const char* kUnknownVersion = …;
struct VersionInfo { … };
static const VersionInfo kVersionNames[] = …;
static const char *ssl_version_to_string(uint16_t version) { … }
static uint16_t wire_version_to_api(uint16_t version) { … }
static bool api_version_to_wire(uint16_t *out, uint16_t version) { … }
static bool set_version_bound(const SSL_PROTOCOL_METHOD *method, uint16_t *out,
uint16_t version) { … }
static bool set_min_version(const SSL_PROTOCOL_METHOD *method, uint16_t *out,
uint16_t version) { … }
static bool set_max_version(const SSL_PROTOCOL_METHOD *method, uint16_t *out,
uint16_t version) { … }
const struct { … } kProtocolVersions[] = …;
bool ssl_get_version_range(const SSL_HANDSHAKE *hs, uint16_t *out_min_version,
uint16_t *out_max_version) { … }
static uint16_t ssl_version(const SSL *ssl) { … }
uint16_t ssl_protocol_version(const SSL *ssl) { … }
bool ssl_supports_version(const SSL_HANDSHAKE *hs, uint16_t version) { … }
bool ssl_add_supported_versions(const SSL_HANDSHAKE *hs, CBB *cbb,
uint16_t extra_min_version) { … }
bool ssl_negotiate_version(SSL_HANDSHAKE *hs, uint8_t *out_alert,
uint16_t *out_version, const CBS *peer_versions) { … }
BSSL_NAMESPACE_END
usingnamespacebssl;
int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, uint16_t version) { … }
int SSL_CTX_set_max_proto_version(SSL_CTX *ctx, uint16_t version) { … }
uint16_t SSL_CTX_get_min_proto_version(const SSL_CTX *ctx) { … }
uint16_t SSL_CTX_get_max_proto_version(const SSL_CTX *ctx) { … }
int SSL_set_min_proto_version(SSL *ssl, uint16_t version) { … }
int SSL_set_max_proto_version(SSL *ssl, uint16_t version) { … }
uint16_t SSL_get_min_proto_version(const SSL *ssl) { … }
uint16_t SSL_get_max_proto_version(const SSL *ssl) { … }
int SSL_version(const SSL *ssl) { … }
const char *SSL_get_version(const SSL *ssl) { … }
size_t SSL_get_all_version_names(const char **out, size_t max_out) { … }
const char *SSL_SESSION_get_version(const SSL_SESSION *session) { … }
uint16_t SSL_SESSION_get_protocol_version(const SSL_SESSION *session) { … }
int SSL_SESSION_set_protocol_version(SSL_SESSION *session, uint16_t version) { … }
int SSL_CTX_set_record_protocol_version(SSL_CTX *ctx, int version) { … }