aboutsummaryrefslogtreecommitdiff
path: root/errorstrings.c
diff options
context:
space:
mode:
Diffstat (limited to 'errorstrings.c')
-rw-r--r--errorstrings.c25
1 files changed, 25 insertions, 0 deletions
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 <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+
+#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