summaryrefslogtreecommitdiff
path: root/app/openvpn/src/openvpn/crypto_openssl.h
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-02-14 11:48:37 +0100
committerParménides GV <parmegv@sdf.org>2015-02-14 11:48:37 +0100
commitc198dbd9dd583d980ae7e70118f67d09bed8de55 (patch)
treec2863f28134af00f26299c97bb6a81ed0aa4ed96 /app/openvpn/src/openvpn/crypto_openssl.h
parent9d346be65e6808710b9e814d2899e5888984b4ab (diff)
parent4028c100a59c45913cb569c4967faaddc090b1f9 (diff)
Merge branch 'develop'0.9.2
Diffstat (limited to 'app/openvpn/src/openvpn/crypto_openssl.h')
-rw-r--r--app/openvpn/src/openvpn/crypto_openssl.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/openvpn/src/openvpn/crypto_openssl.h b/app/openvpn/src/openvpn/crypto_openssl.h
index f883c2a5..42c7e9a9 100644
--- a/app/openvpn/src/openvpn/crypto_openssl.h
+++ b/app/openvpn/src/openvpn/crypto_openssl.h
@@ -70,4 +70,29 @@ typedef HMAC_CTX hmac_ctx_t;
#define DES_KEY_LENGTH 8
#define MD4_DIGEST_LENGTH 16
+/**
+ * Retrieve any occurred OpenSSL errors and print those errors.
+ *
+ * Note that this function uses the not thread-safe OpenSSL error API.
+ *
+ * @param flags Flags to indicate error type and priority.
+ */
+void crypto_print_openssl_errors(const unsigned int flags);
+
+/**
+ * Retrieve any OpenSSL errors, then print the supplied error message.
+ *
+ * This is just a convenience wrapper for often occurring situations.
+ *
+ * @param flags Flags to indicate error type and priority.
+ * @param format Format string to print.
+ * @param format args (optional) arguments for the format string.
+ */
+# define crypto_msg(flags, ...) \
+do { \
+ crypto_print_openssl_errors(nonfatal(flags)); \
+ msg((flags), __VA_ARGS__); \
+} while (false)
+
+
#endif /* CRYPTO_OPENSSL_H_ */