Open yunus opened 9 years ago
Below is the log output. ( Remark: There are 6 messages in flight 4 instead of 5, since I have added an additional message ordered as 2nd message.) In the second reception of CertificateRequest (5th message), next_receive_seq jumps from 4 to 6 (6th is the ServerHelloDone)
12 FINE [ClientHandshaker]: DTLS Message processed (/aaaa:0:0:0:202:2:2:2:5684):
==[ DTLS Message ]============================================
Content Type: Handshake (22)
Version: 254, 253
Epoch: 0
Sequence Number: 3
Length: 109
Handshake Protocol
Type: Certificate (11)
Message Sequence: 3
Fragment Offset: 0
Fragment Length: 97
Length: 97
Raw Public Key: SunPKCS11-NSS EC public key, 256 bits (id 8, session object)
public x coord: 94232897661529392044308082597636544403139625602616773737240455601462877679514
public y coord: 81459975214215857114679354058384353873712640061964199410870538408465338855024
parameters: secp256r1 [NIST P-256, X9.62 prime256v1] (1.2.840.10045.3.1.7)
=============================================================== - (org.eclipse.californium.scandium.dtls.ClientHandshaker.java:237) processMessage() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:25)
12 FINEST [DTLSConnector]: => find handshaker for key /aaaa:0:0:0:202:2:2:2:5684 - (org.eclipse.californium.scandium.DTLSConnector.java:192) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:25)
12 FINEST [DTLSConnector]: => contentType: Handshake (22) - (org.eclipse.californium.scandium.DTLSConnector.java:207) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:25)
12 FINEST [DTLSConnector]: => handshaker: org.eclipse.californium.scandium.dtls.ClientHandshaker@2b32f1 - (org.eclipse.californium.scandium.DTLSConnector.java:271) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:25)
12 INFO [Handshaker]: Queued newer message from same epoch, message_seq: 5, next_receive_seq: 4 - (org.eclipse.californium.scandium.dtls.Handshaker.java:646) processMessageNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:25)
12 FINEST [DTLSConnector]: => find handshaker for key /aaaa:0:0:0:202:2:2:2:5684 - (org.eclipse.californium.scandium.DTLSConnector.java:192) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:50)
12 FINEST [DTLSConnector]: => contentType: Handshake (22) - (org.eclipse.californium.scandium.DTLSConnector.java:207) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:50)
12 FINEST [DTLSConnector]: => handshaker: org.eclipse.californium.scandium.dtls.ClientHandshaker@2b32f1 - (org.eclipse.californium.scandium.DTLSConnector.java:271) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:50)
12 INFO [Handshaker]: Discarded message due to older message_seq: 1, next_receive_seq: 4 - (org.eclipse.californium.scandium.dtls.Handshaker.java:652) processMessageNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:50)
12 FINEST [DTLSConnector]: => find handshaker for key /aaaa:0:0:0:202:2:2:2:5684 - (org.eclipse.californium.scandium.DTLSConnector.java:192) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => contentType: Handshake (22) - (org.eclipse.californium.scandium.DTLSConnector.java:207) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => handshaker: org.eclipse.californium.scandium.dtls.ClientHandshaker@2b32f1 - (org.eclipse.californium.scandium.DTLSConnector.java:271) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 INFO [Handshaker]: Discarded message due to older message_seq: 2, next_receive_seq: 4 - (org.eclipse.californium.scandium.dtls.Handshaker.java:652) processMessageNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => find handshaker for key /aaaa:0:0:0:202:2:2:2:5684 - (org.eclipse.californium.scandium.DTLSConnector.java:192) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => contentType: Handshake (22) - (org.eclipse.californium.scandium.DTLSConnector.java:207) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => handshaker: org.eclipse.californium.scandium.dtls.ClientHandshaker@2b32f1 - (org.eclipse.californium.scandium.DTLSConnector.java:271) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 INFO [Handshaker]: Discarded message due to older message_seq: 3, next_receive_seq: 4 - (org.eclipse.californium.scandium.dtls.Handshaker.java:652) processMessageNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => find handshaker for key /aaaa:0:0:0:202:2:2:2:5684 - (org.eclipse.californium.scandium.DTLSConnector.java:192) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => contentType: Handshake (22) - (org.eclipse.californium.scandium.DTLSConnector.java:207) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => handshaker: org.eclipse.californium.scandium.dtls.ClientHandshaker@2b32f1 - (org.eclipse.californium.scandium.DTLSConnector.java:271) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 INFO [Handshaker]: Discarded message due to older message_seq: 5, next_receive_seq: 6 - (org.eclipse.californium.scandium.dtls.Handshaker.java:652) processMessageNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINE [ClientHandshaker]: DTLS Message processed (/aaaa:0:0:0:202:2:2:2:5684):
==[ DTLS Message ]============================================
Content Type: Handshake (22)
Version: 254, 253
Epoch: 0
Sequence Number: 10
Length: 155
Handshake Protocol
Type: Server Key Exchange (12)
Message Sequence: 4
Fragment Offset: 0
Fragment Length: 143
Length: 143
Diffie-Hellman public key: SunPKCS11-NSS EC public key, 256 bits (id 9, session object)
public x coord: 25432395752676769703517671724784290396489548327748344103923078346474396804221
public y coord: 101069444803793544838331832634371305649146840760865880752929394027956016823068
parameters: secp256r1 [NIST P-256, X9.62 prime256v1] (1.2.840.10045.3.1.7)
=============================================================== - (org.eclipse.californium.scandium.dtls.ClientHandshaker.java:237) processMessage() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => find handshaker for key /aaaa:0:0:0:202:2:2:2:5684 - (org.eclipse.californium.scandium.DTLSConnector.java:192) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => contentType: Handshake (22) - (org.eclipse.californium.scandium.DTLSConnector.java:207) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => handshaker: org.eclipse.californium.scandium.dtls.ClientHandshaker@2b32f1 - (org.eclipse.californium.scandium.DTLSConnector.java:271) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 INFO [Handshaker]: Discarded message due to older message_seq: 5, next_receive_seq: 6 - (org.eclipse.californium.scandium.dtls.Handshaker.java:652) processMessageNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => find handshaker for key /aaaa:0:0:0:202:2:2:2:5684 - (org.eclipse.californium.scandium.DTLSConnector.java:192) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => contentType: Handshake (22) - (org.eclipse.californium.scandium.DTLSConnector.java:207) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: => handshaker: org.eclipse.californium.scandium.dtls.ClientHandshaker@2b32f1 - (org.eclipse.californium.scandium.DTLSConnector.java:271) receiveNext() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINE [ClientHandshaker]: DTLS Message processed (/aaaa:0:0:0:202:2:2:2:5684):
==[ DTLS Message ]============================================
Content Type: Handshake (22)
Version: 254, 253
Epoch: 0
Sequence Number: 12
Length: 12
Handshake Protocol
Type: Server Hello Done (14)
Message Sequence: 6
Fragment Offset: 0
Fragment Length: 0
Length: 0
=============================================================== - (org.eclipse.californium.scandium.dtls.ClientHandshaker.java:237) processMessage() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: Entered to cancelling previous flights of 1 with keys [aaaa:0:0:0:202:2:2:2:5684] - (org.eclipse.californium.scandium.DTLSConnector.java:642) cancelPreviousFlight() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: Cancelling the previous flights: 11004759 --------------START of FLIGHT--------------
Type: Client Hello (1)
--------------END of FLIGHT--------------
- (org.eclipse.californium.scandium.DTLSConnector.java:645) cancelPreviousFlight() in thread DTLS-Receiver0.0.0.0/0.0.0.0:0 at (2015-02-12 11:11:51)
12 FINEST [DTLSConnector]: ==>> sending flight 1486879 with 0th trial, the flight: --------------START of FLIGHT--------------
Type: Client Key Exchange (16)
Type: Finished (20)
--------------END of FLIGHT--------------
When messages are out of order, they are queued. Assume that in Flight 4, ServerKeyExchange is lost, and CertificateRequest arrives out of order. Later, when ServerKeyExchange arrives with ServerHelloDone in a retransmission of the whole flight, Scandium does not go through the QueuedMessages before handling ServerHelloDone.
As a result, Scandium thinks that there was no certificateRequest, so this is a PSK based session.
So the solution should be emptying the QueuedMessages before handling the ServerHelloDone.