summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-07-22 11:08:32 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-07-22 11:08:34 +0200
commit21c9b0fe979e1db946e04381042579c61e264511 (patch)
tree96c7abcd3ecd1949e853b255c7a5501974b4d24a
parent9f1e6d2c686372adb21097a3f22a32e82fecbdb4 (diff)
downloadgnutls-21c9b0fe979e1db946e04381042579c61e264511.tar.gz
introduced: GNUTLS_E_UNAVAILABLE_DURING_HANDSHAKE
This error code is returned when the session resumption parameters are requested during a handshake. That is, to increase the clarity when requesting these parameters while false start is active and the handshake is not complete even if gnutls_handshake() has returned. Relates #114
-rw-r--r--lib/errors.c2
-rw-r--r--lib/includes/gnutls/gnutls.h.in1
-rw-r--r--lib/session_pack.c2
-rw-r--r--tests/resume-with-false-start.c2
4 files changed, 5 insertions, 2 deletions
diff --git a/lib/errors.c b/lib/errors.c
index afa25ac0b8..021c1fcd40 100644
--- a/lib/errors.c
+++ b/lib/errors.c
@@ -386,6 +386,8 @@ static const gnutls_error_entry error_entries[] = {
GNUTLS_E_UNRECOGNIZED_NAME),
ERROR_ENTRY(N_("There was an issue converting to or from UTF8."),
GNUTLS_E_IDNA_ERROR),
+ ERROR_ENTRY(N_("Cannot obtain resumption parameters while handshake is incomplete."),
+ GNUTLS_E_UNAVAILABLE_DURING_HANDSHAKE),
{NULL, NULL, 0}
};
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index a2932e740c..5778d4a2ec 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -2760,6 +2760,7 @@ int gnutls_fips140_mode_enabled(void);
#define GNUTLS_E_NEED_FALLBACK -405
#define GNUTLS_E_SESSION_USER_ID_CHANGED -406
#define GNUTLS_E_HANDSHAKE_DURING_FALSE_START -407
+#define GNUTLS_E_UNAVAILABLE_DURING_HANDSHAKE -408
#define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250
diff --git a/lib/session_pack.c b/lib/session_pack.c
index 96b8efe0c1..5833eb0eaf 100644
--- a/lib/session_pack.c
+++ b/lib/session_pack.c
@@ -728,7 +728,7 @@ pack_security_parameters(gnutls_session_t session, gnutls_buffer_st * ps)
if (session->security_parameters.epoch_read
!= session->security_parameters.epoch_write) {
gnutls_assert();
- return GNUTLS_E_INVALID_REQUEST;
+ return GNUTLS_E_UNAVAILABLE_DURING_HANDSHAKE;
}
ret = _gnutls_epoch_get(session, EPOCH_READ_CURRENT, &params);
diff --git a/tests/resume-with-false-start.c b/tests/resume-with-false-start.c
index 305fbfdd33..6c5eecd8d6 100644
--- a/tests/resume-with-false-start.c
+++ b/tests/resume-with-false-start.c
@@ -121,7 +121,7 @@ void doit(void)
/* try obtaining the resumption data. This should fail because
* the handshake is not yet complete (due to false start) */
ret = gnutls_session_get_data2(client, &data);
- if (ret != GNUTLS_E_INVALID_REQUEST) {
+ if (ret != GNUTLS_E_UNAVAILABLE_DURING_HANDSHAKE) {
fail("unexpected error: %s\n", gnutls_strerror(ret));
}