summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_error_to_string.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-06-13 19:07:13 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-06-13 19:07:13 (GMT)
commit505f963287b050bd46871d4659cebc65986ca5ac (patch)
tree853ad3262ab07f7c5755e76b8154f36f24608014 /libtommath/bn_mp_error_to_string.c
parent689987ea924a8fded1801777c1a14ab1205fa826 (diff)
downloadtcl-505f963287b050bd46871d4659cebc65986ca5ac.zip
tcl-505f963287b050bd46871d4659cebc65986ca5ac.tar.gz
tcl-505f963287b050bd46871d4659cebc65986ca5ac.tar.bz2
Update to latest libtommath's "develop" branch. On the way to 1.2.0
Diffstat (limited to 'libtommath/bn_mp_error_to_string.c')
-rw-r--r--libtommath/bn_mp_error_to_string.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libtommath/bn_mp_error_to_string.c b/libtommath/bn_mp_error_to_string.c
new file mode 100644
index 0000000..e936ec1
--- /dev/null
+++ b/libtommath/bn_mp_error_to_string.c
@@ -0,0 +1,25 @@
+#include "tommath_private.h"
+#ifdef BN_MP_ERROR_TO_STRING_C
+/* LibTomMath, multiple-precision integer library -- Tom St Denis */
+/* SPDX-License-Identifier: Unlicense */
+
+/* return a char * string for a given code */
+const char *mp_error_to_string(mp_err code)
+{
+ switch (code) {
+ case MP_OKAY:
+ return "Successful";
+ case MP_ERR:
+ return "Unknown error";
+ case MP_MEM:
+ return "Out of heap";
+ case MP_VAL:
+ return "Value out of range";
+ case MP_ITER:
+ return "Max. iterations reached";
+ default:
+ return "Invalid error code";
+ }
+}
+
+#endif