]> git.zerfleddert.de Git - proxmark3-svn/blob - common/mbedtls/error.h
chg 'hf mf chk':
[proxmark3-svn] / common / mbedtls / error.h
1 /**
2 * \file error.h
3 *
4 * \brief Error to string translation
5 */
6 /*
7 * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved
8 * SPDX-License-Identifier: GPL-2.0
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 *
24 * This file is part of mbed TLS (https://tls.mbed.org)
25 */
26 #ifndef MBEDTLS_ERROR_H
27 #define MBEDTLS_ERROR_H
28
29 #include <stddef.h>
30
31 /**
32 * Error code layout.
33 *
34 * Currently we try to keep all error codes within the negative space of 16
35 * bits signed integers to support all platforms (-0x0001 - -0x7FFF). In
36 * addition we'd like to give two layers of information on the error if
37 * possible.
38 *
39 * For that purpose the error codes are segmented in the following manner:
40 *
41 * 16 bit error code bit-segmentation
42 *
43 * 1 bit - Unused (sign bit)
44 * 3 bits - High level module ID
45 * 5 bits - Module-dependent error code
46 * 7 bits - Low level module errors
47 *
48 * For historical reasons, low-level error codes are divided in even and odd,
49 * even codes were assigned first, and -1 is reserved for other errors.
50 *
51 * Low-level module errors (0x0002-0x007E, 0x0003-0x007F)
52 *
53 * Module Nr Codes assigned
54 * MPI 7 0x0002-0x0010
55 * GCM 3 0x0012-0x0014 0x0013-0x0013
56 * BLOWFISH 3 0x0016-0x0018 0x0017-0x0017
57 * THREADING 3 0x001A-0x001E
58 * AES 5 0x0020-0x0022 0x0021-0x0025
59 * CAMELLIA 3 0x0024-0x0026 0x0027-0x0027
60 * XTEA 2 0x0028-0x0028 0x0029-0x0029
61 * BASE64 2 0x002A-0x002C
62 * OID 1 0x002E-0x002E 0x000B-0x000B
63 * PADLOCK 1 0x0030-0x0030
64 * DES 2 0x0032-0x0032 0x0033-0x0033
65 * CTR_DBRG 4 0x0034-0x003A
66 * ENTROPY 3 0x003C-0x0040 0x003D-0x003F
67 * NET 13 0x0042-0x0052 0x0043-0x0049
68 * ARIA 4 0x0058-0x005E
69 * ASN1 7 0x0060-0x006C
70 * CMAC 1 0x007A-0x007A
71 * PBKDF2 1 0x007C-0x007C
72 * HMAC_DRBG 4 0x0003-0x0009
73 * CCM 3 0x000D-0x0011
74 * ARC4 1 0x0019-0x0019
75 * MD2 1 0x002B-0x002B
76 * MD4 1 0x002D-0x002D
77 * MD5 1 0x002F-0x002F
78 * RIPEMD160 1 0x0031-0x0031
79 * SHA1 1 0x0035-0x0035
80 * SHA256 1 0x0037-0x0037
81 * SHA512 1 0x0039-0x0039
82 * CHACHA20 3 0x0051-0x0055
83 * POLY1305 3 0x0057-0x005B
84 * CHACHAPOLY 2 0x0054-0x0056
85 *
86 * High-level module nr (3 bits - 0x0...-0x7...)
87 * Name ID Nr of Errors
88 * PEM 1 9
89 * PKCS#12 1 4 (Started from top)
90 * X509 2 20
91 * PKCS5 2 4 (Started from top)
92 * DHM 3 11
93 * PK 3 15 (Started from top)
94 * RSA 4 11
95 * ECP 4 9 (Started from top)
96 * MD 5 5
97 * HKDF 5 1 (Started from top)
98 * CIPHER 6 8
99 * SSL 6 22 (Started from top)
100 * SSL 7 31
101 *
102 * Module dependent error code (5 bits 0x.00.-0x.F8.)
103 */
104
105 #ifdef __cplusplus
106 extern "C" {
107 #endif
108
109 /**
110 * \brief Translate a mbed TLS error code into a string representation,
111 * Result is truncated if necessary and always includes a terminating
112 * null byte.
113 *
114 * \param errnum error code
115 * \param buffer buffer to place representation in
116 * \param buflen length of the buffer
117 */
118 void mbedtls_strerror( int errnum, char *buffer, size_t buflen );
119
120 #ifdef __cplusplus
121 }
122 #endif
123
124 #endif /* error.h */
Impressum, Datenschutz