Macros | Typedefs | Functions
crypto_openssl.h File Reference
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/md5.h>
#include <openssl/sha.h>
Include dependency graph for crypto_openssl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


 Maximum length of an IV. More...
 Cipher is in CBC mode. More...
 Cipher is in OFB mode. More...
 Cipher is in CFB mode. More...
 Cipher is in GCM mode. More...
 Cipher should encrypt. More...
 Cipher should decrypt. More...
#define DES_KEY_LENGTH   8
#define MD4_DIGEST_LENGTH   16
#define crypto_msg(flags, ...)
 Retrieve any OpenSSL errors, then print the supplied error message. More...


typedef EVP_CIPHER cipher_kt_t
 Generic cipher key type context. More...
typedef EVP_MD md_kt_t
 Generic message digest key type context. More...
typedef EVP_CIPHER_CTX cipher_ctx_t
 Generic cipher context. More...
typedef EVP_MD_CTX md_ctx_t
 Generic message digest context. More...
typedef HMAC_CTX hmac_ctx_t
 Generic HMAC context. More...


void crypto_print_openssl_errors (const unsigned int flags)
 Retrieve any occurred OpenSSL errors and print those errors. More...
static bool cipher_kt_var_key_size (const cipher_kt_t *cipher)
EVP_PKEY * engine_load_key (const char *file, SSL_CTX *ctx)
 Load a key file from an engine. More...

Macro Definition Documentation

◆ crypto_msg

#define crypto_msg (   flags,
do { \
crypto_print_openssl_errors(nonfatal(flags)); \
msg((flags), __VA_ARGS__); \
} while (false)
list flags
static unsigned int nonfatal(const unsigned int err)
Convert fatal errors to nonfatal, don&#39;t touch other errors.
Definition: error.h:375

Retrieve any OpenSSL errors, then print the supplied error message.

This is just a convenience wrapper for often occurring situations.

flagsFlags to indicate error type and priority.
formatFormat string to print.
formatargs (optional) arguments for the format string.

Definition at line 94 of file crypto_openssl.h.

Referenced by backend_tls_ctx_reload_crl(), bio_read(), bio_write(), cipher_ctx_init(), cipher_ctx_update(), cipher_ctx_update_ad(), cipher_kt_get(), crypto_pem_decode(), engine_load_key(), get_highest_preference_tls_cipher(), hmac_ctx_init(), hmac_ctx_reset(), key_des_check(), key_state_ssl_init(), md_ctx_init(), md_kt_get(), rand_bytes(), show_available_curves(), show_available_tls_ciphers_list(), tls_ctx_add_extra_certs(), tls_ctx_client_new(), tls_ctx_load_ca(), tls_ctx_load_cert_file(), tls_ctx_load_cryptoapi(), tls_ctx_load_dh_params(), tls_ctx_load_ecdh_params(), tls_ctx_load_extra_certs(), tls_ctx_load_pkcs12(), tls_ctx_load_priv_file(), tls_ctx_restrict_ciphers(), tls_ctx_restrict_ciphers_tls13(), tls_ctx_server_new(), tls_ctx_set_tls_groups(), tls_ctx_use_management_external_key(), and tls_verify_crl_missing().


#define DES_KEY_LENGTH   8

Definition at line 73 of file crypto_openssl.h.


#define MD4_DIGEST_LENGTH   16

Definition at line 74 of file crypto_openssl.h.



Maximum length of an IV.

Definition at line 53 of file crypto_openssl.h.



Cipher is in CBC mode.

Definition at line 56 of file crypto_openssl.h.



Cipher is in CFB mode.

Definition at line 62 of file crypto_openssl.h.



Cipher is in GCM mode.

Definition at line 65 of file crypto_openssl.h.



Cipher is in OFB mode.

Definition at line 59 of file crypto_openssl.h.



Cipher should decrypt.

Definition at line 71 of file crypto_openssl.h.



Cipher should encrypt.

Definition at line 68 of file crypto_openssl.h.

Typedef Documentation

◆ cipher_ctx_t

typedef EVP_CIPHER_CTX cipher_ctx_t

Generic cipher context.

Definition at line 44 of file crypto_openssl.h.

◆ cipher_kt_t

typedef EVP_CIPHER cipher_kt_t

Generic cipher key type context.

Definition at line 38 of file crypto_openssl.h.

◆ hmac_ctx_t

typedef HMAC_CTX hmac_ctx_t

Generic HMAC context.

Definition at line 50 of file crypto_openssl.h.

◆ md_ctx_t

typedef EVP_MD_CTX md_ctx_t

Generic message digest context.

Definition at line 47 of file crypto_openssl.h.

◆ md_kt_t

typedef EVP_MD md_kt_t

Generic message digest key type context.

Definition at line 41 of file crypto_openssl.h.

Function Documentation

◆ cipher_kt_var_key_size()

static bool cipher_kt_var_key_size ( const cipher_kt_t cipher)

Definition at line 101 of file crypto_openssl.h.

References engine_load_key().

◆ crypto_print_openssl_errors()

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.

flagsFlags to indicate error type and priority.

Definition at line 200 of file crypto_openssl.c.

References D_CRYPT_ERRORS, and msg.

Referenced by tls_ctx_load_cert_file().

◆ engine_load_key()

EVP_PKEY* engine_load_key ( const char *  file,
SSL_CTX *  ctx 

Load a key file from an engine.

fileThe engine file to load
uiThe UI method for the password prompt
dataThe data to pass to the UI method
The private key if successful or NULL if not

Definition at line 1085 of file crypto_openssl.c.

References crypto_msg, M_FATAL, M_INFO, and ssl_tls1_PRF().

Referenced by cipher_kt_var_key_size(), and tls_ctx_load_priv_file().