#include <openssl/ssl.h>
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <openssl/ec.h>
#include <openssl/ec_key.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/mem.h>
#include <openssl/span.h>
#include "internal.h"
#include "../crypto/internal.h"
BSSL_NAMESPACE_BEGIN
bool ssl_is_key_type_supported(int key_type) { … }
SSL_SIGNATURE_ALGORITHM;
static const SSL_SIGNATURE_ALGORITHM kSignatureAlgorithms[] = …;
static const SSL_SIGNATURE_ALGORITHM *get_signature_algorithm(uint16_t sigalg) { … }
bool ssl_pkey_supports_algorithm(const SSL *ssl, EVP_PKEY *pkey,
uint16_t sigalg, bool is_verify) { … }
static bool setup_ctx(SSL *ssl, EVP_MD_CTX *ctx, EVP_PKEY *pkey,
uint16_t sigalg, bool is_verify) { … }
enum ssl_private_key_result_t ssl_private_key_sign(
SSL_HANDSHAKE *hs, uint8_t *out, size_t *out_len, size_t max_out,
uint16_t sigalg, Span<const uint8_t> in) { … }
bool ssl_public_key_verify(SSL *ssl, Span<const uint8_t> signature,
uint16_t sigalg, EVP_PKEY *pkey,
Span<const uint8_t> in) { … }
enum ssl_private_key_result_t ssl_private_key_decrypt(SSL_HANDSHAKE *hs,
uint8_t *out,
size_t *out_len,
size_t max_out,
Span<const uint8_t> in) { … }
BSSL_NAMESPACE_END
usingnamespacebssl;
int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa) { … }
int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const uint8_t *der, size_t der_len) { … }
int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey) { … }
int SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const uint8_t *der,
size_t der_len) { … }
int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa) { … }
int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const uint8_t *der,
size_t der_len) { … }
int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) { … }
int SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, const uint8_t *der,
size_t der_len) { … }
void SSL_set_private_key_method(SSL *ssl,
const SSL_PRIVATE_KEY_METHOD *key_method) { … }
void SSL_CTX_set_private_key_method(SSL_CTX *ctx,
const SSL_PRIVATE_KEY_METHOD *key_method) { … }
static constexpr size_t kMaxSignatureAlgorithmNameLen = …;
struct SignatureAlgorithmName { … };
static const SignatureAlgorithmName kSignatureAlgorithmNames[] = …;
const char *SSL_get_signature_algorithm_name(uint16_t sigalg,
int include_curve) { … }
size_t SSL_get_all_signature_algorithm_names(const char **out, size_t max_out) { … }
int SSL_get_signature_algorithm_key_type(uint16_t sigalg) { … }
const EVP_MD *SSL_get_signature_algorithm_digest(uint16_t sigalg) { … }
int SSL_is_signature_algorithm_rsa_pss(uint16_t sigalg) { … }
static int compare_uint16_t(const void *p1, const void *p2) { … }
static bool sigalgs_unique(Span<const uint16_t> in_sigalgs) { … }
static bool set_sigalg_prefs(Array<uint16_t> *out, Span<const uint16_t> prefs) { … }
int SSL_CREDENTIAL_set1_signing_algorithm_prefs(SSL_CREDENTIAL *cred,
const uint16_t *prefs,
size_t num_prefs) { … }
int SSL_CTX_set_signing_algorithm_prefs(SSL_CTX *ctx, const uint16_t *prefs,
size_t num_prefs) { … }
int SSL_set_signing_algorithm_prefs(SSL *ssl, const uint16_t *prefs,
size_t num_prefs) { … }
static constexpr struct { … } kSignatureAlgorithmsMapping[] = …;
static bool parse_sigalg_pairs(Array<uint16_t> *out, const int *values,
size_t num_values) { … }
int SSL_CTX_set1_sigalgs(SSL_CTX *ctx, const int *values, size_t num_values) { … }
int SSL_set1_sigalgs(SSL *ssl, const int *values, size_t num_values) { … }
static bool parse_sigalgs_list(Array<uint16_t> *out, const char *str) { … }
int SSL_CTX_set1_sigalgs_list(SSL_CTX *ctx, const char *str) { … }
int SSL_set1_sigalgs_list(SSL *ssl, const char *str) { … }
int SSL_CTX_set_verify_algorithm_prefs(SSL_CTX *ctx, const uint16_t *prefs,
size_t num_prefs) { … }
int SSL_set_verify_algorithm_prefs(SSL *ssl, const uint16_t *prefs,
size_t num_prefs) { … }