Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: VodafoneUSBModem mbed-rtos mbed tinydtls
Revision 2:fe574f2c2b6a, committed 2013-10-18
- Comitter:
- ashleymills
- Date:
- Fri Oct 18 14:08:05 2013 +0000
- Parent:
- 1:1dd9b8218515
- Commit message:
- Updated to tinydtls v0.5.0
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| tinydtls.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 11 14:01:57 2013 +0000
+++ b/main.cpp Fri Oct 18 14:08:05 2013 +0000
@@ -23,24 +23,24 @@
}
}
+static const dtls_psk_key_t client_psk = {
+ .id = (unsigned char *)"Client_identity",
+ .id_length = 15,
+ .key = (unsigned char *)"secretPSK",
+ .key_length = 9
+};
+
/* This function is the "key store" for tinyDTLS. It is called to
* retrieve a key for the given identiy within this particular
* session. */
-int get_key(struct dtls_context_t *ctx,
- const session_t *session,
- const unsigned char *id, size_t id_len,
- const dtls_key_t **result) {
- DBG("get_key called");
+int
+get_psk_key(struct dtls_context_t *ctx,
+ const session_t *session,
+ const unsigned char *id, size_t id_len,
+ const dtls_psk_key_t **result) {
+ DBG("id: %d, len: %d",id,id_len);
+ *result = &client_psk;
- static const dtls_key_t psk = {
- .type = DTLS_KEY_PSK,
- .key.psk.id = (unsigned char *)"Client_identity",
- .key.psk.id_length = 15,
- .key.psk.key = (unsigned char *)"secretPSK",
- .key.psk.key_length = 9
- };
-
- *result = &psk;
return 0;
}
@@ -171,12 +171,14 @@
return 0;
}
-// structure for required tinydtls callbacks
+// structure for required DTLS callbacks
static dtls_handler_t cb = {
.write = send_to_peer,
.read = read_from_peer,
.event = event_handler,
- .get_key = get_key
+ .get_psk_key = get_psk_key,
+ .get_ecdsa_key = NULL,// get_ecdsa_key,
+ .verify_ecdsa_key = NULL//verify_ecdsa_key
};
int main() {
--- a/tinydtls.lib Fri Oct 11 14:01:57 2013 +0000 +++ b/tinydtls.lib Fri Oct 18 14:08:05 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/ashleymills/code/tinydtls/#bc8a649bad13 +http://mbed.org/users/ashleymills/code/tinydtls/#ff9ebe0cf0e9