2003-03-03 00:59:24 +00:00
|
|
|
/* Future releases will make use of this */
|
|
|
|
#include "mycrypt.h"
|
|
|
|
|
|
|
|
static const char *err_2_str[] =
|
|
|
|
{
|
|
|
|
"CRYPT_OK",
|
|
|
|
"CRYPT_ERROR",
|
2003-03-29 18:19:07 +00:00
|
|
|
"Non-fatal 'no-operation' requested.",
|
2003-03-03 00:59:24 +00: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.",
|
|
|
|
|
|
|
|
"Invalid PK type.",
|
|
|
|
"Invalid PK system.",
|
|
|
|
"Duplicate PK key found on keyring.",
|
|
|
|
"Key not found in keyring.",
|
|
|
|
"Invalid sized parameter.",
|
|
|
|
|
|
|
|
"Invalid size for prime."
|
|
|
|
};
|
|
|
|
|
2003-06-15 22:37:45 +00:00
|
|
|
const char *error_to_string(int err)
|
2003-03-03 00:59:24 +00:00
|
|
|
{
|
2003-06-15 22:37:45 +00:00
|
|
|
if (err < 0 || err >= (int)(sizeof(err_2_str)/sizeof(err_2_str[0]))) {
|
2003-03-03 00:59:24 +00:00
|
|
|
return "Invalid error code.";
|
|
|
|
} else {
|
2003-06-15 22:37:45 +00:00
|
|
|
return err_2_str[err];
|
2003-03-03 00:59:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|