mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-08 10:32:53 +03:00
This fix is in preparation for the full coap_new_client_session_psk2() and coap_context_set_psk2() functions. Structures are updated with the necessary information, as well as provide the high level support. As new sessions are now created for every genuine incoming session (#333), coap_context_t will only hold the initial information provided by coap_context_set_psk2() (server mode), but if there is any updated (triggered by SNI or Indentity), this will be kept in coap_session_t. Likewise, the client initial information will be kept in the coap_session_t, and if modified (triggered by Hint) will be kept separately in coap_session_t. This change does not include the support required in the DTLS interface modules other than changes required to make the code compilable and still run the existing examples - so it is a standalone change. Makefile.am: Make coap_dtls_context_set_cpsk, coap_dtls_context_set_spsk, coap_session_refresh_psk_key and coap_session_refresh_psk_hint hidden Remove coap_dtls_context_set_psk include/coap2/*.h: Replace call-back with callback for consistency include/coap2/coap_dtls.h: Include coap_dtls_cpsk_key_t and coap_dtls_spsk_key_t definitions Define coap_dtls_spsk_key_t for the new coap_*_psk2 functions. Include all the new call back function definitions include/coap2/coap_session.h: Update coap_session_t with the new PSK information Define coap_new_client_session_psk2(), coap_session_refresh_psk_key() and coap_session_refresh_psk_hint() functions include/coap2/net.h: Update coap_context_t with the new PSK information Define the coap_context_set_psk2() function include/coap2/str.h: Add in a new struct coap_bin_const_t Define new functions coap_new_bin_const(), coap_delete_bin_const() and coap_binary_equal(). libcoap-2.{map|sym} Expose the new coap_context_set_psk2, coap_new_client_session_psk2, coap_new_bin_const and coap_delete_bin_const functions src/coap_gnutls.c: src/coap_notls.c: src/coap_tinydtls.c: Replace coap_dtls_context_set_psk() with coap_dtls_context_set_spsk() and coap_dtls_context_set_cpsk() src/coap_openssl.c: Replace coap_dtls_context_set_psk() with coap_dtls_context_set_spsk() and coap_dtls_context_set_cpsk() Update the SSL_CTX_use* and SSL_set_* functions with the new variable locations src/coap_session.c: Free off new information on coap_session_t in coap_session_mfree() Build parameters for coap_new_client_session_psk2() in coap_new_client_session_psk() and call coap_new_client_session_psk2() instead of coap_session_create_client(). Create new coap_new_client_session_psk2(). Create new coap_session_refresh_psk_key() (will be used when DTLS interface code is updated src/net.c: Update coap_get_session_client_psk() to use the new PSK locations. Update coap_get_session_server_psk() to use the new PSK locations. Update coap_get_session_server_hint() to use the new PSK locations. Build parameters for coap_context_set_psk2() in coap_context_set_psk() and call coap_context_set_psk2(). Create new coap_context_set_psk2(). Cleanup usage of old PSK information in coap_free_context() src/str.c: Code for coap_new_bin_const() and coap_delete_bin_const() functions