aboutsummaryrefslogtreecommitdiffstats
path: root/libar2_validate_params.c
blob: 02d159af311fae6559158f6d65224ee45ba748b0 (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;
}