summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2019-09-19 21:26:25 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2019-09-20 22:13:51 +0200
commitecd4a5b2b2cbd474b85cfbfd5ec8f4b18bf8da52 (patch)
tree2455e55a80f908a2b8dc540a1851c6dd12a38e74
parentd5d9278d887ae84062583d588685070571820426 (diff)
downloadgnutls-ecd4a5b2b2cbd474b85cfbfd5ec8f4b18bf8da52.tar.gz
gnutls_ocsp_status_request_is_checked: added tests in client side
This ensures that this function has functional tests. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r--tests/mini-x509-2.c18
-rw-r--r--tests/set_x509_key_file_ocsp.c11
-rw-r--r--tests/set_x509_ocsp_multi_pem.c10
3 files changed, 39 insertions, 0 deletions
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)