Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
error.h
00001 /** 00002 * \file error.h 00003 * 00004 * \brief Error to string translation 00005 * 00006 * Copyright (C) 2006-2013, Brainspark B.V. 00007 * 00008 * This file is part of PolarSSL (http://www.polarssl.org) 00009 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> 00010 * 00011 * All rights reserved. 00012 * 00013 * This program is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation; either version 2 of the License, or 00016 * (at your option) any later version. 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License along 00024 * with this program; if not, write to the Free Software Foundation, Inc., 00025 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00026 */ 00027 #ifndef POLARSSL_ERROR_H 00028 #define POLARSSL_ERROR_H 00029 00030 #include <string.h> 00031 00032 /** 00033 * Error code layout. 00034 * 00035 * Currently we try to keep all error codes within the negative space of 16 00036 * bytes signed integers to support all platforms (-0x0000 - -0x8000). In 00037 * addition we'd like to give two layers of information on the error if 00038 * possible. 00039 * 00040 * For that purpose the error codes are segmented in the following manner: 00041 * 00042 * 16 bit error code bit-segmentation 00043 * 00044 * 1 bit - Sign bit 00045 * 3 bits - High level module ID 00046 * 5 bits - Module-dependent error code 00047 * 7 bits - Low level module errors 00048 * 00049 * For historical reasons, low-level error codes are divided in even and odd, 00050 * even codes were assigned first, and -1 is reserved for other errors. 00051 * 00052 * Low-level module errors (0x0002-0x007E, 0x0003-0x007F) 00053 * 00054 * Module Nr Codes assigned 00055 * MPI 7 0x0002-0x0010 00056 * GCM 2 0x0012-0x0014 00057 * BLOWFISH 2 0x0016-0x0018 00058 * THREADING 3 0x001A-0x001E 00059 * AES 2 0x0020-0x0022 00060 * CAMELLIA 2 0x0024-0x0026 00061 * XTEA 1 0x0028-0x0028 00062 * BASE64 2 0x002A-0x002C 00063 * OID 1 0x002E-0x002E 0x000B-0x000B 00064 * PADLOCK 1 0x0030-0x0030 00065 * DES 1 0x0032-0x0032 00066 * CTR_DBRG 4 0x0034-0x003A 00067 * ENTROPY 3 0x003C-0x0040 00068 * NET 11 0x0042-0x0056 00069 * ENTROPY 1 0x0058-0x0058 00070 * ASN1 7 0x0060-0x006C 00071 * MD2 1 0x0070-0x0070 00072 * MD4 1 0x0072-0x0072 00073 * MD5 1 0x0074-0x0074 00074 * SHA1 1 0x0076-0x0076 00075 * SHA256 1 0x0078-0x0078 00076 * SHA512 1 0x007A-0x007A 00077 * PBKDF2 1 0x007C-0x007C 00078 * RIPEMD160 1 0x007E-0x007E 00079 * HMAC_DRBG 4 0x0003-0x0009 00080 * 00081 * High-level module nr (3 bits - 0x0...-0x7...) 00082 * Name ID Nr of Errors 00083 * PEM 1 9 00084 * PKCS#12 1 4 (Started from top) 00085 * X509 2 18 00086 * PK 2 14 (Started from top, plus 0x2000) 00087 * DHM 3 9 00088 * PKCS5 3 4 (Started from top) 00089 * RSA 4 9 00090 * ECP 4 8 (Started from top) 00091 * MD 5 4 00092 * CIPHER 6 6 00093 * SSL 6 9 (Started from top) 00094 * SSL 7 31 00095 * 00096 * Module dependent error code (5 bits 0x.00.-0x.F8.) 00097 */ 00098 00099 #ifdef __cplusplus 00100 extern "C" { 00101 #endif 00102 00103 /** 00104 * \brief Translate a PolarSSL error code into a string representation, 00105 * Result is truncated if necessary and always includes a terminating 00106 * null byte. 00107 * 00108 * \param errnum error code 00109 * \param buffer buffer to place representation in 00110 * \param buflen length of the buffer 00111 */ 00112 void polarssl_strerror( int errnum, char *buffer, size_t buflen ); 00113 00114 #if defined(POLARSSL_ERROR_STRERROR_BC) 00115 void error_strerror( int errnum, char *buffer, size_t buflen ); 00116 #endif 00117 00118 #ifdef __cplusplus 00119 } 00120 #endif 00121 00122 #endif /* error.h */ 00123 00124
Generated on Tue Jul 12 2022 19:40:15 by
1.7.2