ssl_code.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef _SSL_CODE_H_
  14. #define _SSL_CODE_H_
  15. #include "ssl3.h"
  16. #include "tls1.h"
  17. /* Used in SSL_set_shutdown()/SSL_get_shutdown(); */
  18. # define SSL_SENT_SHUTDOWN 1
  19. # define SSL_RECEIVED_SHUTDOWN 2
  20. /*
  21. * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you
  22. * should not need these
  23. */
  24. # define SSL_ST_READ_HEADER 0xF0
  25. # define SSL_ST_READ_BODY 0xF1
  26. # define SSL_ST_READ_DONE 0xF2
  27. # define SSL_NOTHING 1
  28. # define SSL_WRITING 2
  29. # define SSL_READING 3
  30. # define SSL_X509_LOOKUP 4
  31. # define SSL_ASYNC_PAUSED 5
  32. # define SSL_ASYNC_NO_JOBS 6
  33. # define SSL_ERROR_NONE 0
  34. # define SSL_ERROR_SSL 1
  35. # define SSL_ERROR_WANT_READ 2
  36. # define SSL_ERROR_WANT_WRITE 3
  37. # define SSL_ERROR_WANT_X509_LOOKUP 4
  38. # define SSL_ERROR_SYSCALL 5/* look at error stack/return value/errno */
  39. # define SSL_ERROR_ZERO_RETURN 6
  40. # define SSL_ERROR_WANT_CONNECT 7
  41. # define SSL_ERROR_WANT_ACCEPT 8
  42. # define SSL_ERROR_WANT_ASYNC 9
  43. # define SSL_ERROR_WANT_ASYNC_JOB 10
  44. /* Message flow states */
  45. typedef enum {
  46. /* No handshake in progress */
  47. MSG_FLOW_UNINITED,
  48. /* A permanent error with this connection */
  49. MSG_FLOW_ERROR,
  50. /* We are about to renegotiate */
  51. MSG_FLOW_RENEGOTIATE,
  52. /* We are reading messages */
  53. MSG_FLOW_READING,
  54. /* We are writing messages */
  55. MSG_FLOW_WRITING,
  56. /* Handshake has finished */
  57. MSG_FLOW_FINISHED
  58. } MSG_FLOW_STATE;
  59. typedef enum {
  60. TLS_ST_BEFORE,
  61. TLS_ST_OK,
  62. DTLS_ST_CR_HELLO_VERIFY_REQUEST,
  63. TLS_ST_CR_SRVR_HELLO,
  64. TLS_ST_CR_CERT,
  65. TLS_ST_CR_CERT_STATUS,
  66. TLS_ST_CR_KEY_EXCH,
  67. TLS_ST_CR_CERT_REQ,
  68. TLS_ST_CR_SRVR_DONE,
  69. TLS_ST_CR_SESSION_TICKET,
  70. TLS_ST_CR_CHANGE,
  71. TLS_ST_CR_FINISHED,
  72. TLS_ST_CW_CLNT_HELLO,
  73. TLS_ST_CW_CERT,
  74. TLS_ST_CW_KEY_EXCH,
  75. TLS_ST_CW_CERT_VRFY,
  76. TLS_ST_CW_CHANGE,
  77. TLS_ST_CW_NEXT_PROTO,
  78. TLS_ST_CW_FINISHED,
  79. TLS_ST_SW_HELLO_REQ,
  80. TLS_ST_SR_CLNT_HELLO,
  81. DTLS_ST_SW_HELLO_VERIFY_REQUEST,
  82. TLS_ST_SW_SRVR_HELLO,
  83. TLS_ST_SW_CERT,
  84. TLS_ST_SW_KEY_EXCH,
  85. TLS_ST_SW_CERT_REQ,
  86. TLS_ST_SW_SRVR_DONE,
  87. TLS_ST_SR_CERT,
  88. TLS_ST_SR_KEY_EXCH,
  89. TLS_ST_SR_CERT_VRFY,
  90. TLS_ST_SR_NEXT_PROTO,
  91. TLS_ST_SR_CHANGE,
  92. TLS_ST_SR_FINISHED,
  93. TLS_ST_SW_SESSION_TICKET,
  94. TLS_ST_SW_CERT_STATUS,
  95. TLS_ST_SW_CHANGE,
  96. TLS_ST_SW_FINISHED
  97. } OSSL_HANDSHAKE_STATE;
  98. #endif