Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Rework of DTLS code, add DTLS PKI/RPK #32

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Conversation

pulsastrix
Copy link
Member

This PR refactors the cryptography related code to improve usage ergonomics and to add DTLS support using PKI/RPK.

Still a WIP, not ready for reviews yet.

Closes #30, Closes #4.

@pulsastrix pulsastrix added enhancement New feature or request libcoap-parity Features that libcoap offers, but libcoap-rs currently does not labels Sep 3, 2024
@pulsastrix pulsastrix added this to the v0.3.0 milestone Sep 3, 2024
@pulsastrix pulsastrix self-assigned this Sep 3, 2024
Copy link

github-actions bot commented Sep 3, 2024

Workflow Status Report

Generated for commit 7c58a25 on Wed Sep 11 18:18:27 UTC 2024.

CI Status

Linting Report

Clippy check result: failure

Refer to the "Files Changed" tab for identified issues.

Code Coverage Report

Filename                             Stmts    Miss  Cover    Missing
---------------------------------  -------  ------  -------  -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
libcoap/src/crypto/psk/client.rs        62      43  30.65%   44-47, 55, 70-131, 171-177, 203, 210, 229-248
libcoap/src/crypto/psk/key.rs           44      19  56.82%   29-34, 133-174
libcoap/src/crypto/psk/server.rs        81      66  18.52%   44-53, 61, 64-76, 101, 108, 115, 142-185, 212-304
libcoap/src/message/mod.rs             245     124  49.39%   107-110, 112-133, 141-147, 149-170, 174, 176, 210, 212, 215-224, 227-245, 247-251, 267-276, 297-303, 400, 443, 449, 480, 488, 490-492, 499-500, 508, 513-526, 531, 551-552, 563-564
libcoap/src/message/request.rs         220     150  31.82%   52, 69-202, 229-257, 265-375, 381, 384-386, 390, 397-401, 412, 416, 431-432, 437, 440-441, 445-446, 450, 453, 456, 459, 462, 473-477
libcoap/src/message/response.rs        143     111  22.38%   33-156, 162, 165, 168, 171, 174, 192-322, 326-330, 356-357
libcoap-sys/src/lib.rs                  97      35  63.92%   115-151, 183, 188, 193, 198, 208, 213, 223, 228, 233, 238, 243, 248, 253, 258, 263, 268, 278, 320-337, 459-460
libcoap/src/session/client.rs           76      16  78.95%   57, 151, 157, 178, 184, 212-213, 219-229, 276-281
libcoap/src/session/mod.rs             154      91  40.91%   63-69, 98-99, 113-227, 238-281, 291-293, 303-313, 349, 364, 379-398, 421, 429, 453, 457, 478-482, 560, 566
libcoap/src/session/server.rs           48      12  75.00%   71-73, 140-141, 149-150, 181-186
libcoap/src/context.rs                 171      90  47.37%   46, 85, 90-95, 101-102, 107, 112, 114, 148-191, 200-208, 222, 227, 244, 249, 268, 304, 334, 339, 355, 363-524
libcoap/src/error.rs                     4       4  0.00%    87-166
libcoap/src/event.rs                     9       0  100.00%
libcoap/src/mem.rs                     118      48  59.32%   145-159, 193-194, 207-208, 268-294, 316-320, 350-351, 364-366, 378-389, 449-485, 504, 523-524, 527-528
libcoap/src/prng.rs                     18      14  22.22%   67-179
libcoap/src/protocol.rs                150     110  26.67%   145-146, 152-157, 159-174, 176-177, 184-189, 191-206, 208-209, 266-267, 289, 303-304, 347-352, 361-380, 437-482, 515, 517
libcoap/src/resource.rs                139      69  50.36%   96-98, 173-208, 216-221, 248, 251, 254, 257, 268-289, 302-304, 329-333, 340-341, 350-352, 358-360, 366-374, 496, 498-509
libcoap/src/transport.rs                10       3  70.00%   28-33, 54
libcoap/src/types.rs                   233     163  30.04%   76-121, 128-157, 200-275, 285, 411-451, 504-578, 636, 662-712, 766, 781, 811-831, 853-874, 887-971
libcoap/src/crypto/pki_rpk/key.rs       50      30  40.00%   109-187, 195-203, 205-215
libcoap/src/crypto/pki_rpk/mod.rs      120      88  26.67%   113-139, 149-191, 201, 204-238, 251, 258, 265, 291, 293, 297, 324-406
libcoap/src/crypto/pki_rpk/pki.rs       30      10  66.67%   33-42, 102-109
libcoap/src/crypto/pki_rpk/rpk.rs       17       6  64.71%   57-58, 103-106
libcoap/tests/common/dtls.rs            19       2  89.47%   33, 39
libcoap/tests/common/mod.rs             47       5  89.36%   71, 101, 103-104, 107
TOTAL                                 2305    1309  43.21%

Diff against main

Filename                             Stmts    Miss  Cover
---------------------------------  -------  ------  -------
libcoap/src/crypto/psk/client.rs       +62     +43  +30.65%
libcoap/src/crypto/psk/key.rs          +44     +19  +56.82%
libcoap/src/crypto/psk/server.rs       +81     +66  +18.52%
libcoap-sys/src/lib.rs                  +6      +3  -0.92%
libcoap/src/session/client.rs          -59     -46  +24.87%
libcoap/src/session/mod.rs               0      +5  -3.25%
libcoap/src/context.rs                 -46     -24  -0.10%
libcoap/src/types.rs                    -2      +3  -1.87%
libcoap/src/crypto/pki_rpk/key.rs      +50     +30  +40.00%
libcoap/src/crypto/pki_rpk/mod.rs     +120     +88  +26.67%
libcoap/src/crypto/pki_rpk/pki.rs      +30     +10  +66.67%
libcoap/src/crypto/pki_rpk/rpk.rs      +17      +6  +64.71%
libcoap/tests/common/dtls.rs           +19      +2  +89.47%
libcoap/tests/common/mod.rs             +4       0  +0.99%
TOTAL                                 +326    +205  -2.04%

badge

Results for commit: 29cf312

Coverage target is 80%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request libcoap-parity Features that libcoap offers, but libcoap-rs currently does not
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable DTLS EC JPAKE support Public Key Infrastructure/Raw Public Key Support
1 participant