From b4aea75a3b0d54b4826921488bc8b154e158e715 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Tue, 19 Nov 2024 13:14:20 -0500 Subject: [PATCH 1/5] Add defines for OQS version components Signed-off-by: Douglas Stebila --- CMakeLists.txt | 4 ++++ src/oqsconfig.h.cmake | 4 ++++ tests/system_info.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bddc9553..6c386d24b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,10 @@ set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_C_VISIBILITY_PRESET hidden) set(OQS_VERSION_TEXT "0.11.1-dev") +set(OQS_VERSION_MAJOR 0) +set(OQS_VERSION_MINOR 11) +set(OQS_VERSION_PATCH 1) +set(OQS_VERSION_PRE_RELEASE "-dev") set(OQS_COMPILE_BUILD_TARGET "${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_HOST_SYSTEM}") set(OQS_MINIMAL_GCC_VERSION "7.1.0") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/src/oqsconfig.h.cmake b/src/oqsconfig.h.cmake index dae1babad..00013d4cf 100644 --- a/src/oqsconfig.h.cmake +++ b/src/oqsconfig.h.cmake @@ -1,6 +1,10 @@ // SPDX-License-Identifier: MIT #cmakedefine OQS_VERSION_TEXT "@OQS_VERSION_TEXT@" +#define OQS_VERSION_MAJOR @OQS_VERSION_MAJOR@ +#define OQS_VERSION_MINOR @OQS_VERSION_MINOR@ +#define OQS_VERSION_PATCH @OQS_VERSION_PATCH@ +#define OQS_VERSION_PRE_RELEASE "@OQS_VERSION_PRE_RELEASE@" #cmakedefine OQS_COMPILE_BUILD_TARGET "@OQS_COMPILE_BUILD_TARGET@" #cmakedefine OQS_DIST_BUILD 1 #cmakedefine OQS_DIST_X86_64_BUILD 1 diff --git a/tests/system_info.c b/tests/system_info.c index 248d377cd..b16815dc8 100644 --- a/tests/system_info.c +++ b/tests/system_info.c @@ -219,7 +219,7 @@ static void print_oqs_configuration(void) { * USE_SANITIZER: -fsanitize= option present in compile options * OQS_ENABLE_TEST_CONSTANT_TIME: only shown below */ - printf("OQS version: %s\n", OQS_VERSION_TEXT); + printf("OQS version: %s (major: %d, minor: %d, patch: %d, pre-release: %s)\n", OQS_VERSION_TEXT, OQS_VERSION_MAJOR, OQS_VERSION_MINOR, OQS_VERSION_PATCH, OQS_VERSION_PRE_RELEASE); #if defined(OQS_COMPILE_GIT_COMMIT) printf("Git commit: %s\n", OQS_COMPILE_GIT_COMMIT); #endif From 6e984728462f9f034cb7603899cd65feb7309129 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Fri, 22 Nov 2024 15:52:22 -0500 Subject: [PATCH 2/5] Set OQS_VERSION_TEXT based on new OQS_VERSION_* macros Co-authored-by: Spencer Wilson Signed-off-by: Douglas Stebila Signed-off-by: Douglas Stebila --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c386d24b..3d2a454e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,11 +40,11 @@ set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_C_VISIBILITY_PRESET hidden) -set(OQS_VERSION_TEXT "0.11.1-dev") set(OQS_VERSION_MAJOR 0) set(OQS_VERSION_MINOR 11) set(OQS_VERSION_PATCH 1) set(OQS_VERSION_PRE_RELEASE "-dev") +set(OQS_VERSION_TEXT "${OQS_VERSION_MAJOR}.${OQS_VERSION_MINOR}.${OQS_VERSION_PATCH}${OQS_VERSION_PRE_RELEASE}") set(OQS_COMPILE_BUILD_TARGET "${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_HOST_SYSTEM}") set(OQS_MINIMAL_GCC_VERSION "7.1.0") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) From 47df8b5edd4acef4635dfc65506298f6f1077967 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Fri, 22 Nov 2024 15:54:09 -0500 Subject: [PATCH 3/5] Make OQS_VERSION_PRE_RELEASE optionally defined Co-authored-by: Spencer Wilson Signed-off-by: Douglas Stebila Signed-off-by: Douglas Stebila --- src/oqsconfig.h.cmake | 2 +- tests/system_info.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/oqsconfig.h.cmake b/src/oqsconfig.h.cmake index 00013d4cf..198cc90ce 100644 --- a/src/oqsconfig.h.cmake +++ b/src/oqsconfig.h.cmake @@ -4,7 +4,7 @@ #define OQS_VERSION_MAJOR @OQS_VERSION_MAJOR@ #define OQS_VERSION_MINOR @OQS_VERSION_MINOR@ #define OQS_VERSION_PATCH @OQS_VERSION_PATCH@ -#define OQS_VERSION_PRE_RELEASE "@OQS_VERSION_PRE_RELEASE@" +#cmakedefine OQS_VERSION_PRE_RELEASE "@OQS_VERSION_PRE_RELEASE@" #cmakedefine OQS_COMPILE_BUILD_TARGET "@OQS_COMPILE_BUILD_TARGET@" #cmakedefine OQS_DIST_BUILD 1 #cmakedefine OQS_DIST_X86_64_BUILD 1 diff --git a/tests/system_info.c b/tests/system_info.c index b16815dc8..37689dc20 100644 --- a/tests/system_info.c +++ b/tests/system_info.c @@ -219,7 +219,11 @@ static void print_oqs_configuration(void) { * USE_SANITIZER: -fsanitize= option present in compile options * OQS_ENABLE_TEST_CONSTANT_TIME: only shown below */ +#if defined(OQS_VERSION_PRE_RELEASE) printf("OQS version: %s (major: %d, minor: %d, patch: %d, pre-release: %s)\n", OQS_VERSION_TEXT, OQS_VERSION_MAJOR, OQS_VERSION_MINOR, OQS_VERSION_PATCH, OQS_VERSION_PRE_RELEASE); +#else + printf("OQS version: %s (major: %d, minor: %d, patch: %d)\n", OQS_VERSION_TEXT, OQS_VERSION_MAJOR, OQS_VERSION_MINOR, OQS_VERSION_PATCH); +#endif #if defined(OQS_COMPILE_GIT_COMMIT) printf("Git commit: %s\n", OQS_COMPILE_GIT_COMMIT); #endif From 33065bc16d9d0df71702ffc29fd8dc77c766c87a Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Sun, 24 Nov 2024 11:07:17 -0500 Subject: [PATCH 4/5] Add documentation about OQS_VERSION macros Signed-off-by: Douglas Stebila --- src/oqsconfig.h.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/oqsconfig.h.cmake b/src/oqsconfig.h.cmake index 198cc90ce..91647a1c3 100644 --- a/src/oqsconfig.h.cmake +++ b/src/oqsconfig.h.cmake @@ -1,10 +1,21 @@ // SPDX-License-Identifier: MIT +/** + * Version of liboqs as a string. Equivalent to {MAJOR}.{MINOR}.{PATCH}{PRE_RELEASE} + */ #cmakedefine OQS_VERSION_TEXT "@OQS_VERSION_TEXT@" +/** + * Version levels of liboqs as integers. + */ #define OQS_VERSION_MAJOR @OQS_VERSION_MAJOR@ #define OQS_VERSION_MINOR @OQS_VERSION_MINOR@ #define OQS_VERSION_PATCH @OQS_VERSION_PATCH@ +/** + * OQS_VERSION_PRE_RELEASE is defined if this is a pre-release version of liboqs, otherwise it is empty. + * Examples: "-dev" or "-rc1". + */ #cmakedefine OQS_VERSION_PRE_RELEASE "@OQS_VERSION_PRE_RELEASE@" + #cmakedefine OQS_COMPILE_BUILD_TARGET "@OQS_COMPILE_BUILD_TARGET@" #cmakedefine OQS_DIST_BUILD 1 #cmakedefine OQS_DIST_X86_64_BUILD 1 From d7acb91f895591dd968f87db672d2e0b656bc466 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Mon, 25 Nov 2024 14:03:06 -0500 Subject: [PATCH 5/5] Clarify wording about definition of OQS_VERSION_PRE_RELEASE Signed-off-by: Douglas Stebila --- src/oqsconfig.h.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oqsconfig.h.cmake b/src/oqsconfig.h.cmake index 91647a1c3..7975a5c4a 100644 --- a/src/oqsconfig.h.cmake +++ b/src/oqsconfig.h.cmake @@ -11,7 +11,7 @@ #define OQS_VERSION_MINOR @OQS_VERSION_MINOR@ #define OQS_VERSION_PATCH @OQS_VERSION_PATCH@ /** - * OQS_VERSION_PRE_RELEASE is defined if this is a pre-release version of liboqs, otherwise it is empty. + * OQS_VERSION_PRE_RELEASE is defined if this is a pre-release version of liboqs, otherwise it is undefined. * Examples: "-dev" or "-rc1". */ #cmakedefine OQS_VERSION_PRE_RELEASE "@OQS_VERSION_PRE_RELEASE@"