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

0-RTT #14

Open
mcarrickscott opened this issue Jan 17, 2021 · 10 comments
Open

0-RTT #14

mcarrickscott opened this issue Jan 17, 2021 · 10 comments

Comments

@mcarrickscott
Copy link

I am testing my TLS1.3 client against swifttls.org, in particular 0-RTT on session resumption. It works OK if I calculate the application keys based on a transcript hash taken over everything up to and including Server Finish. But it does not work if I include the end-of-early-data message in the transcript hash. My reading of the RFC would indicate that it should be included?

@nsc
Copy link
Owner

nsc commented Jan 17, 2021

You are right. I am reading the RFC the same way. Thanks for bringing this up. I was aware that early data wasn't working correctly, but hadn't found a good way to debug this. All test installations of TLS 1.3 servers I have tried didn't support early data.
I am currently looking into this.
Thanks again.

@mcarrickscott
Copy link
Author

mcarrickscott commented Jan 17, 2021 via email

@nsc
Copy link
Owner

nsc commented Jan 17, 2021

Right. My current interpretation is that the server and the client application traffic secrets are created at different points in the handshake. That means the server transcript hash does not have the end-of-early-data message in its hash, while the client does.
That is what I am trying right now.

@nsc
Copy link
Owner

nsc commented Jan 17, 2021

No, that was not right. On page 92 of the RFC it says both the client and the server application traffic secret are including all handshake messages up to the server finished.
I am currently testing with Firefox, because it is using early data, and it seems to work fine.

@nsc
Copy link
Owner

nsc commented Jan 19, 2021

I have now enabled the test server to send early data responses. I think the early data handling is working correctly. Maybe you want to have a try with your client.

@mcarrickscott
Copy link
Author

mcarrickscott commented Jan 19, 2021 via email

@nsc
Copy link
Owner

nsc commented Jan 19, 2021

Hi Mike,
yes, I am currently not supporting X25519, but the good thing is, that this triggers the HelloRetry :-)

I guess this is the log from your request (the only one with early data):
2021-01-19 13:44:05.554 (~427): Connection from 86.44.157.108
2021-01-19 13:44:05.557 (~427): Curve: x25519
2021-01-19 13:44:05.557 (~427): Supported Cipher Suites:
2021-01-19 13:44:05.557 (~427): TLS_AES_128_GCM_SHA256
2021-01-19 13:44:05.557 (~427): TLS_AES_256_GCM_SHA384
2021-01-19 13:44:05.557 (~427): Selected cipher suite is TLS_AES_128_GCM_SHA256
2021-01-19 13:44:05.557 (~427): Server: did receive message ClientHello
2021-01-19 13:44:05.557 (~427): Server: did send message HelloRetryRequest
2021-01-19 13:44:05.805 (~427): Curve: secp256r1
2021-01-19 13:44:05.805 (~427): Supported Cipher Suites:
2021-01-19 13:44:05.805 (~427): TLS_AES_128_GCM_SHA256
2021-01-19 13:44:05.805 (~427): TLS_AES_256_GCM_SHA384
2021-01-19 13:44:05.805 (~427): Selected cipher suite is TLS_AES_128_GCM_SHA256
2021-01-19 13:44:05.805 (~427): Server: did receive message ClientHello
2021-01-19 13:44:06.412 (~427): Server: did send message ServerHello
2021-01-19 13:44:06.412 (~427): Server: did send message EncryptedExtensions
2021-01-19 13:44:06.413 (~427): Server: did send message Certificate
2021-01-19 13:44:06.616 (~427): Server: did send message CertificateVerify
2021-01-19 13:44:06.616 (~427): Server: did send message Finished
2021-01-19 13:44:06.617 (~427): Server: activate server traffic secret
2021-01-19 13:44:06.642 (~427): Server: Activate client traffic secret
2021-01-19 13:44:06.642 (~427): Server: did receive message Finished
2021-01-19 13:44:06.643 (~427): Server: did send message NewSessionTicket
2021-01-19 13:44:06.675 (~427): TLS Version: TLS v1.3
Cipher: TLS_AES_128_GCM_SHA256

Client Request:
GET / HTTP/1.1
Host: swifttls.org

2021-01-19 13:44:11.766 (~427): Error: Socket Closed
2021-01-19 13:44:11.786 (~428): Connection from 86.44.157.108
2021-01-19 13:44:11.809 (~428): Curve: secp256r1
2021-01-19 13:44:11.810 (~428): Supported Cipher Suites:
2021-01-19 13:44:11.810 (~428): TLS_AES_128_GCM_SHA256
2021-01-19 13:44:11.810 (~428): TLS_AES_256_GCM_SHA384
2021-01-19 13:44:11.810 (~428): Selected cipher suite is TLS_AES_128_GCM_SHA256
2021-01-19 13:44:11.810 (~428): Server ticket age : 5167
2021-01-19 13:44:11.810 (~428): Client ticket age : 5114
2021-01-19 13:44:11.810 (~428): ticket hash algorithm : sha256
2021-01-19 13:44:11.810 (~428): Choose ticket [10, 190, 26, 84, 100, 68, 166, 90, 20, 199, 131, 6, 146, 250, 227, 235, 206, 41, 155, 198, 72, 103, 189, 81, 38, 122, 255, 51, 124, 169, 42, 135]
2021-01-19 13:44:11.810 (~428): Server: did receive message ClientHello
2021-01-19 13:44:12.404 (~428): Server: did send message ServerHello
2021-01-19 13:44:12.405 (~428): Server: did send message EncryptedExtensions
2021-01-19 13:44:12.405 (~428): Server: did send message Finished
2021-01-19 13:44:12.405 (~428): Server: activate server traffic secret
2021-01-19 13:44:12.405 (~428): Server: activate early traffic secret
2021-01-19 13:44:12.405 (~428): Server: did receive early data: Optional(SwiftTLS.TLSApplicationData)
2021-01-19 13:44:12.406 (~428): TLS Version: TLS v1.3
Cipher: TLS_AES_128_GCM_SHA256
Ticket:

serverNames: ["swifttls.org"]
identity: 0a be 1a 54 64 44 a6 5a 14 c7 83 06 92 fa e3 eb
ce 29 9b c6 48 67 bd 51 26 7a ff 33 7c a9 2a 87
nonce: 00
lifeTime: 3600
ageAdd: 1732565963
cipherSuite: TLS_AES_128_GCM_SHA256
hashAlgorithm sha256

Client Request:
GET / HTTP/1.1
Host: swifttls.org
Early-Data: 1

2021-01-19 13:44:12.407 (~428): Server: sending 727 bytes of early data
2021-01-19 13:44:12.423 (~428): Server: did receive early data: Optional(SwiftTLS.TLS1_3.TLSEndOfEarlyData)
2021-01-19 13:44:12.440 (~428): Server: Activate client traffic secret
2021-01-19 13:44:12.440 (~428): Server: did receive message Finished
2021-01-19 13:44:12.440 (~428): Server: did send message NewSessionTicket

@nsc
Copy link
Owner

nsc commented Jan 19, 2021

it is not easy to debug a tls1.3 client

:-) Tell me about it. Took me a long time, too. With the more subtle bugs, I had a working implementation running on the other end (like OpenSSL or something) and littered it with debug logs to see why it wasn't accepting my input.
Feel free to use my server locally :-)

@mcarrickscott
Copy link
Author

mcarrickscott commented Jan 20, 2021 via email

@nsc
Copy link
Owner

nsc commented Jan 20, 2021

Will do. Yours is the most developer-friendly implementation I have come
across.

Thanks. It is nice to hear that it is useful to you :-)

check out https://github.com/miracl/core

Cool, I will take a look.

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