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

DTLS window handling from user space #13

Open
fridex opened this issue Apr 8, 2016 · 2 comments
Open

DTLS window handling from user space #13

fridex opened this issue Apr 8, 2016 · 2 comments
Labels

Comments

@fridex
Copy link
Member

fridex commented Apr 8, 2016

The current implementation of DTLS sliding window handling behaves correctly only if there are no out of order DTLS records. If we receive a record that is not at the beginning of the window, and user space asks for seq number, the seq number can be incorrect. There should be returned seq number which corresponds to the very first record expected within the sliding window:

An example scenario:

  1. user space sets seq number to be (epoch 1, seq num 1)
  2. kernel receives (epoch 1, seq num 3) - within window, record is accepted
  3. kernel receives (epoch 1, seq num 4) - within window, record is accepted
  4. user space asks for seq number, the kernel responds with (epoch 1. seq num 3) - incorrect, should be (epoch 1, seq num 2)

Since DTLS window is part of the state, there should be probably appropriate {get,set}sockopt(2) call to populate the sliding window to user space. This would allow to sync user space with DTLS socket and vice versa. There has to be kept in mind that sliding window in user space can be of different size than the one in the kernel.

@fridex fridex added bug and removed bug labels Apr 8, 2016
@fridex
Copy link
Member Author

fridex commented Sep 19, 2016

#87 is also relevant here. IMHO we should make possible to get DTLS window state to userspace, otherwise we are dealing with possible reply attacks here.

In case of DTLS, the userspace should ask for seq_number and DTLS window in order to correctly continue with the session.

@fridex
Copy link
Member Author

fridex commented Sep 19, 2016

A simpler version would drop records and aggressively advance when coming back to userspace: we could simply advance dtls window to the newest received , e.g. (see include/linux/count_zeros.h for count_leading_zeros):

seq_numeber += (sizeof(dlts_window_mask)*CHAR_BIT) - count_leading_zeros(dtls_window_mask)

The implementation highly depends on #87.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant