Skip to content

Commit

Permalink
sock_dtls, dsm: Move saving of credential information from dtls sessi…
Browse files Browse the repository at this point in the history
…on to dsm
  • Loading branch information
MarcelStenzel committed Aug 10, 2023
1 parent aa7b3d1 commit f5a1777
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 0 additions & 2 deletions pkg/tinydtls/include/sock_dtls_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ struct sock_dtls {
*/
struct sock_dtls_session {
session_t dtls_session; /**< TinyDTLS session */
credman_tag_t tag; /**< Credman tag used for this session*/
credman_type_t type; /**< Credman type used for this session*/
};

#ifdef __cplusplus
Expand Down
12 changes: 7 additions & 5 deletions sys/net/dsm/dsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ typedef struct {
sock_dtls_session_t session;
dsm_state_t state;
uint32_t last_used_sec;
credman_tag_t tag;
credman_type_t type;
} dsm_session_t;

static int _find_session(sock_dtls_t *sock, sock_dtls_session_t *to_find,
Expand Down Expand Up @@ -160,8 +162,8 @@ int dsm_set_session_credential_info(sock_dtls_t *sock, sock_dtls_session_t *sess
DEBUG("dsm: No session to set the credential information was found\n");
return -1;
}
session_slot->session.type = type;
session_slot->session.tag = tag;
session_slot->type = type;
session_slot->tag = tag;
return 1;
}

Expand All @@ -174,12 +176,12 @@ int dsm_get_session_credential_info(sock_dtls_t *sock, sock_dtls_session_t *sess
DEBUG("dsm: No session to get the credential information from was found\n");
return -1;
}
if (session_slot->session.type == 0 || session_slot->session.tag == 0) {
if (session_slot->type == 0 || session_slot->tag == 0) {
DEBUG("dsm: The credential information for this session was not set\n");
return -2;
}
*type = session_slot->session.type;
*tag = session_slot->session.tag;
*type = session_slot->type;
*tag = session_slot->tag;
return 0;
}

Expand Down

0 comments on commit f5a1777

Please sign in to comment.