diff options
author | Mattias Andrée <maandree@kth.se> | 2022-01-16 19:58:57 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-16 19:58:57 +0100 |
commit | 8bdc2e4929068210d523c34c0b171b51ce96057f (patch) | |
tree | c77331e77b9777a37716bffb7365c4486a6df9a0 /libar2_string_to_version.c | |
download | libar2-8bdc2e4929068210d523c34c0b171b51ce96057f.tar.gz libar2-8bdc2e4929068210d523c34c0b171b51ce96057f.tar.bz2 libar2-8bdc2e4929068210d523c34c0b171b51ce96057f.tar.xz |
First commit1.0
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libar2_string_to_version.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libar2_string_to_version.c b/libar2_string_to_version.c new file mode 100644 index 0000000..a1e6370 --- /dev/null +++ b/libar2_string_to_version.c @@ -0,0 +1,20 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +int +libar2_string_to_version(const char *str, enum libar2_argon2_version *versionp) +{ + if (!strcmp(str, "10") || !strcmp(str, "1.0")) { + *versionp = LIBAR2_ARGON2_VERSION_10; + return 0; + + } else if (!strcmp(str, "13") || !strcmp(str, "1.3")) { + *versionp = LIBAR2_ARGON2_VERSION_13; + return 0; + + } else { + errno = EINVAL; + return -1; + } +} |