aboutsummaryrefslogtreecommitdiffstats
path: root/libar2_string_to_version.c
blob: a1e637034779fcc95556b1c24569f4f6137aa063 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
	}
}