summaryrefslogtreecommitdiff
path: root/lib/handshake.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handshake.h')
-rw-r--r--lib/handshake.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/handshake.h b/lib/handshake.h
index 248d6a1896..e32de894f2 100644
--- a/lib/handshake.h
+++ b/lib/handshake.h
@@ -28,6 +28,11 @@
#include "record.h"
#include <assert.h>
+/* The following two macros are used in the handshake state machines; the first
+ * (IMED_RET) accounts for non-fatal errors and re-entry to current state, while
+ * the latter invalidates the handshake on any error (to be used by functions
+ * that are not expected to return non-fatal errors).
+ */
#define IMED_RET( str, ret, allow_alert) do { \
if (ret < 0) { \
/* EAGAIN and INTERRUPTED are always non-fatal */ \
@@ -54,6 +59,16 @@
return ret; \
} } while (0)
+#define IMED_RET_FATAL( str, ret, allow_alert) do { \
+ if (ret < 0) { \
+ gnutls_assert(); \
+ if (gnutls_error_is_fatal(ret) == 0) \
+ ret = gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); \
+ session_invalidate(session); \
+ _gnutls_handshake_hash_buffers_clear(session); \
+ return ret; \
+ } } while (0)
+
int _gnutls_send_handshake(gnutls_session_t session, mbuffer_st * bufel,
gnutls_handshake_description_t type);
int _gnutls_recv_hello_request(gnutls_session_t session, void *data,