|
OpenVPN
|
Data Channel Cryptography OpenSSL-specific backend interface. More...
#include "syshead.h"#include "basic.h"#include "buffer.h"#include "integer.h"#include "crypto.h"#include "crypto_backend.h"#include "openssl_compat.h"#include <openssl/conf.h>#include <openssl/des.h>#include <openssl/err.h>#include <openssl/evp.h>#include <openssl/objects.h>#include <openssl/rand.h>#include <openssl/ssl.h>#include <openssl/kdf.h>
Go to the source code of this file.
Data Structures | |
| struct | collect_ciphers |
Functions | |
| void | crypto_init_lib_engine (const char *engine_name) |
| provider_t * | crypto_load_provider (const char *provider) |
| Load the given (OpenSSL) providers. | |
| void | crypto_unload_provider (const char *provname, provider_t *provider) |
| Unloads the given (OpenSSL) provider. | |
| void | crypto_init_lib (void) |
| void | crypto_uninit_lib (void) |
| void | crypto_clear_error (void) |
| void | crypto_print_openssl_errors (const unsigned int flags) |
| Retrieve any occurred OpenSSL errors and print those errors. | |
| static int | cipher_name_cmp (const void *a, const void *b) |
| static void | collect_ciphers (EVP_CIPHER *cipher, void *list) |
| void | show_available_ciphers (void) |
| void | print_digest (EVP_MD *digest, void *unused) |
| void | show_available_digests (void) |
| void | show_available_engines (void) |
| bool | crypto_pem_encode (const char *name, struct buffer *dst, const struct buffer *src, struct gc_arena *gc) |
| Encode binary data as PEM. | |
| bool | crypto_pem_decode (const char *name, struct buffer *dst, const struct buffer *src) |
| Decode a PEM buffer to binary data. | |
| int | rand_bytes (uint8_t *output, int len) |
| Wrapper for secure random number generator. | |
| static evp_cipher_type * | cipher_get (const char *ciphername) |
| bool | cipher_valid_reason (const char *ciphername, const char **reason) |
| Returns if the cipher is valid, based on the given cipher name and provides a reason if invalid. | |
| const char * | cipher_kt_name (const char *ciphername) |
| Retrieve a normalised string describing the cipher (e.g. | |
| int | cipher_kt_key_size (const char *ciphername) |
| Returns the size of keys used by the cipher, in bytes. | |
| int | cipher_kt_iv_size (const char *ciphername) |
| Returns the size of the IV used by the cipher, in bytes, or 0 if no IV is used. | |
| int | cipher_kt_block_size (const char *ciphername) |
| Returns the block size of the cipher, in bytes. | |
| int | cipher_kt_tag_size (const char *ciphername) |
| Returns the MAC tag size of the cipher, in bytes. | |
| bool | cipher_kt_insecure (const char *ciphername) |
| Returns true if we consider this cipher to be insecure. | |
| int | cipher_kt_mode (const EVP_CIPHER *cipher_kt) |
| bool | cipher_kt_mode_cbc (const char *ciphername) |
| Check if the supplied cipher is a supported CBC mode cipher. | |
| bool | cipher_kt_mode_ofb_cfb (const char *ciphername) |
| Check if the supplied cipher is a supported OFB or CFB mode cipher. | |
| bool | cipher_kt_mode_aead (const char *ciphername) |
| Check if the supplied cipher is a supported AEAD mode cipher. | |
| cipher_ctx_t * | cipher_ctx_new (void) |
| Generic cipher functions. | |
| void | cipher_ctx_free (EVP_CIPHER_CTX *ctx) |
| void | cipher_ctx_init (EVP_CIPHER_CTX *ctx, const uint8_t *key, const char *ciphername, crypto_operation_t enc) |
| int | cipher_ctx_iv_length (const EVP_CIPHER_CTX *ctx) |
| int | cipher_ctx_get_tag (EVP_CIPHER_CTX *ctx, uint8_t *tag_buf, int tag_size) |
| int | cipher_ctx_block_size (const EVP_CIPHER_CTX *ctx) |
| int | cipher_ctx_mode (const EVP_CIPHER_CTX *ctx) |
| bool | cipher_ctx_mode_cbc (const cipher_ctx_t *ctx) |
| Check if the supplied cipher is a supported CBC mode cipher. | |
| bool | cipher_ctx_mode_ofb_cfb (const cipher_ctx_t *ctx) |
| Check if the supplied cipher is a supported OFB or CFB mode cipher. | |
| bool | cipher_ctx_mode_aead (const cipher_ctx_t *ctx) |
| Check if the supplied cipher is a supported AEAD mode cipher. | |
| int | cipher_ctx_reset (EVP_CIPHER_CTX *ctx, const uint8_t *iv_buf) |
| int | cipher_ctx_update_ad (EVP_CIPHER_CTX *ctx, const uint8_t *src, int src_len) |
| int | cipher_ctx_update (EVP_CIPHER_CTX *ctx, uint8_t *dst, int *dst_len, uint8_t *src, int src_len) |
| int | cipher_ctx_final (EVP_CIPHER_CTX *ctx, uint8_t *dst, int *dst_len) |
| int | cipher_ctx_final_check_tag (EVP_CIPHER_CTX *ctx, uint8_t *dst, int *dst_len, uint8_t *tag, size_t tag_len) |
| static evp_md_type * | md_get (const char *digest) |
| bool | md_valid (const char *digest) |
| Return if a message digest parameters is valid given the name of the digest. | |
| const char * | md_kt_name (const char *mdname) |
| Retrieve a string describing the digest digest (e.g. | |
| unsigned char | md_kt_size (const char *mdname) |
| Returns the size of the message digest, in bytes. | |
| int | md_full (const char *mdname, const uint8_t *src, int src_len, uint8_t *dst) |
| Calculates the message digest for the given buffer. | |
| EVP_MD_CTX * | md_ctx_new (void) |
| void | md_ctx_free (EVP_MD_CTX *ctx) |
| void | md_ctx_init (EVP_MD_CTX *ctx, const char *mdname) |
| void | md_ctx_cleanup (EVP_MD_CTX *ctx) |
| int | md_ctx_size (const EVP_MD_CTX *ctx) |
| void | md_ctx_update (EVP_MD_CTX *ctx, const uint8_t *src, int src_len) |
| void | md_ctx_final (EVP_MD_CTX *ctx, uint8_t *dst) |
| HMAC_CTX * | hmac_ctx_new (void) |
| void | hmac_ctx_free (HMAC_CTX *ctx) |
| void | hmac_ctx_init (HMAC_CTX *ctx, const uint8_t *key, const char *mdname) |
| void | hmac_ctx_cleanup (HMAC_CTX *ctx) |
| int | hmac_ctx_size (HMAC_CTX *ctx) |
| void | hmac_ctx_reset (HMAC_CTX *ctx) |
| void | hmac_ctx_update (HMAC_CTX *ctx, const uint8_t *src, int src_len) |
| void | hmac_ctx_final (HMAC_CTX *ctx, uint8_t *dst) |
| int | memcmp_constant_time (const void *a, const void *b, size_t size) |
| As memcmp(), but constant-time. | |
| bool | ssl_tls1_PRF (const uint8_t *seed, size_t seed_len, const uint8_t *secret, size_t secret_len, uint8_t *output, size_t output_len) |
| Calculates the TLS 1.0-1.1 PRF function. | |
Variables | |
| const cipher_name_pair | cipher_name_translation_table [] |
| Cipher name translation table. | |
| const size_t | cipher_name_translation_table_count |
| const cipher_name_pair | digest_name_translation_table [] |
| const size_t | digest_name_translation_table_count |
Data Channel Cryptography OpenSSL-specific backend interface.
Definition in file crypto_openssl.c.
| int cipher_ctx_block_size | ( | const EVP_CIPHER_CTX * | ctx | ) |
Definition at line 888 of file crypto_openssl.c.
| int cipher_ctx_final | ( | EVP_CIPHER_CTX * | ctx, |
| uint8_t * | dst, | ||
| int * | dst_len | ||
| ) |
Definition at line 989 of file crypto_openssl.c.
Referenced by cipher_ctx_final_check_tag().
| int cipher_ctx_final_check_tag | ( | EVP_CIPHER_CTX * | ctx, |
| uint8_t * | dst, | ||
| int * | dst_len, | ||
| uint8_t * | tag, | ||
| size_t | tag_len | ||
| ) |
Definition at line 995 of file crypto_openssl.c.
References ASSERT, and cipher_ctx_final().
| void cipher_ctx_free | ( | EVP_CIPHER_CTX * | ctx | ) |
Definition at line 852 of file crypto_openssl.c.
| int cipher_ctx_get_tag | ( | EVP_CIPHER_CTX * | ctx, |
| uint8_t * | tag_buf, | ||
| int | tag_size | ||
| ) |
Definition at line 882 of file crypto_openssl.c.
| void cipher_ctx_init | ( | EVP_CIPHER_CTX * | ctx, |
| const uint8_t * | key, | ||
| const char * | ciphername, | ||
| crypto_operation_t | enc | ||
| ) |
Definition at line 858 of file crypto_openssl.c.
References ASSERT, cipher_get(), crypto_msg, EVP_CIPHER_free(), and M_FATAL.
| int cipher_ctx_iv_length | ( | const EVP_CIPHER_CTX * | ctx | ) |
Definition at line 876 of file crypto_openssl.c.
| int cipher_ctx_mode | ( | const EVP_CIPHER_CTX * | ctx | ) |
Definition at line 894 of file crypto_openssl.c.
| bool cipher_ctx_mode_aead | ( | const cipher_ctx_t * | ctx | ) |
Check if the supplied cipher is a supported AEAD mode cipher.
| ctx | Cipher's context. May not be NULL. |
Definition at line 939 of file crypto_openssl.c.
Referenced by key_ctx_update_implicit_iv(), openvpn_decrypt(), openvpn_encrypt(), and test_crypto().
| bool cipher_ctx_mode_cbc | ( | const cipher_ctx_t * | ctx | ) |
Check if the supplied cipher is a supported CBC mode cipher.
| ctx | Cipher's context. May not be NULL. |
Definition at line 905 of file crypto_openssl.c.
Referenced by openvpn_decrypt_v1(), and openvpn_encrypt_v1().
| bool cipher_ctx_mode_ofb_cfb | ( | const cipher_ctx_t * | ctx | ) |
Check if the supplied cipher is a supported OFB or CFB mode cipher.
| ctx | Cipher's context. May not be NULL. |
Definition at line 924 of file crypto_openssl.c.
References EVP_CIPHER_CTX_get_mode.
Referenced by openvpn_decrypt_v1(), and openvpn_encrypt_v1().
| cipher_ctx_t * cipher_ctx_new | ( | void | ) |
Generic cipher functions.
Allocate a new cipher context
Definition at line 844 of file crypto_openssl.c.
References check_malloc_return().
Referenced by init_key_ctx().
| int cipher_ctx_reset | ( | EVP_CIPHER_CTX * | ctx, |
| const uint8_t * | iv_buf | ||
| ) |
Definition at line 962 of file crypto_openssl.c.
| int cipher_ctx_update | ( | EVP_CIPHER_CTX * | ctx, |
| uint8_t * | dst, | ||
| int * | dst_len, | ||
| uint8_t * | src, | ||
| int | src_len | ||
| ) |
Definition at line 979 of file crypto_openssl.c.
References crypto_msg, and M_FATAL.
| int cipher_ctx_update_ad | ( | EVP_CIPHER_CTX * | ctx, |
| const uint8_t * | src, | ||
| int | src_len | ||
| ) |
Definition at line 968 of file crypto_openssl.c.
References crypto_msg, and M_FATAL.
|
static |
Definition at line 600 of file crypto_openssl.c.
References ASSERT, EVP_CIPHER_fetch(), and translate_cipher_name_from_openvpn().
Referenced by cipher_ctx_init(), cipher_kt_block_size(), cipher_kt_insecure(), cipher_kt_iv_size(), cipher_kt_key_size(), cipher_kt_mode_aead(), cipher_kt_mode_cbc(), cipher_kt_mode_ofb_cfb(), cipher_kt_name(), and cipher_valid_reason().
| int cipher_kt_block_size | ( | const char * | ciphername | ) |
Returns the block size of the cipher, in bytes.
| ciphername | cipher name |
Definition at line 691 of file crypto_openssl.c.
References cipher_get(), cleanup(), EVP_CIPHER_fetch(), EVP_CIPHER_free(), string_alloc(), translate_cipher_name_from_openvpn(), and translate_cipher_name_to_openvpn().
Referenced by adjust_payload_max_cbc(), calculate_crypto_overhead(), cipher_kt_insecure(), init_key_ctx(), init_key_type(), print_cipher(), and warn_insecure_key_type().
| bool cipher_kt_insecure | ( | const char * | ciphername | ) |
Returns true if we consider this cipher to be insecure.
Definition at line 753 of file crypto_openssl.c.
References cipher_get(), cipher_kt_block_size(), and EVP_CIPHER_free().
Referenced by show_available_ciphers(), tls_limit_reneg_bytes(), and warn_insecure_key_type().
| int cipher_kt_iv_size | ( | const char * | ciphername | ) |
Returns the size of the IV used by the cipher, in bytes, or 0 if no IV is used.
| ciphername | cipher name to lookup |
Definition at line 682 of file crypto_openssl.c.
References cipher_get(), and EVP_CIPHER_free().
Referenced by calculate_crypto_overhead(), epoch_data_key_derive(), and init_key_ctx().
| int cipher_kt_key_size | ( | const char * | ciphername | ) |
Returns the size of keys used by the cipher, in bytes.
If the cipher has a variable key size, return the default key size.
| ciphername | Cipher name to lookup |
Definition at line 673 of file crypto_openssl.c.
References cipher_get(), and EVP_CIPHER_free().
Referenced by dco_new_key(), epoch_data_key_derive(), init_key_ctx(), key_is_zero(), key_print(), options_string(), and print_cipher().
| int cipher_kt_mode | ( | const EVP_CIPHER * | cipher_kt | ) |
Definition at line 775 of file crypto_openssl.c.
References ASSERT.
Referenced by cipher_kt_mode_cbc(), and cipher_kt_mode_ofb_cfb().
| bool cipher_kt_mode_aead | ( | const char * | ciphername | ) |
Check if the supplied cipher is a supported AEAD mode cipher.
| ciphername | name of the cipher |
Definition at line 812 of file crypto_openssl.c.
References cipher_get(), EVP_CIPHER_free(), and OPENVPN_MODE_GCM.
Referenced by calculate_crypto_overhead(), cipher_get_aead_limits(), cipher_kt_tag_size(), collect_ciphers(), init_key_contexts(), init_key_type(), multi_client_set_protocol_options(), mutate_ncp_cipher_list(), p2p_ncp_set_options(), and tls_print_deferred_options_results().
| bool cipher_kt_mode_cbc | ( | const char * | ciphername | ) |
Check if the supplied cipher is a supported CBC mode cipher.
| ciphername | cipher name |
Definition at line 782 of file crypto_openssl.c.
References cipher_get(), cipher_kt_mode(), EVP_CIPH_FLAG_ENC_THEN_MAC, EVP_CIPHER_free(), and OPENVPN_MODE_CBC.
Referenced by adjust_payload_max_cbc(), calculate_crypto_overhead(), collect_ciphers(), frame_calculate_fragment(), frame_calculate_payload_overhead(), init_key_type(), mutate_ncp_cipher_list(), and print_cipher().
| bool cipher_kt_mode_ofb_cfb | ( | const char * | ciphername | ) |
Check if the supplied cipher is a supported OFB or CFB mode cipher.
| ciphername | cipher name |
Definition at line 799 of file crypto_openssl.c.
References cipher_get(), cipher_kt_mode(), EVP_CIPHER_free(), OPENVPN_MODE_CFB, and OPENVPN_MODE_OFB.
Referenced by calc_packet_id_size_dc(), collect_ciphers(), do_init_crypto_tls(), init_key_type(), mutate_ncp_cipher_list(), and tls_session_update_crypto_params_do_work().
| const char * cipher_kt_name | ( | const char * | ciphername | ) |
Retrieve a normalised string describing the cipher (e.g.
AES-128-CBC). The returned name is normalised to the OpenVPN config name in case the name differs from the name used by the crypto library.
Returns [null-cipher] in case the ciphername is none. NULL if the cipher is not valid.
| ciphername | Name of the cipher |
Definition at line 653 of file crypto_openssl.c.
References ASSERT, cipher_get(), EVP_CIPHER_free(), and translate_cipher_name_to_openvpn().
Referenced by cipher_get_aead_limits(), init_key_contexts(), init_key_ctx(), key_print(), mutate_ncp_cipher_list(), options_string(), p2p_mode_ncp(), print_cipher(), test_translate_cipher(), and tls_print_deferred_options_results().
| int cipher_kt_tag_size | ( | const char * | ciphername | ) |
Returns the MAC tag size of the cipher, in bytes.
| ciphername | Name of the cipher |
Definition at line 740 of file crypto_openssl.c.
References cipher_kt_mode_aead(), and OPENVPN_AEAD_TAG_LENGTH.
Referenced by calculate_crypto_overhead().
|
static |
Definition at line 321 of file crypto_openssl.c.
References EVP_CIPHER_get0_name.
Referenced by show_available_ciphers().
| bool cipher_valid_reason | ( | const char * | ciphername, |
| const char ** | reason | ||
| ) |
Returns if the cipher is valid, based on the given cipher name and provides a reason if invalid.
| ciphername | Name of the cipher to check for validity (e.g. AES-128-CBC). Will be translated to the library name from the openvpn config name if needed. |
| reason | Pointer where a static string indicating the reason for rejecting the cipher should be stored. It is set to NULL if the cipher is valid. |
Definition at line 609 of file crypto_openssl.c.
References cipher_get(), crypto_msg, D_LOW, EVP_CIPHER_free(), MAX_CIPHER_KEY_LENGTH, and msg.
Referenced by cipher_valid(), and print_cipher().
|
static |
Definition at line 337 of file crypto_openssl.c.
References cipher_kt_mode_aead(), cipher_kt_mode_cbc(), cipher_kt_mode_ofb_cfb(), EVP_CIPHER_get0_name, collect_ciphers::list, M_WARN, msg, collect_ciphers::num, and SIZE.
| void crypto_clear_error | ( | void | ) |
Definition at line 224 of file crypto_openssl.c.
Referenced by openvpn_decrypt_aead(), openvpn_decrypt_v1(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), tls_crypt_unwrap(), and tls_crypt_wrap().
| void crypto_init_lib | ( | void | ) |
Definition at line 189 of file crypto_openssl.c.
Referenced by init_ssl_lib().
| void crypto_init_lib_engine | ( | const char * | engine_name | ) |
Definition at line 139 of file crypto_openssl.c.
References ASSERT, M_WARN, and msg.
Referenced by init_crypto_pre().
| provider_t * crypto_load_provider | ( | const char * | provider | ) |
Load the given (OpenSSL) providers.
| provider | name of providers to load |
Definition at line 155 of file crypto_openssl.c.
References crypto_msg, M_FATAL, M_WARN, and msg.
Referenced by init_early(), and main().
Decode a PEM buffer to binary data.
| name | The name expected in the PEM header/footer. |
| dst | Destination buffer for decoded data. |
| src | Source buffer (PEM data). |
Definition at line 524 of file crypto_openssl.c.
References BCAP, BLEN, BPTR, buf_write_alloc(), cleanup(), crypto_msg, D_CRYPT_ERRORS, dmsg, and M_FATAL.
Referenced by crypto_pem_encode_decode_loopback(), and read_pem_key_file().
| bool crypto_pem_encode | ( | const char * | name, |
| struct buffer * | dst, | ||
| const struct buffer * | src, | ||
| struct gc_arena * | gc | ||
| ) |
Encode binary data as PEM.
| name | The name to use in the PEM header/footer. |
| dst | Destination buffer for PEM-encoded data. Must be a valid pointer to an uninitialized buffer structure. Iff this function returns true, the buffer will contain memory allocated through the supplied gc. |
| src | Source buffer. |
| gc | The garbage collector to use when allocating memory for dst. |
Definition at line 496 of file crypto_openssl.c.
References alloc_buf_gc(), ASSERT, BLEN, BPTR, buf_write(), cleanup(), buffer::data, and gc.
Referenced by crypto_pem_encode_decode_loopback(), tls_crypt_v2_write_client_key_file(), and write_pem_key_file().
| void crypto_print_openssl_errors | ( | const unsigned int | flags | ) |
Retrieve any occurred OpenSSL errors and print those errors.
Note that this function uses the not thread-safe OpenSSL error API.
| flags | Flags to indicate error type and priority. |
Definition at line 230 of file crypto_openssl.c.
References check_debug_level(), D_CRYPT_ERRORS, D_TLS_DEBUG_MED, ERR_get_error_all(), and msg.
Referenced by tls_ctx_load_cert_pem_file(), tls_ctx_load_cert_uri(), and tls_ctx_load_pkcs12().
| void crypto_uninit_lib | ( | void | ) |
| void crypto_unload_provider | ( | const char * | provname, |
| provider_t * | provider | ||
| ) |
Unloads the given (OpenSSL) provider.
| provname | name of the provider to unload |
| provider | pointer to the provider to unload |
Definition at line 172 of file crypto_openssl.c.
References crypto_msg, and M_FATAL.
Referenced by main(), and uninit_early().
| void hmac_ctx_cleanup | ( | HMAC_CTX * | ctx | ) |
Definition at line 1220 of file crypto_openssl.c.
| void hmac_ctx_final | ( | HMAC_CTX * | ctx, |
| uint8_t * | dst | ||
| ) |
Definition at line 1256 of file crypto_openssl.c.
| void hmac_ctx_free | ( | HMAC_CTX * | ctx | ) |
Definition at line 1197 of file crypto_openssl.c.
| void hmac_ctx_init | ( | HMAC_CTX * | ctx, |
| const uint8_t * | key, | ||
| const char * | mdname | ||
| ) |
Definition at line 1203 of file crypto_openssl.c.
References ASSERT, crypto_msg, M_FATAL, and md_get().
| HMAC_CTX * hmac_ctx_new | ( | void | ) |
Definition at line 1189 of file crypto_openssl.c.
References check_malloc_return().
Referenced by crypto_test_hmac(), gen_hmac_md5(), init_key_ctx(), init_static_hmac(), ovpn_hkdf_expand(), and session_id_hmac_init().
| void hmac_ctx_reset | ( | HMAC_CTX * | ctx | ) |
Definition at line 1241 of file crypto_openssl.c.
References crypto_msg, and M_FATAL.
| int hmac_ctx_size | ( | HMAC_CTX * | ctx | ) |
Definition at line 1231 of file crypto_openssl.c.
| void hmac_ctx_update | ( | HMAC_CTX * | ctx, |
| const uint8_t * | src, | ||
| int | src_len | ||
| ) |
Definition at line 1250 of file crypto_openssl.c.
| void md_ctx_cleanup | ( | EVP_MD_CTX * | ctx | ) |
Definition at line 1156 of file crypto_openssl.c.
| void md_ctx_final | ( | EVP_MD_CTX * | ctx, |
| uint8_t * | dst | ||
| ) |
Definition at line 1174 of file crypto_openssl.c.
| void md_ctx_free | ( | EVP_MD_CTX * | ctx | ) |
Definition at line 1136 of file crypto_openssl.c.
| void md_ctx_init | ( | EVP_MD_CTX * | ctx, |
| const char * | mdname | ||
| ) |
Definition at line 1142 of file crypto_openssl.c.
References ASSERT, crypto_msg, EVP_MD_free(), M_FATAL, and md_get().
| EVP_MD_CTX * md_ctx_new | ( | void | ) |
Definition at line 1128 of file crypto_openssl.c.
References check_malloc_return().
Referenced by DigestCalcHA1(), DigestCalcResponse(), and process_incoming_push_reply().
| int md_ctx_size | ( | const EVP_MD_CTX * | ctx | ) |
Definition at line 1162 of file crypto_openssl.c.
| void md_ctx_update | ( | EVP_MD_CTX * | ctx, |
| const uint8_t * | src, | ||
| int | src_len | ||
| ) |
Definition at line 1168 of file crypto_openssl.c.
| int md_full | ( | const char * | mdname, |
| const uint8_t * | src, | ||
| int | src_len, | ||
| uint8_t * | dst | ||
| ) |
Calculates the message digest for the given buffer.
| mdname | message digest name |
| src | Buffer to digest. May not be NULL. |
| src_len | The length of the incoming buffer. |
| dst | Buffer to write the message digest to. May not be NULL. |
1 on success, 0 on failure Definition at line 1117 of file crypto_openssl.c.
References EVP_MD_free(), and md_get().
Referenced by gen_md4_hash().
|
static |
Definition at line 1019 of file crypto_openssl.c.
References ASSERT, crypto_msg, EVP_MD_fetch(), M_FATAL, and MAX_HMAC_KEY_LENGTH.
Referenced by hmac_ctx_init(), md_ctx_init(), md_full(), md_kt_name(), and md_kt_size().
| const char * md_kt_name | ( | const char * | mdname | ) |
Retrieve a string describing the digest digest (e.g.
SHA1).
| mdname | Message digest name |
Definition at line 1073 of file crypto_openssl.c.
References digest_name_translation_table, digest_name_translation_table_count, EVP_MD_free(), EVP_MD_get0_name, i, cipher_name_pair::lib_name, md_get(), and cipher_name_pair::openvpn_name.
Referenced by init_key_ctx(), key_print(), options_string(), print_digest(), and tls_print_deferred_options_results().
| unsigned char md_kt_size | ( | const char * | mdname | ) |
Returns the size of the message digest, in bytes.
| mdname | Message digest name |
Definition at line 1097 of file crypto_openssl.c.
References EVP_MD_free(), and md_get().
Referenced by calculate_crypto_overhead(), crypto_test_hmac(), init_key_ctx(), init_key_type(), and key_print().
| bool md_valid | ( | const char * | digest | ) |
Return if a message digest parameters is valid given the name of the digest.
| digest | Name of the digest to verify, e.g. MD5). |
Definition at line 1041 of file crypto_openssl.c.
References EVP_MD_fetch(), and EVP_MD_free().
Referenced by create_kt(), do_init_tls_wrap_key(), init_static_hmac(), main(), and session_id_hmac_init().
| int memcmp_constant_time | ( | const void * | a, |
| const void * | b, | ||
| size_t | size | ||
| ) |
As memcmp(), but constant-time.
Returns 0 when data is equal, non-zero otherwise.
Definition at line 1355 of file crypto_openssl.c.
Referenced by check_hmac_token(), check_session_hmac_and_pkt_id(), is_auth_token(), man_check_password(), openvpn_decrypt_v1(), tls_crypt_unwrap(), tls_crypt_v2_unwrap_client_key(), verify_auth_token(), and verify_cert().
| void print_digest | ( | EVP_MD * | digest, |
| void * | unused | ||
| ) |
Definition at line 425 of file crypto_openssl.c.
References EVP_MD_get0_name, and md_kt_name().
Referenced by show_available_digests().
| int rand_bytes | ( | uint8_t * | output, |
| int | len | ||
| ) |
Wrapper for secure random number generator.
Retrieves len bytes of random data, and places it in output.
| output | Output buffer |
| len | Length of the output buffer, in bytes |
1 on success, 0 on failure Definition at line 583 of file crypto_openssl.c.
References crypto_msg, D_CRYPT_ERRORS, and unlikely.
Referenced by do_data_channel_round_trip(), encrypt_one_packet(), establish_http_proxy_passthru(), generate_auth_token(), generate_ephemeral_key(), generate_key_random(), init_crypto_options(), prng_bytes(), random_bytes_to_buf(), session_id_hmac_init(), test_crypto(), test_tls_crypt_v2_setup(), tls_crypt_v2_wrap_unwrap_dst_too_small(), tls_crypt_v2_wrap_unwrap_max_metadata(), tls_crypt_v2_write_client_key_file(), and write_pem_key_file().
| void show_available_ciphers | ( | void | ) |
Definition at line 364 of file crypto_openssl.c.
References cipher_kt_insecure(), cipher_name_cmp(), EVP_CIPHER_get0_name, i, collect_ciphers::list, collect_ciphers::num, and print_cipher().
Referenced by print_openssl_info().
| void show_available_digests | ( | void | ) |
Definition at line 432 of file crypto_openssl.c.
References print_digest().
Referenced by print_openssl_info().
| void show_available_engines | ( | void | ) |
Definition at line 473 of file crypto_openssl.c.
Referenced by print_openssl_info().
| bool ssl_tls1_PRF | ( | const uint8_t * | seed, |
| size_t | seed_len, | ||
| const uint8_t * | secret, | ||
| size_t | secret_len, | ||
| uint8_t * | output, | ||
| size_t | output_len | ||
| ) |
Calculates the TLS 1.0-1.1 PRF function.
For the exact specification of the function definition see the TLS RFCs like RFC 4346.
| seed | seed to use |
| seed_len | length of the seed |
| secret | secret to use |
| secret_len | length of the secret |
| output | output destination |
| output_len | length of output/number of bytes to generate |
Definition at line 1424 of file crypto_openssl.c.
Referenced by check_tls_prf_working(), crypto_test_tls_prf(), and openvpn_PRF().
| const cipher_name_pair cipher_name_translation_table[] |
Cipher name translation table.
Definition at line 310 of file crypto_openssl.c.
Referenced by get_cipher_name_pair().
| const size_t cipher_name_translation_table_count |
Definition at line 316 of file crypto_openssl.c.
Referenced by get_cipher_name_pair().
| const cipher_name_pair digest_name_translation_table[] |
Definition at line 1056 of file crypto_openssl.c.
Referenced by md_kt_name().
| const size_t digest_name_translation_table_count |
Definition at line 1069 of file crypto_openssl.c.
Referenced by md_kt_name().