From: Loup Vaillant Date: Sat, 19 Oct 2019 13:14:48 +0000 (+0200) Subject: Added version number to binaries X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=30737a99843ac9f33698ea7e06afae1e7c6133df;p=Monocypher.git Added version number to binaries Sometimes, we don't have the sources, and we want to check the version number of the binaries themselves. (For instance when distributing Monocypher as a library.) To that end, I've added the global string constant "monocypher_version". It can be used from the calling program, or scanned directly by tools. --- diff --git a/src/monocypher.c b/src/monocypher.c index 6a4b10f..30b5fdb 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -1,4 +1,5 @@ // Monocypher version __git__ +const char *monocypher_version = "__git__"; #include "monocypher.h" diff --git a/src/monocypher.h b/src/monocypher.h index c99561d..a85c01d 100644 --- a/src/monocypher.h +++ b/src/monocypher.h @@ -3,6 +3,8 @@ #ifndef MONOCYPHER_H #define MONOCYPHER_H +extern const char *monocypher_version; + #include #include diff --git a/tests/test.c b/tests/test.c index c195e46..14548ab 100644 --- a/tests/test.c +++ b/tests/test.c @@ -856,6 +856,8 @@ static int p_auth() int main(int argc, char *argv[]) { + printf("\nMonocypher version: %s\n", monocypher_version); + if (argc > 1) { sscanf(argv[1], "%" PRIu64 "", &random_state); }