esp_tls_wolfssl.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Copyright 2019 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. #pragma once
  14. #include "esp_tls.h"
  15. /**
  16. * Internal Callback for creating ssl handle for wolfssl
  17. */
  18. int esp_create_wolfssl_handle(const char *hostname, size_t hostlen, const void *cfg, esp_tls_t *tls);
  19. /**
  20. * Internal Callback for wolfssl_handshake
  21. */
  22. int esp_wolfssl_handshake(esp_tls_t *tls, const esp_tls_cfg_t *cfg);
  23. /**
  24. * Internal Callback API for wolfssl_ssl_read
  25. */
  26. ssize_t esp_wolfssl_read(esp_tls_t *tls, char *data, size_t datalen);
  27. /**
  28. * Internal callback API for wolfssl_ssl_write
  29. */
  30. ssize_t esp_wolfssl_write(esp_tls_t *tls, const char *data, size_t datalen);
  31. /**
  32. * Internal Callback for wolfssl_cleanup , frees up all the memory used by wolfssl
  33. */
  34. void esp_wolfssl_cleanup(esp_tls_t *tls);
  35. /**
  36. * Internal Callback for Certificate verification for wolfssl
  37. */
  38. void esp_wolfssl_verify_certificate(esp_tls_t *tls);
  39. /**
  40. * Internal Callback for deleting the wolfssl connection
  41. */
  42. void esp_wolfssl_conn_delete(esp_tls_t *tls);
  43. /**
  44. * Internal Callback for wolfssl_get_bytes_avail
  45. */
  46. ssize_t esp_wolfssl_get_bytes_avail(esp_tls_t *tls);
  47. /**
  48. * Callback function for setting global CA store data for TLS/SSL using wolfssl
  49. */
  50. esp_err_t esp_wolfssl_set_global_ca_store(const unsigned char *cacert_pem_buf, const unsigned int cacert_pem_bytes);
  51. /**
  52. * Callback function for freeing global ca store for TLS/SSL using wolfssl
  53. */
  54. void esp_wolfssl_free_global_ca_store(void);
  55. /**
  56. *
  57. * Callback function for Initializing the global ca store for TLS?SSL using wolfssl
  58. */
  59. esp_err_t esp_wolfssl_init_global_ca_store(void);
  60. #ifdef CONFIG_ESP_TLS_SERVER
  61. /**
  62. * Function to Create ESP-TLS Server session with wolfssl Stack
  63. */
  64. int esp_wolfssl_server_session_create(esp_tls_cfg_server_t *cfg, int sockfd, esp_tls_t *tls);
  65. /*
  66. * Delete Server Session
  67. */
  68. void esp_wolfssl_server_session_delete(esp_tls_t *tls);
  69. #endif