error-ssl.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /* error-ssl.h
  2. *
  3. * Copyright (C) 2006-2023 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL 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. * wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. #ifndef WOLFSSL_ERROR_H
  22. #define WOLFSSL_ERROR_H
  23. #include <wolfssl/wolfcrypt/error-crypt.h> /* pull in wolfCrypt errors */
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. enum wolfSSL_ErrorCodes {
  28. INPUT_CASE_ERROR = -301, /* process input state error */
  29. PREFIX_ERROR = -302, /* bad index to key rounds */
  30. MEMORY_ERROR = -303, /* out of memory */
  31. VERIFY_FINISHED_ERROR = -304, /* verify problem on finished */
  32. VERIFY_MAC_ERROR = -305, /* verify mac problem */
  33. PARSE_ERROR = -306, /* parse error on header */
  34. UNKNOWN_HANDSHAKE_TYPE = -307, /* weird handshake type */
  35. SOCKET_ERROR_E = -308, /* error state on socket */
  36. SOCKET_NODATA = -309, /* expected data, not there */
  37. INCOMPLETE_DATA = -310, /* don't have enough data to
  38. complete task */
  39. UNKNOWN_RECORD_TYPE = -311, /* unknown type in record hdr */
  40. DECRYPT_ERROR = -312, /* error during decryption */
  41. FATAL_ERROR = -313, /* recvd alert fatal error */
  42. ENCRYPT_ERROR = -314, /* error during encryption */
  43. FREAD_ERROR = -315, /* fread problem */
  44. NO_PEER_KEY = -316, /* need peer's key */
  45. NO_PRIVATE_KEY = -317, /* need the private key */
  46. RSA_PRIVATE_ERROR = -318, /* error during rsa priv op */
  47. NO_DH_PARAMS = -319, /* server missing DH params */
  48. BUILD_MSG_ERROR = -320, /* build message failure */
  49. BAD_HELLO = -321, /* client hello malformed */
  50. DOMAIN_NAME_MISMATCH = -322, /* peer subject name mismatch */
  51. WANT_READ = -323, /* want read, call again */
  52. NOT_READY_ERROR = -324, /* handshake layer not ready */
  53. IPADDR_MISMATCH = -325, /* peer ip address mismatch */
  54. VERSION_ERROR = -326, /* record layer version error */
  55. WANT_WRITE = -327, /* want write, call again */
  56. BUFFER_ERROR = -328, /* malformed buffer input */
  57. VERIFY_CERT_ERROR = -329, /* verify cert error */
  58. VERIFY_SIGN_ERROR = -330, /* verify sign error */
  59. CLIENT_ID_ERROR = -331, /* psk client identity error */
  60. SERVER_HINT_ERROR = -332, /* psk server hint error */
  61. PSK_KEY_ERROR = -333, /* psk key error */
  62. GETTIME_ERROR = -337, /* gettimeofday failed ??? */
  63. GETITIMER_ERROR = -338, /* getitimer failed ??? */
  64. SIGACT_ERROR = -339, /* sigaction failed ??? */
  65. SETITIMER_ERROR = -340, /* setitimer failed ??? */
  66. LENGTH_ERROR = -341, /* record layer length error */
  67. PEER_KEY_ERROR = -342, /* can't decode peer key */
  68. ZERO_RETURN = -343, /* peer sent close notify */
  69. SIDE_ERROR = -344, /* wrong client/server type */
  70. NO_PEER_CERT = -345, /* peer didn't send key */
  71. ECC_CURVETYPE_ERROR = -350, /* Bad ECC Curve Type */
  72. ECC_CURVE_ERROR = -351, /* Bad ECC Curve */
  73. ECC_PEERKEY_ERROR = -352, /* Bad Peer ECC Key */
  74. ECC_MAKEKEY_ERROR = -353, /* Bad Make ECC Key */
  75. ECC_EXPORT_ERROR = -354, /* Bad ECC Export Key */
  76. ECC_SHARED_ERROR = -355, /* Bad ECC Shared Secret */
  77. NOT_CA_ERROR = -357, /* Not a CA cert error */
  78. BAD_CERT_MANAGER_ERROR = -359, /* Bad Cert Manager */
  79. OCSP_CERT_REVOKED = -360, /* OCSP Certificate revoked */
  80. CRL_CERT_REVOKED = -361, /* CRL Certificate revoked */
  81. CRL_MISSING = -362, /* CRL Not loaded */
  82. MONITOR_SETUP_E = -363, /* CRL Monitor setup error */
  83. THREAD_CREATE_E = -364, /* Thread Create Error */
  84. OCSP_NEED_URL = -365, /* OCSP need an URL for lookup */
  85. OCSP_CERT_UNKNOWN = -366, /* OCSP responder doesn't know */
  86. OCSP_LOOKUP_FAIL = -367, /* OCSP lookup not successful */
  87. MAX_CHAIN_ERROR = -368, /* max chain depth exceeded */
  88. COOKIE_ERROR = -369, /* dtls cookie error */
  89. SEQUENCE_ERROR = -370, /* dtls sequence error */
  90. SUITES_ERROR = -371, /* suites pointer error */
  91. OUT_OF_ORDER_E = -373, /* out of order message */
  92. BAD_KEA_TYPE_E = -374, /* bad KEA type found */
  93. SANITY_CIPHER_E = -375, /* sanity check on cipher error */
  94. RECV_OVERFLOW_E = -376, /* RXCB returned more than read */
  95. GEN_COOKIE_E = -377, /* Generate Cookie Error */
  96. NO_PEER_VERIFY = -378, /* Need peer cert verify Error */
  97. FWRITE_ERROR = -379, /* fwrite problem */
  98. CACHE_MATCH_ERROR = -380, /* Cache hdr match error */
  99. UNKNOWN_SNI_HOST_NAME_E = -381, /* Unrecognized host name Error */
  100. UNKNOWN_MAX_FRAG_LEN_E = -382, /* Unrecognized max frag len Error */
  101. KEYUSE_SIGNATURE_E = -383, /* KeyUse digSignature error */
  102. KEYUSE_ENCIPHER_E = -385, /* KeyUse keyEncipher error */
  103. EXTKEYUSE_AUTH_E = -386, /* ExtKeyUse server|client_auth */
  104. SEND_OOB_READ_E = -387, /* Send Cb out of bounds read */
  105. SECURE_RENEGOTIATION_E = -388, /* Invalid Renegotiation Info */
  106. SESSION_TICKET_LEN_E = -389, /* Session Ticket too large */
  107. SESSION_TICKET_EXPECT_E = -390, /* Session Ticket missing */
  108. SCR_DIFFERENT_CERT_E = -391, /* SCR Different cert error */
  109. SESSION_SECRET_CB_E = -392, /* Session secret Cb fcn failure */
  110. NO_CHANGE_CIPHER_E = -393, /* Finished before change cipher */
  111. SANITY_MSG_E = -394, /* Sanity check on msg order error */
  112. DUPLICATE_MSG_E = -395, /* Duplicate message error */
  113. SNI_UNSUPPORTED = -396, /* SSL 3.0 does not support SNI */
  114. SOCKET_PEER_CLOSED_E = -397, /* Underlying transport closed */
  115. BAD_TICKET_KEY_CB_SZ = -398, /* Bad session ticket key cb size */
  116. BAD_TICKET_MSG_SZ = -399, /* Bad session ticket msg size */
  117. BAD_TICKET_ENCRYPT = -400, /* Bad user ticket encrypt */
  118. DH_KEY_SIZE_E = -401, /* DH Key too small */
  119. SNI_ABSENT_ERROR = -402, /* No SNI request. */
  120. RSA_SIGN_FAULT = -403, /* RSA Sign fault */
  121. HANDSHAKE_SIZE_ERROR = -404, /* Handshake message too large */
  122. UNKNOWN_ALPN_PROTOCOL_NAME_E = -405, /* Unrecognized protocol name Error*/
  123. BAD_CERTIFICATE_STATUS_ERROR = -406, /* Bad certificate status message */
  124. OCSP_INVALID_STATUS = -407, /* Invalid OCSP Status */
  125. OCSP_WANT_READ = -408, /* OCSP callback response WOLFSSL_CBIO_ERR_WANT_READ */
  126. RSA_KEY_SIZE_E = -409, /* RSA key too small */
  127. ECC_KEY_SIZE_E = -410, /* ECC key too small */
  128. DTLS_EXPORT_VER_E = -411, /* export version error */
  129. INPUT_SIZE_E = -412, /* input size too big error */
  130. CTX_INIT_MUTEX_E = -413, /* initialize ctx mutex error */
  131. EXT_MASTER_SECRET_NEEDED_E = -414, /* need EMS enabled to resume */
  132. DTLS_POOL_SZ_E = -415, /* exceeded DTLS pool size */
  133. DECODE_E = -416, /* decode handshake message error */
  134. HTTP_TIMEOUT = -417, /* HTTP timeout for OCSP or CRL req */
  135. WRITE_DUP_READ_E = -418, /* Write dup write side can't read */
  136. WRITE_DUP_WRITE_E = -419, /* Write dup read side can't write */
  137. INVALID_CERT_CTX_E = -420, /* TLS cert ctx not matching */
  138. BAD_KEY_SHARE_DATA = -421, /* Key Share data invalid */
  139. MISSING_HANDSHAKE_DATA = -422, /* Handshake message missing data */
  140. BAD_BINDER = -423, /* Binder does not match */
  141. EXT_NOT_ALLOWED = -424, /* Extension not allowed in msg */
  142. INVALID_PARAMETER = -425, /* Security parameter invalid */
  143. MCAST_HIGHWATER_CB_E = -426, /* Multicast highwater cb err */
  144. ALERT_COUNT_E = -427, /* Alert Count exceeded err */
  145. EXT_MISSING = -428, /* Required extension not found */
  146. UNSUPPORTED_EXTENSION = -429, /* TLSX not requested by client */
  147. PRF_MISSING = -430, /* PRF not compiled in */
  148. DTLS_RETX_OVER_TX = -431, /* Retransmit DTLS flight over */
  149. DH_PARAMS_NOT_FFDHE_E = -432, /* DH params from server not FFDHE */
  150. TCA_INVALID_ID_TYPE = -433, /* TLSX TCA ID type invalid */
  151. TCA_ABSENT_ERROR = -434, /* TLSX TCA ID no response */
  152. TSIP_MAC_DIGSZ_E = -435, /* Invalid MAC size for TSIP */
  153. CLIENT_CERT_CB_ERROR = -436, /* Client cert callback error */
  154. SSL_SHUTDOWN_ALREADY_DONE_E = -437, /* Shutdown called redundantly */
  155. TLS13_SECRET_CB_E = -438, /* TLS1.3 secret Cb fcn failure */
  156. DTLS_SIZE_ERROR = -439, /* Trying to send too much data */
  157. NO_CERT_ERROR = -440, /* TLS1.3 - no cert set error */
  158. APP_DATA_READY = -441, /* DTLS1.2 application data ready for read */
  159. TOO_MUCH_EARLY_DATA = -442, /* Too much Early data */
  160. SOCKET_FILTERED_E = -443, /* Session stopped by network filter */
  161. HTTP_RECV_ERR = -444, /* HTTP Receive error */
  162. HTTP_HEADER_ERR = -445, /* HTTP Header error */
  163. HTTP_PROTO_ERR = -446, /* HTTP Protocol error */
  164. HTTP_STATUS_ERR = -447, /* HTTP Status error */
  165. HTTP_VERSION_ERR = -448, /* HTTP Version error */
  166. HTTP_APPSTR_ERR = -449, /* HTTP Application string error */
  167. UNSUPPORTED_PROTO_VERSION = -450, /* bad/unsupported protocol version*/
  168. FALCON_KEY_SIZE_E = -451, /* Wrong key size for Falcon. */
  169. QUIC_TP_MISSING_E = -452, /* QUIC transport parameter missing */
  170. DILITHIUM_KEY_SIZE_E = -453, /* Wrong key size for Dilithium. */
  171. DTLS_CID_ERROR = -454, /* Wrong or missing CID */
  172. DTLS_TOO_MANY_FRAGMENTS_E = -455, /* Received too many fragments */
  173. QUIC_WRONG_ENC_LEVEL = -456, /* QUIC data received on wrong encryption level */
  174. DUPLICATE_TLS_EXT_E = -457, /* Duplicate TLS extension in msg. */
  175. /* add strings to wolfSSL_ERR_reason_error_string in internal.c !!!!! */
  176. /* begin negotiation parameter errors */
  177. UNSUPPORTED_SUITE = -500, /* unsupported cipher suite */
  178. MATCH_SUITE_ERROR = -501, /* can't match cipher suite */
  179. COMPRESSION_ERROR = -502, /* compression mismatch */
  180. KEY_SHARE_ERROR = -503, /* key share mismatch */
  181. POST_HAND_AUTH_ERROR = -504, /* client won't do post-hand auth */
  182. HRR_COOKIE_ERROR = -505, /* HRR msg cookie mismatch */
  183. UNSUPPORTED_CERTIFICATE = -506 /* unsupported certificate type */
  184. /* end negotiation parameter errors only 10 for now */
  185. /* add strings to wolfSSL_ERR_reason_error_string in internal.c !!!!! */
  186. /* no error strings go down here, add above negotiation errors !!!! */
  187. };
  188. #if defined(WOLFSSL_CALLBACKS) || defined(OPENSSL_EXTRA)
  189. enum {
  190. MIN_PARAM_ERR = UNSUPPORTED_SUITE,
  191. MAX_PARAM_ERR = MIN_PARAM_ERR - 10
  192. };
  193. #endif
  194. WOLFSSL_LOCAL
  195. void SetErrorString(int err, char* buff);
  196. #ifdef __cplusplus
  197. } /* extern "C" */
  198. #endif
  199. #endif /* wolfSSL_ERROR_H */