PageRenderTime 29ms CodeModel.GetById 18ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/cyassl-1.2.0/ctaocrypt/include/error.h

https://bitbucket.org/mkramer/cyassl
C++ Header | 92 lines | 53 code | 17 blank | 22 comment | 0 complexity | 8190342335addc323e41807e682a0215 MD5 | raw file
 1/* error.h
 2 *
 3 * Copyright (C) 2006-2009 Sawtooth Consulting Ltd.
 4 *
 5 * This file is part of CyaSSL.
 6 *
 7 * CyaSSL is free software; you can redistribute it and/or modify
 8 * it under the terms of the GNU General Public License as published by
 9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * CyaSSL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 */
21
22
23#ifndef CTAO_CRYPT_ERROR_H
24#define CTAO_CRYPT_ERROR_H
25
26#include "types.h"
27
28
29#ifdef __cplusplus
30    extern "C" {
31#endif
32
33
34/* error codes */
35enum {
36    MAX_ERROR_SZ       =  80,   /* max size of error string */
37    MAX_CODE_E         = -100,  /* errors -101 - -199 */
38    OPEN_RAN_E         = -101,  /* opening random device error */
39    READ_RAN_E         = -102,  /* reading random device error */
40    WINCRYPT_E         = -103,  /* windows crypt init error */
41    CRYPTGEN_E         = -104,  /* windows crypt generation error */
42    RAN_BLOCK_E        = -105,  /* reading random device would block */
43
44    MP_INIT_E          = -110,  /* mp_init error state */
45    MP_READ_E          = -111,  /* mp_read error state */
46    MP_EXPTMOD_E       = -112,  /* mp_exptmod error state */
47    MP_TO_E            = -113,  /* mp_to_xxx error state, can't convert */
48    MP_SUB_E           = -114,  /* mp_sub error state, can't subtract */
49    MP_ADD_E           = -115,  /* mp_add error state, can't add */
50    MP_MUL_E           = -116,  /* mp_mul error state, can't multiply */
51    MP_MULMOD_E        = -117,  /* mp_mulmod error state, can't multiply mod */
52    MP_MOD_E           = -118,  /* mp_mod error state, can't mod */
53    MP_INVMOD_E        = -119,  /* mp_invmod error state, can't inv mod */
54
55    MEMORY_E           = -120,  /* out of memory error */
56
57    RSA_WRONG_TYPE_E   = -130,  /* RSA wrong block type for RSA function */
58    RSA_BUFFER_E       = -131,  /* RSA buffer error, output too small or 
59                                   input too large */
60
61    ASN_PARSE_E        = -140,  /* ASN parsing error, invalid input */
62    ASN_VERSION_E      = -141,  /* ASN version error, invalid number */
63    ASN_GETINT_E       = -142,  /* ASN get big int error, invalid data */
64    ASN_RSA_KEY_E      = -143,  /* ASN key init error, invalid input */
65    ASN_OBJECT_ID_E    = -144,  /* ASN object id error, invalid id */
66    ASN_TAG_NULL_E     = -145,  /* ASN tag error, not null */
67    ASN_EXPECT_0_E     = -146,  /* ASN expect error, not zero */
68    ASN_BITSTR_E       = -147,  /* ASN bit string error, wrong id */
69    ASN_UNKNOWN_OID_E  = -148,  /* ASN oid error, unknown sum id */
70    ASN_DATE_SZ_E      = -149,  /* ASN date error, bad size */
71    ASN_BEFORE_DATE_E  = -150,  /* ASN date error, current date before */
72    ASN_AFTER_DATE_E   = -151,  /* ASN date error, current date after */
73    ASN_SIG_OID_E      = -152,  /* ASN signature error, mismatched oid */
74    ASN_TIME_E         = -153,  /* ASN time error, unkown time type */
75    ASN_INPUT_E        = -154,  /* ASN input error, not enough data */
76    ASN_SIG_CONFIRM_E  = -155,  /* ASN sig error, confirm failure */
77    ASN_SIG_HASH_E     = -156,  /* ASN sig error, unsupported hash type */
78    ASN_SIG_KEY_E      = -157,  /* ASN sig error, unsupported key  type */
79    ASN_DH_KEY_E       = -158,  /* ASN key init error, invalid input */
80    MIN_CODE_E         = -200   /* errors -101 - -199 */
81};
82
83
84void CTaoCryptErrorString(int error, char* buffer);
85
86
87#ifdef __cplusplus
88    } /* extern "C" */
89#endif
90
91#endif /* CTAO_CRYPT_ERROR_H */
92