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

SSL_read()=0 passthrough is not good #48

Closed
markokr opened this issue Sep 14, 2015 · 3 comments
Closed

SSL_read()=0 passthrough is not good #48

markokr opened this issue Sep 14, 2015 · 3 comments

Comments

@markokr
Copy link

markokr commented Sep 14, 2015

I see you have changed tls_read/tls_write to let 0 passthrough without checks. But is it really smart thing to do?

I remember some SSL2-era security problem caused by inability to differentiate between tcp abort and peer-requested shutdown. Currently 0 from tls_read says it was proper shutdown. Seems now you are changing it to "either it was shut down or we just lost tcp connection". I suppose its possible to check tls_close() error to see if something was off, but it does not seem like improvement.

@4a6f656c
Copy link

The intention is to make tls_read(3)/tls_write(3) follow as closely as possible to the semantics of read(2)/write(2). This means that they should return 0 on EOF - the challenge is that with read(2)/write(2) you would then go and check errno in order to see if the EOF was unexpected. In this case, I think we just need to ensure that tls_close() can indicate the difference between EOF with close-notify and unexpected EOF without close-notify. The application then gets to decide if that is a problem or not.

@markokr
Copy link
Author

markokr commented Sep 14, 2015

Unexpected EOF of underlying transport should not be "end of data" but EIO, where read() also returns -1.

Zero should be reserved only for successful EOF.

@markokr
Copy link
Author

markokr commented Sep 14, 2015

I have been convinced current behaviour is more practical.

Closing.

@markokr markokr closed this as completed Sep 14, 2015
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

No branches or pull requests

2 participants