summaryrefslogtreecommitdiff
path: root/lib/tls13
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-06-01 09:54:41 +0200
committerDaiki Ueno <dueno@redhat.com>2018-06-01 14:19:25 +0200
commitfd8c1ec8fe155861dffa28811127f101b6697b4b (patch)
tree32759f32b22aa4441541751dfe2959afe68b43d9 /lib/tls13
parent6b45592c28f5305047c5046afcd11e36aabe7e3a (diff)
downloadgnutls-fd8c1ec8fe155861dffa28811127f101b6697b4b.tar.gz
ext/pre_shared_key: make PSK identity parsing robustertmp-session-ticket-key-name
Previously, to determine whether a PSK identity is a ticket or a PSK username, it relied on PskIdentity.obfuscated_ticket_age, which "SHOULD" be 0 if the identity is a PSK username. This patch instead checks the key name of the ticket first and then check the constraints of the PSK username. That way, it can distinguish tickets and PSK usernames in a more realible manner. Signed-off-by: Daiki Ueno <dueno@redhat.com>
Diffstat (limited to 'lib/tls13')
-rw-r--r--lib/tls13/session_ticket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/tls13/session_ticket.c b/lib/tls13/session_ticket.c
index 25e067fc00..d98475094a 100644
--- a/lib/tls13/session_ticket.c
+++ b/lib/tls13/session_ticket.c
@@ -112,7 +112,7 @@ unpack_ticket(gnutls_session_t session, gnutls_datum_t *packed, tls13_ticket_t *
/* Check if the MAC ID we got is valid */
prf = _gnutls_mac_to_entry(kdf);
if (prf == NULL)
- return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR);
+ return gnutls_assert_val(GNUTLS_E_ILLEGAL_PARAMETER);
/* Read the ticket age add and the ticket lifetime */
DECR_LEN(len, 4);
@@ -133,7 +133,7 @@ unpack_ticket(gnutls_session_t session, gnutls_datum_t *packed, tls13_ticket_t *
/* Check if the size of resumption_master_secret matches the PRF */
if (resumption_master_secret_size != prf->output_size)
- return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR);
+ return gnutls_assert_val(GNUTLS_E_ILLEGAL_PARAMETER);
DECR_LEN(len, resumption_master_secret_size);
memcpy(resumption_master_secret, p, resumption_master_secret_size);