libtommath/bn_mp_error_to_string.c

26 lines
586 B
C
Raw Normal View History

#include "tommath_private.h"
2019-04-10 13:40:54 +00:00
#ifdef BN_MP_ERROR_TO_STRING_C
2019-04-07 13:29:11 +00:00
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
2003-08-05 01:24:44 +00:00
/* return a char * string for a given code */
const char *mp_error_to_string(mp_err code)
2003-08-05 01:24:44 +00:00
{
2019-04-12 09:24:17 +00:00
switch (code) {
case MP_OKAY:
return "Successful";
2019-05-09 02:16:24 +00:00
case MP_ERR:
return "Unknown error";
2019-04-12 09:24:17 +00:00
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";
2003-08-05 01:24:44 +00:00
}
}
2004-10-29 22:07:18 +00:00
#endif