From 00a6d0743a38e179f5f9b5de4b73be9fcec0bb4c Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Tue, 30 Apr 2024 11:54:42 +0200 Subject: ssl_sess.c: deprecate SSL_SESSION_get_time/SSL_SESSION_set_time Adjust the manpages at the same time so that only the new functions are being presented. Fixes: #23648 Signed-off-by: Alexander Kanavin Reviewed-by: Matt Caswell Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/24307) --- test/clienthellotest.c | 2 +- test/sslapitest.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/clienthellotest.c b/test/clienthellotest.c index a86f1ab..935396a 100644 --- a/test/clienthellotest.c +++ b/test/clienthellotest.c @@ -164,7 +164,7 @@ static int test_client_hello(int currtest) * We reset the creation time so that we don't discard the session as * too old. */ - if (!TEST_true(SSL_SESSION_set_time(sess, (long)time(NULL))) + if (!TEST_true(SSL_SESSION_set_time_ex(sess, time(NULL))) || !TEST_true(SSL_set_session(con, sess))) goto end; } diff --git a/test/sslapitest.c b/test/sslapitest.c index 8a88558..e013838 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -2330,9 +2330,9 @@ static int execute_test_session(int maxprot, int use_int_cache, */ /* Make sess1 expire before sess2 */ - if (!TEST_long_gt(SSL_SESSION_set_time(sess1, 1000), 0) + if (!TEST_time_t_gt(SSL_SESSION_set_time_ex(sess1, 1000), 0) || !TEST_long_gt(SSL_SESSION_set_timeout(sess1, 1000), 0) - || !TEST_long_gt(SSL_SESSION_set_time(sess2, 2000), 0) + || !TEST_time_t_gt(SSL_SESSION_set_time_ex(sess2, 2000), 0) || !TEST_long_gt(SSL_SESSION_set_timeout(sess2, 2000), 0)) goto end; @@ -3991,7 +3991,7 @@ static int early_data_skip_helper(int testtype, int cipher, int idx) * time. It could be any value as long as it is not within tolerance. * This should mean the ticket is rejected. */ - if (!TEST_true(SSL_SESSION_set_time(sess, (long)(time(NULL) - 20)))) + if (!TEST_true(SSL_SESSION_set_time_ex(sess, time(NULL) - 20))) goto end; } @@ -9325,7 +9325,7 @@ static int test_session_timeout(int test) SSL_SESSION *late = NULL; SSL_CTX *ctx; int testresult = 0; - long now = (long)time(NULL); + time_t now = time(NULL); #define TIMEOUT 10 if (!TEST_ptr(ctx = SSL_CTX_new_ex(libctx, NULL, TLS_method())) @@ -9353,9 +9353,9 @@ static int test_session_timeout(int test) || !TEST_ptr(late->prev)) goto end; - if (!TEST_int_ne(SSL_SESSION_set_time(early, now - 10), 0) - || !TEST_int_ne(SSL_SESSION_set_time(middle, now), 0) - || !TEST_int_ne(SSL_SESSION_set_time(late, now + 10), 0)) + if (!TEST_time_t_ne(SSL_SESSION_set_time_ex(early, now - 10), 0) + || !TEST_time_t_ne(SSL_SESSION_set_time_ex(middle, now), 0) + || !TEST_time_t_ne(SSL_SESSION_set_time_ex(late, now + 10), 0)) goto end; if (!TEST_int_ne(SSL_SESSION_set_timeout(early, TIMEOUT), 0) @@ -9421,9 +9421,9 @@ static int test_session_timeout(int test) /* make sure |now| is NOT equal to the current time */ now -= 10; - if (!TEST_int_ne(SSL_SESSION_set_time(early, now), 0) + if (!TEST_time_t_ne(SSL_SESSION_set_time_ex(early, now), 0) || !TEST_int_eq(SSL_CTX_add_session(ctx, early), 1) - || !TEST_long_ne(SSL_SESSION_get_time(early), now)) + || !TEST_time_t_ne(SSL_SESSION_get_time_ex(early), now)) goto end; testresult = 1; -- cgit v1.1