esp_tls_wolfssl.h 2.2 KB

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