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

Add CCM cipher suite variants (2.) #147

Closed
wants to merge 2 commits into from
Closed

Conversation

boaks
Copy link
Contributor

@boaks boaks commented Jun 23, 2022

In case of CCM gets recommended and CCM8 deprecated.

Introduce cipher_suite_param_t for cipher-suite specific mac_len and
key_exchange_algorithm, and introduce dtls_cipher_index_t for simplified
cipher-suite parameter lookup. Cleanup old functions.

Copy link
Contributor

@mrdeep1 mrdeep1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a good read through the changes, only a couple of minor things found.

@@ -105,7 +111,7 @@ typedef struct {
typedef struct {
dtls_compression_t compression; /**< compression method */

dtls_cipher_t cipher; /**< cipher type */
dtls_cipher_index_t cipher_index; /**< internal index for cipher_suite_params, DTLS_CIPHER_INDEX_NULL for TLS_NULL_WITH_NULL_NULL */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line length is > 80 chars, breaking coding style. This occurs in multiple places

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we break / split line for macros as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be my preference. @obgm ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That requires a lot of concentration to only fix the lines, which are altered with this PR.
Otherwise we get a couple of "format only changes", which I would prefer to have them done "once applying a formatter" (issue #143).
We will see ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, if I continue to try to fix the format only of the changed lines, that will eat up hour and hour. it requires also to spend a lot of time in the follow-up commits, though these are changing the same lines and cherrypick ends up in also a lot of conflicts.
My proposal: I go "fast over it". And the final "format" approach is then done with #143.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Tidy up things with clang-format etc. at a later stage.

@@ -2801,7 +2866,7 @@ dtls_send_client_hello(dtls_context_t *ctx, dtls_peer_t *peer,
psk = is_psk_supported(ctx);
ecdsa = is_ecdsa_supported(ctx, 1);

cipher_size = 2 + ((ecdsa) ? 2 : 0) + ((psk) ? 2 : 0);
cipher_size = 2 + ((ecdsa) ? 4 : 0) + ((psk) ? 4 : 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a comment here that the 4 refers to there being 2 algorithms that are going to be defined - to make it more obvious what needs to be done when another algorithm is added.
Perhaps 4 should be 2*2 to emphasize this further.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to improve the "length documentation" in a commit later 84f834a .
I will add also comment here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

84f834a certainly helps, but does not specifically bring focus to this line for the supported suites that are going to be announced.

-  cipher_size = 2 + ((ecdsa) ? 2 : 0) + ((psk) ? 2 : 0);
+  /* Each announced cipher suite is 2 bytes long */
+  cipher_size = 2 + ((ecdsa) ? 2*2 : 0) + ((psk) ? 2*2 : 0);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that commit doesn't address it, because this lines are removed on a commit before.

Therefore I think, it doesn't really pay-off to polish it more and then remove it.

@boaks
Copy link
Contributor Author

boaks commented Jan 21, 2023

Available on "develop" until follow up PR #148 gets merged.

@boaks boaks added the available on develop Mark PRs (pre-)available only on develop label Jan 21, 2023
Add cipher suites with full 16 byte MAC.

Signed-off-by: Achim Kraus <[email protected]>
Use cipher_suite_param_t for cipher-suite specific mac_len and
key_exchange_algorithm. Introduce dtls_cipher_index_t for simplified
cipher-suite parameter lookup. Cleanup old functions.

Signed-off-by: Achim Kraus <[email protected]>
@boaks
Copy link
Contributor Author

boaks commented Apr 17, 2023

Now merged in main.

@boaks boaks closed this Apr 17, 2023
@boaks boaks removed the available on develop Mark PRs (pre-)available only on develop label Apr 17, 2023
@boaks boaks deleted the add_ccm branch April 17, 2023 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants