summaryrefslogtreecommitdiff
path: root/src/openvpn/crypto_mbedtls.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvpn/crypto_mbedtls.h')
-rw-r--r--src/openvpn/crypto_mbedtls.h59
1 files changed, 31 insertions, 28 deletions
diff --git a/src/openvpn/crypto_mbedtls.h b/src/openvpn/crypto_mbedtls.h
index 574a63f..d9b1446 100644
--- a/src/openvpn/crypto_mbedtls.h
+++ b/src/openvpn/crypto_mbedtls.h
@@ -5,8 +5,8 @@
* packet encryption, packet authentication, and
* packet compression.
*
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
- * Copyright (C) 2010 Fox Crypto B.V. <openvpn@fox-it.com>
+ * Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net>
+ * Copyright (C) 2010-2017 Fox Crypto B.V. <openvpn@fox-it.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
@@ -50,29 +50,29 @@ typedef mbedtls_md_context_t md_ctx_t;
typedef mbedtls_md_context_t hmac_ctx_t;
/** Maximum length of an IV */
-#define OPENVPN_MAX_IV_LENGTH MBEDTLS_MAX_IV_LENGTH
+#define OPENVPN_MAX_IV_LENGTH MBEDTLS_MAX_IV_LENGTH
/** Cipher is in CBC mode */
-#define OPENVPN_MODE_CBC MBEDTLS_MODE_CBC
+#define OPENVPN_MODE_CBC MBEDTLS_MODE_CBC
/** Cipher is in OFB mode */
-#define OPENVPN_MODE_OFB MBEDTLS_MODE_OFB
+#define OPENVPN_MODE_OFB MBEDTLS_MODE_OFB
/** Cipher is in CFB mode */
-#define OPENVPN_MODE_CFB MBEDTLS_MODE_CFB
+#define OPENVPN_MODE_CFB MBEDTLS_MODE_CFB
/** Cipher is in GCM mode */
-#define OPENVPN_MODE_GCM MBEDTLS_MODE_GCM
+#define OPENVPN_MODE_GCM MBEDTLS_MODE_GCM
/** Cipher should encrypt */
-#define OPENVPN_OP_ENCRYPT MBEDTLS_ENCRYPT
+#define OPENVPN_OP_ENCRYPT MBEDTLS_ENCRYPT
/** Cipher should decrypt */
-#define OPENVPN_OP_DECRYPT MBEDTLS_DECRYPT
+#define OPENVPN_OP_DECRYPT MBEDTLS_DECRYPT
-#define MD4_DIGEST_LENGTH 16
-#define MD5_DIGEST_LENGTH 16
-#define SHA_DIGEST_LENGTH 20
+#define MD4_DIGEST_LENGTH 16
+#define MD5_DIGEST_LENGTH 16
+#define SHA_DIGEST_LENGTH 20
#define DES_KEY_LENGTH 8
/**
@@ -92,14 +92,15 @@ mbedtls_ctr_drbg_context *rand_ctx_get();
* Enable prediction resistance on the random number generator.
*/
void rand_ctx_enable_prediction_resistance();
+
#endif
/**
* Log the supplied mbed TLS error, prefixed by supplied prefix.
*
- * @param flags Flags to indicate error type and priority.
- * @param errval mbed TLS error code to convert to error message.
- * @param prefix Prefix to mbed TLS error message.
+ * @param flags Flags to indicate error type and priority.
+ * @param errval mbed TLS error code to convert to error message.
+ * @param prefix Prefix to mbed TLS error message.
*
* @returns true if no errors are detected, false otherwise.
*/
@@ -108,23 +109,25 @@ bool mbed_log_err(unsigned int flags, int errval, const char *prefix);
/**
* Log the supplied mbed TLS error, prefixed by function name and line number.
*
- * @param flags Flags to indicate error type and priority.
- * @param errval mbed TLS error code to convert to error message.
- * @param func Function name where error was reported.
- * @param line Line number where error was reported.
+ * @param flags Flags to indicate error type and priority.
+ * @param errval mbed TLS error code to convert to error message.
+ * @param func Function name where error was reported.
+ * @param line Line number where error was reported.
*
* @returns true if no errors are detected, false otherwise.
*/
bool mbed_log_func_line(unsigned int flags, int errval, const char *func,
- int line);
+ int line);
/** Wraps mbed_log_func_line() to prevent function calls for non-errors */
-static inline bool mbed_log_func_line_lite(unsigned int flags, int errval,
- const char *func, int line) {
- if (errval) {
- return mbed_log_func_line (flags, errval, func, line);
- }
- return true;
+static inline bool
+mbed_log_func_line_lite(unsigned int flags, int errval,
+ const char *func, int line) {
+ if (errval)
+ {
+ return mbed_log_func_line(flags, errval, func, line);
+ }
+ return true;
}
/**
@@ -135,12 +138,12 @@ static inline bool mbed_log_func_line_lite(unsigned int flags, int errval,
* or
* ASSERT (mbed_ok (mbedtls_ssl_func()));
*
- * @param errval mbed TLS error code to convert to error message.
+ * @param errval mbed TLS error code to convert to error message.
*
* @returns true if no errors are detected, false otherwise.
*/
#define mbed_ok(errval) \
- mbed_log_func_line_lite(D_CRYPT_ERRORS, errval, __func__, __LINE__)
+ mbed_log_func_line_lite(D_CRYPT_ERRORS, errval, __func__, __LINE__)
#endif /* CRYPTO_MBEDTLS_H_ */