comparison libtomcrypt/src/misc/error_to_string.c @ 1471:6dba84798cd5

Update to libtomcrypt 1.18.1, merged with Dropbear changes
author Matt Johnston <matt@ucc.asn.au>
date Fri, 09 Feb 2018 21:44:05 +0800
parents f849a5ca2efc
children
comparison
equal deleted inserted replaced
1470:8bba51a55704 1471:6dba84798cd5
3 * LibTomCrypt is a library that provides various cryptographic 3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner. 4 * algorithms in a highly modular and flexible manner.
5 * 5 *
6 * The library is free for all purposes without any express 6 * The library is free for all purposes without any express
7 * guarantee it works. 7 * guarantee it works.
8 *
9 * Tom St Denis, [email protected], http://libtom.org
10 */ 8 */
11 9
12 #include "tomcrypt.h" 10 #include "tomcrypt.h"
13 11
14 /** 12 /**
15 @file error_to_string.c 13 @file error_to_string.c
16 Convert error codes to ASCII strings, Tom St Denis 14 Convert error codes to ASCII strings, Tom St Denis
17 */ 15 */
18 16
19 static const char *err_2_str[] = 17 static const char * const err_2_str[] =
20 { 18 {
21 "CRYPT_OK", 19 "CRYPT_OK",
22 "CRYPT_ERROR", 20 "CRYPT_ERROR",
23 "Non-fatal 'no-operation' requested.", 21 "Non-fatal 'no-operation' requested.",
24 22
25 "Invalid keysize for block cipher.", 23 "Invalid key size.",
26 "Invalid number of rounds for block cipher.", 24 "Invalid number of rounds for block cipher.",
27 "Algorithm failed test vectors.", 25 "Algorithm failed test vectors.",
28 26
29 "Buffer overflow.", 27 "Buffer overflow.",
30 "Invalid input packet.", 28 "Invalid input packet.",
43 41
44 "Invalid argument provided.", 42 "Invalid argument provided.",
45 "File Not Found", 43 "File Not Found",
46 44
47 "Invalid PK type.", 45 "Invalid PK type.",
48 "Invalid PK system.", 46
49 "Duplicate PK key found on keyring.", 47 "An overflow of a value was detected/prevented.",
50 "Key not found in keyring.", 48
49 "UNUSED1.",
50
51 "The input was longer than expected.",
52
51 "Invalid sized parameter.", 53 "Invalid sized parameter.",
52 54
53 "Invalid size for prime.", 55 "Invalid size for prime.",
54 56
57 "Invalid padding.",
58
59 "Hash applied to too many bits.",
55 }; 60 };
56 61
57 /** 62 /**
58 Convert an LTC error code to ASCII 63 Convert an LTC error code to ASCII
59 @param err The error code 64 @param err The error code
63 { 68 {
64 if (err < 0 || err >= (int)(sizeof(err_2_str)/sizeof(err_2_str[0]))) { 69 if (err < 0 || err >= (int)(sizeof(err_2_str)/sizeof(err_2_str[0]))) {
65 return "Invalid error code."; 70 return "Invalid error code.";
66 } else { 71 } else {
67 return err_2_str[err]; 72 return err_2_str[err];
68 } 73 }
69 } 74 }
70 75
71 76
72 /* $Source$ */ 77 /* ref: $Format:%D$ */
73 /* $Revision$ */ 78 /* git commit: $Format:%H$ */
74 /* $Date$ */ 79 /* commit time: $Format:%ai$ */