]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
tests: remove unnecessary session creation in tls13/anti_replay
authorDaiki Ueno <dueno@redhat.com>
Sat, 24 Nov 2018 15:00:48 +0000 (16:00 +0100)
committerDaiki Ueno <dueno@redhat.com>
Sat, 24 Nov 2018 16:02:44 +0000 (17:02 +0100)
This test only checks the behavior of _gnutls_anti_replay_check, thus
session is not needed at all.

Signed-off-by: Daiki Ueno <dueno@redhat.com>
tests/tls13/anti_replay.c

index 31ab517151fab658269ef2f546bd0e979926799a..d8636f0b43041e9758cfc8be9b563113e94bd57b 100644 (file)
@@ -84,7 +84,6 @@ void doit(void)
        gnutls_datum_t key = { (unsigned char *) "\xFF\xFF\xFF\xFF", 4 };
        struct timespec creation_time;
        struct storage_st storage;
-       gnutls_session_t session;
        int ret;
 
        virt_time_init();
@@ -96,13 +95,10 @@ void doit(void)
        gnutls_anti_replay_set_window(anti_replay, 10000);
        gnutls_anti_replay_set_add_function(anti_replay, storage_add);
        gnutls_anti_replay_set_ptr(anti_replay, &storage);
-       gnutls_init(&session, GNUTLS_SERVER);
-       gnutls_anti_replay_enable(session, anti_replay);
        mygettime(&creation_time);
        ret = _gnutls_anti_replay_check(anti_replay, 10000, &creation_time, &key);
        if (ret != GNUTLS_E_ILLEGAL_PARAMETER)
                fail("error is not returned, while server_ticket_age < client_ticket_age\n");
-       gnutls_deinit(session);
        gnutls_anti_replay_deinit(anti_replay);
        storage_clear(&storage);
 
@@ -112,14 +108,11 @@ void doit(void)
        gnutls_anti_replay_set_add_function(anti_replay, storage_add);
        gnutls_anti_replay_set_ptr(anti_replay, &storage);
        gnutls_anti_replay_set_window(anti_replay, 10000);
-       gnutls_init(&session, GNUTLS_SERVER);
-       gnutls_anti_replay_enable(session, anti_replay);
        mygettime(&creation_time);
        virt_sec_sleep(30);
        ret = _gnutls_anti_replay_check(anti_replay, 10000, &creation_time, &key);
        if (ret != GNUTLS_E_EARLY_DATA_REJECTED)
                fail("early data is NOT rejected, while freshness check fails\n");
-       gnutls_deinit(session);
        gnutls_anti_replay_deinit(anti_replay);
        storage_clear(&storage);
 
@@ -129,8 +122,6 @@ void doit(void)
        gnutls_anti_replay_set_add_function(anti_replay, storage_add);
        gnutls_anti_replay_set_ptr(anti_replay, &storage);
        gnutls_anti_replay_set_window(anti_replay, 10000);
-       gnutls_init(&session, GNUTLS_SERVER);
-       gnutls_anti_replay_enable(session, anti_replay);
        mygettime(&creation_time);
        virt_sec_sleep(15);
        ret = _gnutls_anti_replay_check(anti_replay, 10000, &creation_time, &key);
@@ -139,7 +130,6 @@ void doit(void)
        ret = _gnutls_anti_replay_check(anti_replay, 10000, &creation_time, &key);
        if (ret != GNUTLS_E_EARLY_DATA_REJECTED)
                fail("early data is NOT rejected for a duplicate key\n");
-       gnutls_deinit(session);
        gnutls_anti_replay_deinit(anti_replay);
        storage_clear(&storage);
 }