From f50805b30323155755393ac6639aaae1067452c1 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Thu, 21 May 2015 13:47:12 -0400 Subject: Add test harness: no useful tests yet, just the framework. Add human-readable error strings for hal_error_t codes. --- errorstrings.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 errorstrings.c (limited to 'errorstrings.c') diff --git a/errorstrings.c b/errorstrings.c new file mode 100644 index 0000000..9686eab --- /dev/null +++ b/errorstrings.c @@ -0,0 +1,25 @@ +/* + * Translate HAL error codes to strings. + */ + +#include +#include +#include +#include +#include + +#include "cryptech.h" + +#define DEFINE_HAL_ERROR(_code_,_text_) \ + case _code_: return _text_; + +const char *hal_error_string(const hal_error_t code) +{ + switch (code) { + HAL_ERROR_LIST; + default: + return "Unknown HAL error code"; + } +} + +#undef DEFINE_HAL_ERROR -- cgit v1.2.3