Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRYPTOPP_VERSION has reached its limits #1239

Open
noloader opened this issue Oct 1, 2023 · 3 comments
Open

CRYPTOPP_VERSION has reached its limits #1239

noloader opened this issue Oct 1, 2023 · 3 comments

Comments

@noloader
Copy link
Collaborator

noloader commented Oct 1, 2023

Crypto++ 8.9.0 was released on October 1, 2023. As part of the release process, we bump version numbers for semantic versioning per https://www.cryptopp.com/wiki/Release_Versioning#Increment.

Crypto++ has a CRYPTOPP_VERSION macro, but it cannot handle '10' in the minor position. We cannot go from:

#define CRYPTOPP_VERSION 890

to version 8.10.

An additional constraint is, CRYPTOPP_VERSION has always used 10-based numbers. They are not hexadecimal based.

This report will track the problem.


$ grep CRYPTOPP_VERSION *.h *.cpp
config_ver.h:/// \sa CRYPTOPP_VERSION, LibraryVersion(), HeaderVersion()
config_ver.h:/// \sa CRYPTOPP_VERSION, LibraryVersion(), HeaderVersion()
config_ver.h:/// \sa CRYPTOPP_VERSION, LibraryVersion(), HeaderVersion()
config_ver.h:/// \details CRYPTOPP_VERSION reflects the version of the library the headers
config_ver.h:#define CRYPTOPP_VERSION 8A0
cryptlib.h:     return CRYPTOPP_VERSION;
bench1.cpp:     oss << "\n<H1><A href=\"http://www.cryptopp.com\">Crypto++ " << CRYPTOPP_VERSION / 100;
bench1.cpp:     oss << '.' << (CRYPTOPP_VERSION % 100) / 10 << '.' << CRYPTOPP_VERSION % 10 << "</A> Benchmarks</H1>";
cryptlib.cpp:# define CRYPTOPP_BUILD_VERSION CRYPTOPP_VERSION
test.cpp:                       std::cout << CRYPTOPP_VERSION / 100 << '.' << (CRYPTOPP_VERSION % 100) / 10 << '.' << CRYPTOPP_VERSION % 10 << std::endl;
@noloader
Copy link
Collaborator Author

noloader commented Oct 1, 2023

I think we need to use two digits for each component:

#define CRYPTOPP_VERSION 081000

@jurassicLizard
Copy link

It is also possible to get inspired by libcurl they use define macros for major , minor and patch versions as well as hexadecimal (24-bit , 6 digit) version identifier that can be used to compare older to newer version. I used exactly this when interacting with libcurl to check if building against a curl library version that is lower than a certain desired version.

for example , adapting from https://github.com/curl/curl/blob/master/include/curl/curlver.h . you could just go for hexadecimal 24-bit since its always comparable between recent and older versions and will never fall in the problem above for example :

#define CRYPTOPP_VERSION_HEX 0x0810AF

#define CRYPTOPP_VERSION_MAJOR 8
#define CRYPTOPP_VERSION_MINOR 10
#define CRYPTOPP_VERSION_PATCH 175

with a fictional 175 version patch number used only for demonstration purposes

@irwir
Copy link
Contributor

irwir commented Oct 7, 2023

Not sure about inspiration, but this is versioning in Windows: https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-makedllverull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants