{"action":"created","comment":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/comments/46471282","id":46471282,"diff_hunk":"@@ -0,0 +1,286 @@\n+/*\n+ * Copyright (C) 2015 Olaf Bergmann <bergmann@tzi.org>\n+ * Copyright (C) 2015 Hauke Mehrtens <hauke@hauke-m.de>\n+ * Copyright (C) 2015 INRIA\n+ *\n+ * This file is subject to the terms and conditions of the GNU Lesser\n+ * General Public License v2.1. See the file LICENSE in the top level\n+ * directory for more details.\n+ */\n+\n+/**\n+ * @ingroup     examples\n+ * @{\n+ *\n+ * @file\n+ * @brief       TinyDTLS client\n+ *\n+ * @author      Olaf Bergmann <bergmann@tzi.org>\n+ * @author      Hauke Mehrtens <hauke@hauke-m.de>\n+ * @author      Oliver Hahm <oliver.hahm@inria.fr>\n+ *\n+ * @}\n+ */\n+\n+#include \"tinydtls.h\"\n+\n+#include <stdio.h>\n+#include <string.h>\n+#include <errno.h>\n+#include <unistd.h>\n+#include <ctype.h>\n+#include <netinet/in.h>\n+#include <sys/types.h>\n+#include <sys/socket.h>\n+#include <sys/time.h>\n+#include <arpa/inet.h>\n+#include <signal.h>\n+\n+#include \"thread.h\"\n+#include \"assert.h\"\n+#include \"byteorder.h\"\n+#include \"global.h\"\n+#include \"tinydtls_debug.h\"\n+#include \"dtls.h\"\n+#include \"riot_tinydtls.h\"\n+\n+#include \"dtls_app.h\"\n+\n+#define DEFAULT_PORT 20220\n+\n+#define PSK_DEFAULT_IDENTITY \"Client_identity\"\n+#define PSK_DEFAULT_KEY      \"secretPSK\"\n+#define PSK_OPTIONS          \"i:k:\"\n+\n+#define CLIENT_QUEUE_SIZE     (8)\n+static msg_t _client_msg_queue[CLIENT_QUEUE_SIZE];\n+\n+char client_reader[THREAD_STACKSIZE_DEFAULT];\n+\n+typedef struct {\n+    size_t length;              /* length of string */\n+    unsigned char *s;           /* string data */\n+} dtls_str;\n+\n+static dtls_context_t *dtls_context = NULL;\n+static session_t dst;\n+\n+\n+static const unsigned char ecdsa_priv_key[] = {\n+    0x41, 0xC1, 0xCB, 0x6B, 0x51, 0x24, 0x7A, 0x14,\n+    0x43, 0x21, 0x43, 0x5B, 0x7A, 0x80, 0xE7, 0x14,\n+    0x89, 0x6A, 0x33, 0xBB, 0xAD, 0x72, 0x94, 0xCA,\n+    0x40, 0x14, 0x55, 0xA1, 0x94, 0xA9, 0x49, 0xFA\n+};\n+\n+static const unsigned char ecdsa_pub_key_x[] = {\n+    0x36, 0xDF, 0xE2, 0xC6, 0xF9, 0xF2, 0xED, 0x29,\n+    0xDA, 0x0A, 0x9A, 0x8F, 0x62, 0x68, 0x4E, 0x91,\n+    0x63, 0x75, 0xBA, 0x10, 0x30, 0x0C, 0x28, 0xC5,\n+    0xE4, 0x7C, 0xFB, 0xF2, 0x5F, 0xA5, 0x8F, 0x52\n+};\n+\n+static const unsigned char ecdsa_pub_key_y[] = {\n+    0x71, 0xA0, 0xD4, 0xFC, 0xDE, 0x1A, 0xB8, 0x78,\n+    0x5A, 0x3C, 0x78, 0x69, 0x35, 0xA7, 0xCF, 0xAB,\n+    0xE9, 0x3F, 0x98, 0x72, 0x09, 0xDA, 0xED, 0x0B,\n+    0x4F, 0xAB, 0xC3, 0x6F, 0xC7, 0x72, 0xF8, 0x29\n+};\n+\n+#ifdef DTLS_PSK\n+/* The PSK information for DTLS */\n+#define PSK_ID_MAXLEN 256\n+#define PSK_MAXLEN 256\n+static unsigned char psk_id[PSK_ID_MAXLEN];\n+static size_t psk_id_length = 0;\n+static unsigned char psk_key[PSK_MAXLEN];\n+static size_t psk_key_length = 0;\n+\n+/* This function is the \"key store\" for tinyDTLS. It is called to\n+ * retrieve a key for the given identity within this particular\n+ * session. */\n+static int get_psk_info(struct dtls_context_t *ctx, const session_t *session,\n+             dtls_credentials_type_t type, const unsigned char *id,","path":"examples/dtls/dtls-client.c","position":null,"original_position":103,"commit_id":"bee02bef98dcad7a914c19183b72a3928fc1ee12","original_commit_id":"fcf8a6e5e90b72818358c4451616d5dce749ee1e","user":{"login":"OlegHahm","id":1590423,"avatar_url":"https://avatars.githubusercontent.com/u/1590423?v=3","gravatar_id":"","url":"https://api.github.com/users/OlegHahm","html_url":"https://github.com/OlegHahm","followers_url":"https://api.github.com/users/OlegHahm/followers","following_url":"https://api.github.com/users/OlegHahm/following{/other_user}","gists_url":"https://api.github.com/users/OlegHahm/gists{/gist_id}","starred_url":"https://api.github.com/users/OlegHahm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlegHahm/subscriptions","organizations_url":"https://api.github.com/users/OlegHahm/orgs","repos_url":"https://api.github.com/users/OlegHahm/repos","events_url":"https://api.github.com/users/OlegHahm/events{/privacy}","received_events_url":"https://api.github.com/users/OlegHahm/received_events","type":"User","site_admin":false},"body":"addressed","created_at":"2015-12-02T20:34:19Z","updated_at":"2015-12-02T20:34:19Z","html_url":"https://github.com/RIOT-OS/RIOT/pull/4308#discussion_r46471282","pull_request_url":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/4308","_links":{"self":{"href":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/comments/46471282"},"html":{"href":"https://github.com/RIOT-OS/RIOT/pull/4308#discussion_r46471282"},"pull_request":{"href":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/4308"}}},"pull_request":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/4308","id":51167650,"html_url":"https://github.com/RIOT-OS/RIOT/pull/4308","diff_url":"https://github.com/RIOT-OS/RIOT/pull/4308.diff","patch_url":"https://github.com/RIOT-OS/RIOT/pull/4308.patch","issue_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/4308","number":4308,"state":"open","locked":false,"title":"Initial import of tinydtls as a package","user":{"login":"OlegHahm","id":1590423,"avatar_url":"https://avatars.githubusercontent.com/u/1590423?v=3","gravatar_id":"","url":"https://api.github.com/users/OlegHahm","html_url":"https://github.com/OlegHahm","followers_url":"https://api.github.com/users/OlegHahm/followers","following_url":"https://api.github.com/users/OlegHahm/following{/other_user}","gists_url":"https://api.github.com/users/OlegHahm/gists{/gist_id}","starred_url":"https://api.github.com/users/OlegHahm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlegHahm/subscriptions","organizations_url":"https://api.github.com/users/OlegHahm/orgs","repos_url":"https://api.github.com/users/OlegHahm/repos","events_url":"https://api.github.com/users/OlegHahm/events{/privacy}","received_events_url":"https://api.github.com/users/OlegHahm/received_events","type":"User","site_admin":false},"body":"Particular the application needs some more work.\r\n\r\n~~Depends on #4326 and #4327 to work.~~","created_at":"2015-11-19T01:18:17Z","updated_at":"2015-12-02T20:34:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1995a977fad6cd8a6abe4ea8f39db8c34e83a20","assignee":{"login":"emmanuelsearch","id":3717254,"avatar_url":"https://avatars.githubusercontent.com/u/3717254?v=3","gravatar_id":"","url":"https://api.github.com/users/emmanuelsearch","html_url":"https://github.com/emmanuelsearch","followers_url":"https://api.github.com/users/emmanuelsearch/followers","following_url":"https://api.github.com/users/emmanuelsearch/following{/other_user}","gists_url":"https://api.github.com/users/emmanuelsearch/gists{/gist_id}","starred_url":"https://api.github.com/users/emmanuelsearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emmanuelsearch/subscriptions","organizations_url":"https://api.github.com/users/emmanuelsearch/orgs","repos_url":"https://api.github.com/users/emmanuelsearch/repos","events_url":"https://api.github.com/users/emmanuelsearch/events{/privacy}","received_events_url":"https://api.github.com/users/emmanuelsearch/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/milestones/10","html_url":"https://github.com/RIOT-OS/RIOT/milestones/Release%202015.12","labels_url":"https://api.github.com/repos/RIOT-OS/RIOT/milestones/10/labels","id":871004,"number":10,"title":"Release 2015.12","description":"This is the next major milestone.","creator":{"login":"OlegHahm","id":1590423,"avatar_url":"https://avatars.githubusercontent.com/u/1590423?v=3","gravatar_id":"","url":"https://api.github.com/users/OlegHahm","html_url":"https://github.com/OlegHahm","followers_url":"https://api.github.com/users/OlegHahm/followers","following_url":"https://api.github.com/users/OlegHahm/following{/other_user}","gists_url":"https://api.github.com/users/OlegHahm/gists{/gist_id}","starred_url":"https://api.github.com/users/OlegHahm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlegHahm/subscriptions","organizations_url":"https://api.github.com/users/OlegHahm/orgs","repos_url":"https://api.github.com/users/OlegHahm/repos","events_url":"https://api.github.com/users/OlegHahm/events{/privacy}","received_events_url":"https://api.github.com/users/OlegHahm/received_events","type":"User","site_admin":false},"open_issues":100,"closed_issues":199,"state":"open","created_at":"2014-11-18T10:51:58Z","updated_at":"2015-12-02T18:17:20Z","due_on":"2015-12-07T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/4308/commits","review_comments_url":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/4308/comments","review_comment_url":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/4308/comments","statuses_url":"https://api.github.com/repos/RIOT-OS/RIOT/statuses/bee02bef98dcad7a914c19183b72a3928fc1ee12","head":{"label":"OlegHahm:tinydtls","ref":"tinydtls","sha":"bee02bef98dcad7a914c19183b72a3928fc1ee12","user":{"login":"OlegHahm","id":1590423,"avatar_url":"https://avatars.githubusercontent.com/u/1590423?v=3","gravatar_id":"","url":"https://api.github.com/users/OlegHahm","html_url":"https://github.com/OlegHahm","followers_url":"https://api.github.com/users/OlegHahm/followers","following_url":"https://api.github.com/users/OlegHahm/following{/other_user}","gists_url":"https://api.github.com/users/OlegHahm/gists{/gist_id}","starred_url":"https://api.github.com/users/OlegHahm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlegHahm/subscriptions","organizations_url":"https://api.github.com/users/OlegHahm/orgs","repos_url":"https://api.github.com/users/OlegHahm/repos","events_url":"https://api.github.com/users/OlegHahm/events{/privacy}","received_events_url":"https://api.github.com/users/OlegHahm/received_events","type":"User","site_admin":false},"repo":{"id":10973192,"name":"RIOT","full_name":"OlegHahm/RIOT","owner":{"login":"OlegHahm","id":1590423,"avatar_url":"https://avatars.githubusercontent.com/u/1590423?v=3","gravatar_id":"","url":"https://api.github.com/users/OlegHahm","html_url":"https://github.com/OlegHahm","followers_url":"https://api.github.com/users/OlegHahm/followers","following_url":"https://api.github.com/users/OlegHahm/following{/other_user}","gists_url":"https://api.github.com/users/OlegHahm/gists{/gist_id}","starred_url":"https://api.github.com/users/OlegHahm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlegHahm/subscriptions","organizations_url":"https://api.github.com/users/OlegHahm/orgs","repos_url":"https://api.github.com/users/OlegHahm/repos","events_url":"https://api.github.com/users/OlegHahm/events{/privacy}","received_events_url":"https://api.github.com/users/OlegHahm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/OlegHahm/RIOT","description":"RIOT OS -  The rambling OS for the IoT","fork":true,"url":"https://api.github.com/repos/OlegHahm/RIOT","forks_url":"https://api.github.com/repos/OlegHahm/RIOT/forks","keys_url":"https://api.github.com/repos/OlegHahm/RIOT/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OlegHahm/RIOT/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OlegHahm/RIOT/teams","hooks_url":"https://api.github.com/repos/OlegHahm/RIOT/hooks","issue_events_url":"https://api.github.com/repos/OlegHahm/RIOT/issues/events{/number}","events_url":"https://api.github.com/repos/OlegHahm/RIOT/events","assignees_url":"https://api.github.com/repos/OlegHahm/RIOT/assignees{/user}","branches_url":"https://api.github.com/repos/OlegHahm/RIOT/branches{/branch}","tags_url":"https://api.github.com/repos/OlegHahm/RIOT/tags","blobs_url":"https://api.github.com/repos/OlegHahm/RIOT/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OlegHahm/RIOT/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OlegHahm/RIOT/git/refs{/sha}","trees_url":"https://api.github.com/repos/OlegHahm/RIOT/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OlegHahm/RIOT/statuses/{sha}","languages_url":"https://api.github.com/repos/OlegHahm/RIOT/languages","stargazers_url":"https://api.github.com/repos/OlegHahm/RIOT/stargazers","contributors_url":"https://api.github.com/repos/OlegHahm/RIOT/contributors","subscribers_url":"https://api.github.com/repos/OlegHahm/RIOT/subscribers","subscription_url":"https://api.github.com/repos/OlegHahm/RIOT/subscription","commits_url":"https://api.github.com/repos/OlegHahm/RIOT/commits{/sha}","git_commits_url":"https://api.github.com/repos/OlegHahm/RIOT/git/commits{/sha}","comments_url":"https://api.github.com/repos/OlegHahm/RIOT/comments{/number}","issue_comment_url":"https://api.github.com/repos/OlegHahm/RIOT/issues/comments{/number}","contents_url":"https://api.github.com/repos/OlegHahm/RIOT/contents/{+path}","compare_url":"https://api.github.com/repos/OlegHahm/RIOT/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OlegHahm/RIOT/merges","archive_url":"https://api.github.com/repos/OlegHahm/RIOT/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OlegHahm/RIOT/downloads","issues_url":"https://api.github.com/repos/OlegHahm/RIOT/issues{/number}","pulls_url":"https://api.github.com/repos/OlegHahm/RIOT/pulls{/number}","milestones_url":"https://api.github.com/repos/OlegHahm/RIOT/milestones{/number}","notifications_url":"https://api.github.com/repos/OlegHahm/RIOT/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OlegHahm/RIOT/labels{/name}","releases_url":"https://api.github.com/repos/OlegHahm/RIOT/releases{/id}","created_at":"2013-06-26T16:32:09Z","updated_at":"2015-11-19T16:05:05Z","pushed_at":"2015-12-02T20:34:14Z","git_url":"git://github.com/OlegHahm/RIOT.git","ssh_url":"git@github.com:OlegHahm/RIOT.git","clone_url":"https://github.com/OlegHahm/RIOT.git","svn_url":"https://github.com/OlegHahm/RIOT","homepage":"https://github.com/RIOT-OS/RIOT/wiki","size":25859,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"RIOT-OS:master","ref":"master","sha":"c8f00d0ac523ba4b3d069ac045b3cd25bec8ba5e","user":{"login":"RIOT-OS","id":3079480,"avatar_url":"https://avatars.githubusercontent.com/u/3079480?v=3","gravatar_id":"","url":"https://api.github.com/users/RIOT-OS","html_url":"https://github.com/RIOT-OS","followers_url":"https://api.github.com/users/RIOT-OS/followers","following_url":"https://api.github.com/users/RIOT-OS/following{/other_user}","gists_url":"https://api.github.com/users/RIOT-OS/gists{/gist_id}","starred_url":"https://api.github.com/users/RIOT-OS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RIOT-OS/subscriptions","organizations_url":"https://api.github.com/users/RIOT-OS/orgs","repos_url":"https://api.github.com/users/RIOT-OS/repos","events_url":"https://api.github.com/users/RIOT-OS/events{/privacy}","received_events_url":"https://api.github.com/users/RIOT-OS/received_events","type":"Organization","site_admin":false},"repo":{"id":7370241,"name":"RIOT","full_name":"RIOT-OS/RIOT","owner":{"login":"RIOT-OS","id":3079480,"avatar_url":"https://avatars.githubusercontent.com/u/3079480?v=3","gravatar_id":"","url":"https://api.github.com/users/RIOT-OS","html_url":"https://github.com/RIOT-OS","followers_url":"https://api.github.com/users/RIOT-OS/followers","following_url":"https://api.github.com/users/RIOT-OS/following{/other_user}","gists_url":"https://api.github.com/users/RIOT-OS/gists{/gist_id}","starred_url":"https://api.github.com/users/RIOT-OS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RIOT-OS/subscriptions","organizations_url":"https://api.github.com/users/RIOT-OS/orgs","repos_url":"https://api.github.com/users/RIOT-OS/repos","events_url":"https://api.github.com/users/RIOT-OS/events{/privacy}","received_events_url":"https://api.github.com/users/RIOT-OS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RIOT-OS/RIOT","description":"RIOT -  The friendly OS for IoT","fork":false,"url":"https://api.github.com/repos/RIOT-OS/RIOT","forks_url":"https://api.github.com/repos/RIOT-OS/RIOT/forks","keys_url":"https://api.github.com/repos/RIOT-OS/RIOT/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RIOT-OS/RIOT/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RIOT-OS/RIOT/teams","hooks_url":"https://api.github.com/repos/RIOT-OS/RIOT/hooks","issue_events_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/events{/number}","events_url":"https://api.github.com/repos/RIOT-OS/RIOT/events","assignees_url":"https://api.github.com/repos/RIOT-OS/RIOT/assignees{/user}","branches_url":"https://api.github.com/repos/RIOT-OS/RIOT/branches{/branch}","tags_url":"https://api.github.com/repos/RIOT-OS/RIOT/tags","blobs_url":"https://api.github.com/repos/RIOT-OS/RIOT/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RIOT-OS/RIOT/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RIOT-OS/RIOT/git/refs{/sha}","trees_url":"https://api.github.com/repos/RIOT-OS/RIOT/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RIOT-OS/RIOT/statuses/{sha}","languages_url":"https://api.github.com/repos/RIOT-OS/RIOT/languages","stargazers_url":"https://api.github.com/repos/RIOT-OS/RIOT/stargazers","contributors_url":"https://api.github.com/repos/RIOT-OS/RIOT/contributors","subscribers_url":"https://api.github.com/repos/RIOT-OS/RIOT/subscribers","subscription_url":"https://api.github.com/repos/RIOT-OS/RIOT/subscription","commits_url":"https://api.github.com/repos/RIOT-OS/RIOT/commits{/sha}","git_commits_url":"https://api.github.com/repos/RIOT-OS/RIOT/git/commits{/sha}","comments_url":"https://api.github.com/repos/RIOT-OS/RIOT/comments{/number}","issue_comment_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/comments{/number}","contents_url":"https://api.github.com/repos/RIOT-OS/RIOT/contents/{+path}","compare_url":"https://api.github.com/repos/RIOT-OS/RIOT/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RIOT-OS/RIOT/merges","archive_url":"https://api.github.com/repos/RIOT-OS/RIOT/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RIOT-OS/RIOT/downloads","issues_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues{/number}","pulls_url":"https://api.github.com/repos/RIOT-OS/RIOT/pulls{/number}","milestones_url":"https://api.github.com/repos/RIOT-OS/RIOT/milestones{/number}","notifications_url":"https://api.github.com/repos/RIOT-OS/RIOT/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RIOT-OS/RIOT/labels{/name}","releases_url":"https://api.github.com/repos/RIOT-OS/RIOT/releases{/id}","created_at":"2012-12-29T20:38:40Z","updated_at":"2015-12-02T18:35:38Z","pushed_at":"2015-12-02T20:34:15Z","git_url":"git://github.com/RIOT-OS/RIOT.git","ssh_url":"git@github.com:RIOT-OS/RIOT.git","clone_url":"https://github.com/RIOT-OS/RIOT.git","svn_url":"https://github.com/RIOT-OS/RIOT","homepage":"https://github.com/RIOT-OS/RIOT/wiki","size":78129,"stargazers_count":569,"watchers_count":569,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":440,"mirror_url":null,"open_issues_count":414,"forks":440,"open_issues":414,"watchers":569,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/4308"},"html":{"href":"https://github.com/RIOT-OS/RIOT/pull/4308"},"issue":{"href":"https://api.github.com/repos/RIOT-OS/RIOT/issues/4308"},"comments":{"href":"https://api.github.com/repos/RIOT-OS/RIOT/issues/4308/comments"},"review_comments":{"href":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/4308/comments"},"review_comment":{"href":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/4308/commits"},"statuses":{"href":"https://api.github.com/repos/RIOT-OS/RIOT/statuses/bee02bef98dcad7a914c19183b72a3928fc1ee12"}}}}