Skip to content

api: add key update request functionality #4453

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

Merged
merged 8 commits into from
Mar 8, 2024

Conversation

jmayclin
Copy link
Contributor

@jmayclin jmayclin commented Mar 8, 2024

Description of changes:

This commit adds a new API which allows a customer to signal their desire for a key update.

Testing:

Unit tests were added to cover new functionality.

Testing was done locally with other implementations to confirm that they receive the new key update. at the signaled time.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jmayclin jmayclin requested review from camshaft and lrstewart March 8, 2024 05:53
@github-actions github-actions bot added the s2n-core team label Mar 8, 2024
Copy link
Contributor

@camshaft camshaft left a comment

Choose a reason for hiding this comment

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

Looks good to me. In terms of it being sparse, we already had all of the functionality in place for this feature; it just wasn't exposed in a public API.

POSIX_ENSURE_REF(conn);
/* s2n-tls does not currently support requesting key updates from peers */
POSIX_ENSURE(!peer_update_requested, S2N_ERR_T_USAGE);
s2n_atomic_flag_set(&conn->key_update_pending);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should have another check to make sure that the handshake is complete?

Copy link
Contributor

Choose a reason for hiding this comment

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

Theoretically not necessary? We just wouldn't send the update until after the handshake

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well it'd be nice to be able to have the compliance comment about not sending this until the finished message has been sent, so I'll go ahead and add it.

Copy link
Contributor

Choose a reason for hiding this comment

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

But this method doesn't send anything, so that'd be the wrong place for that compliance comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, I'd add it as a test case in s2n_key_update_test.c

- return unimplemented err rather than generic type
- explicitly mention that the key update message is not sent until
  s2n_send is called
- explicitly mention that the method will fail is peer_update is set to
  false.
jmayclin added 2 commits March 8, 2024 06:22
- switch err to a usage type
- switch to uint8_t for the input
- use enum intead of uint8_t for the toggle parameter
@jmayclin jmayclin marked this pull request as ready for review March 8, 2024 17:32
jmayclin added 2 commits March 8, 2024 17:40
- cleanup singular vs plural nouns in documentation
@jmayclin jmayclin enabled auto-merge (squash) March 8, 2024 17:56
@jmayclin jmayclin merged commit d916942 into aws:main Mar 8, 2024
@jmayclin jmayclin deleted the key-update-signal branch July 1, 2024 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants