├── .gitignore
├── CONTRIBUTING.md
├── LICENSE.txt
├── Makefile
├── README.md
├── TODO.md
├── ble_scan.c
├── ble_scan.h
├── cert.c
├── contactstore.c
├── contactstore.h
├── dp3t-config.h
├── dp3t.c
├── dp3t.h
├── dtls-client.c
├── dtls-server.c
├── gatt-srv.c
├── keystore.c
├── keystore.h
├── main.c
├── mykey.pub
├── nvmc.c
├── nvmc.h
├── pubkey.der
├── random.c
├── random.h
├── rsa-server-cert.der
├── rsa-server-key.der
├── server-cert.der
└── server-key.der
/.gitignore:
--------------------------------------------------------------------------------
1 | # Object files
2 | *.o
3 | # Documentation artifacts
4 | doc/doxygen/html
5 | doc/doxygen/latex
6 | doc/doxygen/man
7 | doc/doxygen/*.log
8 | doc/doxygen/*.db
9 | doc/doxygen/*.tmp
10 | # Built binaries
11 | *bin
12 | # Build directory
13 | /build
14 | # Backup files
15 | *~
16 | *.orig
17 | .*.swp
18 | cachegrind.out*
19 | # Eclipse workspace files
20 | .project
21 | .cproject
22 | .settings
23 | .idea
24 | # KDevelop4 project files
25 | .kdev4
26 | *.kdev4
27 | # Codelite (among others) project files
28 | *.project
29 | # Visual Studio Code user settings
30 | .vscode/
31 | # ctags index files
32 | tags
33 | # GDB initialization scripts
34 | .gdbinit
35 |
36 | # Eclipse symbol file (output from make eclipsesym)
37 | eclipsesym.xml
38 | /toolchain
39 | # Ignore created Arduino sketch files
40 | _sketches.cpp
41 |
42 | # local override files
43 | Makefile.local
44 |
45 | # Vagrant
46 | .vagrant
47 |
48 | # clang-complete command line argument lists (Vim: clang-complete, Atom: linter-clang, autocomplete-clang addons)
49 | .clang_complete
50 | # YouCompleteMe (https://github.com/Valloric/YouCompleteMe)
51 | .ycm_extra_conf.py
52 |
53 | # Python compiled files
54 | *.pyc
55 |
56 | # Ignore download cache
57 | .dlcache
58 |
59 | # scan-build artifacts
60 | scan-build/
61 |
62 | # compile_and_test_for_boards default "results" directory
63 | results/
64 |
65 | # mypy artifacts
66 | .mypy_cache/
67 |
68 | # Clangd compile flags (language server)
69 | compile_commands.json
70 | compile_flags.txt
71 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Dyne.org - Contributor License Agreement
2 |
3 | This Contributor Agreement (“CA”) applies to the contribution specified in section "Terms" below that you make to any product or project managed by us (the “project”), and sets out the intellectual property rights you grant to us in the contributed materials. The term “us” shall mean Dyne.org Foundation. The term “you” shall mean the person or entity identified below. If you agree to be bound by these terms, fill in the information requested and [sign the Dyne.org CA](https://dyne.org/cla). Read this agreement carefully before signing. These terms and conditions constitute a binding legal agreement.
4 |
5 | ## Terms
6 |
7 | The term 'contribution' or ‘contributed materials’ means the following: any source code, object code, patch, tool, sample, graphic, specification, manual, documentation, or any other material posted or submitted by you to the Zenroom stack and/or any project owned by us, publicly or privately distributed.
8 |
9 | ## Copyrights
10 |
11 | With respect to any worldwide copyrights, or copyright applications and registrations, in your contribution:
12 | - you hereby grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, royalty-free, unrestricted license to exercise all rights under those copyrights. This includes, at our option, the right to sublicense these same rights to third parties through multiple levels of sublicensees or other licensing arrangements;
13 | - you agree that each of us can do all things in relation to your contribution as if each of us were the sole owners, and if one of us makes a derivative work of your contribution, the one who makes the derivative work (or has it made) will be the sole owner of that derivative work;
14 | - you agree that you will not assert any moral rights in your contribution against us, our licensees or transferees;
15 | - you agree that we may register a copyright in your contribution and exercise all ownership rights associated with it; and
16 | - you agree that neither of us has any duty to consult with, obtain the consent of, pay or render an accounting to the other for any use or distribution of your contribution.
17 |
18 | ## Patents
19 |
20 | With respect to any patents you own, or that you can license without payment to any third party, you hereby grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, royalty-free license to:
21 | - make, have made, use, sell, offer to sell, import, and otherwise transfer your contribution in whole or in part, alone or in combination with or included in any product, work or materials arising out of the project to which your contribution was submitted, and
22 | - at our option, to sublicense these same rights to third parties through multiple levels of sublicensees or other licensing arrangements.
23 |
24 | ## Free availability
25 |
26 | Except as set out above, you keep all right, title, and interest in your contribution. The rights that you grant to us under these terms are effective on the date you first submitted a contribution to us, even if your submission took place before the date you sign these terms. Any contribution we make available under any license will also be made available under a suitable FSF (Free Software Foundation) or DECODE project's approved license.
27 |
28 | ## Covenant
29 |
30 | You covenant, represent, warrant and agree that:
31 | - each contribution that you submit is and shall be an original work of authorship and you can legally grant the rights set out in this CA;
32 | - to the best of your knowledge, each contribution will not violate any third party's copyrights, trademarks, patents, or other intellectual property rights; and You agree to notify us if you become aware of any circumstance which would make any of the foregoing representations inaccurate in any respect. We may publicly disclose your participation in the project, including the fact that you have signed the CA.
33 |
34 | ## Jurisdiction
35 |
36 | This CA is governed by the laws of the courts of Amsterdam and applicable to Dutch laws. Any choice of law rules will not apply.
37 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published
637 | by the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
662 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # name of your application
2 | APPLICATION = dp3t
3 |
4 | # If no BOARD is found in the environment, use this default:
5 | BOARD ?= nrf52dk
6 |
7 | # This has to be the absolute path to the RIOT base directory:
8 | RIOTBASE ?= $(CURDIR)/../RIOT/
9 |
10 | # wolfSSL supports 32-bit architectures only
11 | BOARD_BLACKLIST := arduino-duemilanove arduino-leonardo arduino-mega2560 arduino-nano arduino-uno \
12 | chronos jiminy-mega256rfr2 mega-xplained msb-430 msb-430h telosb \
13 | waspmote-pro wsn430-v1_3b wsn430-v1_4 z1
14 |
15 | BOARD_INSUFFICIENT_MEMORY := airfy-beacon b-l072z-lrwan1 bluepill \
16 | calliope-mini cc2650-launchpad cc2650stk hifive1 i-nucleo-lrwan1 \
17 | maple-mini microbit nrf51dongle nrf6310 nucleo-f031k6 \
18 | nucleo-f042k6 nucleo-f303k8 nucleo-f303k8 nucleo-l031k6 nucleo-f030r8 \
19 | nucleo-f070rb nucleo-f072rb nucleo-f103rb nucleo-f302r8 nucleo-f334r8 \
20 | nucleo-l031k6 nucleo-l053r8 nucleo-l073rz opencm904 \
21 | saml11-xpro bluepill blackpill saml10-xpro \
22 | stm32l0538-disco \
23 | spark-core stm32f0discovery stm32mindev yunjia-nrf51822
24 |
25 | # Include packages that pull up and auto-init the link layer.
26 | # NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present
27 | USEMODULE += gnrc_netdev_default
28 | USEMODULE += auto_init_gnrc_netif
29 | # Specify the mandatory networking modules for IPv6 and UDP
30 | USEMODULE += gnrc_ipv6_default
31 | USEMODULE += gnrc_sock_udp
32 |
33 | # Add also the shell, some shell commands
34 | USEMODULE += shell
35 | USEMODULE += shell_commands
36 |
37 | USEPKG += nimble
38 | USEMODULE += nimble_scanner
39 | USEMODULE += nimble_scanlist
40 | USEMODULE += nimble_svc_gap
41 | USEMODULE += nimble_svc_gatt
42 | USEMODULE += event_timeout
43 |
44 | USEPKG += wolfssl
45 | USEMODULE += wolfcrypt
46 | USEMODULE += wolfssl
47 | USEMODULE += wolfssl_dtls
48 |
49 | # Select public key algorithm (or PSK) support fot ciphersuite(s):
50 | #USEMODULE += wolfcrypt_ecc
51 | #USEMODULE += wolfcrypt_rsa wolfcrypt_dh
52 | USEMODULE += wolfcrypt_hmac wolfcrypt_aes_ctr wolfcrypt_aes
53 | USEMODULE += wolfssl_psk
54 | #USEMODULE += wolfcrypt-test
55 |
56 | # Uncomment the following line to add debug symbols
57 | CFLAGS+=-g -ggdb3
58 | #CFLAGS+=-Os
59 |
60 | CFLAGS += -DDTLS_DEFAULT_PORT=$(DTLS_PORT) -DDTLS_WOLFSSL -Wno-unused-parameter -Wno-unused-variable -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT
61 |
62 | # A larger stack size is required if using ECC or RSA
63 | CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(3*THREAD_STACKSIZE_DEFAULT\)
64 |
65 | # Comment this out to disable code in RIOT that does safety checking
66 | # which is not needed in a production environment but helps in the
67 | # development process:
68 | CFLAGS += -DDEVELHELP
69 |
70 | # Change this to 0 show compiler invocation lines by default:
71 | QUIET ?= 1
72 |
73 | include $(RIOTBASE)/Makefile.include
74 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | DECODE Proximity embedded
2 | Implementing DP-3T (embedded nRF52 version)
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | This project is a privacy-preserving and decentralized alternative to the Dutch
15 | `#coronaApp`.
16 |
17 | It will adhere to the technological demands published last week in the
18 | [‘Veilig tegen corona’ manifesto](https://www.veiligtegencorona.nl/).
19 |
20 | The decode-proximity provides virus tracking and a warning system with a
21 | proximity alert. Every device broadcasts its proximity to other devices,
22 | privately recording when two people have been close (only the device owners
23 | know!).
24 |
25 | If a user gets an alert from the device they can request a test for a corona
26 | diagnosis. If positive they can scan a QRCode from the GGD to anonymously
27 | upload a notice for all other users that have been close to them, to let them
28 | know of the risk.
29 |
30 | ❗ Please note: there are NO personal data stored on the central server. The
31 | secret key and the ephemeral ids can NOT be traced to identifiable people.
32 |
33 | We are also developing a hardware port (This repository) to allow usage as a
34 | keyring and without a mobile phone
35 |
36 | Using RIOT-OS+nimble on Nordic nRF52.
37 |
38 | Using wolfSSL/wolfCrypt for TLS and crypto.
39 |
40 | 🚧 This software is in **ALPHA stage** and are part of the
41 | [DECODE project](https://decodeproject.eu) about data-ownership and
42 | [technological sovereignty](https://www.youtube.com/watch?v=RvBRbwBm_nQ). Our
43 | effort is that of improving people's awareness of how their data is processed
44 | by algorithms, as well facilitate the work of developers to create along
45 | [privacy by design principles](https://decodeproject.eu/publications/privacy-design-strategies-decode-architecture)
46 | using algorithms that can be deployed in any situation without any change.
47 |
48 |
49 |
50 | 🚩 Table of Contents (click to expand)
51 |
52 | * [Install](#-install)
53 | * [Quick start](#-quick-start)
54 | * [Configuration](#-configuration)
55 | * [Hardware](#-hardware)
56 | * [Testing](#-testing)
57 | * [Troubleshooting & debugging](#-troubleshooting--debugging)
58 | * [Acknowledgements](#-acknowledgements)
59 | * [Links](#-links)
60 | * [Contributing](#-contributing)
61 | * [License](#-license)
62 |
63 |
64 | ***
65 | ## 💾 Install
66 |
67 | Some dependencies are needed before you are able to build the project.
68 |
69 | ### Dependencies
70 |
71 | You need to clone the RIOT-OS project
72 | [More details](https://doc.riot-os.org/getting-started.html).
73 |
74 | Once you cloned the repo you have to reference it in the `RIOTBASE` variable of
75 | the
76 | [Makefile](https://github.com/dyne/decode-proximity-hw/blob/master/Makefile#L8)
77 |
78 |
79 | The GNU Arm Embedded Toolchain is also needed available on most operative
80 | systems packaging systems eg.
81 |
82 | ```bash
83 | apt install gcc-arm-none-eabi
84 | ```
85 | ### Building
86 |
87 | To build the project jus run
88 |
89 | ```bash
90 | make
91 | ```
92 | This will download all the submodule needed projects and compile.
93 |
94 | When finished you'll find the binary application file under `./bin/nrf52dk/dp3t.elf`
95 |
96 | ### Flashing on device
97 |
98 | ```bash
99 | make flash
100 | ```
101 |
102 | ***
103 | ## 🎮 Quick start
104 |
105 | > TODO
106 |
107 | ***
108 | ## 🔧 Configuration
109 |
110 | > TODO
111 |
112 | ***
113 |
114 | ## 📟 Hardware
115 |
116 | Below a brief list supported and tested hardware to begin with
117 |
118 | **nRF52 DK** :heavy_check_mark:
119 |
120 |
121 |
122 | https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF52-DK
123 |
124 | **Arduino NANO 33 IoT** :heavy_check_mark:
125 |
126 |
127 |
128 | https://store.arduino.cc/arduino-nano-33-iot
129 |
130 | **Pinetime** :white_check_mark:
131 |
132 |
133 |
134 | https://www.pine64.org/pinetime/
135 |
136 | ***
137 |
138 | ## 📋 Testing
139 |
140 | ***
141 | ## 🐛 Troubleshooting & debugging
142 |
143 | ***
144 | ## 😍 Acknowledgements
145 |
146 | Copyright © 2020 by [Dyne.org](https://www.dyne.org) foundation, Amsterdam
147 |
148 | Designed, written and maintained by Daniele Lacamera
149 |
150 | **RIOT-OS+nimble** on Nordic nRF52.
151 |
152 | **wolfSSL/wolfCrypt** for TLS and crypto.
153 |
154 | ***
155 | ## 🌐 Links
156 |
157 | https://dyne.org/
158 |
159 | https://www.decodeproject.eu/
160 |
161 |
162 | ***
163 | ## 👤 Contributing
164 |
165 | Please first take a look at the [Dyne.org - Contributor License Agreement](CONTRIBUTING.md) then
166 |
167 | 1. 🔀 [FORK IT](../../fork)
168 | 2. Create your feature branch `git checkout -b feature/branch`
169 | 3. Commit your changes `git commit -am 'Add some fooBar'`
170 | 4. Push to the branch `git push origin feature/branch`
171 | 5. Create a new Pull Request
172 | 6. 🙏 Thank you
173 |
174 |
175 | **[🔝 back to top](#toc)**
176 |
177 | ***
178 | ## 💼 License
179 | DECODE Proximity embedded
180 | Copyright (c) 2020 Dyne.org foundation, Amsterdam
181 |
182 | This program is free software: you can redistribute it and/or modify
183 | it under the terms of the GNU Affero General Public License as
184 | published by the Free Software Foundation, either version 3 of the
185 | License, or (at your option) any later version.
186 |
187 | This program is distributed in the hope that it will be useful,
188 | but WITHOUT ANY WARRANTY; without even the implied warranty of
189 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
190 | GNU Affero General Public License for more details.
191 |
192 | You should have received a copy of the GNU Affero General Public License
193 | along with this program. If not, see .
194 |
195 | **[🔝 back to top](#toc)**
196 |
197 |
--------------------------------------------------------------------------------
/TODO.md:
--------------------------------------------------------------------------------
1 |
2 | - [x] Communication based on BLE advertisements
3 | - [x] Integrate wolfCrypt
4 | - [ ] Store received info in FLASH memory
5 | - [x] Mock application to generate/collect DP3T-EphIds
6 | - [ ] Design IoT communication
7 |
--------------------------------------------------------------------------------
/ble_scan.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #include "event/timeout.h"
10 | #include "nimble_scanner.h"
11 | #include "net/bluetil/ad.h"
12 | #include "nimble_scanlist.h"
13 | #include "dp3t-config.h"
14 | #include "dp3t.h"
15 | #include "keystore.h"
16 | #include "contactstore.h"
17 |
18 |
19 | static event_queue_t eq;
20 | static event_t blescan_evt;
21 | static event_timeout_t blescan_timeout_evt;
22 |
23 |
24 | /*** SCAN ***/
25 | static void dp3t_print_entry(int *idx, nimble_scanlist_entry_t *e)
26 | {
27 | char name[(BLE_ADV_PDU_LEN + 1)] = { 0 };
28 | char peer_ephid[17] = { 0 };
29 | int res;
30 | bluetil_ad_t ad = BLUETIL_AD_INIT(e->ad, e->ad_len, e->ad_len);
31 | res = bluetil_ad_find_str(&ad, BLE_GAP_AD_NAME, name, sizeof(name));
32 | if (res != BLUETIL_AD_OK) {
33 | res = bluetil_ad_find_str(&ad, BLE_GAP_AD_NAME_SHORT, name, sizeof(name));
34 | }
35 | if (res != BLUETIL_AD_OK) {
36 | strncpy(name, "undefined", sizeof(name));
37 | }
38 | res = bluetil_ad_find_str(&ad, BLE_GAP_AD_UUID128_COMP, peer_ephid, sizeof(peer_ephid));
39 | if (res == BLUETIL_AD_OK) {
40 | printf("[rx ephid %02d RSSI %d]: %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X\n",
41 | (*idx)++,
42 | e->last_rssi,
43 | peer_ephid[0],
44 | peer_ephid[1],
45 | peer_ephid[2],
46 | peer_ephid[3],
47 | peer_ephid[4],
48 | peer_ephid[5],
49 | peer_ephid[6],
50 | peer_ephid[7],
51 | peer_ephid[8],
52 | peer_ephid[9],
53 | peer_ephid[10],
54 | peer_ephid[11],
55 | peer_ephid[12],
56 | peer_ephid[13],
57 | peer_ephid[14],
58 | peer_ephid[15]);
59 | cstore_add(0, 0, (uint8_t) ((0 - e->last_rssi) & 0xFF), (uint8_t *)peer_ephid);
60 | }
61 | }
62 |
63 | void dp3t_scanlist_print(void)
64 | {
65 | int i = 0;
66 | nimble_scanlist_entry_t *e = nimble_scanlist_get_next(NULL);
67 | while (e) {
68 | dp3t_print_entry(&i, e);
69 | e = nimble_scanlist_get_next(e);
70 | }
71 | }
72 |
73 | static void blescan(event_t *e)
74 | {
75 | uint32_t timeout = BLESCAN_DURATION;
76 | nimble_scanlist_clear();
77 | // printf("BLE scan\n");
78 | nimble_scanner_start();
79 | xtimer_usleep(timeout * 1000);
80 | nimble_scanner_stop();
81 | // puts("Contacts:");
82 | // nimble_scanlist_print();
83 | dp3t_scanlist_print();
84 | /* schedule next update event */
85 | event_timeout_set(&blescan_timeout_evt, BLESCAN_INTERVAL * 1000);
86 | }
87 |
88 |
89 | #define INITIAL_BLESCAN_INTERVAL 2000
90 | static char blescan_thread_stack[THREAD_STACKSIZE_MAIN];
91 |
92 | void dp3t_blescan_start(void)
93 | {
94 | event_timeout_set(&blescan_timeout_evt, INITIAL_BLESCAN_INTERVAL * 1000);
95 | }
96 |
97 | static void *blescan_task(void *arg)
98 | {
99 | (void)arg;
100 | struct ble_gap_disc_params scan_params = {
101 | .itvl = BLE_GAP_LIM_DISC_SCAN_INT,
102 | .window = BLE_GAP_LIM_DISC_SCAN_WINDOW,
103 | .filter_policy = 0, /* don't use */
104 | .limited = 0, /* no limited discovery */
105 | .passive = 0, /* no passive scanning */
106 | . filter_duplicates = 0, /* no duplicate filtering */
107 | };
108 | /* initialize the nimble scanner */
109 | nimble_scanlist_init();
110 | nimble_scanner_init(&scan_params, nimble_scanlist_update);
111 |
112 | /* initialize the timer to trigger scan events */
113 | event_queue_init(&eq);
114 | blescan_evt.handler = blescan;
115 | event_timeout_init(&blescan_timeout_evt, &eq, &blescan_evt);
116 | dp3t_blescan_start();
117 | event_loop(&eq);
118 | return NULL; /* never reached */
119 | }
120 |
121 |
122 | void dp3t_blescan_init(void)
123 | {
124 | thread_create(blescan_thread_stack, THREAD_STACKSIZE_MAIN,
125 | THREAD_PRIORITY_MAIN - 1, THREAD_CREATE_STACKTEST,
126 | blescan_task, NULL, "blescan");
127 | }
128 |
129 | void dp3t_blescan_stop(void)
130 | {
131 | event_timeout_clear(&blescan_timeout_evt);
132 | }
133 |
--------------------------------------------------------------------------------
/ble_scan.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #ifndef BLESCAN_H
10 | #define BLESCAN_H
11 | void dp3t_blescan_init(void);
12 | int dp3t_blescan_start(void);
13 | void dp3t_blescan_stop(void);
14 | #endif
15 |
--------------------------------------------------------------------------------
/cert.c:
--------------------------------------------------------------------------------
1 | /* Created from wolfssl-examples test certificate+keys, ECC/RSA. 28/08/2019 */
2 |
3 | #ifdef MODULE_WOLFCRYPT_ECC
4 | const unsigned char server_cert[] = {
5 | 0x30, 0x82, 0x03, 0x50, 0x30, 0x82, 0x02, 0xf5, 0xa0, 0x03, 0x02, 0x01,
6 | 0x02, 0x02, 0x02, 0x10, 0x00, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48,
7 | 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x81, 0x97, 0x31, 0x0b, 0x30, 0x09,
8 | 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30,
9 | 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x0a, 0x57, 0x61, 0x73, 0x68,
10 | 0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,
11 | 0x55, 0x04, 0x07, 0x0c, 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6c, 0x65,
12 | 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x07, 0x77,
13 | 0x6f, 0x6c, 0x66, 0x53, 0x53, 0x4c, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03,
14 | 0x55, 0x04, 0x0b, 0x0c, 0x0b, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70,
15 | 0x6d, 0x65, 0x6e, 0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04,
16 | 0x03, 0x0c, 0x0f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x6f, 0x6c, 0x66, 0x73,
17 | 0x73, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x09,
18 | 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69,
19 | 0x6e, 0x66, 0x6f, 0x40, 0x77, 0x6f, 0x6c, 0x66, 0x73, 0x73, 0x6c, 0x2e,
20 | 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x37, 0x31, 0x30, 0x32,
21 | 0x30, 0x31, 0x38, 0x31, 0x39, 0x30, 0x36, 0x5a, 0x17, 0x0d, 0x32, 0x37,
22 | 0x31, 0x30, 0x31, 0x38, 0x31, 0x38, 0x31, 0x39, 0x30, 0x36, 0x5a, 0x30,
23 | 0x81, 0x8f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
24 | 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
25 | 0x0c, 0x0a, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e,
26 | 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x07, 0x53,
27 | 0x65, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,
28 | 0x55, 0x04, 0x0a, 0x0c, 0x07, 0x45, 0x6c, 0x69, 0x70, 0x74, 0x69, 0x63,
29 | 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x03, 0x45,
30 | 0x43, 0x43, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
31 | 0x0f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x6f, 0x6c, 0x66, 0x73, 0x73, 0x6c,
32 | 0x2e, 0x63, 0x6f, 0x6d, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x09, 0x2a, 0x86,
33 | 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6e, 0x66,
34 | 0x6f, 0x40, 0x77, 0x6f, 0x6c, 0x66, 0x73, 0x73, 0x6c, 0x2e, 0x63, 0x6f,
35 | 0x6d, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d,
36 | 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,
37 | 0x03, 0x42, 0x00, 0x04, 0xbb, 0x33, 0xac, 0x4c, 0x27, 0x50, 0x4a, 0xc6,
38 | 0x4a, 0xa5, 0x04, 0xc3, 0x3c, 0xde, 0x9f, 0x36, 0xdb, 0x72, 0x2d, 0xce,
39 | 0x94, 0xea, 0x2b, 0xfa, 0xcb, 0x20, 0x09, 0x39, 0x2c, 0x16, 0xe8, 0x61,
40 | 0x02, 0xe9, 0xaf, 0x4d, 0xd3, 0x02, 0x93, 0x9a, 0x31, 0x5b, 0x97, 0x92,
41 | 0x21, 0x7f, 0xf0, 0xcf, 0x18, 0xda, 0x91, 0x11, 0x02, 0x34, 0x86, 0xe8,
42 | 0x20, 0x58, 0x33, 0x0b, 0x80, 0x34, 0x89, 0xd8, 0xa3, 0x82, 0x01, 0x35,
43 | 0x30, 0x82, 0x01, 0x31, 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04,
44 | 0x02, 0x30, 0x00, 0x30, 0x11, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86,
45 | 0xf8, 0x42, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, 0x06, 0x40, 0x30, 0x1d,
46 | 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x5d, 0x5d, 0x26,
47 | 0xef, 0xac, 0x7e, 0x36, 0xf9, 0x9b, 0x76, 0x15, 0x2b, 0x4a, 0x25, 0x02,
48 | 0x23, 0xef, 0xb2, 0x89, 0x30, 0x30, 0x81, 0xcc, 0x06, 0x03, 0x55, 0x1d,
49 | 0x23, 0x04, 0x81, 0xc4, 0x30, 0x81, 0xc1, 0x80, 0x14, 0x56, 0x8e, 0x9a,
50 | 0xc3, 0xf0, 0x42, 0xde, 0x18, 0xb9, 0x45, 0x55, 0x6e, 0xf9, 0x93, 0xcf,
51 | 0xea, 0xc3, 0xf3, 0xa5, 0x21, 0xa1, 0x81, 0x9d, 0xa4, 0x81, 0x9a, 0x30,
52 | 0x81, 0x97, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
53 | 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
54 | 0x0c, 0x0a, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e,
55 | 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x07, 0x53,
56 | 0x65, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,
57 | 0x55, 0x04, 0x0a, 0x0c, 0x07, 0x77, 0x6f, 0x6c, 0x66, 0x53, 0x53, 0x4c,
58 | 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x0b, 0x44,
59 | 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x31, 0x18,
60 | 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x77, 0x77, 0x77,
61 | 0x2e, 0x77, 0x6f, 0x6c, 0x66, 0x73, 0x73, 0x6c, 0x2e, 0x63, 0x6f, 0x6d,
62 | 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
63 | 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6e, 0x66, 0x6f, 0x40, 0x77, 0x6f,
64 | 0x6c, 0x66, 0x73, 0x73, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x82, 0x09, 0x00,
65 | 0x97, 0xb4, 0xbd, 0x16, 0x78, 0xf8, 0x47, 0xf2, 0x30, 0x0e, 0x06, 0x03,
66 | 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x03, 0xa8,
67 | 0x30, 0x13, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x04, 0x0c, 0x30, 0x0a, 0x06,
68 | 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x0a, 0x06,
69 | 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x49, 0x00,
70 | 0x30, 0x46, 0x02, 0x21, 0x00, 0xbe, 0xb8, 0x58, 0xf0, 0xe4, 0x15, 0x01,
71 | 0x1f, 0xdf, 0x70, 0x54, 0x73, 0x4a, 0x6c, 0x40, 0x1f, 0x77, 0xa8, 0xb4,
72 | 0xeb, 0x52, 0x1e, 0xbf, 0xf5, 0x0d, 0xb1, 0x33, 0xca, 0x6a, 0xc4, 0x76,
73 | 0xb9, 0x02, 0x21, 0x00, 0x97, 0x08, 0xde, 0x2c, 0x28, 0xc1, 0x45, 0x71,
74 | 0xb6, 0x2c, 0x54, 0x87, 0x98, 0x63, 0x76, 0xa8, 0x21, 0x34, 0x90, 0xa8,
75 | 0xf7, 0x9e, 0x3f, 0xfc, 0x02, 0xb0, 0xe7, 0xd3, 0x09, 0x31, 0x27, 0xe4
76 | };
77 | unsigned int server_cert_len = 852;
78 | const unsigned char server_key[] = {
79 | 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x45, 0xb6, 0x69, 0x02, 0x73,
80 | 0x9c, 0x6c, 0x85, 0xa1, 0x38, 0x5b, 0x72, 0xe8, 0xe8, 0xc7, 0xac, 0xc4,
81 | 0x03, 0x8d, 0x53, 0x35, 0x04, 0xfa, 0x6c, 0x28, 0xdc, 0x34, 0x8d, 0xe1,
82 | 0xa8, 0x09, 0x8c, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
83 | 0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xbb, 0x33, 0xac,
84 | 0x4c, 0x27, 0x50, 0x4a, 0xc6, 0x4a, 0xa5, 0x04, 0xc3, 0x3c, 0xde, 0x9f,
85 | 0x36, 0xdb, 0x72, 0x2d, 0xce, 0x94, 0xea, 0x2b, 0xfa, 0xcb, 0x20, 0x09,
86 | 0x39, 0x2c, 0x16, 0xe8, 0x61, 0x02, 0xe9, 0xaf, 0x4d, 0xd3, 0x02, 0x93,
87 | 0x9a, 0x31, 0x5b, 0x97, 0x92, 0x21, 0x7f, 0xf0, 0xcf, 0x18, 0xda, 0x91,
88 | 0x11, 0x02, 0x34, 0x86, 0xe8, 0x20, 0x58, 0x33, 0x0b, 0x80, 0x34, 0x89,
89 | 0xd8
90 | };
91 | unsigned int server_key_len = 121;
92 |
93 | #endif
94 |
95 | #ifdef MODULE_WOLFCRYPT_RSA
96 | const unsigned char server_cert[] = {
97 | 0x30, 0x82, 0x04, 0x9e, 0x30, 0x82, 0x03, 0x86, 0xa0, 0x03, 0x02, 0x01,
98 | 0x02, 0x02, 0x01, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
99 | 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x81, 0x94, 0x31, 0x0b,
100 | 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31,
101 | 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x07, 0x4d, 0x6f,
102 | 0x6e, 0x74, 0x61, 0x6e, 0x61, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55,
103 | 0x04, 0x07, 0x0c, 0x07, 0x42, 0x6f, 0x7a, 0x65, 0x6d, 0x61, 0x6e, 0x31,
104 | 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x53, 0x61,
105 | 0x77, 0x74, 0x6f, 0x6f, 0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
106 | 0x55, 0x04, 0x0b, 0x0c, 0x0a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x74,
107 | 0x69, 0x6e, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03,
108 | 0x0c, 0x0f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x6f, 0x6c, 0x66, 0x73, 0x73,
109 | 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x09, 0x2a,
110 | 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6e,
111 | 0x66, 0x6f, 0x40, 0x77, 0x6f, 0x6c, 0x66, 0x73, 0x73, 0x6c, 0x2e, 0x63,
112 | 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x38, 0x30, 0x34, 0x31, 0x33,
113 | 0x31, 0x35, 0x32, 0x33, 0x31, 0x30, 0x5a, 0x17, 0x0d, 0x32, 0x31, 0x30,
114 | 0x31, 0x30, 0x37, 0x31, 0x35, 0x32, 0x33, 0x31, 0x30, 0x5a, 0x30, 0x81,
115 | 0x90, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
116 | 0x55, 0x53, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c,
117 | 0x07, 0x4d, 0x6f, 0x6e, 0x74, 0x61, 0x6e, 0x61, 0x31, 0x10, 0x30, 0x0e,
118 | 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x07, 0x42, 0x6f, 0x7a, 0x65, 0x6d,
119 | 0x61, 0x6e, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c,
120 | 0x07, 0x77, 0x6f, 0x6c, 0x66, 0x53, 0x53, 0x4c, 0x31, 0x10, 0x30, 0x0e,
121 | 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x07, 0x53, 0x75, 0x70, 0x70, 0x6f,
122 | 0x72, 0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
123 | 0x0f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x6f, 0x6c, 0x66, 0x73, 0x73, 0x6c,
124 | 0x2e, 0x63, 0x6f, 0x6d, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x09, 0x2a, 0x86,
125 | 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6e, 0x66,
126 | 0x6f, 0x40, 0x77, 0x6f, 0x6c, 0x66, 0x73, 0x73, 0x6c, 0x2e, 0x63, 0x6f,
127 | 0x6d, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
128 | 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f,
129 | 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc0, 0x95,
130 | 0x08, 0xe1, 0x57, 0x41, 0xf2, 0x71, 0x6d, 0xb7, 0xd2, 0x45, 0x41, 0x27,
131 | 0x01, 0x65, 0xc6, 0x45, 0xae, 0xf2, 0xbc, 0x24, 0x30, 0xb8, 0x95, 0xce,
132 | 0x2f, 0x4e, 0xd6, 0xf6, 0x1c, 0x88, 0xbc, 0x7c, 0x9f, 0xfb, 0xa8, 0x67,
133 | 0x7f, 0xfe, 0x5c, 0x9c, 0x51, 0x75, 0xf7, 0x8a, 0xca, 0x07, 0xe7, 0x35,
134 | 0x2f, 0x8f, 0xe1, 0xbd, 0x7b, 0xc0, 0x2f, 0x7c, 0xab, 0x64, 0xa8, 0x17,
135 | 0xfc, 0xca, 0x5d, 0x7b, 0xba, 0xe0, 0x21, 0xe5, 0x72, 0x2e, 0x6f, 0x2e,
136 | 0x86, 0xd8, 0x95, 0x73, 0xda, 0xac, 0x1b, 0x53, 0xb9, 0x5f, 0x3f, 0xd7,
137 | 0x19, 0x0d, 0x25, 0x4f, 0xe1, 0x63, 0x63, 0x51, 0x8b, 0x0b, 0x64, 0x3f,
138 | 0xad, 0x43, 0xb8, 0xa5, 0x1c, 0x5c, 0x34, 0xb3, 0xae, 0x00, 0xa0, 0x63,
139 | 0xc5, 0xf6, 0x7f, 0x0b, 0x59, 0x68, 0x78, 0x73, 0xa6, 0x8c, 0x18, 0xa9,
140 | 0x02, 0x6d, 0xaf, 0xc3, 0x19, 0x01, 0x2e, 0xb8, 0x10, 0xe3, 0xc6, 0xcc,
141 | 0x40, 0xb4, 0x69, 0xa3, 0x46, 0x33, 0x69, 0x87, 0x6e, 0xc4, 0xbb, 0x17,
142 | 0xa6, 0xf3, 0xe8, 0xdd, 0xad, 0x73, 0xbc, 0x7b, 0x2f, 0x21, 0xb5, 0xfd,
143 | 0x66, 0x51, 0x0c, 0xbd, 0x54, 0xb3, 0xe1, 0x6d, 0x5f, 0x1c, 0xbc, 0x23,
144 | 0x73, 0xd1, 0x09, 0x03, 0x89, 0x14, 0xd2, 0x10, 0xb9, 0x64, 0xc3, 0x2a,
145 | 0xd0, 0xa1, 0x96, 0x4a, 0xbc, 0xe1, 0xd4, 0x1a, 0x5b, 0xc7, 0xa0, 0xc0,
146 | 0xc1, 0x63, 0x78, 0x0f, 0x44, 0x37, 0x30, 0x32, 0x96, 0x80, 0x32, 0x23,
147 | 0x95, 0xa1, 0x77, 0xba, 0x13, 0xd2, 0x97, 0x73, 0xe2, 0x5d, 0x25, 0xc9,
148 | 0x6a, 0x0d, 0xc3, 0x39, 0x60, 0xa4, 0xb4, 0xb0, 0x69, 0x42, 0x42, 0x09,
149 | 0xe9, 0xd8, 0x08, 0xbc, 0x33, 0x20, 0xb3, 0x58, 0x22, 0xa7, 0xaa, 0xeb,
150 | 0xc4, 0xe1, 0xe6, 0x61, 0x83, 0xc5, 0xd2, 0x96, 0xdf, 0xd9, 0xd0, 0x4f,
151 | 0xad, 0xd7, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, 0xfc, 0x30, 0x81,
152 | 0xf9, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14,
153 | 0xb3, 0x11, 0x32, 0xc9, 0x92, 0x98, 0x84, 0xe2, 0xc9, 0xf8, 0xd0, 0x3b,
154 | 0x6e, 0x03, 0x42, 0xca, 0x1f, 0x0e, 0x8e, 0x3c, 0x30, 0x81, 0xc9, 0x06,
155 | 0x03, 0x55, 0x1d, 0x23, 0x04, 0x81, 0xc1, 0x30, 0x81, 0xbe, 0x80, 0x14,
156 | 0x27, 0x8e, 0x67, 0x11, 0x74, 0xc3, 0x26, 0x1d, 0x3f, 0xed, 0x33, 0x63,
157 | 0xb3, 0xa4, 0xd8, 0x1d, 0x30, 0xe5, 0xe8, 0xd5, 0xa1, 0x81, 0x9a, 0xa4,
158 | 0x81, 0x97, 0x30, 0x81, 0x94, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
159 | 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,
160 | 0x55, 0x04, 0x08, 0x0c, 0x07, 0x4d, 0x6f, 0x6e, 0x74, 0x61, 0x6e, 0x61,
161 | 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x07, 0x42,
162 | 0x6f, 0x7a, 0x65, 0x6d, 0x61, 0x6e, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03,
163 | 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6f, 0x6f, 0x74,
164 | 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x0a,
165 | 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x74, 0x69, 0x6e, 0x67, 0x31, 0x18,
166 | 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x77, 0x77, 0x77,
167 | 0x2e, 0x77, 0x6f, 0x6c, 0x66, 0x73, 0x73, 0x6c, 0x2e, 0x63, 0x6f, 0x6d,
168 | 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
169 | 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6e, 0x66, 0x6f, 0x40, 0x77, 0x6f,
170 | 0x6c, 0x66, 0x73, 0x73, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x82, 0x09, 0x00,
171 | 0x86, 0xff, 0xf5, 0x8e, 0x10, 0xde, 0xb8, 0xfb, 0x30, 0x0c, 0x06, 0x03,
172 | 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d,
173 | 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05,
174 | 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0xb4, 0x54, 0x60, 0xad, 0xa0, 0x03,
175 | 0x32, 0xde, 0x02, 0x7f, 0x21, 0x4a, 0x81, 0xc6, 0xed, 0xcd, 0xcd, 0xd8,
176 | 0x12, 0x8a, 0xc0, 0xba, 0x82, 0x5b, 0x75, 0xad, 0x54, 0xe3, 0x7c, 0x80,
177 | 0x6a, 0xac, 0x2e, 0x6c, 0x20, 0x4e, 0xbe, 0x4d, 0x82, 0xa7, 0x47, 0x13,
178 | 0x5c, 0xf4, 0xc6, 0x6a, 0x2b, 0x10, 0x99, 0x58, 0xde, 0xab, 0x6b, 0x7c,
179 | 0x22, 0x05, 0xc1, 0x83, 0x9d, 0xcb, 0xff, 0x3c, 0xe4, 0x2d, 0x57, 0x6a,
180 | 0xa6, 0x96, 0xdf, 0xd3, 0xc1, 0x68, 0xe3, 0xd2, 0xc6, 0x83, 0x4b, 0x97,
181 | 0xe2, 0xc6, 0x32, 0x0e, 0xbe, 0xc4, 0x03, 0xb9, 0x07, 0x8a, 0x5b, 0xb8,
182 | 0x84, 0xba, 0xc5, 0x39, 0x3f, 0x1c, 0x58, 0xa7, 0x55, 0xd7, 0xf0, 0x9b,
183 | 0xe8, 0xd2, 0x45, 0xb9, 0xe3, 0x83, 0x2e, 0xee, 0xb6, 0x71, 0x56, 0xb9,
184 | 0x3a, 0xee, 0x3f, 0x27, 0xd8, 0x77, 0xe8, 0xfb, 0x44, 0x48, 0x65, 0x27,
185 | 0x47, 0x4c, 0xfb, 0xfe, 0x72, 0xc3, 0xac, 0x05, 0x7b, 0x1d, 0xcb, 0xeb,
186 | 0x5e, 0x65, 0x9a, 0xab, 0x02, 0xe4, 0x88, 0x5b, 0x3b, 0x8b, 0x0b, 0xc7,
187 | 0xcc, 0xa9, 0xa6, 0x8b, 0xe1, 0x87, 0xb0, 0x19, 0x1a, 0x0c, 0x28, 0x58,
188 | 0x6f, 0x99, 0x52, 0x7e, 0xed, 0xb0, 0x3a, 0x68, 0x3b, 0x8c, 0x0a, 0x08,
189 | 0x74, 0x72, 0xab, 0xb9, 0x09, 0xc5, 0xed, 0x04, 0x7e, 0x6f, 0x0b, 0x1c,
190 | 0x09, 0x21, 0xd0, 0xcd, 0x7f, 0xf9, 0xc4, 0x5e, 0x27, 0x20, 0xe4, 0x85,
191 | 0x73, 0x52, 0x05, 0xd2, 0xba, 0xf8, 0xd5, 0x8f, 0x41, 0xcc, 0x23, 0x2e,
192 | 0x12, 0x6d, 0xbc, 0x31, 0x98, 0xe7, 0x63, 0xa3, 0x8e, 0x26, 0xcd, 0xe8,
193 | 0x2b, 0x88, 0xee, 0xe2, 0xfe, 0x3a, 0x74, 0x52, 0x34, 0x0e, 0xfd, 0x12,
194 | 0xe5, 0x5e, 0x69, 0x50, 0x20, 0x31, 0x34, 0xe4, 0x31, 0xf1, 0xe7, 0xe4,
195 | 0x5b, 0x03, 0x13, 0xda, 0xac, 0x41, 0x6c, 0xe7, 0xcf, 0x2b
196 | };
197 | const unsigned int server_cert_len = 1186;
198 |
199 | const unsigned char server_key[] = {
200 | 0x30, 0x82, 0x04, 0xa5, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,
201 | 0xc0, 0x95, 0x08, 0xe1, 0x57, 0x41, 0xf2, 0x71, 0x6d, 0xb7, 0xd2, 0x45,
202 | 0x41, 0x27, 0x01, 0x65, 0xc6, 0x45, 0xae, 0xf2, 0xbc, 0x24, 0x30, 0xb8,
203 | 0x95, 0xce, 0x2f, 0x4e, 0xd6, 0xf6, 0x1c, 0x88, 0xbc, 0x7c, 0x9f, 0xfb,
204 | 0xa8, 0x67, 0x7f, 0xfe, 0x5c, 0x9c, 0x51, 0x75, 0xf7, 0x8a, 0xca, 0x07,
205 | 0xe7, 0x35, 0x2f, 0x8f, 0xe1, 0xbd, 0x7b, 0xc0, 0x2f, 0x7c, 0xab, 0x64,
206 | 0xa8, 0x17, 0xfc, 0xca, 0x5d, 0x7b, 0xba, 0xe0, 0x21, 0xe5, 0x72, 0x2e,
207 | 0x6f, 0x2e, 0x86, 0xd8, 0x95, 0x73, 0xda, 0xac, 0x1b, 0x53, 0xb9, 0x5f,
208 | 0x3f, 0xd7, 0x19, 0x0d, 0x25, 0x4f, 0xe1, 0x63, 0x63, 0x51, 0x8b, 0x0b,
209 | 0x64, 0x3f, 0xad, 0x43, 0xb8, 0xa5, 0x1c, 0x5c, 0x34, 0xb3, 0xae, 0x00,
210 | 0xa0, 0x63, 0xc5, 0xf6, 0x7f, 0x0b, 0x59, 0x68, 0x78, 0x73, 0xa6, 0x8c,
211 | 0x18, 0xa9, 0x02, 0x6d, 0xaf, 0xc3, 0x19, 0x01, 0x2e, 0xb8, 0x10, 0xe3,
212 | 0xc6, 0xcc, 0x40, 0xb4, 0x69, 0xa3, 0x46, 0x33, 0x69, 0x87, 0x6e, 0xc4,
213 | 0xbb, 0x17, 0xa6, 0xf3, 0xe8, 0xdd, 0xad, 0x73, 0xbc, 0x7b, 0x2f, 0x21,
214 | 0xb5, 0xfd, 0x66, 0x51, 0x0c, 0xbd, 0x54, 0xb3, 0xe1, 0x6d, 0x5f, 0x1c,
215 | 0xbc, 0x23, 0x73, 0xd1, 0x09, 0x03, 0x89, 0x14, 0xd2, 0x10, 0xb9, 0x64,
216 | 0xc3, 0x2a, 0xd0, 0xa1, 0x96, 0x4a, 0xbc, 0xe1, 0xd4, 0x1a, 0x5b, 0xc7,
217 | 0xa0, 0xc0, 0xc1, 0x63, 0x78, 0x0f, 0x44, 0x37, 0x30, 0x32, 0x96, 0x80,
218 | 0x32, 0x23, 0x95, 0xa1, 0x77, 0xba, 0x13, 0xd2, 0x97, 0x73, 0xe2, 0x5d,
219 | 0x25, 0xc9, 0x6a, 0x0d, 0xc3, 0x39, 0x60, 0xa4, 0xb4, 0xb0, 0x69, 0x42,
220 | 0x42, 0x09, 0xe9, 0xd8, 0x08, 0xbc, 0x33, 0x20, 0xb3, 0x58, 0x22, 0xa7,
221 | 0xaa, 0xeb, 0xc4, 0xe1, 0xe6, 0x61, 0x83, 0xc5, 0xd2, 0x96, 0xdf, 0xd9,
222 | 0xd0, 0x4f, 0xad, 0xd7, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, 0x01,
223 | 0x01, 0x00, 0x9a, 0xd0, 0x34, 0x0f, 0x52, 0x62, 0x05, 0x50, 0x01, 0xef,
224 | 0x9f, 0xed, 0x64, 0x6e, 0xc2, 0xc4, 0xda, 0x1a, 0xf2, 0x84, 0xd7, 0x92,
225 | 0x10, 0x48, 0x92, 0xc4, 0xe9, 0x6a, 0xeb, 0x8b, 0x75, 0x6c, 0xc6, 0x79,
226 | 0x38, 0xf2, 0xc9, 0x72, 0x4a, 0x86, 0x64, 0x54, 0x95, 0x77, 0xcb, 0xc3,
227 | 0x9a, 0x9d, 0xb7, 0xd4, 0x1d, 0xa4, 0x00, 0xc8, 0x9e, 0x4e, 0xe4, 0xdd,
228 | 0xc7, 0xba, 0x67, 0x16, 0xc1, 0x74, 0xbc, 0xa9, 0xd6, 0x94, 0x8f, 0x2b,
229 | 0x30, 0x1a, 0xfb, 0xed, 0xdf, 0x21, 0x05, 0x23, 0xd9, 0x4a, 0x39, 0xbd,
230 | 0x98, 0x6b, 0x65, 0x9a, 0xb8, 0xdc, 0xc4, 0x7d, 0xee, 0xa6, 0x43, 0x15,
231 | 0x2e, 0x3d, 0xbe, 0x1d, 0x22, 0x60, 0x2a, 0x73, 0x30, 0xd5, 0x3e, 0xd8,
232 | 0xa2, 0xac, 0x86, 0x43, 0x2e, 0xc4, 0xf5, 0x64, 0x5e, 0x3f, 0x89, 0x75,
233 | 0x0f, 0x11, 0xd8, 0x51, 0x25, 0x4e, 0x9f, 0xd8, 0xaa, 0xa3, 0xce, 0x60,
234 | 0xb3, 0xe2, 0x8a, 0xd9, 0x7e, 0x1b, 0xf0, 0x64, 0xca, 0x9a, 0x5b, 0x05,
235 | 0x0b, 0x5b, 0xaa, 0xcb, 0xe5, 0xe3, 0x3f, 0x6e, 0x32, 0x22, 0x05, 0xf3,
236 | 0xd0, 0xfa, 0xef, 0x74, 0x52, 0x81, 0xe2, 0x5f, 0x74, 0xd3, 0xbd, 0xff,
237 | 0x31, 0x83, 0x45, 0x75, 0xfa, 0x63, 0x7a, 0x97, 0x2e, 0xd6, 0xb6, 0x19,
238 | 0xc6, 0x92, 0x26, 0xe4, 0x28, 0x06, 0x50, 0x50, 0x0e, 0x78, 0x2e, 0xa9,
239 | 0x78, 0x0d, 0x14, 0x97, 0xb4, 0x12, 0xd8, 0x31, 0x40, 0xab, 0xa1, 0x01,
240 | 0x41, 0xc2, 0x30, 0xf8, 0x07, 0x5f, 0x16, 0xe4, 0x61, 0x77, 0xd2, 0x60,
241 | 0xf2, 0x9f, 0x8d, 0xe8, 0xf4, 0xba, 0xeb, 0x63, 0xde, 0x2a, 0x97, 0x81,
242 | 0xef, 0x4c, 0x6c, 0xe6, 0x55, 0x34, 0x51, 0x2b, 0x28, 0x34, 0xf4, 0x53,
243 | 0x1c, 0xc4, 0x58, 0x0a, 0x3f, 0xbb, 0xaf, 0xb5, 0xf7, 0x4a, 0x85, 0x43,
244 | 0x2d, 0x3c, 0xf1, 0x58, 0x58, 0x81, 0x02, 0x81, 0x81, 0x00, 0xf2, 0x2c,
245 | 0x54, 0x76, 0x39, 0x23, 0x63, 0xc9, 0x10, 0x32, 0xb7, 0x93, 0xad, 0xaf,
246 | 0xbe, 0x19, 0x75, 0x96, 0x81, 0x64, 0xe6, 0xb5, 0xb8, 0x89, 0x42, 0x41,
247 | 0xd1, 0x6d, 0xd0, 0x1c, 0x1b, 0xf8, 0x1b, 0xac, 0x69, 0xcb, 0x36, 0x3c,
248 | 0x64, 0x7d, 0xdc, 0xf4, 0x19, 0xb8, 0xc3, 0x60, 0xb1, 0x57, 0x48, 0x5f,
249 | 0x52, 0x4f, 0x59, 0x3a, 0x55, 0x7f, 0x32, 0xc0, 0x19, 0x43, 0x50, 0x3f,
250 | 0xae, 0xce, 0x6f, 0x17, 0xf3, 0x0e, 0x9f, 0x40, 0xca, 0x4e, 0xad, 0x15,
251 | 0x3b, 0xc9, 0x79, 0xe9, 0xc0, 0x59, 0x38, 0x73, 0x70, 0x9c, 0x0a, 0x7c,
252 | 0xc9, 0x3a, 0x48, 0x32, 0xa7, 0xd8, 0x49, 0x75, 0x0a, 0x85, 0xc2, 0xc2,
253 | 0xfd, 0x15, 0x73, 0xda, 0x99, 0x09, 0x2a, 0x69, 0x9a, 0x9f, 0x0a, 0x71,
254 | 0xbf, 0xb0, 0x04, 0xa6, 0x8c, 0x7a, 0x5a, 0x6f, 0x48, 0x5a, 0x54, 0x3b,
255 | 0xc6, 0xb1, 0x53, 0x17, 0xdf, 0xe7, 0x02, 0x81, 0x81, 0x00, 0xcb, 0x93,
256 | 0xde, 0x77, 0x15, 0x5d, 0xb7, 0x5c, 0x5c, 0x7c, 0xd8, 0x90, 0xa9, 0x98,
257 | 0x2d, 0xd6, 0x69, 0x0e, 0x63, 0xb3, 0xa3, 0xdc, 0xa6, 0xcc, 0x8b, 0x6a,
258 | 0xa4, 0xa2, 0x12, 0x8c, 0x8e, 0x7b, 0x48, 0x2c, 0xb2, 0x4b, 0x37, 0xdc,
259 | 0x06, 0x18, 0x7d, 0xea, 0xfe, 0x76, 0xa1, 0xd4, 0xa1, 0xe9, 0x3f, 0x0d,
260 | 0xcd, 0x1b, 0x5f, 0xaf, 0x5f, 0x9e, 0x96, 0x5b, 0x5b, 0x0f, 0xa1, 0x7c,
261 | 0xaf, 0xb3, 0x9b, 0x90, 0xdb, 0x57, 0x73, 0x3a, 0xed, 0xb0, 0x23, 0x44,
262 | 0xae, 0x41, 0x4f, 0x1f, 0x07, 0x42, 0x13, 0x23, 0x4c, 0xcb, 0xfa, 0xf4,
263 | 0x14, 0xa4, 0xd5, 0xf7, 0x9e, 0x36, 0x7c, 0x5b, 0x9f, 0xa8, 0x3c, 0xc1,
264 | 0x85, 0x5f, 0x74, 0xd2, 0x39, 0x2d, 0xff, 0xd0, 0x84, 0xdf, 0xfb, 0xb3,
265 | 0x20, 0x7a, 0x2e, 0x9b, 0x17, 0xae, 0xe6, 0xba, 0x0b, 0xae, 0x5f, 0x53,
266 | 0xa4, 0x52, 0xed, 0x1b, 0xc4, 0x91, 0x02, 0x81, 0x81, 0x00, 0xec, 0x98,
267 | 0xda, 0xbb, 0xd5, 0xfe, 0xf9, 0x52, 0x4a, 0x7d, 0x02, 0x55, 0x49, 0x6f,
268 | 0x55, 0x6e, 0x52, 0x2f, 0x84, 0xa3, 0x2b, 0xb3, 0x86, 0x62, 0xb3, 0x54,
269 | 0xd2, 0x63, 0x52, 0xda, 0xe3, 0x88, 0x76, 0xa0, 0xef, 0x8b, 0x15, 0xa5,
270 | 0xd3, 0x18, 0x14, 0x72, 0x77, 0x5e, 0xc7, 0xa3, 0x04, 0x1f, 0x9e, 0x19,
271 | 0x62, 0xb5, 0x1b, 0x1b, 0x9e, 0xc3, 0xf2, 0xb5, 0x32, 0xf9, 0x4c, 0xc1,
272 | 0xaa, 0xeb, 0x0c, 0x26, 0x7d, 0xd4, 0x5f, 0x4a, 0x51, 0x5c, 0xa4, 0x45,
273 | 0x06, 0x70, 0x44, 0xa7, 0x56, 0xc0, 0xd4, 0x22, 0x14, 0x76, 0x9e, 0xd8,
274 | 0x63, 0x50, 0x89, 0x90, 0xd3, 0xe2, 0xbf, 0x81, 0x95, 0x92, 0x31, 0x41,
275 | 0x87, 0x39, 0x1a, 0x43, 0x0b, 0x18, 0xa5, 0x53, 0x1f, 0x39, 0x1a, 0x5f,
276 | 0x1f, 0x43, 0xbc, 0x87, 0x6a, 0xdf, 0x6e, 0xd3, 0x22, 0x00, 0xfe, 0x22,
277 | 0x98, 0x70, 0x4e, 0x1a, 0x19, 0x29, 0x02, 0x81, 0x81, 0x00, 0x8a, 0x41,
278 | 0x56, 0x28, 0x51, 0x9e, 0x5f, 0xd4, 0x9e, 0x0b, 0x3b, 0x98, 0xa3, 0x54,
279 | 0xf2, 0x6c, 0x56, 0xd4, 0xaa, 0xe9, 0x69, 0x33, 0x85, 0x24, 0x0c, 0xda,
280 | 0xd4, 0x0c, 0x2d, 0xc4, 0xbf, 0x4f, 0x02, 0x69, 0x38, 0x7c, 0xd4, 0xe6,
281 | 0xdc, 0x4c, 0xed, 0xd7, 0x16, 0x11, 0xc3, 0x3e, 0x00, 0xe7, 0xc3, 0x26,
282 | 0xc0, 0x51, 0x02, 0xde, 0xbb, 0x75, 0x9c, 0x6f, 0x56, 0x9c, 0x7a, 0xf3,
283 | 0x8e, 0xef, 0xcf, 0x8a, 0xc5, 0x2b, 0xd2, 0xda, 0x06, 0x6a, 0x44, 0xc9,
284 | 0x73, 0xfe, 0x6e, 0x99, 0x87, 0xf8, 0x5b, 0xbe, 0xf1, 0x7c, 0xe6, 0x65,
285 | 0xb5, 0x4f, 0x6c, 0xf0, 0xc9, 0xc5, 0xff, 0x16, 0xca, 0x8b, 0x1b, 0x17,
286 | 0xe2, 0x58, 0x3d, 0xa2, 0x37, 0xab, 0x01, 0xbc, 0xbf, 0x40, 0xce, 0x53,
287 | 0x8c, 0x8e, 0xed, 0xef, 0xee, 0x59, 0x9d, 0xe0, 0x63, 0xe6, 0x7c, 0x5e,
288 | 0xf5, 0x8e, 0x4b, 0xf1, 0x3b, 0xc1, 0x02, 0x81, 0x80, 0x4d, 0x45, 0xf9,
289 | 0x40, 0x8c, 0xc5, 0x5b, 0xf4, 0x2a, 0x1a, 0x8a, 0xb4, 0xf2, 0x1c, 0xac,
290 | 0x6b, 0xe9, 0x0c, 0x56, 0x36, 0xb7, 0x4e, 0x72, 0x96, 0xd5, 0xe5, 0x8a,
291 | 0xd2, 0xe2, 0xff, 0xf1, 0xf1, 0x18, 0x13, 0x3d, 0x86, 0x09, 0xb8, 0xd8,
292 | 0x76, 0xa7, 0xc9, 0x1c, 0x71, 0x52, 0x94, 0x30, 0x43, 0xe0, 0xf1, 0x78,
293 | 0x74, 0xfd, 0x61, 0x1b, 0x4c, 0x09, 0xcc, 0xe6, 0x68, 0x2a, 0x71, 0xad,
294 | 0x1c, 0xdf, 0x43, 0xbc, 0x56, 0xdb, 0xa5, 0xa4, 0xbe, 0x35, 0x70, 0xa4,
295 | 0x5e, 0xcf, 0x4f, 0xfc, 0x00, 0x55, 0x99, 0x3a, 0x3d, 0x23, 0xcf, 0x67,
296 | 0x5a, 0xf5, 0x22, 0xf8, 0xb5, 0x29, 0xd0, 0x44, 0x11, 0xeb, 0x35, 0x2e,
297 | 0x46, 0xbe, 0xfd, 0x8e, 0x18, 0xb2, 0x5f, 0xa8, 0xbf, 0x19, 0x32, 0xa1,
298 | 0xf5, 0xdc, 0x03, 0xe6, 0x7c, 0x9a, 0x1f, 0x0c, 0x7c, 0xa9, 0xb0, 0x0e,
299 | 0x21, 0x37, 0x3b, 0xf1, 0xb0
300 | };
301 | const unsigned int server_key_len = 1193;
302 | #endif
303 |
304 | #ifdef MODULE_WOLFSSL_PSK
305 | const unsigned char server_key[1] = { 0 };
306 | const unsigned int server_key_len = 0;
307 | #endif
308 |
--------------------------------------------------------------------------------
/contactstore.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #include
10 | #include
11 |
12 | #include "dp3t.h"
13 | #include "dp3t-config.h"
14 |
15 | #define CSTORE_ADDR 0
16 | #define CONTACTS_BASE (CSTORE_ADDR + sizeof(contacts_t))
17 |
18 |
19 | int cstore_add( uint8_t day, uint8_t epoch, uint8_t rssi, uint8_t *ephid)
20 | {
21 | contact_t c;
22 | c.day = day;
23 | c.epoch = epoch;
24 | c.rssi = rssi;
25 | memcpy(c.data, ephid, 16);
26 | /* TODO: write to store page, update index */
27 | return 0;
28 | }
29 |
--------------------------------------------------------------------------------
/contactstore.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #ifndef CONTACTSTORE_H
10 | #define CONTACTSTORE_H
11 | #include
12 | int cstore_add( uint8_t day, uint8_t epoch, uint8_t rssi, uint8_t *ephid);
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/dp3t-config.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #ifndef DP3T_CONFIG_H
10 | #define DP3T_CONFIG_H
11 | #include
12 |
13 | /* SK / EPHID / SHA base parameters
14 | */
15 | #define SK_LEN 32
16 | #define SHA256_LEN 32
17 | #define EPHID_LEN 16
18 |
19 |
20 | /* Use-case DP3-T parameters */
21 | #define TTL (180) // In minutes
22 | #define EPOCHS (((24 * 60) / TTL) + 1)
23 | #define RETENTION_PERIOD (14) // In days
24 | #define BROADCAST_KEY "Broadcast key"
25 | #define BROADCAST_KEY_LEN 13UL
26 |
27 | /* Bluetooth scan/adv timing (in milliseconds) */
28 | #define BLESCAN_INTERVAL 58000
29 | #define BLESCAN_DURATION 2000
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/dp3t.c:
--------------------------------------------------------------------------------
1 | /* The Fastest Proximity Tracing in the West (FPTW)
2 | * aka the Secret Pangolin Code
3 | *
4 | * Copyright (C) 2020 Dyne.org foundation
5 | * designed, written and maintained by Daniele Lacamera and Denis Roio
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Affero General Public License as
9 | * published by the Free Software Foundation, either version 3 of the
10 | * License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License
18 | * along with this program. If not, see .
19 | *
20 | */
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #ifndef WOLFSSL_USER_SETTINGS
28 | #include
29 | #else
30 | #include "user_settings.h"
31 | #endif
32 | #include
33 | #include
34 | #include
35 |
36 | #include
37 |
38 | // zero nonce, one ephid long
39 | const uint8_t zero16[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
40 |
41 | char *create_key(WC_RNG* rng) { return NULL; }
42 |
43 | // renew the SK in place (reuse input buffer)
44 | void renew_key(sk_t dest, sk_t src) {
45 | wc_Sha256 sha;
46 | assert( wc_InitSha256(&sha) == 0);
47 | wc_Sha256Update(&sha, src, 32);
48 | wc_Sha256Final(&sha, dest);
49 | wc_Sha256Free(&sha);
50 | }
51 |
52 | // epd = epochs per day = ((24 * 60) / ttl in minutes) +1
53 | int32_t generate_beacons(beacons_t *beacons, uint32_t max_beacons,
54 | const sk_t oldest_sk, const uint32_t day, const uint32_t ttl,
55 | const char *bk, uint32_t bklen) {
56 | Aes aes;
57 | Hmac hmac;
58 | register uint32_t i;
59 | sk_t sk, sk_n;
60 | uint8_t prf[32];
61 |
62 | assert(ttl > 0);
63 | assert(bk);
64 | assert(bklen > 0);
65 | beacons->epochs = (24*60)/ttl+1;
66 | memcpy(beacons->broadcast, bk, bklen>32?32:bklen);
67 | beacons->broadcast_len = bklen;
68 |
69 | memcpy(sk, oldest_sk, 32);
70 | for (i = 0; i < day; i++) {
71 | renew_key(sk_n, sk);
72 | memcpy(sk, sk_n, 32);
73 | }
74 |
75 | /* PRF */
76 | wc_HmacInit(&hmac, NULL, INVALID_DEVID);
77 | wc_HmacSetKey(&hmac, WC_SHA256, sk, 32);
78 | wc_HmacUpdate(&hmac, (const byte*)beacons->broadcast, beacons->broadcast_len);
79 | wc_HmacFinal(&hmac, prf);
80 | wc_HmacFree(&hmac);
81 |
82 | wc_AesInit(&aes, NULL, INVALID_DEVID);
83 | wc_AesSetKeyDirect(&aes, prf, 32, zero16, AES_ENCRYPTION);
84 | for(i=0; iepochs; i++)
85 | wc_AesCtrEncrypt(&aes, beacons->ephids[i], zero16, 16);
86 | wc_AesFree(&aes);
87 | return(0);
88 | }
89 |
90 | int32_t match_positive(matches_t *matches, uint32_t max_matches,
91 | const sk_t positive, const contacts_t *contacts) {
92 | Hmac hmac;
93 | Aes aes;
94 | uint8_t prf[32];
95 | register uint32_t i, ii;
96 | uint8_t skeph[16];
97 | register uint32_t ret = 0;
98 |
99 | assert(matches);
100 | assert(positive);
101 | assert(contacts);
102 |
103 | // initial buffer allocation: number of ephids / 8
104 | wc_HmacInit(&hmac, NULL, INVALID_DEVID);
105 | wc_AesInit(&aes, NULL, INVALID_DEVID);
106 |
107 | wc_HmacSetKey(&hmac, WC_SHA256, positive, 32);
108 | wc_HmacUpdate(&hmac, (const byte*)contacts->broadcast, contacts->broadcast_len);
109 | wc_HmacFinal(&hmac, prf);
110 | wc_AesSetKeyDirect(&aes, prf, 32, zero16, AES_ENCRYPTION);
111 | // calculate ephids of the current posisk
112 | for(i=0; iepochs; i++) {
113 | wc_AesCtrEncrypt(&aes, skeph, zero16, 16);
114 | for(ii=0; iicount; ii++) {
115 | if( memcmp(skeph, contacts->ephids[ii].data, 16) ==0) {
116 | if(retephids[ret] = &contacts->ephids[ii];
118 | matches->count++;
119 | ret++;
120 | } else goto finish;
121 | }
122 | }
123 | }
124 | finish:
125 | wc_AesFree(&aes);
126 | wc_HmacFree(&hmac);
127 | return(ret);
128 | }
129 |
--------------------------------------------------------------------------------
/dp3t.h:
--------------------------------------------------------------------------------
1 | /* The Fastest Proximity Tracing in the West (FPTW)
2 | * aka the Secret Pangolin Code
3 | *
4 | * Copyright (C) 2020 Dyne.org foundation
5 | * designed, written and maintained by Daniele Lacamera and Denis Roio
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Affero General Public License as
9 | * published by the Free Software Foundation, either version 3 of the
10 | * License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License
18 | * along with this program. If not, see .
19 | *
20 | */
21 |
22 | #ifndef __DP3T_H__
23 | #define __DP3T_H__
24 |
25 | #include
26 |
27 | typedef uint8_t beacon_t[16];
28 | typedef uint8_t sk_t[32];
29 |
30 | // simple offset structure of num elements sized EPHID_LEN bytes
31 | typedef struct {
32 | uint32_t epochs; //< data length (capacity) provided by caller
33 | char broadcast[32]; //< broadcast key
34 | uint32_t broadcast_len; //< broadcast key length
35 | beacon_t ephids[0]; //< data offset provided by caller
36 | } beacons_t;
37 |
38 | typedef struct __attribute__((packed)) {
39 | uint8_t day;
40 | uint8_t epoch;
41 | uint8_t rssi;
42 | uint8_t reserved;
43 | uint8_t data[16];
44 | } contact_t;
45 |
46 | typedef struct {
47 | uint32_t count; //< number of ephids stored
48 | contact_t *ephids; //< array of ephids
49 | uint32_t epochs; //< how many epochs in a day
50 | char broadcast[32]; //< broadcast key
51 | uint32_t broadcast_len; //< broadcast key length
52 | } contacts_t; // always const
53 |
54 | // struct filled with match_positive results, it does not use more
55 | // memory but returns pointers to contact_t data passed in from
56 | // contacts_t
57 | typedef struct {
58 | uint32_t count; //< number of ephids stored
59 | contact_t *ephids[0]; //< array of pointers to contacts found
60 | } matches_t;
61 |
62 | void renew_key(sk_t dest, sk_t src);
63 |
64 | int32_t generate_beacons(beacons_t *beacons, uint32_t max_beacons,
65 | const sk_t oldest_sk, const uint32_t day, const uint32_t ttl,
66 | const char *bk, uint32_t bklen);
67 |
68 | int32_t match_positive(matches_t *matches, uint32_t max_matches,
69 | const sk_t positive, const contacts_t *contacts);
70 |
71 |
72 | #endif
73 |
--------------------------------------------------------------------------------
/dtls-client.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #include
16 | #include
17 | #include
18 |
19 | #include "log.h"
20 |
21 | #define SERVER_PORT 11111
22 | #define APP_DTLS_BUF_SIZE 64
23 |
24 | extern const unsigned char server_cert[];
25 | extern const unsigned long server_cert_len;
26 |
27 | static sock_tls_t skv;
28 | static sock_tls_t *sk = &skv;
29 |
30 | static void usage(const char *cmd_name)
31 | {
32 | LOG(LOG_ERROR, "Usage: %s \n", cmd_name);
33 | }
34 |
35 | #ifdef MODULE_WOLFSSL_PSK
36 | /* identity is OpenSSL testing default for openssl s_client, keep same */
37 | static const char* kIdentityStr = "Client_identity";
38 |
39 | static inline unsigned int my_psk_client_cb(WOLFSSL* ssl, const char* hint,
40 | char* identity, unsigned int id_max_len, unsigned char* key,
41 | unsigned int key_max_len)
42 | {
43 | (void)ssl;
44 | (void)hint;
45 | (void)key_max_len;
46 |
47 | /* see internal.h MAX_PSK_ID_LEN for PSK identity limit */
48 | strncpy(identity, kIdentityStr, id_max_len);
49 |
50 | if (wolfSSL_GetVersion(ssl) < WOLFSSL_TLSV1_3) {
51 | /* test key in hex is 0x1a2b3c4d , in decimal 439,041,101 , we're using
52 | unsigned binary */
53 | key[0] = 0x1a;
54 | key[1] = 0x2b;
55 | key[2] = 0x3c;
56 | key[3] = 0x4d;
57 |
58 | return 4; /* length of key in octets or 0 for error */
59 | }
60 | else {
61 | int i;
62 | int b = 0x01;
63 |
64 | for (i = 0; i < 32; i++, b += 0x22) {
65 | if (b >= 0x100)
66 | b = 0x01;
67 | key[i] = b;
68 | }
69 |
70 | return 32; /* length of key in octets or 0 for error */
71 | }
72 | }
73 | #endif
74 |
75 | int dtls_client(int argc, char **argv)
76 | {
77 | int ret = 0;
78 | char buf[APP_DTLS_BUF_SIZE] = "Hello from DTLS client!";
79 | char *iface;
80 | char *addr_str;
81 | int connect_timeout = 0;
82 | const int max_connect_timeouts = 5;
83 |
84 | if (argc != 2) {
85 | usage(argv[0]);
86 | return -1;
87 | }
88 |
89 | addr_str = argv[1];
90 | sock_udp_ep_t local = SOCK_IPV6_EP_ANY;
91 | sock_udp_ep_t remote = SOCK_IPV6_EP_ANY;
92 |
93 | /* Parsing */
94 | iface = ipv6_addr_split_iface(addr_str);
95 | if (!iface) {
96 | if (gnrc_netif_numof() == 1) {
97 | /* assign the single interface found in gnrc_netif_numof() */
98 | remote.netif = (uint16_t)gnrc_netif_iter(NULL)->pid;
99 | }
100 | }
101 | else {
102 | gnrc_netif_t *netif = gnrc_netif_get_by_pid(atoi(iface));
103 | if (netif == NULL) {
104 | LOG(LOG_ERROR, "ERROR: interface not valid\n");
105 | usage(argv[0]);
106 | return -1;
107 | }
108 | remote.netif = (uint16_t)netif->pid;
109 | }
110 | if (ipv6_addr_from_str((ipv6_addr_t *)remote.addr.ipv6, addr_str) == NULL) {
111 | LOG(LOG_ERROR, "ERROR: unable to parse destination address\n");
112 | usage(argv[0]);
113 | return -1;
114 | }
115 | remote.port = SERVER_PORT;
116 | if (sock_dtls_create(sk, &local, &remote, 0, wolfDTLSv1_2_client_method()) != 0) {
117 | LOG(LOG_ERROR, "ERROR: Unable to create DTLS sock\n");
118 | return -1;
119 | }
120 |
121 | #ifndef MODULE_WOLFSSL_PSK
122 | /* Disable certificate validation from the client side */
123 | wolfSSL_CTX_set_verify(sk->ctx, SSL_VERIFY_NONE, 0);
124 |
125 | /* Load certificate file for the DTLS client */
126 | if (wolfSSL_CTX_use_certificate_buffer(sk->ctx, server_cert,
127 | server_cert_len, SSL_FILETYPE_ASN1 ) != SSL_SUCCESS)
128 | {
129 | LOG(LOG_ERROR, "Error loading cert buffer\n");
130 | return -1;
131 | }
132 |
133 | #else /* !def MODULE_WOLFSSL_PSK */
134 | wolfSSL_CTX_set_psk_client_callback(sk->ctx, my_psk_client_cb);
135 | #endif
136 |
137 | if (sock_dtls_session_create(sk) < 0)
138 | return -1;
139 | wolfSSL_dtls_set_timeout_init(sk->ssl, 5);
140 | LOG(LOG_INFO, "connecting to server...\n");
141 | /* attempt to connect until the connection is successful */
142 | do {
143 | ret = wolfSSL_connect(sk->ssl);
144 | if ((ret != SSL_SUCCESS)) {
145 | if(wolfSSL_get_error(sk->ssl, ret) == SOCKET_ERROR_E) {
146 | LOG(LOG_WARNING, "Socket error: reconnecting...\n");
147 | sock_dtls_session_destroy(sk);
148 | connect_timeout = 0;
149 | if (sock_dtls_session_create(sk) < 0)
150 | return -1;
151 | }
152 | if ((wolfSSL_get_error(sk->ssl, ret) == WOLFSSL_ERROR_WANT_READ) &&
153 | (connect_timeout++ >= max_connect_timeouts)) {
154 | LOG(LOG_WARNING, "Server not responding: reconnecting...\n");
155 | sock_dtls_session_destroy(sk);
156 | connect_timeout = 0;
157 | if (sock_dtls_session_create(sk) < 0)
158 | return -1;
159 | }
160 | }
161 | } while(ret != SSL_SUCCESS);
162 |
163 | /* set remote endpoint */
164 | sock_dtls_set_endpoint(sk, &remote);
165 |
166 | /* send the hello message */
167 | wolfSSL_write(sk->ssl, buf, strlen(buf));
168 |
169 | /* wait for a reply, indefinitely */
170 | do {
171 | ret = wolfSSL_read(sk->ssl, buf, APP_DTLS_BUF_SIZE - 1);
172 | LOG(LOG_INFO, "wolfSSL_read returned %d\n", ret);
173 | } while (ret <= 0);
174 | buf[ret] = (char)0;
175 | LOG(LOG_INFO, "Received: '%s'\n", buf);
176 |
177 | /* Clean up and exit. */
178 | LOG(LOG_INFO, "Closing connection.\n");
179 | sock_dtls_session_destroy(sk);
180 | sock_dtls_close(sk);
181 | return 0;
182 | }
183 |
--------------------------------------------------------------------------------
/dtls-server.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 |
10 | #include
11 | #include
12 |
13 | #include
14 |
15 | #include
16 |
17 | #include
18 | #include
19 | #include
20 |
21 | #include "log.h"
22 |
23 | #define SERVER_PORT 11111
24 | #define DEBUG 1
25 | extern const unsigned char server_cert[];
26 | extern const unsigned char server_key[];
27 | extern unsigned int server_cert_len;
28 | extern unsigned int server_key_len;
29 |
30 | static sock_tls_t skv;
31 | static sock_tls_t *sk = &skv;
32 |
33 | static const char Test_dtls_string[] = "DTLS OK!";
34 |
35 | #ifdef MODULE_WOLFSSL_PSK
36 | /* identity is OpenSSL testing default for openssl s_client, keep same */
37 | static const char* kIdentityStr = "Client_identity";
38 |
39 | static inline unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
40 | unsigned char* key, unsigned int key_max_len)
41 | {
42 | (void)ssl;
43 | (void)key_max_len;
44 |
45 | /* see internal.h MAX_PSK_ID_LEN for PSK identity limit */
46 | if (strncmp(identity, kIdentityStr, strlen(kIdentityStr)) != 0)
47 | return 0;
48 |
49 | if (wolfSSL_GetVersion(ssl) < WOLFSSL_TLSV1_3) {
50 | /* test key in hex is 0x1a2b3c4d , in decimal 439,041,101 , we're using
51 | unsigned binary */
52 | key[0] = 0x1a;
53 | key[1] = 0x2b;
54 | key[2] = 0x3c;
55 | key[3] = 0x4d;
56 |
57 | return 4; /* length of key in octets or 0 for error */
58 | }
59 | else {
60 | int i;
61 | int b = 0x01;
62 |
63 | for (i = 0; i < 32; i++, b += 0x22) {
64 | if (b >= 0x100)
65 | b = 0x01;
66 | key[i] = b;
67 | }
68 |
69 | return 32; /* length of key in octets or 0 for error */
70 | }
71 | }
72 | #endif /* MODULE_WOLFSSL_PSK */
73 |
74 | #define APP_DTLS_BUF_SIZE 64
75 |
76 | int dtls_server(int argc, char **argv)
77 | {
78 | char buf[APP_DTLS_BUF_SIZE];
79 | int ret;
80 | sock_udp_ep_t local = SOCK_IPV6_EP_ANY;
81 | local.port = SERVER_PORT;
82 |
83 | (void)argc;
84 | (void)argv;
85 |
86 | if (sock_dtls_create(sk, &local, NULL, 0, wolfDTLSv1_2_server_method()) != 0) {
87 | LOG(LOG_ERROR, "ERROR: Unable to create DTLS sock\n");
88 | return -1;
89 | }
90 |
91 | #ifndef MODULE_WOLFSSL_PSK
92 | /* Load certificate file for the DTLS server */
93 | if (wolfSSL_CTX_use_certificate_buffer(sk->ctx, server_cert,
94 | server_cert_len, SSL_FILETYPE_ASN1 ) != SSL_SUCCESS)
95 | {
96 | LOG(LOG_ERROR, "Failed to load certificate from memory.\n");
97 | return -1;
98 | }
99 |
100 | /* Load the private key */
101 | if (wolfSSL_CTX_use_PrivateKey_buffer(sk->ctx, server_key,
102 | server_key_len, SSL_FILETYPE_ASN1 ) != SSL_SUCCESS)
103 | {
104 | LOG(LOG_ERROR, "Failed to load private key from memory.\n");
105 | return -1;
106 | }
107 | #else
108 | wolfSSL_CTX_set_psk_server_callback(sk->ctx, my_psk_server_cb);
109 | wolfSSL_CTX_use_psk_identity_hint(sk->ctx, "hint");
110 | #endif /* MODULE_WOLFSSL_PSK */
111 |
112 | /* Create the DTLS session */
113 | ret = sock_dtls_session_create(sk);
114 | if (ret < 0)
115 | {
116 | LOG(LOG_ERROR, "Failed to create DTLS session (err: %s)\n", strerror(-ret));
117 | return -1;
118 | }
119 |
120 | LOG(LOG_INFO, "Listening on %d\n", SERVER_PORT);
121 | while(1) {
122 | /* Wait until a new client connects */
123 | ret = wolfSSL_accept(sk->ssl);
124 | if (ret != SSL_SUCCESS) {
125 | if (wolfSSL_get_error(sk->ssl, ret) != WOLFSSL_ERROR_WANT_READ) {
126 | sock_dtls_session_destroy(sk);
127 | if (sock_dtls_session_create(sk) < 0)
128 | return -1;
129 | }
130 | continue;
131 | }
132 |
133 | /* Wait until data is received */
134 | LOG(LOG_INFO, "Connection accepted\n");
135 | ret = wolfSSL_read(sk->ssl, buf, APP_DTLS_BUF_SIZE);
136 | if (ret > 0) {
137 | buf[ret] = (char)0;
138 | LOG(LOG_INFO, "Received '%s'\n", buf);
139 | }
140 |
141 | /* Send reply */
142 | LOG(LOG_INFO, "Sending 'DTLS OK'...\n");
143 | wolfSSL_write(sk->ssl, Test_dtls_string, sizeof(Test_dtls_string));
144 |
145 | /* Cleanup/shutdown */
146 | LOG(LOG_INFO, "Closing connection.\n");
147 | sock_dtls_session_destroy(sk);
148 | sock_dtls_close(sk);
149 | break;
150 | }
151 | return 0;
152 | }
153 |
--------------------------------------------------------------------------------
/gatt-srv.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 |
10 | #include
11 | #include
12 |
13 | #include "assert.h"
14 | #include "event/timeout.h"
15 | #include "nimble_riot.h"
16 | #include "net/bluetil/ad.h"
17 |
18 | #include "host/ble_hs.h"
19 | #include "host/ble_gatt.h"
20 | #include "services/gap/ble_svc_gap.h"
21 | #include "services/gatt/ble_svc_gatt.h"
22 | #include "dp3t.h"
23 | #include "random.h"
24 | #include "keystore.h"
25 |
26 | #define HRS_FLAGS_DEFAULT (0x01) /* 16-bit BPM value */
27 | #define SENSOR_LOCATION (0x02) /* wrist sensor */
28 | #define UPDATE_INTERVAL (250U * US_PER_MS)
29 |
30 | static const char *device_name = "DP3T";
31 | static const char *_manufacturer_name = "Dyne.org";
32 | static const char *_model_number = "1";
33 |
34 | static event_queue_t _eq;
35 | static event_t _update_evt;
36 |
37 | static uint16_t _conn_handle;
38 | static uint16_t _hrs_val_handle;
39 |
40 |
41 | static int _devinfo_handler(uint16_t conn_handle, uint16_t attr_handle,
42 | struct ble_gatt_access_ctxt *ctxt, void *arg);
43 |
44 | static void start_advertising(void);
45 |
46 | /* GATT service definitions */
47 | static const struct ble_gatt_svc_def gatt_svr_svcs[] = {
48 | {
49 | /* Device Information Service */
50 | .type = BLE_GATT_SVC_TYPE_PRIMARY,
51 | .uuid = BLE_UUID16_DECLARE(BLE_GATT_SVC_DEVINFO),
52 | .characteristics = (struct ble_gatt_chr_def[]) { {
53 | .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_MANUFACTURER_NAME),
54 | .access_cb = _devinfo_handler,
55 | .flags = BLE_GATT_CHR_F_READ,
56 | }, {
57 | .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_MODEL_NUMBER_STR),
58 | .access_cb = _devinfo_handler,
59 | .flags = BLE_GATT_CHR_F_READ,
60 | }, {
61 | .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_SERIAL_NUMBER_STR),
62 | .access_cb = _devinfo_handler,
63 | .flags = BLE_GATT_CHR_F_READ,
64 | }, {
65 | .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_FW_REV_STR),
66 | .access_cb = _devinfo_handler,
67 | .flags = BLE_GATT_CHR_F_READ,
68 | }, {
69 | .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_HW_REV_STR),
70 | .access_cb = _devinfo_handler,
71 | .flags = BLE_GATT_CHR_F_READ,
72 | }, {
73 | 0, /* no more characteristics in this service */
74 | }, }
75 | },
76 | {
77 | 0, /* no more services */
78 | },
79 | };
80 |
81 | static int _devinfo_handler(uint16_t conn_handle, uint16_t attr_handle,
82 | struct ble_gatt_access_ctxt *ctxt, void *arg)
83 | {
84 | (void)conn_handle;
85 | (void)attr_handle;
86 | (void)arg;
87 | const char *str;
88 |
89 | switch (ble_uuid_u16(ctxt->chr->uuid)) {
90 | case BLE_GATT_CHAR_MANUFACTURER_NAME:
91 | //printf("[READ] device information service: manufacturer name value");
92 | str = _manufacturer_name;
93 | break;
94 | case BLE_GATT_CHAR_MODEL_NUMBER_STR:
95 | //printf("[READ] device information service: model number value");
96 | str = _model_number;
97 | break;
98 | default:
99 | return BLE_ATT_ERR_UNLIKELY;
100 | }
101 |
102 | int res = os_mbuf_append(ctxt->om, str, strlen(str));
103 | return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
104 | }
105 |
106 | static int gap_event_cb(struct ble_gap_event *event, void *arg)
107 | {
108 | (void)arg;
109 | /* Used only if we want to export other GATT services */
110 | return 0;
111 | }
112 |
113 | static void start_advertising(void)
114 | {
115 | struct ble_gap_adv_params advp;
116 | int res;
117 |
118 | memset(&advp, 0, sizeof advp);
119 | advp.conn_mode = BLE_GAP_CONN_MODE_UND;
120 | advp.disc_mode = BLE_GAP_DISC_MODE_GEN;
121 | advp.itvl_min = BLE_GAP_ADV_FAST_INTERVAL1_MIN;
122 | advp.itvl_max = BLE_GAP_ADV_FAST_INTERVAL1_MAX;
123 | res = ble_gap_adv_start(nimble_riot_own_addr_type, NULL, BLE_HS_FOREVER,
124 | &advp, gap_event_cb, NULL);
125 | assert(res == 0);
126 | (void)res;
127 | }
128 |
129 | int gatt_server(void)
130 | {
131 | int res = 0;
132 | uint8_t buf[31];
133 | uint16_t hdr_txpow = BLE_GAP_AD_TX_POWER_LEVEL;
134 | uint16_t hdr_uuid = BLE_GAP_AD_UUID128_COMP;
135 | uint8_t tx_pow = 0x00;
136 | uint8_t addr[6];
137 |
138 | //printf("BLE DP3T service started");
139 | /* verify and add our custom services */
140 | res = ble_gatts_count_cfg(gatt_svr_svcs);
141 | assert(res == 0);
142 | res = ble_gatts_add_svcs(gatt_svr_svcs);
143 | assert(res == 0);
144 |
145 | /* set the device name */
146 | ble_svc_gap_device_name_set("");
147 |
148 | /* reload the GATT server to link our added services */
149 | ble_gatts_start();
150 | sys_random(addr, 6);
151 | ble_hs_id_set_rnd(addr);
152 |
153 | /* configure and set the advertising data */
154 | bluetil_ad_t ad;
155 | bluetil_ad_init_with_flags(&ad, buf, sizeof(buf), BLE_GAP_DISCOVERABLE);
156 | bluetil_ad_add(&ad, hdr_txpow, &tx_pow, 1);
157 | bluetil_ad_add(&ad, hdr_uuid, dp3t_get_ephid(0), EPHID_LEN);
158 | ble_gap_adv_set_data(ad.buf, ad.pos);
159 |
160 | /* start to advertise this node */
161 | start_advertising();
162 |
163 | /* run an event loop for handling the heart rate update events */
164 | //event_loop(&_eq);
165 |
166 | return 0;
167 | }
168 |
--------------------------------------------------------------------------------
/keystore.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #include
10 | #include
11 | #include
12 | #include "dp3t-config.h"
13 | #include "dp3t.h"
14 | #include "random.h"
15 | #include "nvmc.h"
16 |
17 | static uint8_t SKT_0[SK_LEN] = {};
18 | static int keystore_initialized = 0;
19 | static int beacons_generated = 0;
20 | static int day_ephid_table = -1;
21 |
22 | static char broadcast_key[32] = BROADCAST_KEY;
23 | static uint32_t broadcast_key_len = BROADCAST_KEY_LEN;
24 |
25 | #define BEACONS_OBJ_SIZE (sizeof(beacons_t) + sizeof(beacon_t) * 16)
26 | static uint8_t local_beacons_buffer[BEACONS_OBJ_SIZE];
27 | static beacons_t *beacons = (beacons_t *)(local_beacons_buffer);
28 |
29 | #define CONFIG_FLASH_ADDR ((512 - 4) * (1024)) /* Last sector of flash considering a 512KB boundary */
30 |
31 | const char dp3t_config_signature[4] = "DP3T";
32 |
33 | struct __attribute__((packed)) dp3t_config_store {
34 | char signature[4]; /* spells "DP3T" if the store is in use */
35 | sk_t key; /* oldest key stored */
36 | uint32_t age; /* age in days */
37 | };
38 |
39 | static void print_hex(const uint8_t *x, int len)
40 | {
41 | int i;
42 | for(i = 0; i < len; i++) {
43 | printf("%02x",x[i]);
44 | }
45 | printf("\n");
46 | }
47 |
48 | static void print_ephid(const uint8_t *x)
49 | {
50 | print_hex(x, EPHID_LEN);
51 | }
52 |
53 | static void print_sk(const uint8_t *x)
54 | {
55 | print_hex(x, SK_LEN);
56 | }
57 |
58 |
59 | void dp3t_print_ephids(void)
60 | {
61 | int i;
62 | for (i = 0; i < EPOCHS; i++) {
63 | printf("[ %03d ] ", i);
64 | print_ephid(beacons->ephids[i]);
65 | }
66 | }
67 |
68 |
69 | beacons_t *dp3t_generate_beacons(sk_t key, int day)
70 | {
71 | int ret;
72 | memset(beacons, 0, BEACONS_OBJ_SIZE);
73 | ret = generate_beacons(beacons, EPOCHS, key, day, TTL, broadcast_key, broadcast_key_len);
74 | if (ret != 0)
75 | return NULL;
76 | dp3t_print_ephids();
77 | return beacons;
78 | }
79 |
80 |
81 | uint8_t *dp3t_get_ephid(uint8_t idx)
82 | {
83 | static uint8_t zero16[16] = {};
84 | if (!keystore_initialized)
85 | return zero16;
86 | return beacons->ephids[idx];
87 | }
88 |
89 |
90 | static struct dp3t_config_store *load_config(void)
91 | {
92 | struct dp3t_config_store *store =
93 | (struct dp3t_config_store *)(CONFIG_FLASH_ADDR);
94 | if (strncmp(store->signature, dp3t_config_signature, 4) == 0) {
95 | printf("DP-3T configuration loaded from NVMC\n");
96 | print_sk(store->key);
97 | return store;
98 | }
99 | return NULL;
100 | }
101 |
102 | static void store_config(struct dp3t_config_store *sto)
103 | {
104 | flash_erase(CONFIG_FLASH_ADDR, FLASH_PAGE_SIZE);
105 | flash_write(CONFIG_FLASH_ADDR, (uint8_t *)sto, sizeof(struct dp3t_config_store));
106 | printf("DP-3T configuration stored to NVMC\n");
107 | }
108 |
109 | uint8_t *dp3t_get_skt_0(void)
110 | {
111 | if (keystore_initialized)
112 | return SKT_0;
113 | else return NULL;
114 | }
115 |
116 |
117 | static int rekey(void)
118 | {
119 | struct dp3t_config_store *sto, newsto;
120 | sys_random(newsto.key, SK_LEN);
121 | memcpy(newsto.signature, dp3t_config_signature, 4);
122 | memcpy(newsto.key, newsto.key, SK_LEN);
123 | newsto.age = 0;
124 | store_config(&newsto);
125 | /* Sanity check for the new configuration */
126 | sto = load_config();
127 | if (!sto)
128 | return -1;
129 | return 0;
130 | }
131 |
132 |
133 | /* Initialize dp3t subsystem.
134 | * returns: 0 : Okay
135 | * -1 : Problems with nvm store
136 | * -2 : Could not generate beacons
137 | */
138 | int dp3t_start(void)
139 | {
140 | struct dp3t_config_store *sto;
141 | int ret;
142 | if (keystore_initialized)
143 | return 0;
144 | sto = load_config();
145 | if (!sto) {
146 | /* Create new random SK0, set age to 0 */
147 | rekey();
148 | sto = load_config();
149 | if (!sto)
150 | return -1;
151 | }
152 | memset(beacons, 0, BEACONS_OBJ_SIZE);
153 | ret = generate_beacons(beacons, EPOCHS, sto->key, sto->age, TTL, broadcast_key, broadcast_key_len);
154 | if (ret != 0)
155 | return -2;
156 | keystore_initialized = 1;
157 | return 0;
158 | }
159 |
160 | int dp3t_restart(unsigned int day)
161 | {
162 | struct dp3t_config_store *sto, newsto;
163 | int ret;
164 | if (keystore_initialized) {
165 | sto = load_config();
166 | if (sto != NULL) {
167 | /* don't update if the age is the same */
168 | if (sto->age == day)
169 | return 0;
170 | memcpy(&newsto, sto, sizeof(struct dp3t_config_store));
171 | } else {
172 | /* Generate new random key, don't set age */
173 | sys_random(SKT_0, SK_LEN);
174 | memcpy(newsto.key, SKT_0, SK_LEN);
175 | }
176 | keystore_initialized = 0;
177 | } else {
178 | sto = &newsto;
179 | }
180 | /* Store new configuration */
181 | memcpy(newsto.signature, dp3t_config_signature, 4);
182 | newsto.age = day;
183 | store_config(&newsto);
184 | /* Sanity check */
185 | if (!load_config())
186 | return -1;
187 | /* Generate beacons for the day */
188 | ret = generate_beacons(beacons, EPOCHS, sto->key, sto->age, TTL, broadcast_key, broadcast_key_len);
189 | if (ret != 0)
190 | return -2;
191 | keystore_initialized = 1;
192 | return 0;
193 | }
194 |
195 |
196 | int dp3t_shellcmd_testvec(int argc, char **argv)
197 | {
198 | uint8_t testkey[32] = { }; /* zeros */
199 | dp3t_generate_beacons(testkey, 0);
200 | return 0;
201 | }
202 |
203 | int dp3t_shellcmd_rekey(int argc, char **argv)
204 | {
205 | return rekey();
206 | }
207 |
--------------------------------------------------------------------------------
/keystore.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #ifndef KEYSTORE_H
10 | #define KEYSTORE_H
11 | #include "dp3t.h"
12 | #include "dp3t-config.h"
13 | #include
14 |
15 | int dp3t_start(void);
16 | int dp3t_restart(unsigned int day);
17 | uint8_t *dp3t_get_ephid(uint8_t idx);
18 |
19 | uint8_t *dp3t_get_skt_0(void);
20 | beacons_t *dp3t_generate_beacons(sk_t key, int day);
21 |
22 |
23 | int dp3t_shellcmd_testvec(int argc, char **argv);
24 | int dp3t_shellcmd_rekey(int argc, char **argv);
25 | #endif
26 |
--------------------------------------------------------------------------------
/main.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #include
10 | #include
11 |
12 | #include "shell.h"
13 | #include "msg.h"
14 |
15 | #include "dp3t-config.h"
16 | #include "dp3t.h"
17 | #include "keystore.h"
18 | #include "ble_scan.h"
19 |
20 | #define MAIN_QUEUE_SIZE (8)
21 | static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
22 |
23 | extern int dtls_client(int argc, char **argv);
24 | extern int dtls_server(int argc, char **argv);
25 |
26 | #ifdef MODULE_WOLFCRYPT_TEST
27 | extern int wolfcrypt_test(void* args);
28 | static int wolftest(int argc, char **argv)
29 | {
30 | (void)argc;
31 | (void)argv;
32 | wolfcrypt_test(NULL);
33 | return 0;
34 | }
35 | #endif
36 | extern int gatt_server(void);
37 |
38 | static const shell_command_t shell_commands[] = {
39 | { "testvec", "print test vectors", dp3t_shellcmd_testvec },
40 | { "rekey", "regenerate DP3T secure key", dp3t_shellcmd_rekey },
41 | #ifdef MODULE_WOLFCRYPT_TEST
42 | { "wolftest", "Perform wolfcrypt porting test", wolftest },
43 | #endif
44 | { NULL, NULL, NULL }
45 | };
46 |
47 | char line_buf[SHELL_DEFAULT_BUFSIZE];
48 |
49 | int main(void)
50 | {
51 | uint8_t *ephid, *sk_t0;
52 |
53 | /* we need a message queue for the thread running the shell in order to
54 | * receive potentially fast incoming networking packets */
55 | msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
56 |
57 | /* Global wolfSSL initialization */
58 | wolfSSL_Init();
59 | wolfSSL_Debugging_ON();
60 |
61 | /* dp3t */
62 | dp3t_start();
63 |
64 | /* Start dp3t gatt advertisements */
65 | gatt_server();
66 |
67 | /* Start dp3t scan service */
68 | dp3t_blescan_init();
69 |
70 | /* start shell */
71 | printf( "All up, running the shell now\r\n");
72 | shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
73 |
74 | /* should be never reached */
75 | return 0;
76 | }
77 |
--------------------------------------------------------------------------------
/mykey.pub:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuzOsTCdQSsZKpQTDPN6fNttyLc6U
3 | 6iv6yyAJOSwW6GEC6a9N0wKTmjFbl5Ihf/DPGNqREQI0huggWDMLgDSJ2A==
4 | -----END PUBLIC KEY-----
5 |
--------------------------------------------------------------------------------
/nvmc.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #include
10 | #include "nvmc.h"
11 |
12 | /* Flash write/erase control */
13 | #define NVMC_BASE (0x4001E000)
14 | #define NVMC_CONFIG *((volatile uint32_t *)(NVMC_BASE + 0x504))
15 | #define NVMC_ERASEPAGE *((volatile uint32_t *)(NVMC_BASE + 0x508))
16 | #define NVMC_READY *((volatile uint32_t *)(NVMC_BASE + 0x400))
17 | #define NVMC_CONFIG_REN 0
18 | #define NVMC_CONFIG_WEN 1
19 | #define NVMC_CONFIG_EEN 2
20 |
21 |
22 |
23 | static void flash_wait_complete(void)
24 | {
25 | while (NVMC_READY == 0)
26 | ;
27 | }
28 |
29 | int flash_write(uint32_t address, const uint8_t *data, int len)
30 | {
31 | int i = 0;
32 | uint32_t *src, *dst;
33 |
34 | while (i < len) {
35 | if ((len - i > 3) && ((((address + i) & 0x03) == 0) && ((((uint32_t)data) + i) & 0x03) == 0)) {
36 | src = (uint32_t *)data;
37 | dst = (uint32_t *)address;
38 | NVMC_CONFIG = NVMC_CONFIG_WEN;
39 | flash_wait_complete();
40 | dst[i >> 2] = src[i >> 2];
41 | flash_wait_complete();
42 | i+=4;
43 | } else {
44 | uint32_t val;
45 | uint8_t *vbytes = (uint8_t *)(&val);
46 | int off = (address + i) - (((address + i) >> 2) << 2);
47 | dst = (uint32_t *)(address - off);
48 | val = dst[i >> 2];
49 | vbytes[off] = data[i];
50 | NVMC_CONFIG = NVMC_CONFIG_WEN;
51 | flash_wait_complete();
52 | dst[i >> 2] = val;
53 | flash_wait_complete();
54 | i++;
55 | }
56 | }
57 | return 0;
58 | }
59 |
60 |
61 | int flash_erase(uint32_t address, int len)
62 | {
63 | uint32_t end = address + len - 1;
64 | uint32_t p;
65 | for (p = address; p <= end; p += FLASH_PAGE_SIZE) {
66 | NVMC_CONFIG = NVMC_CONFIG_EEN;
67 | flash_wait_complete();
68 | NVMC_ERASEPAGE = p;
69 | flash_wait_complete();
70 | }
71 | return 0;
72 | }
73 |
74 |
--------------------------------------------------------------------------------
/nvmc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #ifndef NVMC_H
10 | #define NVMC_H
11 | #define FLASH_PAGE_SIZE (4096)
12 | int flash_write(uint32_t address, const uint8_t *data, int len);
13 | int flash_erase(uint32_t address, int len);
14 | #endif
15 |
--------------------------------------------------------------------------------
/pubkey.der:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyne/decode-proximity-hw/0412cc76df4e87a2e9f795483edda764f5e9c742/pubkey.der
--------------------------------------------------------------------------------
/random.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | #include "nimble_scanner.h"
15 | #include "net/bluetil/ad.h"
16 | #include "nimble_scanlist.h"
17 |
18 | #include "dp3t.h"
19 |
20 |
21 |
22 |
23 | #define TRNG_BASE 0x4000D000
24 | #define TRNG_TASKS_START (*(volatile uint32_t *)(TRNG_BASE + 0x000))
25 | #define TRNG_TASKS_STOP (*(volatile uint32_t *)(TRNG_BASE + 0x004))
26 | #define TRNG_EV_VALRDY (*(volatile uint32_t *)(TRNG_BASE + 0x100))
27 | #define TRNG_VALUE (*(volatile uint32_t *)(TRNG_BASE + 0x508))
28 |
29 | void sys_random(uint8_t *buf, int len)
30 | {
31 | uint8_t val;
32 | int i = 0;
33 |
34 | /* Clear VALRDY */
35 | TRNG_EV_VALRDY = 0;
36 | /* Start TRNG */
37 | TRNG_TASKS_START = 1;
38 | for (i = 0; i < len; i++) {
39 | /* Wait until value ready */
40 | while (TRNG_EV_VALRDY == 0)
41 | ;
42 | buf[i] = (uint8_t)(TRNG_VALUE & 0x000000FF);
43 | TRNG_EV_VALRDY = 0;
44 | }
45 | TRNG_TASKS_STOP |= 1;
46 | }
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/random.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Dyne.org foundation
3 | *
4 | * This file is subject to the terms and conditions of the Affero GNU
5 | * General Public License (AGPL) version 3. See the file LICENSE for
6 | * more details.
7 | *
8 | */
9 | #ifndef RANDOM_H
10 | #define RANDOM_H
11 | void sys_random(uint8_t *buf, int len);
12 | #endif
13 |
--------------------------------------------------------------------------------
/rsa-server-cert.der:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyne/decode-proximity-hw/0412cc76df4e87a2e9f795483edda764f5e9c742/rsa-server-cert.der
--------------------------------------------------------------------------------
/rsa-server-key.der:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyne/decode-proximity-hw/0412cc76df4e87a2e9f795483edda764f5e9c742/rsa-server-key.der
--------------------------------------------------------------------------------
/server-cert.der:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyne/decode-proximity-hw/0412cc76df4e87a2e9f795483edda764f5e9c742/server-cert.der
--------------------------------------------------------------------------------
/server-key.der:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyne/decode-proximity-hw/0412cc76df4e87a2e9f795483edda764f5e9c742/server-key.der
--------------------------------------------------------------------------------