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

ktls: alert/handshake data #4169

Closed
Tracked by #3711
toidiu opened this issue Aug 25, 2023 · 0 comments · Fixed by #4199
Closed
Tracked by #3711

ktls: alert/handshake data #4169

toidiu opened this issue Aug 25, 2023 · 0 comments · Fixed by #4199

Comments

@toidiu
Copy link
Contributor

toidiu commented Aug 25, 2023

main...toidiu:s2n-tls:ak-ktls0_main1 is some sample code, warning.. its nasty looking code. The relevant files are s2n_shutdown.c and s2n_ktls_io.c.

This task should come after #4168 and might influence that task.

Receiving Alerts:
I'll list a few assumptions and things we should watch out for Alerts:

  • we can recv an alert at any point
  • kTLS could return a fragmented alert (alerts are 2 bytes but could it return 1 byte)? I was not able to repro this and verify if its something we need to worry about. Other impls dont seem to worry about this.
  • If we recv alert when trying to recv app data, we need to process it and then 'rewind the read' so that we do not return the alert to the user
  • when calling s2n_ktls_recv from shutdown, we only care about alerts so we drop app data
    • we will need to read into our own library owned buffer (what size should it be?) (which stuffer? conn->alert_in or conn->in)
    • since its possible to recv app data the stuffer should be >2 but also large enough to process some app data quickly
    • do we want to allocate the stuffer each time or alloc once and keep it around?
  • It might be best to call s2n_process_alert_fragment

Receiving Handshake:

  • We error on hadnshake message except some logic around TLS_HELLO_REQUEST and conn->config->renegotiate_request_cb. Here is some sample code but one should double check the current TLS impl also to make sure there is nothing missing.
  • It might be best to call s2n_post_handshake_recv
@toidiu toidiu mentioned this issue Aug 25, 2023
32 tasks
@toidiu toidiu changed the title alert/handshake ktls: alert/handshake data Aug 25, 2023
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 a pull request may close this issue.

1 participant