2003-03-02 19:59:24 -05:00
|
|
|
/* Future releases will make use of this */
|
|
|
|
#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.",
|
|
|
|
|
|
|
|
"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 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
|
|
|
}
|
|
|
|
}
|
|
|
|
|