From: Nikos Mavrogiannopoulos Date: Thu, 19 Sep 2019 19:26:25 +0000 (+0200) Subject: gnutls_ocsp_status_request_is_checked: added tests in client side X-Git-Tag: gnutls_3_6_10~6^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ecd4a5b2b2cbd474b85cfbfd5ec8f4b18bf8da52;p=thirdparty%2Fgnutls.git gnutls_ocsp_status_request_is_checked: added tests in client side This ensures that this function has functional tests. Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/tests/mini-x509-2.c b/tests/mini-x509-2.c index e20d45b7ff..e336af8367 100644 --- a/tests/mini-x509-2.c +++ b/tests/mini-x509-2.c @@ -415,6 +415,24 @@ void start(const char *prio) fprintf(stderr, "could not verify certificate: %.4x\n", status); exit(1); } + + status = gnutls_ocsp_status_request_is_checked(client, 0); + if (status != 0) { + fprintf(stderr, "gnutls_ocsp_status_request_is_checked: unexpected value (%u)\n", status); + exit(1); + } + + status = gnutls_ocsp_status_request_is_checked(client, GNUTLS_OCSP_SR_IS_AVAIL); + if (status != 0) { + fprintf(stderr, "gnutls_ocsp_status_request_is_checked: unexpected value (%u)\n", status); + exit(1); + } + + status = gnutls_ocsp_status_request_is_checked(server, 0); + if (status != 0) { + fprintf(stderr, "gnutls_ocsp_status_request_is_checked: unexpected value (%u)\n", status); + exit(1); + } } gnutls_bye(client, GNUTLS_SHUT_RDWR); diff --git a/tests/set_x509_key_file_ocsp.c b/tests/set_x509_key_file_ocsp.c index d668550932..9cb4001393 100644 --- a/tests/set_x509_key_file_ocsp.c +++ b/tests/set_x509_key_file_ocsp.c @@ -274,6 +274,17 @@ static void check_response(gnutls_session_t session, void *priv) if (resp.size != exp_resp->size || memcmp(resp.data, exp_resp->data, resp.size) != 0) { fail("did not receive the expected response\n"); } + + /* we provide a response, but an invalid one */ + ret = gnutls_ocsp_status_request_is_checked(session, 0); + if (ret != 0) { + fail("did not receive the expected value (%d)\n", ret); + } + + ret = gnutls_ocsp_status_request_is_checked(session, GNUTLS_OCSP_SR_IS_AVAIL); + if (ret == 0) { + fail("did not receive the expected value (%d)\n", ret); + } } void doit(void) diff --git a/tests/set_x509_ocsp_multi_pem.c b/tests/set_x509_ocsp_multi_pem.c index c5c22dd618..834ee468e0 100644 --- a/tests/set_x509_ocsp_multi_pem.c +++ b/tests/set_x509_ocsp_multi_pem.c @@ -79,6 +79,16 @@ static void check_response(gnutls_session_t session, void *priv) fail("did not receive the expected intermediate response\n"); } } + + ret = gnutls_ocsp_status_request_is_checked(session, 0); + if (ret == 0) { + fail("did not receive the expected value (%d)\n", ret); + } + + ret = gnutls_ocsp_status_request_is_checked(session, GNUTLS_OCSP_SR_IS_AVAIL); + if (ret == 0) { + fail("did not receive the expected value (%d)\n", ret); + } } static void tls_log_func(int level, const char *str)