From 8bdc2e4929068210d523c34c0b171b51ce96057f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 16 Jan 2022 19:58:57 +0100 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libar2_validate_params.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 libar2_validate_params.c (limited to 'libar2_validate_params.c') diff --git a/libar2_validate_params.c b/libar2_validate_params.c new file mode 100644 index 0000000..02d159a --- /dev/null +++ b/libar2_validate_params.c @@ -0,0 +1,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; +} -- cgit v1.2.3-70-g09d2