diff options
author | Miroslav Lichvar <mlichvar@redhat.com> | 2019-11-06 11:37:10 +0100 |
---|---|---|
committer | Miroslav Lichvar <mlichvar@redhat.com> | 2019-11-06 12:11:31 +0100 |
commit | ba6b9689b8952401a54ff9b8ea54ac1cd31c95d0 (patch) | |
tree | 1a05c7b8df3d854de6a46693fa0dad9df008de72 /tests/prf.c | |
parent | 416b1922ffb912b1f11a20f7a533b7619291eaa0 (diff) | |
download | gnutls-ba6b9689b8952401a54ff9b8ea54ac1cd31c95d0.tar.gz |
prf: don't crash when called before handshake completion
If a gnutls_prf*() function is called before the handshake is completed,
return GNUTLS_E_INVALID_REQUEST instead of crashing.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Diffstat (limited to 'tests/prf.c')
-rw-r--r-- | tests/prf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/prf.c b/tests/prf.c index ff839fe73c..c4c7a0dac2 100644 --- a/tests/prf.c +++ b/tests/prf.c @@ -283,6 +283,14 @@ static void client(int fd) gnutls_handshake_set_random(session, &hrnd); gnutls_transport_set_int(session, fd); + if (gnutls_prf(session, 4, "aaaa", 0, 0, NULL, sizeof(err), (char *)&err) != + GNUTLS_E_INVALID_REQUEST || + gnutls_prf_rfc5705(session, 4, "aaaa", 0, NULL, sizeof(err), (char *)&err) != + GNUTLS_E_INVALID_REQUEST) { + fprintf(stderr, "unexpected prf error code\n"); + exit(1); + } + /* Perform the TLS handshake */ do { |