21#define strcasecmp _stricmp
22#define strncasecmp _strnicmp
32 key->
key.define.ca.s_byte = setup_data->
pki_key.
key.pem.ca_file;
33 key->
key.define.public_cert.s_byte = setup_data->
pki_key.
key.pem.public_cert;
34 key->
key.define.private_key.s_byte = setup_data->
pki_key.
key.pem.private_key;
42 key->
key.define.ca.u_byte = setup_data->
pki_key.
key.asn1.ca_cert;
43 key->
key.define.public_cert.u_byte = setup_data->
pki_key.
key.asn1.public_cert;
44 key->
key.define.private_key.u_byte = setup_data->
pki_key.
key.asn1.private_key;
46 key->
key.define.ca_len = setup_data->
pki_key.
key.asn1.ca_cert_len;
47 key->
key.define.public_cert_len = setup_data->
pki_key.
key.asn1.public_cert_len;
48 key->
key.define.private_key_len = setup_data->
pki_key.
key.asn1.private_key_len;
50 key->
key.define.private_key_type = setup_data->
pki_key.
key.asn1.private_key_type;
58 key->
key.define.ca.u_byte = setup_data->
pki_key.
key.pem_buf.ca_cert;
59 key->
key.define.public_cert.u_byte = setup_data->
pki_key.
key.pem_buf.public_cert;
60 key->
key.define.private_key.u_byte = setup_data->
pki_key.
key.pem_buf.private_key;
62 key->
key.define.ca_len = setup_data->
pki_key.
key.pem_buf.ca_cert_len;
63 key->
key.define.public_cert_len = setup_data->
pki_key.
key.pem_buf.public_cert_len;
64 key->
key.define.private_key_len = setup_data->
pki_key.
key.pem_buf.private_key_len;
84 key->
key.define.ca.s_byte = setup_data->
pki_key.
key.pkcs11.ca;
85 key->
key.define.public_cert.s_byte = setup_data->
pki_key.
key.pkcs11.public_cert;
86 key->
key.define.private_key.s_byte = setup_data->
pki_key.
key.pkcs11.private_key;
88 key->
key.define.user_pin = setup_data->
pki_key.
key.pkcs11.user_pin;
90 if (strncasecmp(key->
key.pkcs11.ca,
"pkcs11:", 7) == 0) {
103 if (strncasecmp(key->
key.pkcs11.public_cert,
"pkcs11:", 7) == 0) {
116 if (strncasecmp(key->
key.pkcs11.private_key,
"pkcs11:", 7) == 0) {
138#if (COAP_MAX_LOGGING_LEVEL >= _COAP_LOG_ERR)
167#if (COAP_MAX_LOGGING_LEVEL >= _COAP_LOG_ERR)
173 coap_log_warn(
"*** setup_pki: (D)TLS: %s: %s CA configure failure\n",
178 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s CA type not supported\n",
183 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s CA not defined\n",
194 coap_log_warn(
"*** setup_pki: (D)TLS: %s: %s Root CA configure failure\n",
199 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Root CA type not supported\n",
204 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Root CA not defined\n",
215 coap_log_warn(
"*** setup_pki: (D)TLS: %s: %s Certificate configure failure\n",
220 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Certificate type not supported\n",
225 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Certificate not defined\n",
236 coap_log_warn(
"*** setup_pki: (D)TLS: %s: %s Private Key configure failure\n",
241 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Private Key type not supported\n",
246 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Private Key not defined\n",
268#if COAP_CLIENT_SUPPORT
272#if COAP_SERVER_SUPPORT
297#if COAP_CLIENT_SUPPORT
301#if COAP_SERVER_SUPPORT
static const char * coap_dtls_get_define_type(coap_pki_define_t def, coap_const_char_ptr_t name)
@ COAP_NACK_TLS_LAYER_FAILED
Library specific build wrapper for coap_internal.h.
void coap_dtls_free_session(coap_session_t *coap_session COAP_UNUSED)
void coap_tls_free_session(coap_session_t *coap_session COAP_UNUSED)
void coap_ticks(coap_tick_t *)
Returns the current value of an internal tick counter.
void * coap_tls_new_server_session(coap_session_t *coap_session)
Create a TLS new server-side session.
int coap_dtls_define_issue(coap_define_issue_key_t type, coap_define_issue_fail_t fail, coap_dtls_key_t *key, const coap_dtls_role_t role, int ret)
Report PKI DEFINE type issue.
void * coap_dtls_new_client_session(coap_session_t *coap_session)
Create a new client-side session.
void coap_tls_establish(coap_session_t *session)
Layer function interface for layer below TLS accept/connect being established.
void coap_dtls_establish(coap_session_t *session)
Layer function interface for layer below DTLS connect being established.
void * coap_dtls_new_server_session(coap_session_t *coap_session)
Create a new DTLS server-side session.
void * coap_tls_new_client_session(coap_session_t *coap_session)
Create a new TLS client-side session.
void coap_dtls_map_key_type_to_define(const coap_dtls_pki_t *setup_data, coap_dtls_key_t *key)
Map the PKI key definitions to the new DEFINE format.
void coap_tls_close(coap_session_t *session)
Layer function interface for TLS close for a session.
void coap_dtls_close(coap_session_t *session)
Layer function interface for DTLS close for a session.
@ COAP_DEFINE_KEY_PRIVATE
@ COAP_DEFINE_KEY_ROOT_CA
@ COAP_DEFINE_FAIL_NOT_SUPPORTED
coap_pki_define_t
The enum to define the format of the key parameter definition.
@ COAP_PKI_KEY_DEF_PKCS11
The PKI key type is PKCS11 (pkcs11:...).
@ COAP_PKI_KEY_DEF_DER_BUF
The PKI key type is DER buffer (ASN.1).
@ COAP_PKI_KEY_DEF_PEM_BUF
The PKI key type is PEM buffer.
@ COAP_PKI_KEY_DEF_PEM
The PKI key type is PEM file.
@ COAP_PKI_KEY_DEF_ENGINE
The PKI key type is to be passed to ENGINE.
@ COAP_PKI_KEY_DEF_RPK_BUF
The PKI key type is RPK in buffer.
@ COAP_PKI_KEY_DEF_DER
The PKI key type is DER file.
@ COAP_PKI_KEY_DEF_PKCS11_RPK
The PKI key type is PKCS11 w/ RPK (pkcs11:...).
@ COAP_DTLS_ROLE_SERVER
Internal function invoked for server.
@ COAP_PKI_KEY_PKCS11
The PKI key type is PKCS11 (DER).
@ COAP_PKI_KEY_PEM_BUF
The PKI key type is PEM buffer.
@ COAP_PKI_KEY_DEFINE
The individual PKI key types are Definable.
@ COAP_PKI_KEY_PEM
The PKI key type is PEM file.
@ COAP_PKI_KEY_ASN1
The PKI key type is ASN.1 (DER) buffer.
#define coap_log_warn(...)
#define coap_log_err(...)
void coap_session_disconnected_lkd(coap_session_t *session, coap_nack_reason_t reason)
Notify session that it has failed.
@ COAP_SESSION_TYPE_CLIENT
client-side
@ COAP_SESSION_STATE_HANDSHAKE
The structure that holds the PKI key information.
union coap_dtls_key_t::@332042164257017036137116140373246301042222333011 key
coap_pki_key_t key_type
key format type
The structure used for defining the PKI setup data to be used.
uint8_t is_rpk_not_cert
1 is RPK instead of Public Certificate.
coap_dtls_key_t pki_key
PKI key definition.
coap_layer_close_t l_close
The structure that holds the PKI Definable key type definitions.
coap_const_char_ptr_t public_cert
define: Public Cert
coap_const_char_ptr_t private_key
define: Private Key
coap_const_char_ptr_t ca
define: Common CA Certificate
coap_pki_define_t private_key_def
define: Private Key type definition
coap_pki_define_t ca_def
define: Common CA type definition
coap_pki_define_t public_cert_def
define: Public Cert type definition
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
coap_socket_t sock
socket object for the session, if any
coap_session_state_t state
current state of relationship with peer
void * tls
security parameters
coap_session_type_t type
client or server side socket
coap_layer_func_t lfunc[COAP_LAYER_LAST]
Layer functions to use.
CoAP union for handling signed / unsigned chars.
const char * s_byte
signed char ptr