PageRenderTime 25ms CodeModel.GetById 9ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/cyassl/error.h

https://github.com/andersmalm/cyassl
C++ Header | 140 lines | 98 code | 17 blank | 25 comment | 0 complexity | 506c930a792a2642bb73bcab6f336088 MD5 | raw file
  1/* error.h
  2 *
  3 * Copyright (C) 2006-2012 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 CYASSL_ERROR_H
 24#define CYASSL_ERROR_H
 25
 26#include <cyassl/ctaocrypt/error.h>   /* pull in CTaoCrypt errors */
 27
 28#ifdef __cplusplus
 29    extern "C" {
 30#endif
 31
 32enum CyaSSL_ErrorCodes {
 33    INPUT_CASE_ERROR       = -201,            /* process input state error */
 34    PREFIX_ERROR           = -202,            /* bad index to key rounds  */
 35    MEMORY_ERROR           = -203,            /* out of memory            */
 36    VERIFY_FINISHED_ERROR  = -204,            /* verify problem on finished */
 37    VERIFY_MAC_ERROR       = -205,            /* verify mac problem       */
 38    PARSE_ERROR            = -206,            /* parse error on header    */
 39    UNKNOWN_HANDSHAKE_TYPE = -207,            /* weird handshake type     */
 40    SOCKET_ERROR_E         = -208,            /* error state on socket    */
 41    SOCKET_NODATA          = -209,            /* expected data, not there */
 42    INCOMPLETE_DATA        = -210,            /* don't have enough data to 
 43                                                 complete task            */
 44    UNKNOWN_RECORD_TYPE    = -211,            /* unknown type in record hdr */
 45    DECRYPT_ERROR          = -212,            /* error during decryption  */
 46    FATAL_ERROR            = -213,            /* recvd alert fatal error  */
 47    ENCRYPT_ERROR          = -214,            /* error during encryption  */
 48    FREAD_ERROR            = -215,            /* fread problem            */
 49    NO_PEER_KEY            = -216,            /* need peer's key          */
 50    NO_PRIVATE_KEY         = -217,            /* need the private key     */
 51    RSA_PRIVATE_ERROR      = -218,            /* error during rsa priv op */
 52    NO_DH_PARAMS           = -219,            /* server missing DH params */
 53    BUILD_MSG_ERROR        = -220,            /* build message failure    */
 54
 55    BAD_HELLO              = -221,            /* client hello malformed   */
 56    DOMAIN_NAME_MISMATCH   = -222,            /* peer subject name mismatch */
 57    WANT_READ              = -223,            /* want read, call again    */
 58    NOT_READY_ERROR        = -224,            /* handshake layer not ready */
 59    PMS_VERSION_ERROR      = -225,            /* pre m secret version error */
 60    VERSION_ERROR          = -226,            /* record layer version error */
 61    WANT_WRITE             = -227,            /* want write, call again   */
 62    BUFFER_ERROR           = -228,            /* malformed buffer input   */
 63    VERIFY_CERT_ERROR      = -229,            /* verify cert error        */
 64    VERIFY_SIGN_ERROR      = -230,            /* verify sign error        */
 65    CLIENT_ID_ERROR        = -231,            /* psk client identity error  */
 66    SERVER_HINT_ERROR      = -232,            /* psk server hint error  */
 67    PSK_KEY_ERROR          = -233,            /* psk key error  */
 68    ZLIB_INIT_ERROR        = -234,            /* zlib init error  */
 69    ZLIB_COMPRESS_ERROR    = -235,            /* zlib compression error  */
 70    ZLIB_DECOMPRESS_ERROR  = -236,            /* zlib decompression error  */
 71
 72    GETTIME_ERROR          = -237,            /* gettimeofday failed ??? */
 73    GETITIMER_ERROR        = -238,            /* getitimer failed ??? */
 74    SIGACT_ERROR           = -239,            /* sigaction failed ??? */
 75    SETITIMER_ERROR        = -240,            /* setitimer failed ??? */
 76    LENGTH_ERROR           = -241,            /* record layer length error */
 77    PEER_KEY_ERROR         = -242,            /* can't decode peer key */
 78    ZERO_RETURN            = -243,            /* peer sent close notify */
 79    SIDE_ERROR             = -244,            /* wrong client/server type */
 80    NO_PEER_CERT           = -245,            /* peer didn't send key */
 81    NTRU_KEY_ERROR         = -246,            /* NTRU key error  */
 82    NTRU_DRBG_ERROR        = -247,            /* NTRU drbg error  */
 83    NTRU_ENCRYPT_ERROR     = -248,            /* NTRU encrypt error  */
 84    NTRU_DECRYPT_ERROR     = -249,            /* NTRU decrypt error  */
 85    ECC_CURVETYPE_ERROR    = -250,            /* Bad ECC Curve Type */
 86    ECC_CURVE_ERROR        = -251,            /* Bad ECC Curve */
 87    ECC_PEERKEY_ERROR      = -252,            /* Bad Peer ECC Key */
 88    ECC_MAKEKEY_ERROR      = -253,            /* Bad Make ECC Key */
 89    ECC_EXPORT_ERROR       = -254,            /* Bad ECC Export Key */
 90    ECC_SHARED_ERROR       = -255,            /* Bad ECC Shared Secret */
 91    BAD_MUTEX_ERROR        = -256,            /* Bad mutex */
 92    NOT_CA_ERROR           = -257,            /* Not a CA cert error */
 93    BAD_PATH_ERROR         = -258,            /* Bad path for opendir */
 94    BAD_CERT_MANAGER_ERROR = -259,            /* Bad Cert Manager */
 95    OCSP_CERT_REVOKED      = -260,            /* OCSP Certificate revoked */
 96    CRL_CERT_REVOKED       = -261,            /* CRL Certificate revoked */
 97    CRL_MISSING            = -262,            /* CRL Not loaded */
 98    MONITOR_RUNNING_E      = -263,            /* CRL Monitor already running */
 99    THREAD_CREATE_E        = -264,            /* Thread Create Error */
100    OCSP_NEED_URL          = -265,            /* OCSP need an URL for lookup */
101    OCSP_CERT_UNKNOWN      = -266,            /* OCSP responder doesn't know */
102    OCSP_LOOKUP_FAIL       = -267,            /* OCSP lookup not successful */
103    MAX_CHAIN_ERROR        = -268,            /* max chain depth exceeded */
104    COOKIE_ERROR           = -269,            /* dtls cookie error */
105    SEQUENCE_ERROR         = -270,            /* dtls sequence error */
106    SUITES_ERROR           = -271,            /* suites pointer error */
107    SSL_NO_PEM_HEADER      = -272,            /* no PEM header found */
108    OUT_OF_ORDER_E         = -273,            /* out of order message */
109    BAD_KEA_TYPE_E         = -274,            /* bad KEA type found */
110    SANITY_CIPHER_E        = -275,            /* sanity check on cipher error */
111    RECV_OVERFLOW_E        = -276,            /* RXCB returned more than rqed */
112    /* add strings to SetErrorString !!!!! */
113
114    /* begin negotiation parameter errors */
115    UNSUPPORTED_SUITE      = -290,            /* unsupported cipher suite */
116    MATCH_SUITE_ERROR      = -291             /* can't match cipher suite */
117    /* end negotiation parameter errors only 10 for now */
118    /* add strings to SetErrorString !!!!! */
119};
120
121
122#ifdef CYASSL_CALLBACKS
123    enum {
124        MIN_PARAM_ERR = UNSUPPORTED_SUITE,
125        MAX_PARAM_ERR = MIN_PARAM_ERR - 10
126    };
127#endif
128
129
130CYASSL_LOCAL
131void SetErrorString(int error, char* buffer);
132
133
134#ifdef __cplusplus
135    }  /* extern "C" */
136#endif
137
138
139#endif /* CyaSSL_ERROR_H */
140