aboutsummaryrefslogtreecommitdiffstats
path: root/libar2_validate_params.c
blob: f30498500988ebbb4ed9fb6a7b072cd20d2f548b (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"


enum libar2_parameter_error
libar2_validate_params(const struct libar2_argon2_parameters *params, const char **errmsgp)
{
#define LIBAR2_X__(ENUM, ERRMESG, CONDITION)\
	if (CONDITION) {\
		if (errmsgp)\
			*errmsgp = ERRMESG;\
		return ENUM;\
	}
	LIBAR2_LIST_PARAMETER_ERRORS(LIBAR2_X__, params)
#undef LIBAR2_X__

	if (errmsgp)
		*errmsgp = "OK";
	return LIBAR2_OK;
}