esp_tls_wolfssl.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include "esp_tls.h"
  8. /**
  9. * Internal Callback for creating ssl handle for wolfssl
  10. */
  11. int esp_create_wolfssl_handle(const char *hostname, size_t hostlen, const void *cfg, esp_tls_t *tls);
  12. /**
  13. * Internal Callback for wolfssl_handshake
  14. */
  15. int esp_wolfssl_handshake(esp_tls_t *tls, const esp_tls_cfg_t *cfg);
  16. /**
  17. * Internal Callback API for wolfssl_ssl_read
  18. */
  19. ssize_t esp_wolfssl_read(esp_tls_t *tls, char *data, size_t datalen);
  20. /**
  21. * Internal callback API for wolfssl_ssl_write
  22. */
  23. ssize_t esp_wolfssl_write(esp_tls_t *tls, const char *data, size_t datalen);
  24. /**
  25. * Internal Callback for wolfssl_cleanup , frees up all the memory used by wolfssl
  26. */
  27. void esp_wolfssl_cleanup(esp_tls_t *tls);
  28. /**
  29. * Internal Callback for Certificate verification for wolfssl
  30. */
  31. void esp_wolfssl_verify_certificate(esp_tls_t *tls);
  32. /**
  33. * Internal Callback for deleting the wolfssl connection
  34. */
  35. void esp_wolfssl_conn_delete(esp_tls_t *tls);
  36. /**
  37. * Internal Callback for wolfssl_get_bytes_avail
  38. */
  39. ssize_t esp_wolfssl_get_bytes_avail(esp_tls_t *tls);
  40. /**
  41. * Callback function for setting global CA store data for TLS/SSL using wolfssl
  42. */
  43. esp_err_t esp_wolfssl_set_global_ca_store(const unsigned char *cacert_pem_buf, const unsigned int cacert_pem_bytes);
  44. /**
  45. * Callback function for freeing global ca store for TLS/SSL using wolfssl
  46. */
  47. void esp_wolfssl_free_global_ca_store(void);
  48. /**
  49. *
  50. * Callback function for Initializing the global ca store for TLS?SSL using wolfssl
  51. */
  52. esp_err_t esp_wolfssl_init_global_ca_store(void);
  53. /**
  54. * wolfSSL function for Initializing socket wrappers (no-operation for wolfSSL)
  55. */
  56. static inline void esp_wolfssl_net_init(esp_tls_t *tls)
  57. {
  58. }
  59. #ifdef CONFIG_ESP_TLS_SERVER
  60. /**
  61. * Function to Create ESP-TLS Server session with wolfssl Stack
  62. */
  63. int esp_wolfssl_server_session_create(esp_tls_cfg_server_t *cfg, int sockfd, esp_tls_t *tls);
  64. /*
  65. * Delete Server Session
  66. */
  67. void esp_wolfssl_server_session_delete(esp_tls_t *tls);
  68. #endif