diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2019-05-24 05:46:18 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2019-05-24 05:46:21 +0200 |
commit | ae32be70d76bf0379e99e0111fa979420599f2f5 (patch) | |
tree | cdbfa83a749902c9b30e07fcca477cc2de74e25f | |
parent | eac062f478a940471c16c750fe7f080f5a4128c6 (diff) | |
download | gnutls-ae32be70d76bf0379e99e0111fa979420599f2f5.tar.gz |
tests: prf-early fixes the global version
This allows having fixed data in the hello message involved.
That required exposing the variable holding the global gnutls
version number for testing.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r-- | lib/db.h | 2 | ||||
-rw-r--r-- | lib/global.c | 2 | ||||
-rw-r--r-- | lib/gnutls_int.h | 2 | ||||
-rw-r--r-- | lib/libgnutls.map | 2 | ||||
-rw-r--r-- | tests/tls13/prf-early.c | 3 |
5 files changed, 10 insertions, 1 deletions
@@ -30,6 +30,6 @@ int _gnutls_server_restore_session(gnutls_session_t session, int _gnutls_check_resumed_params(gnutls_session_t session); -#define PACKED_SESSION_MAGIC ((0xfadebadd)+(GNUTLS_VERSION_NUMBER)) +#define PACKED_SESSION_MAGIC ((0xfadebadd)+(_gnutls_global_version)) #endif /* GNUTLS_LIB_DB_H */ diff --git a/lib/global.c b/lib/global.c index 2ff371f873..334148342e 100644 --- a/lib/global.c +++ b/lib/global.c @@ -79,6 +79,8 @@ gnutls_log_func _gnutls_log_func = NULL; gnutls_audit_log_func _gnutls_audit_log_func = NULL; int _gnutls_log_level = 0; /* default log level */ +unsigned int _gnutls_global_version = GNUTLS_VERSION_NUMBER; + static int _gnutls_global_init(unsigned constructor); static void _gnutls_global_deinit(unsigned destructor); diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index da0a92ebcb..0e0942511d 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -1621,4 +1621,6 @@ get_certificate_type(gnutls_session_t session, #define CONSTCHECK_NOT_EQUAL(a, b) ((-((uint32_t)(a) ^ (uint32_t)(b))) >> 31) #define CONSTCHECK_EQUAL(a, b) (1U - CONSTCHECK_NOT_EQUAL(a, b)) +extern unsigned int _gnutls_global_version; + #endif /* GNUTLS_LIB_GNUTLS_INT_H */ diff --git a/lib/libgnutls.map b/lib/libgnutls.map index f200c841d7..836e75eb87 100644 --- a/lib/libgnutls.map +++ b/lib/libgnutls.map @@ -1347,6 +1347,8 @@ GNUTLS_PRIVATE_3_4 { _gnutls_x509_generalTime2gtime; # Internal symbols needed by tests/: + # by tests/tls13/prf-early.c + _gnutls_global_version; _gnutls_default_priority_string; _gnutls_supplemental_deinit; _gnutls_record_overhead; diff --git a/tests/tls13/prf-early.c b/tests/tls13/prf-early.c index 758f78efe7..414b1db5ea 100644 --- a/tests/tls13/prf-early.c +++ b/tests/tls13/prf-early.c @@ -54,6 +54,8 @@ static void terminate(void); #define MAX_BUF 5*1024 #define MSG "Hello TLS" +extern unsigned int _gnutls_global_version; + /* This program tests whether the gnutls_prf() works as * expected. */ @@ -421,6 +423,7 @@ void doit(void) int i; int ret; + _gnutls_global_version = 0x030607; signal(SIGPIPE, SIG_IGN); for (i = 0; i < SESSIONS; i++) { |