<p dir="ltr">Matt,<br>
Thanks for taking the time to go through this. Unfortunately this error only happens when WebRTC is acting as the server in the dtls handshake and no logs (at all) seem to be printed but I think that's because openssl logging is done in a different way in native WebRTC which I'm not handling. I'll try increasing logs and / or printing openssl errors.</p>
<p dir="ltr">The janus server gets the alert packet which I'm guessing is an error produced by the server in the transaction above.<br>
 <br>
I'm assuming the problem is with the client reply that janus sent. Any idea what it could have sent wrong that WebRTC didn't like? Could it have encrypted the message with a wrong crypto or something or is this negotiation wholly handled by openssl? I'm trying to understand if janus is doing something wrong or is the dtls stuff completely handled by libssl - in which case this might be a dtls bug?</p>
<p dir="ltr">I'm a newbie to openssl and dtls so dont mind the stupid questions. I however do know C and socket stuff so can get in to check with some guidance :)<br><br></p>
<br><div class="gmail_quote">On Fri, May 1, 2015, 2:37 AM Matt Caswell <<a href="mailto:matt@openssl.org">matt@openssl.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 01/05/15 02:11, faraz khan wrote:<br>
> Hi everyone,<br>
> This is my first time posting to this list - so if theres a better place<br>
> for this question please let me know.<br>
><br>
> The problem I'm trying to fix applies to the Janus webrtc gateway<br>
> (<a href="https://github.com/meetecho/janus-gateway" target="_blank">https://github.com/meetecho/janus-gateway</a>) and my application which is<br>
> using native C++ webrtc.<br>
><br>
> What happens is that after hundreds of successful connections, sometimes<br>
> the Janus server is unable to negotiate a DTLS handshake and after a key<br>
> exchange the webrtc client replied with a DTLS Alert: Decrypt failed<br>
> message. I'm attaching a wireshark trace of the issue happening and one<br>
> for the correct negotiation.<br>
><br>
> The problem refuses to fix itself till Janus is restarted.<br>
><br>
> Both installations are using Openssl. Janus is compiled with version 1.0.1f<br>
><br>
> If someone can help explain how DTLS key exchange works and whats going<br>
> wrong in the above trace it would be great! I'm completely at a loss as<br>
> far as this is concerned!<br>
><br>
> Thanks all!<br>
<br>
Hmmmm. I can't see anything obviously wrong with the above traces. The<br>
handshake seems to proceed as normal and then fail near the end.<br>
<br>
A couple of things of note:<br>
* A client cert is being sent, but it has expired. I don't think this is<br>
the problem though because it is the same cert in the "good" trace and<br>
the "bad" trace.<br>
        Validity<br>
            Not Before: Feb  9 16:18:45 2007 GMT<br>
            Not After : Feb  8 16:18:45 2009 GMT<br>
<br>
* A different ciphersuite is being negotiated between the "good" version<br>
and the "bad" version. "Good" is TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,<br>
whilst "Bad" is TLS_RSA_WITH_AES_256_CBC_SHA. I'm not sure if that is<br>
significant, but I can't see why a server restart would make any<br>
difference if it were.<br>
<br>
Are there any server logs which might indicate why it is sending the<br>
alert? Looking at the code there are only a few places in the code which<br>
generate a decrypt error alert. It would probably help diagnose the<br>
problem if we could narrow down which of those places this is coming<br>
from. OpenSSL adds an error to its error queue for each of those places.<br>
<br>
The other point of note is that there have been quite a lot of DTLS<br>
related defect fixes in the OpenSSL code since 1.0.1f. An upgrade would<br>
be a really good idea.<br>
<br>
Matt<br>
<br>
_______________________________________________<br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" target="_blank">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br>
</blockquote></div>