Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / sshd / libtomcrypt / strings.c
1 /* Future releases will make use of this */
2 #include "mycrypt.h"
3
4 static const char *err_2_str[] =
5 {
6    "CRYPT_OK",
7    "CRYPT_ERROR",
8    "Non-fatal 'no-operation' requested.",
9
10    "Invalid keysize for block cipher.",
11    "Invalid number of rounds for block cipher.",
12    "Algorithm failed test vectors.",
13
14    "Buffer overflow.",
15    "Invalid input packet.",
16
17    "Invalid number of bits for a PRNG.",
18    "Error reading the PRNG.",
19
20    "Invalid cipher specified.",
21    "Invalid hash specified.",
22    "Invalid PRNG specified.",
23
24    "Out of memory.",
25
26    "Invalid PK key or key type specified for function.",
27    "A private PK key is required.",
28
29    "Invalid argument provided.",
30
31    "Invalid PK type.",
32    "Invalid PK system.",
33    "Duplicate PK key found on keyring.",
34    "Key not found in keyring.",
35    "Invalid sized parameter.",
36
37    "Invalid size for prime."
38 };
39
40 const char *error_to_string(int err)
41 {
42    if (err < 0 || err >= (int)(sizeof(err_2_str)/sizeof(err_2_str[0]))) {
43       return "Invalid error code.";
44    } else {
45       return err_2_str[err];
46    }   
47 }
48