2004-01-25 12:40:34 -05:00
|
|
|
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
|
|
|
*
|
|
|
|
* LibTomCrypt is a library that provides various cryptographic
|
|
|
|
* algorithms in a highly modular and flexible manner.
|
|
|
|
*
|
|
|
|
* The library is free for all purposes without any express
|
2004-05-12 16:42:16 -04:00
|
|
|
* guarantee it works.
|
2004-01-25 12:40:34 -05:00
|
|
|
*
|
|
|
|
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
|
|
|
*/
|
|
|
|
|
2003-03-02 19:59:24 -05:00
|
|
|
#include "mycrypt.h"
|
|
|
|
|
|
|
|
static const char *err_2_str[] =
|
|
|
|
{
|
|
|
|
"CRYPT_OK",
|
|
|
|
"CRYPT_ERROR",
|
2003-03-29 13:19:07 -05:00
|
|
|
"Non-fatal 'no-operation' requested.",
|
2003-03-02 19:59:24 -05:00
|
|
|
|
|
|
|
"Invalid keysize for block cipher.",
|
|
|
|
"Invalid number of rounds for block cipher.",
|
|
|
|
"Algorithm failed test vectors.",
|
|
|
|
|
|
|
|
"Buffer overflow.",
|
|
|
|
"Invalid input packet.",
|
|
|
|
|
|
|
|
"Invalid number of bits for a PRNG.",
|
|
|
|
"Error reading the PRNG.",
|
|
|
|
|
|
|
|
"Invalid cipher specified.",
|
|
|
|
"Invalid hash specified.",
|
|
|
|
"Invalid PRNG specified.",
|
|
|
|
|
|
|
|
"Out of memory.",
|
|
|
|
|
|
|
|
"Invalid PK key or key type specified for function.",
|
|
|
|
"A private PK key is required.",
|
|
|
|
|
|
|
|
"Invalid argument provided.",
|
2003-09-25 21:16:18 -04:00
|
|
|
"File Not Found",
|
2003-03-02 19:59:24 -05:00
|
|
|
|
|
|
|
"Invalid PK type.",
|
|
|
|
"Invalid PK system.",
|
|
|
|
"Duplicate PK key found on keyring.",
|
|
|
|
"Key not found in keyring.",
|
|
|
|
"Invalid sized parameter.",
|
|
|
|
|
2003-09-25 21:16:18 -04:00
|
|
|
"Invalid size for prime.",
|
|
|
|
|
2003-03-02 19:59:24 -05:00
|
|
|
};
|
|
|
|
|
2003-06-15 18:37:45 -04:00
|
|
|
const char *error_to_string(int err)
|
2003-03-02 19:59:24 -05:00
|
|
|
{
|
2003-06-15 18:37:45 -04:00
|
|
|
if (err < 0 || err >= (int)(sizeof(err_2_str)/sizeof(err_2_str[0]))) {
|
2003-03-02 19:59:24 -05:00
|
|
|
return "Invalid error code.";
|
|
|
|
} else {
|
2003-06-15 18:37:45 -04:00
|
|
|
return err_2_str[err];
|
2003-03-02 19:59:24 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|