Go to the documentation of this file.
29 #ifndef CRYPTO_MBEDTLS_H_
30 #define CRYPTO_MBEDTLS_H_
32 #include <mbedtls/cipher.h>
33 #include <mbedtls/md.h>
34 #include <mbedtls/ctr_drbg.h>
52 #define OPENVPN_MAX_IV_LENGTH MBEDTLS_MAX_IV_LENGTH
55 #define OPENVPN_MODE_CBC MBEDTLS_MODE_CBC
58 #define OPENVPN_MODE_OFB MBEDTLS_MODE_OFB
61 #define OPENVPN_MODE_CFB MBEDTLS_MODE_CFB
64 #define OPENVPN_MODE_GCM MBEDTLS_MODE_GCM
69 #define OPENVPN_OP_ENCRYPT MBEDTLS_ENCRYPT
72 #define OPENVPN_OP_DECRYPT MBEDTLS_DECRYPT
74 #define MD4_DIGEST_LENGTH 16
75 #define MD5_DIGEST_LENGTH 16
76 #define SHA_DIGEST_LENGTH 20
77 #define SHA256_DIGEST_LENGTH 32
78 #define DES_KEY_LENGTH 8
92 #ifdef ENABLE_PREDICTION_RESISTANCE
96 void rand_ctx_enable_prediction_resistance(
void);
109 bool mbed_log_err(
unsigned int flags,
int errval,
const char *prefix);
127 const char *func,
int line)
148 #define mbed_ok(errval) \
149 mbed_log_func_line_lite(D_CRYPT_ERRORS, errval, __func__, __LINE__)
static bool mbed_log_func_line_lite(unsigned int flags, int errval, const char *func, int line)
Wraps mbed_log_func_line() to prevent function calls for non-errors.
mbedtls_md_context_t hmac_ctx_t
Generic HMAC context.
mbedtls_ctr_drbg_context * rand_ctx_get(void)
Returns a singleton instance of the mbed TLS random number generator.
mbedtls_md_context_t md_ctx_t
Generic message digest context.
mbedtls_cipher_context_t cipher_ctx_t
Generic cipher context.
bool mbed_log_func_line(unsigned int flags, int errval, const char *func, int line)
Log the supplied mbed TLS error, prefixed by function name and line number.
mbedtls_md_info_t md_kt_t
Generic message digest key type context.
bool mbed_log_err(unsigned int flags, int errval, const char *prefix)
Log the supplied mbed TLS error, prefixed by supplied prefix.
mbedtls_operation_t crypto_operation_t