webrtc icon indicating copy to clipboard operation
webrtc copied to clipboard

[dtls] `invalid named curve` during of handshake

Open Shaienn opened this issue 2 years ago • 0 comments

Hello. Our application receives SDP offer from webrtc.rs and sets setup:active in the answer. Then our application starts dtls handshake by sending client_hello with list of elliptic curve groups supported by our application. I expect that webrtc.rs should find curves supported by itself in the received list and then continue handshake using the best curve supported by both sides.

I have noticed that webrtc.rs supports only P384, P256, X25519 curves and make sure that they are included in the client_hello curves list:

image

But during of handshake i have got the error:

warning: [webrtc::peer_connection::peer_connection_internal:654]: Failed to start manager dtls: invalid named curve

And tcpdump: image

I did an investigation and looks like webrtc.rs just uses the first curve in the received list and forbids handshake if curve is not supported despite that supported curves are present in the list.

I suppose that the code which selects first curve is: https://github.com/webrtc-rs/webrtc/blob/76115186593e139e1d69235be24a2e6382e056a4/dtls/src/flight/flight0.rs#L101-L114

Also i did an experiment and sent P384 as first element of curves list and unsupported curve as second element. Handshake has been completed:

image

Could you please consider to implement searching of supported curve in received list instead of using first curve.

Thanks

Shaienn avatar Mar 06 '23 09:03 Shaienn