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 1096226410..2175d6f2db 100644
--- a/lib/handshake.h
+++ b/lib/handshake.h
@@ -26,6 +26,7 @@
#include "errors.h"
#include "record.h"
+#include <assert.h>
#define IMED_RET( str, ret, allow_alert) do { \
if (ret < 0) { \
@@ -107,6 +108,20 @@ inline static int handshake_remaining_time(gnutls_session_t session)
return 0;
}
+/* Returns non-zero if the present credentials are sufficient for TLS1.3 negotiation.
+ * This is to be used in client side only. On server side, it is allowed to start
+ * without credentials.
+ */
+inline static unsigned have_creds_for_tls13(gnutls_session_t session)
+{
+ assert(session->security_parameters.entity == GNUTLS_CLIENT);
+ if (_gnutls_get_cred(session, GNUTLS_CRD_CERTIFICATE) != NULL ||
+ _gnutls_get_cred(session, GNUTLS_CRD_PSK) != NULL)
+ return 1;
+
+ return 0;
+}
+
int _gnutls_handshake_get_session_hash(gnutls_session_t session, gnutls_datum_t *shash);
int _gnutls_check_id_for_change(gnutls_session_t session);