]> git.codecow.com Git - Monocypher.git/commitdiff
Added version number to binaries
authorLoup Vaillant <loup@loup-vaillant.fr>
Sat, 19 Oct 2019 13:14:48 +0000 (15:14 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Sat, 19 Oct 2019 13:14:48 +0000 (15:14 +0200)
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.

src/monocypher.c
src/monocypher.h
tests/test.c

index 6a4b10fb776ae386ede7c18a94f81107b6d12fef..30b5fdb6cdce1d40e4f198ff42ae5f328f7a41e5 100644 (file)
@@ -1,4 +1,5 @@
 // Monocypher version __git__
+const char *monocypher_version = "__git__";
 
 #include "monocypher.h"
 
index c99561def611a2c213a89c5120b52758243addc4..a85c01d878bf955f784cf0f9e996c4315e0eb64d 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef MONOCYPHER_H
 #define MONOCYPHER_H
 
+extern const char *monocypher_version;
+
 #include <inttypes.h>
 #include <stddef.h>
 
index c195e466375903d9b24ee6f5c1fa68842d7de491..14548ab59733daf78c65ddef271b4b54d9a3bf69 100644 (file)
@@ -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);
     }