summaryrefslogtreecommitdiff
path: root/src/openvpn/crypto_openssl.h
diff options
context:
space:
mode:
authorAlberto Gonzalez Iniesta <agi@inittab.org>2016-05-10 17:40:25 +0200
committerAlberto Gonzalez Iniesta <agi@inittab.org>2016-05-10 17:40:25 +0200
commitfd1989a44e8b5f8a1204268c0b831e1215d345c5 (patch)
treeb7953a8e1b3bd31ab9b25ed4a87b66f43cba2007 /src/openvpn/crypto_openssl.h
parent5ed34d2384cae48c45501f30c9e69512fe54b3ec (diff)
parentffca24bed7a03d95585ad02278667abe75d8b272 (diff)
Merge tag 'upstream/2.3.11'
Upstream version 2.3.11
Diffstat (limited to 'src/openvpn/crypto_openssl.h')
-rw-r--r--src/openvpn/crypto_openssl.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/openvpn/crypto_openssl.h b/src/openvpn/crypto_openssl.h
index f883c2a..42c7e9a 100644
--- a/src/openvpn/crypto_openssl.h
+++ b/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_ */