Mercurial > dropbear
comparison error_to_string.c @ 15:6362d3854bb4 libtomcrypt-orig
0.96 release of LibTomCrypt
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 15 Jun 2004 14:07:21 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:7faae8f46238 | 15:6362d3854bb4 |
---|---|
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
2 * | |
3 * LibTomCrypt is a library that provides various cryptographic | |
4 * algorithms in a highly modular and flexible manner. | |
5 * | |
6 * The library is free for all purposes without any express | |
7 * guarantee it works. | |
8 * | |
9 * Tom St Denis, [email protected], http://libtomcrypt.org | |
10 */ | |
11 | |
12 #include "mycrypt.h" | |
13 | |
14 static const char *err_2_str[] = | |
15 { | |
16 "CRYPT_OK", | |
17 "CRYPT_ERROR", | |
18 "Non-fatal 'no-operation' requested.", | |
19 | |
20 "Invalid keysize for block cipher.", | |
21 "Invalid number of rounds for block cipher.", | |
22 "Algorithm failed test vectors.", | |
23 | |
24 "Buffer overflow.", | |
25 "Invalid input packet.", | |
26 | |
27 "Invalid number of bits for a PRNG.", | |
28 "Error reading the PRNG.", | |
29 | |
30 "Invalid cipher specified.", | |
31 "Invalid hash specified.", | |
32 "Invalid PRNG specified.", | |
33 | |
34 "Out of memory.", | |
35 | |
36 "Invalid PK key or key type specified for function.", | |
37 "A private PK key is required.", | |
38 | |
39 "Invalid argument provided.", | |
40 "File Not Found", | |
41 | |
42 "Invalid PK type.", | |
43 "Invalid PK system.", | |
44 "Duplicate PK key found on keyring.", | |
45 "Key not found in keyring.", | |
46 "Invalid sized parameter.", | |
47 | |
48 "Invalid size for prime.", | |
49 | |
50 }; | |
51 | |
52 const char *error_to_string(int err) | |
53 { | |
54 if (err < 0 || err >= (int)(sizeof(err_2_str)/sizeof(err_2_str[0]))) { | |
55 return "Invalid error code."; | |
56 } else { | |
57 return err_2_str[err]; | |
58 } | |
59 } | |
60 |