node-webrtc / node-webrtc

node-webrtc is a Node.js Native Addon that provides bindings to WebRTC M87
Other
2.71k stars 456 forks source link

createOffer failing in GetSignatureDigestAlgorithm on WebRTC for ARM with node-webrtc on Raspberry pi #296

Closed ssaroha closed 7 years ago

ssaroha commented 7 years ago

Hi, I cross compiled webrtc Specifically for ARM using the following build steps: //////////// fetch --nohooks webrtc gclient sync ./build/install-build-deps.sh

gn gen out/Default --args='target_cpu = "arm" target_os=”linux” rtc_use_dummy_audio_file_devices=true'

ninja -C out/Default ////////////

the libwebrtc static library compiled fine, which I used in building the node module https://github.com/js-platform/node-webrtc here is my fork: https://github.com/ssaroha/node-webrtc

  1. When I ran the following node test program with the cross-compiled webrtc on raspberry pi https://github.com/js-platform/node-webrtc/blob/develop/examples/ping-pong-test.js

its able to create the rtcpeerconnection(s) just fine including generating the SSL certificate but when it tries to create an offer, its fails to get the signature digest algorithm name from the cert. when I try to print the cert in that method

rtc::OpenSSLCertificate::GetSignatureDigestAlgorithm

it core dumps with SIGSEGV.

Unix OS used for cross-compiling webrtc for ARM on ubuntu - Linux 4.4.0-31-generic

OS on Raspberry PI where the test is run: Linux raspberrypi 4.4.26-v7+ #915 SMP Thu Oct 20 17:08:44 BST 2016 armv7l GNU/Linux

Following pastebin shows the console logs: http://pastebin.com/AKFDMa6Y

Also here is the stack trace:

#0  0x004f4164 in X509_print_ex ()
#1  0x74129eca in rtc::PrintCert (x509=0x70afd8e0) at ../../webrtc/base/opensslidentity.cc:97
#2  0x7412a0c8 in rtc::OpenSSLCertificate::GetSignatureDigestAlgorithm (this=0x70afdfe8, algorithm=0x73d37cb4)
    at ../../webrtc/base/opensslidentity.cc:326
#3  0x73eadc96 in cricket::TransportDescriptionFactory::SetSecurityInfo (this=0x70c0c540, desc=0x70c0e910, 
    role=cricket::CONNECTIONROLE_ACTPASS) at ../../webrtc/p2p/base/transportdescriptionfactory.cc:115
#4  0x73eadb86 in cricket::TransportDescriptionFactory::CreateOffer (this=0x70c0c540, options=..., current_description=0x0)
    at ../../webrtc/p2p/base/transportdescriptionfactory.cc:48
Python Exception <class 'gdb.error'> There is no member named _M_dataplus.: 
#5  0x73e949a6 in cricket::MediaSessionDescriptionFactory::AddTransportOffer (this=0x70c0c548, content_name=, 
    transport_options=..., current_desc=0x0, offer_desc=0x70c0d290) at ../../webrtc/pc/mediasession.cc:1615
#6  0x73e92386 in cricket::MediaSessionDescriptionFactory::AddDataContentForOffer (this=0x70c0c548, options=..., 
    current_description=0x0, data_codecs=0x73d38398, current_streams=0x73d383c8, desc=0x70c0d290)
    at ../../webrtc/pc/mediasession.cc:1821
#7  0x73e91432 in cricket::MediaSessionDescriptionFactory::CreateOffer (this=0x70c0c548, options=..., current_description=0x0)
    at ../../webrtc/pc/mediasession.cc:1395
#8  0x7418f416 in webrtc::WebRtcSessionDescriptionFactory::InternalCreateOffer (this=0x70c0c4e0, request=...)
    at ../../webrtc/api/webrtcsessiondescriptionfactory.cc:341
#9  0x7418f1ce in webrtc::WebRtcSessionDescriptionFactory::CreateOffer (this=0x70c0c4e0, observer=0x1762b20, options=..., 
    session_options=...) at ../../webrtc/api/webrtcsessiondescriptionfactory.cc:253
#10 0x7417ff9e in webrtc::WebRtcSession::CreateOffer (this=0x70c0be78, observer=0x1762b20, options=..., session_options=...)
    at ../../webrtc/api/webrtcsession.cc:672
#11 0x73f8606e in webrtc::PeerConnection::CreateOffer (this=0x70c00ca8, observer=0x1762b20, options=...)
    at ../../webrtc/api/peerconnection.cc:1024
#12 0x73f85dfa in webrtc::PeerConnection::CreateOffer (this=0x70c00ca8, observer=0x1762b20, constraints=0x0)
    at ../../webrtc/api/peerconnection.cc:1005
#13 0x73e20c30 in webrtc::ReturnType<void>::Invoke<webrtc::PeerConnectionInterface, void (webrtc::PeerConnectionInterface::*)(webrtc::CreateSessionDescriptionObserver*, webrtc::MediaConstraintsInterface const*), webrtc::CreateSessionDescriptionObserver*, webrtc::MediaConstraintsInterface const*> (this=0x7eff9c14, c=0x70c00ca8, 
    m=&virtual webrtc::PeerConnectionInterface::CreateOffer(webrtc::CreateSessionDescriptionObserver*, webrtc::MediaConstraintsInterface const*), a1=0x1762b20, a2=0x0) at ../../webrtc/api/proxy.h:93
#14 0x73e20bb6 in webrtc::MethodCall2<webrtc::PeerConnectionInterface, void, webrtc::CreateSessionDescriptionObserver*, webrtc::MediaConstraintsInterface const*>::OnMessage (this=0x7eff9be0) at ../../webrtc/api/proxy.h:223
#15 0x73e14542 in webrtc::internal::SynchronousMethodCall::OnMessage (this=0x7eff9b7c) at ../../webrtc/api/proxy.h:121
#16 0x73dd720c in rtc::MessageQueue::Dispatch (this=0x746faad8 <signalingThread>, pmsg=0x73d38dd8)
    at ../../webrtc/base/messagequeue.cc:533
#17 0x73dd45c8 in rtc::Thread::ProcessMessages (this=0x746faad8 <signalingThread>, cmsLoop=-1) at ../../webrtc/base/thread.cc:538
#18 0x73dd4538 in rtc::Thread::Run (this=0x746faad8 <signalingThread>) at ../../webrtc/base/thread.cc:366
#19 0x73dd4392 in rtc::Thread::PreRun (pv=0x172c030) at ../../webrtc/base/thread.cc:358

I have been struggling with this for sometime now, any insights would be highly valuable.

ssaroha commented 7 years ago

attaching the logs after setting the log level to VERBOSE. Its interesting that the certificates are printing just fine in the VERBOSE level when they are being created as part of setting up RTC connections with Signature Algorithm: ecdsa-with-SHA256.

But as part of createOffer when its trying to fetch the digest algorithm, the NID: 1925185696, its trying to fetch the algorithm for is way off. its as if the certificate object(s) its trying to access is not amongst the ones which got created during rtc connection setup.

getting rtc peer connections object..
getting rtc session description object..
Creating rtc peer connections..
(webrtcvoiceengine.cc:548): WebRtcVoiceEngine::WebRtcVoiceEngine
(webrtcvoiceengine.cc:555): Supported send codecs in order of preference:
(webrtcvoiceengine.cc:312): Adding supported codec: opus/48000/2 (111)
(webrtcvoiceengine.cc:312): Adding supported codec: ISAC/16000/1 (103)
(webrtcvoiceengine.cc:312): Adding supported codec: G722/8000/1 (9)
(webrtcvoiceengine.cc:312): Adding supported codec: ILBC/8000/1 (102)
(webrtcvoiceengine.cc:312): Adding supported codec: PCMU/8000/1 (0)
(webrtcvoiceengine.cc:312): Adding supported codec: PCMA/8000/1 (8)
(webrtcvoiceengine.cc:312): Adding supported codec: CN/32000/1 (106)
(webrtcvoiceengine.cc:312): Adding supported codec: CN/16000/1 (105)
(webrtcvoiceengine.cc:312): Adding supported codec: CN/8000/1 (13)
(webrtcvoiceengine.cc:312): Adding supported codec: telephone-event/8000/1 (126)
(webrtcvoiceengine.cc:558): opus/48000/2 (111)
(webrtcvoiceengine.cc:558): ISAC/16000/1 (103)
(webrtcvoiceengine.cc:558): G722/8000/1 (9)
(webrtcvoiceengine.cc:558): ILBC/8000/1 (102)
(webrtcvoiceengine.cc:558): PCMU/8000/1 (0)
(webrtcvoiceengine.cc:558): PCMA/8000/1 (8)
(webrtcvoiceengine.cc:558): CN/32000/1 (106)
(webrtcvoiceengine.cc:558): CN/16000/1 (105)
(webrtcvoiceengine.cc:558): CN/8000/1 (13)
(webrtcvoiceengine.cc:558): telephone-event/8000/1 (126)
(webrtcvoiceengine.cc:561): Supported recv codecs in order of preference:
(webrtcvoiceengine.cc:564): opus/48000/2 (111)
(webrtcvoiceengine.cc:564): isac/16000/1 (103)
(webrtcvoiceengine.cc:564): G722/8000/1 (9)
(webrtcvoiceengine.cc:564): iLBC/8000/1 (102)
(webrtcvoiceengine.cc:564): PCMU/8000/1 (0)
(webrtcvoiceengine.cc:564): PCMA/8000/1 (8)
(webrtcvoiceengine.cc:564): cn/16000/1 (105)
(webrtcvoiceengine.cc:564): cn/8000/1 (13)
(webrtcvoiceengine.cc:564): telephone-event/8000/1 (126)
(webrtcvoiceengine.cc:572): VoiceEngine 4.1.0
(audio_device_impl.cc:86): Create
(audio_device_buffer.cc:73): AudioDeviceBuffer::ctor
(audio_device_impl.cc:133): AudioDeviceModuleImpl
(audio_device_impl.cc:141): CheckPlatform
(audio_device_impl.cc:155): current platform is Linux
(audio_device_impl.cc:182): CreatePlatformSpecificObjects
(file_audio_device_factory.cc:30): WebRTC configured with WEBRTC_DUMMY_FILE_DEVICES but no device files supplied. Will fall back to dummy audio.
(audio_device_impl.cc:196): Dummy Audio APIs will be utilized
(audio_device_impl.cc:371): AttachAudioBuffer
(audio_device_impl.cc:1484): RegisterEventObserver
(audio_device_impl.cc:1497): RegisterAudioCallback
(audio_device_buffer.cc:88): RegisterAudioCallback
(audio_device_impl.cc:499): Init
(audio_device_impl.cc:1228): SetPlayoutDevice(0)
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to set the default output device (error=10028)
(audio_device_impl.cc:548): InitSpeaker
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to initialize the speaker (error=9005)
(audio_device_impl.cc:1323): SetRecordingDevice(0)
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to set the default input device (error=8090)
(audio_device_impl.cc:558): InitMicrophone
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to initialize the microphone (error=9004)
(audio_device_impl.cc:1037): StereoPlayoutIsAvailable
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to query stereo playout mode (error=8090)
(audio_device_impl.cc:1056): SetStereoPlayout(0)
(audio_device_impl.cc:1066): stereo playout is not supported
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to set mono/stereo playout mode (error=8090)
(audio_device_impl.cc:923): StereoRecordingIsAvailable
(audio_device_impl.cc:942): SetStereoRecording(0)
(audio_device_impl.cc:951): failed to change stereo recording
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to set mono/stereo recording mode (error=8090)
(webrtcvoiceengine.cc:1023): webrtc: TransmitMixer::SetAudioProcessingModule(audioProcessingModule=0x72c9c8f8)
(webrtcvoiceengine.cc:1023): webrtc: OutputMixer::SetAudioProcessingModule(audioProcessingModule=0x72c9c8f8)
(audio_device_impl.cc:1103): SetAGC(1)
(voe_base_impl.cc:336): virtual int webrtc::VoEBaseImpl::Init(webrtc::AudioDeviceModule *, webrtc::AudioProcessing *, const rtc::scoped_refptr<AudioDecoderFactory> &): Failed to set agc to enabled: 1
(webrtcvoiceengine.cc:647): WebRtcVoiceEngine::ApplyOptions: AudioOptions {aec: true, agc: true, ns: true, hf: true, swap: false, audio_jitter_buffer_max_packets: 50, audio_jitter_buffer_fast_accelerate: false, typing: true, agc_delta: 0, experimental_agc: false, extended_filter_aec: false, delay_agnostic_aec: false, experimental_ns: false, intelligibility_enhancer: false, level_control: false, residual_echo_detector: true, }
(audio_device_impl.cc:1792): BuiltInAECIsAvailable
(audio_device_generic.cc:51): virtual bool webrtc::AudioDeviceGeneric::BuiltInAECIsAvailable() const: Not supported on this platform
(audio_device_impl.cc:1795): output: 0
(webrtcvoiceengine.cc:728): Echo control set to 1 with mode 2
(audio_device_impl.cc:1808): BuiltInAGCIsAvailable
(audio_device_generic.cc:61): virtual bool webrtc::AudioDeviceGeneric::BuiltInAGCIsAvailable() const: Not supported on this platform
(audio_device_impl.cc:1811): output: 0
(audio_device_impl.cc:1103): SetAGC(1)
(webrtcvoiceengine.cc:1023): webrtc: SetAgcStatus() failed to set Agc mode (error=10028)
(webrtcvoiceengine.cc:762): Auto gain set to 1 with mode 2
(audio_device_impl.cc:1824): BuiltInNSIsAvailable
(audio_device_generic.cc:71): virtual bool webrtc::AudioDeviceGeneric::BuiltInNSIsAvailable() const: Not supported on this platform
(audio_device_impl.cc:1827): output: 0
(webrtcvoiceengine.cc:817): Noise suppression set to 1 with mode 5
(webrtcvoiceengine.cc:823): High pass filter enabled? 1
(webrtcvoiceengine.cc:831): Stereo swapping enabled? 0
(webrtcvoiceengine.cc:840): NetEq capacity is 50
(webrtcvoiceengine.cc:846): NetEq fast mode? 0
(webrtcvoiceengine.cc:853): Typing detection is enabled? 1
(webrtcvoiceengine.cc:862): Adjust agc delta is 0
(webrtcvoiceengine.cc:1048): Adjusting AGC level from default -2dB to -2dB
(webrtcvoiceengine.cc:873): Delay agnostic aec is enabled? 0
(webrtcvoiceengine.cc:882): Extended filter aec is enabled? 0
(webrtcvoiceengine.cc:891): Experimental ns is enabled? 0
(webrtcvoiceengine.cc:897): Intelligibility Enhancer is enabled? 0
(webrtcvoiceengine.cc:907): Level control: 0
(webrtcvoiceengine.cc:1023): webrtc: (audio_processing_impl.cc:601): Level controller activated: 0
(webrtcvoiceengine.cc:943): Setting microphone to (id=0) and speaker to (id=0)
(audio_device_impl.cc:1473): Recording
(audio_device_impl.cc:989): SetRecordingChannel(both)
(audio_device_impl.cc:1000): recording in stereo is not supported
(webrtcvoiceengine.cc:1023): webrtc: SetRecordingChannel() unable to set the recording channel (error=10028)
(audio_device_impl.cc:1323): SetRecordingDevice(0)
(webrtcvoiceengine.cc:1023): webrtc: SetRecordingDevice() unable to set the recording device (error=10028)
(webrtcvoiceengine.cc:948): SetRecordingDevice(0) failed, err=10028
(audio_device_impl.cc:1431): Playing
(audio_device_impl.cc:1228): SetPlayoutDevice(0)
(webrtcvoiceengine.cc:1023): webrtc: SetPlayoutDevice() unable to set the playout device (error=8090)
(webrtcvoiceengine.cc:955): SetPlayoutDevice(0) failed, err=8090
(webrtcvideoengine2.cc:561): WebRtcVideoEngine2::WebRtcVideoEngine2()
(webrtcvideoengine2.cc:642): Supported codecs: {VideoCodec[100:VP8], VideoCodec[96:rtx], VideoCodec[101:VP9], VideoCodec[97:rtx], VideoCodec[116:red], VideoCodec[98:rtx], VideoCodec[117:ulpfec]}
(webrtcvideoengine2.cc:570): WebRtcVideoEngine2::Init
(webrtcsessiondescriptionfactory.cc:162): DTLS-SRTP enabled; sending DTLS identity request (key type: 1).
(opensslidentity.cc:43): Making key pair
(opensslidentity.cc:84): Returning key pair
(opensslidentity.cc:91): Making certificate for WebRTC
(opensslidentity.cc:139): Returning certificate
(opensslidentity.cc:272): Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            eb:93:e9:68:a3:fc:a2:52
    Signature Algorithm: ecdsa-with-SHA256
        Issuer: CN=WebRTC
        Validity
            Not Before: Nov 19 21:31:12 2016 GMT
            Not After : Dec 20 21:31:12 2016 GMT
        Subject: CN=WebRTC
        Subject Public Key Info:
            Public Key Algorithm: id-ecPublicKey
                Public-Key: (256 bit)
                pub: 
                    04:e4:fc:c8:59:d6:f0:61:af:eb:49:2e:1c:45:e5:
                    f7:1d:08:e1:29:0b:48:22:42:a0:67:24:d6:72:70:
                    d1:1f:86:1f:13:bb:36:7f:f5:48:45:03:35:bd:bc:
                    74:6a:70:a9:1e:8f:34:24:13:78:ed:06:a0:cb:12:
                    c2:d6:72:31:14
                Field Type: prime-field
                Prime:
                    00:ff:ff:ff:ff:00:00:00:01:00:00:00:00:00:00:
                    00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:
                    ff:ff:ff
                A:   
                    00:ff:ff:ff:ff:00:00:00:01:00:00:00:00:00:00:
                    00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:
                    ff:ff:fc
                B:   
                    5a:c6:35:d8:aa:3a:93:e7:b3:eb:bd:55:76:98:86:
                    bc:65:1d:06:b0:cc:53:b0:f6:3b:ce:3c:3e:27:d2:
                    60:4b
                Generator (uncompressed):
                    04:6b:17:d1:f2:e1:2c:42:47:f8:bc:e6:e5:63:a4:
                    40:f2:77:03:7d:81:2d:eb:33:a0:f4:a1:39:45:d8:
                    98:c2:96:4f:e3:42:e2:fe:1a:7f:9b:8e:e7:eb:4a:
                    7c:0f:9e:16:2b:ce:33:57:6b:31:5e:ce:cb:b6:40:
                    68:37:bf:51:f5
                Order: 
                    00:ff:ff:ff:ff:00:00:00:00:ff:ff:ff:ff:ff:ff:
                    ff:ff:bc:e6:fa:ad:a7:17:9e:84:f3:b9:ca:c2:fc:
                    63:25:51
                Cofactor:  1 (0x1)
                Seed:
                    c4:9d:36:08:86:e7:04:93:6a:66:78:e1:13:9d:26:
                    b7:81:9f:7e:90
    Signature Algorithm: ecdsa-with-SHA256
         30:44:02:20:44:2d:b4:fa:cd:cf:3f:05:b8:ab:7a:ed:4f:f6:
         97:07:53:05:a6:71:e0:43:a9:35:22:b3:9a:c0:98:25:65:54:
         02:20:21:d9:65:43:72:15:15:11:ef:c1:0f:b4:09:e2:80:40:
         f8:d4:72:63:35:ef:cf:53:3d:ed:2f:cf:9b:91:47:93

(webrtcvoiceengine.cc:548): WebRtcVoiceEngine::WebRtcVoiceEngine
(webrtcvoiceengine.cc:555): Supported send codecs in order of preference:
(webrtcvoiceengine.cc:312): Adding supported codec: opus/48000/2 (111)
(webrtcvoiceengine.cc:312): Adding supported codec: ISAC/16000/1 (103)
(webrtcvoiceengine.cc:312): Adding supported codec: G722/8000/1 (9)
(webrtcvoiceengine.cc:312): Adding supported codec: ILBC/8000/1 (102)
(webrtcvoiceengine.cc:312): Adding supported codec: PCMU/8000/1 (0)
(webrtcvoiceengine.cc:312): Adding supported codec: PCMA/8000/1 (8)
(webrtcvoiceengine.cc:312): Adding supported codec: CN/32000/1 (106)
(webrtcvoiceengine.cc:312): Adding supported codec: CN/16000/1 (105)
(webrtcvoiceengine.cc:312): Adding supported codec: CN/8000/1 (13)
(webrtcvoiceengine.cc:312): Adding supported codec: telephone-event/8000/1 (126)
(webrtcvoiceengine.cc:558): opus/48000/2 (111)
(webrtcvoiceengine.cc:558): ISAC/16000/1 (103)
(webrtcvoiceengine.cc:558): G722/8000/1 (9)
(webrtcvoiceengine.cc:558): ILBC/8000/1 (102)
(webrtcvoiceengine.cc:558): PCMU/8000/1 (0)
(webrtcvoiceengine.cc:558): PCMA/8000/1 (8)
(webrtcvoiceengine.cc:558): CN/32000/1 (106)
(webrtcvoiceengine.cc:558): CN/16000/1 (105)
(webrtcvoiceengine.cc:558): CN/8000/1 (13)
(webrtcvoiceengine.cc:558): telephone-event/8000/1 (126)
(webrtcvoiceengine.cc:561): Supported recv codecs in order of preference:
(webrtcvoiceengine.cc:564): opus/48000/2 (111)
(webrtcvoiceengine.cc:564): isac/16000/1 (103)
(webrtcvoiceengine.cc:564): G722/8000/1 (9)
(webrtcvoiceengine.cc:564): iLBC/8000/1 (102)
(webrtcvoiceengine.cc:564): PCMU/8000/1 (0)
(webrtcvoiceengine.cc:564): PCMA/8000/1 (8)
(webrtcvoiceengine.cc:564): cn/16000/1 (105)
(webrtcvoiceengine.cc:564): cn/8000/1 (13)
(webrtcvoiceengine.cc:564): telephone-event/8000/1 (126)
(webrtcvoiceengine.cc:572): VoiceEngine 4.1.0
(audio_device_impl.cc:86): Create
(audio_device_buffer.cc:73): AudioDeviceBuffer::ctor
(audio_device_impl.cc:133): AudioDeviceModuleImpl
(audio_device_impl.cc:141): CheckPlatform
(audio_device_impl.cc:155): current platform is Linux
(audio_device_impl.cc:182): CreatePlatformSpecificObjects
(file_audio_device_factory.cc:30): WebRTC configured with WEBRTC_DUMMY_FILE_DEVICES but no device files supplied. Will fall back to dummy audio.
(audio_device_impl.cc:196): Dummy Audio APIs will be utilized
(audio_device_impl.cc:371): AttachAudioBuffer
(audio_device_impl.cc:1484): RegisterEventObserver
(audio_device_impl.cc:1497): RegisterAudioCallback
(audio_device_buffer.cc:88): RegisterAudioCallback
(audio_device_impl.cc:499): Init
(audio_device_impl.cc:1228): SetPlayoutDevice(0)
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to set the default output device (error=10028)
(audio_device_impl.cc:548): InitSpeaker
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to initialize the speaker (error=9005)
(audio_device_impl.cc:1323): SetRecordingDevice(0)
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to set the default input device (error=8090)
(audio_device_impl.cc:558): InitMicrophone
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to initialize the microphone (error=9004)
(audio_device_impl.cc:1037): StereoPlayoutIsAvailable
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to query stereo playout mode (error=8090)
(audio_device_impl.cc:1056): SetStereoPlayout(0)
(audio_device_impl.cc:1066): stereo playout is not supported
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to set mono/stereo playout mode (error=8090)
(audio_device_impl.cc:923): StereoRecordingIsAvailable
(audio_device_impl.cc:942): SetStereoRecording(0)
(audio_device_impl.cc:951): failed to change stereo recording
(webrtcvoiceengine.cc:1023): webrtc: Init() failed to set mono/stereo recording mode (error=8090)
(webrtcvoiceengine.cc:1023): webrtc: TransmitMixer::SetAudioProcessingModule(audioProcessingModule=0x727996f0)
(webrtcvoiceengine.cc:1023): webrtc: OutputMixer::SetAudioProcessingModule(audioProcessingModule=0x727996f0)
(audio_device_impl.cc:1103): SetAGC(1)
(voe_base_impl.cc:336): virtual int webrtc::VoEBaseImpl::Init(webrtc::AudioDeviceModule *, webrtc::AudioProcessing *, const rtc::scoped_refptr<AudioDecoderFactory> &): Failed to set agc to enabled: 1
(webrtcvoiceengine.cc:647): WebRtcVoiceEngine::ApplyOptions: AudioOptions {aec: true, agc: true, ns: true, hf: true, swap: false, audio_jitter_buffer_max_packets: 50, audio_jitter_buffer_fast_accelerate: false, typing: true, agc_delta: 0, experimental_agc: false, extended_filter_aec: false, delay_agnostic_aec: false, experimental_ns: false, intelligibility_enhancer: false, level_control: false, residual_echo_detector: true, }
(audio_device_impl.cc:1792): BuiltInAECIsAvailable
(audio_device_generic.cc:51): virtual bool webrtc::AudioDeviceGeneric::BuiltInAECIsAvailable() const: Not supported on this platform
(audio_device_impl.cc:1795): output: 0
(webrtcvoiceengine.cc:728): Echo control set to 1 with mode 2
(audio_device_impl.cc:1808): BuiltInAGCIsAvailable
(audio_device_generic.cc:61): virtual bool webrtc::AudioDeviceGeneric::BuiltInAGCIsAvailable() const: Not supported on this platform
(audio_device_impl.cc:1811): output: 0
(audio_device_impl.cc:1103): SetAGC(1)
(webrtcvoiceengine.cc:1023): webrtc: SetAgcStatus() failed to set Agc mode (error=10028)
(webrtcvoiceengine.cc:762): Auto gain set to 1 with mode 2
(audio_device_impl.cc:1824): BuiltInNSIsAvailable
(audio_device_generic.cc:71): virtual bool webrtc::AudioDeviceGeneric::BuiltInNSIsAvailable() const: Not supported on this platform
(audio_device_impl.cc:1827): output: 0
(webrtcvoiceengine.cc:817): Noise suppression set to 1 with mode 5
(webrtcvoiceengine.cc:823): High pass filter enabled? 1
(webrtcvoiceengine.cc:831): Stereo swapping enabled? 0
(webrtcvoiceengine.cc:840): NetEq capacity is 50
(webrtcvoiceengine.cc:846): NetEq fast mode? 0
(webrtcvoiceengine.cc:853): Typing detection is enabled? 1
(webrtcvoiceengine.cc:862): Adjust agc delta is 0
(webrtcvoiceengine.cc:1048): Adjusting AGC level from default -2dB to -2dB
(webrtcvoiceengine.cc:873): Delay agnostic aec is enabled? 0
(webrtcvoiceengine.cc:882): Extended filter aec is enabled? 0
(webrtcvoiceengine.cc:891): Experimental ns is enabled? 0
(webrtcvoiceengine.cc:897): Intelligibility Enhancer is enabled? 0
(webrtcvoiceengine.cc:907): Level control: 0
(webrtcvoiceengine.cc:1023): webrtc: (audio_processing_impl.cc:601): Level controller activated: 0
(webrtcvoiceengine.cc:943): Setting microphone to (id=0) and speaker to (id=0)
(audio_device_impl.cc:1473): Recording
(audio_device_impl.cc:989): SetRecordingChannel(both)
(audio_device_impl.cc:1000): recording in stereo is not supported
(webrtcvoiceengine.cc:1023): webrtc: SetRecordingChannel() unable to set the recording channel (error=10028)
(audio_device_impl.cc:1323): SetRecordingDevice(0)
(webrtcvoiceengine.cc:1023): webrtc: SetRecordingDevice() unable to set the recording device (error=10028)
(webrtcvoiceengine.cc:948): SetRecordingDevice(0) failed, err=10028
(audio_device_impl.cc:1431): Playing
(audio_device_impl.cc:1228): SetPlayoutDevice(0)
(webrtcvoiceengine.cc:1023): webrtc: SetPlayoutDevice() unable to set the playout device (error=8090)
(webrtcvoiceengine.cc:955): SetPlayoutDevice(0) failed, err=8090
(webrtcvideoengine2.cc:561): WebRtcVideoEngine2::WebRtcVideoEngine2()
(webrtcvideoengine2.cc:642): Supported codecs: {VideoCodec[100:VP8], VideoCodec[96:rtx], VideoCodec[101:VP9], VideoCodec[97:rtx], VideoCodec[116:red], VideoCodec[98:rtx], VideoCodec[117:ulpfec]}
(webrtcvideoengine2.cc:570): WebRtcVideoEngine2::Init
(webrtcsessiondescriptionfactory.cc:479): Setting new certificate.
(webrtcsessiondescriptionfactory.cc:162): DTLS-SRTP enabled; sending DTLS identity request (key type: 1).
(opensslidentity.cc:43): Making key pair
Created rtc peer connections..
(opensslidentity.cc:84): Returning key pair
(opensslidentity.cc:91): Making certificate for WebRTC
(opensslidentity.cc:139): Returning certificate
(opensslidentity.cc:272): Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            df:a7:69:c3:b6:de:f6:41
    Signature Algorithm: ecdsa-with-SHA256
        Issuer: CN=WebRTC
        Validity
            Not Before: Nov 19 21:31:12 2016 GMT
            Not After : Dec 20 21:31:12 2016 GMT
        Subject: CN=WebRTC
        Subject Public Key Info:
            Public Key Algorithm: id-ecPublicKey
                Public-Key: (256 bit)
                pub: 
                    04:4a:7b:c8:24:bb:50:b9:fa:09:30:49:fa:dc:c7:
                    3e:1e:bf:73:51:dc:d8:61:90:ea:f2:de:b7:ff:f1:
                    e2:10:e2:87:a2:51:14:a4:75:c9:d7:f3:7c:1d:52:
                    15:14:d4:84:58:ee:24:0d:ef:6f:35:f1:e9:0e:58:
                    9a:f4:92:ca:2b
                Field Type: prime-field
                Prime:
                    00:ff:ff:ff:ff:00:00:00:01:00:00:00:00:00:00:
                    00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:
                    ff:ff:ff
                A:   
                    00:ff:ff:ff:ff:00:00:00:01:00:00:00:00:00:00:
                    00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:
                    ff:ff:fc
                B:   
                    5a:c6:35:d8:aa:3a:93:e7:b3:eb:bd:55:76:98:86:
                    bc:65:1d:06:b0:cc:53:b0:f6:3b:ce:3c:3e:27:d2:
                    60:4b
                Generator (uncompressed):
                    04:6b:17:d1:f2:e1:2c:42:47:f8:bc:e6:e5:63:a4:
                    40:f2:77:03:7d:81:2d:eb:33:a0:f4:a1:39:45:d8:
                    98:c2:96:4f:e3:42:e2:fe:1a:7f:9b:8e:e7:eb:4a:
                    7c:0f:9e:16:2b:ce:33:57:6b:31:5e:ce:cb:b6:40:
                    68:37:bf:51:f5
                Order: 
                    00:ff:ff:ff:ff:00:00:00:00:ff:ff:ff:ff:ff:ff:
                    ff:ff:bc:e6:fa:ad:a7:17:9e:84:f3:b9:ca:c2:fc:
                    63:25:51
                Cofactor:  1 (0x1)
                Seed:
                    c4:9d:36:08:86:e7:04:93:6a:66:78:e1:13:9d:26:
                    b7:81:9f:7e:90
    Signature Algorithm: ecdsa-with-SHA256
         30:44:02:20:53:29:ed:a2:b9:75:fd:f9:b9:62:59:ba:15:82:
         d8:1d:b1:b9:d2:56:44:0a:5f:84:21:7e:63:d2:92:97:35:69:
         02:20:54:39:25:7f:ea:71:8d:47:24:9a:91:58:f5:6e:ef:2a:
         2a:c7:6f:a0:1f:cc:fc:a3:b5:16:65:3d:12:6d:8e:12

(webrtcsessiondescriptionfactory.cc:479): Setting new certificate.
pc1: create offer
(opensslidentity.cc:352): Unknown signature algorithm NID: 1925185696
(transportdescriptionfactory.cc:117): Failed to retrieve the certificate's digest algorithm
(mediasession.cc:1616): Failed to AddTransportOffer, content name=data
(webrtcsessiondescriptionfactory.cc:455): Create SDP failed: Failed to initialize the offer.
ssaroha commented 7 years ago

Just FYI, I had also opened an issue with chromium for this: https://bugs.chromium.org/p/webrtc/issues/detail?id=6698

ssaroha commented 7 years ago

sharing some updates: was able to move past the core dump issue related to GetSignatureDigestAlgorithm returning failure. turns out by the time execution reached the getSignatureDigestAlgorithm method, the associated X509_ object on the OpenSSLCertificate class was getting freed, probably a case of missed reference counting.

For the time being I removed the X509_free call in opensslidentity.cc https://chromium.googlesource.com/external/webrtc/trunk/webrtc/+/master/base/opensslidentity.cc#293

with this change the code is able to execute forward getting the signature digest algorithm just fine.

Now its dumping core here deep in SSL code EVP_PKEY_CTX_ctrl:

(gdb) bt
#0  0x0047a3bc in EVP_PKEY_CTX_ctrl ()
#1  0x0046fbfa in EVP_DigestInit_ex ()
Python Exception <class 'gdb.error'> There is no member named _M_dataplus.: 
#2  0x7413a152 in rtc::OpenSSLDigest::OpenSSLDigest (this=0x72421770, algorithm=) at ../../webrtc/base/openssldigest.cc:25
Python Exception <class 'gdb.error'> There is no member named _M_dataplus.: 
#3  0x73e74b04 in rtc::MessageDigestFactory::Create (alg=) at ../../webrtc/base/messagedigest.cc:44
Python Exception <class 'gdb.error'> There is no member named _M_dataplus.: 
#4  0x73e7511e in rtc::ComputeHmac (alg=, key=0x16d6254, key_len=24, input=0x72421978, in_len=64, output=0x73529838, out_len=20)
    at ../../webrtc/base/messagedigest.cc:153
#5  0x73ef1a24 in cricket::StunMessage::AddMessageIntegrity (this=0x72420bd8, key=0x16d6254 "QdbuMvRAYwQAmm1VClUqv8n2", keylen=24)
    at ../../webrtc/p2p/base/stun.cc:236
Python Exception <class 'gdb.error'> There is no member named _M_dataplus.: 
#6  0x73ef18f6 in cricket::StunMessage::AddMessageIntegrity (this=0x72420bd8, password=) at ../../webrtc/p2p/base/stun.cc:214
#7  0x73ee884c in cricket::ConnectionRequest::Prepare (this=0x724217e0, request=0x72420bd8) at ../../webrtc/p2p/base/port.cc:813
#8  0x73ef5d36 in cricket::StunRequest::Construct (this=0x724217e0) at ../../webrtc/p2p/base/stunrequest.cc:182
#9  0x73ef5bb0 in cricket::StunRequestManager::SendDelayed (this=0x724210a0, request=0x724217e0, delay=0)
    at ../../webrtc/p2p/base/stunrequest.cc:49
#10 0x73ef5b26 in cricket::StunRequestManager::Send (this=0x724210a0, request=0x724217e0) at ../../webrtc/p2p/base/stunrequest.cc:42
#11 0x73ee1152 in cricket::Connection::Ping (this=0x72420dc8, now=143719956) at ../../webrtc/p2p/base/port.cc:1224
#12 0x73f08ad0 in cricket::P2PTransportChannel::PingConnection (this=0x727fdfc0, conn=0x72420dc8)
    at ../../webrtc/p2p/base/p2ptransportchannel.cc:1737
#13 0x73f0853e in cricket::P2PTransportChannel::OnCheckAndPing (this=0x727fdfc0) at ../../webrtc/p2p/base/p2ptransportchannel.cc:1539
#14 0x73f08454 in cricket::P2PTransportChannel::OnMessage (this=0x727fdfc0, pmsg=0x73529dd8)
    at ../../webrtc/p2p/base/p2ptransportchannel.cc:1509
#15 0x73dc33c0 in rtc::MessageQueue::Dispatch (this=0x746fb098 <workerThread>, pmsg=0x73529dd8) at ../../webrtc/base/messagequeue.cc:533
#16 0x73dc0778 in rtc::Thread::ProcessMessages (this=0x746fb098 <workerThread>, cmsLoop=-1) at ../../webrtc/base/thread.cc:505
#17 0x73dc06e8 in rtc::Thread::Run (this=0x746fb098 <workerThread>) at ../../webrtc/base/thread.cc:333
#18 0x73dc0542 in rtc::Thread::PreRun (pv=0x170c268) at ../../webrtc/base/thread.cc:325
#19 0x76dd6e90 in start_thread (arg=0x7352a450) at pthread_create.c:311
#20 0x76d60598 in ?? () at ../ports/sysdeps/unix/sysv/linux/arm/nptl/../clone.S:92 from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?

Unfortunately when i setup breakpoint on this method EVP_DigestInit_ex in boringssl here: src/third_party/boringssl/src/crypto/digest/digest.c it does not step into this method, even though boringssl is part of the static library libwebrtc.a which has debug info for all other objects.

Boringssl objects were compiled with -g flag cflags = -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pipe -fcolor-diagnostics -fdebug-prefix-map=/home/satender/linux_cross/webrtc-checkout/src=. -pthread --target=arm-linux-gnueabihf -march=armv7-a -mfloat-abi=hard -mthumb -mtune=generic-armv7-a -mfpu=neon -fno-omit-frame-pointer -g --sysroot=../../build/linux/debian_wheezy_arm-sysroot -fvisibility=hidden -Xclang -load -Xclang ../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-ipc -Wheader-hygiene -Wstring-conversion -Werror -Wall -Wno-unused-variable -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-deprecated-register -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member

Also its not printing the print stmts I have put in that method. here is the modified EVPDigestInit_ex method.

int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *engine) {
  perror("satender: Inside EVP_DigestInit_ex \n");
  if (ctx->digest != type) {
    printf("satender: Inside EVP_DigestInit_ex 2 \n");
    if (ctx->digest && ctx->digest->ctx_size > 0) {
      printf("satender: Inside EVP_DigestInit_ex 3 \n");
      OPENSSL_free(ctx->md_data);
      ctx->md_data = NULL;
    }
    printf("satender: Inside EVP_DigestInit_ex 4 \n");
    ctx->digest = type;
    if (type->ctx_size > 0) {
      printf("satender: Inside EVP_DigestInit_ex 5 \n");
      ctx->md_data = OPENSSL_malloc(type->ctx_size);
      if (ctx->md_data == NULL) {
        OPENSSL_PUT_ERROR(DIGEST, ERR_R_MALLOC_FAILURE);
        return 0;
      }
    }
  }

  printf("satender: Inside EVP_DigestInit_ex 6 \n");
  assert(ctx->pctx == NULL || ctx->pctx_ops != NULL);

  ctx->digest->init(ctx);
  return 1;
}

I have verified that the resulting libwebrtc.a does have the print stmts by doing this:

strings -a -n 1 libwebrtc.a | grep "Inside EVP_DigestInit" satender: Inside EVP_DigestInit_ex satender: Inside EVP_DigestInit_ex 2 satender: Inside EVP_DigestInit_ex 3 satender: Inside EVP_DigestInit_ex 4 satender: Inside EVP_DigestInit_ex 5 satender: Inside EVP_DigestInit_ex 6

but during runtime, logs are not showing any sign of above stmts.

any ideas how to get gdb to step into this method in boringssl.

ssaroha commented 7 years ago

It turns out we cannot mix boringssl which comes with webrtc when linking webrtc with node because node already is precompiled with openssl. So I had to recompile webrtc without ssl using the following gn parameters

gn gen out/Default --args='target_cpu = "arm" target_os="linux" rtc_use_dummy_audio_file_devices=true rtc_build_ssl=false  rtc_ssl_root="<path_to_openssl>'

now when I link this libwebrtc.a (which does not have libboringssl) with node, and run the test program, there is no core dump, but I see ssl handshake failure and DTLS timeout, and code keep retrying to setup ssl handshake.

node examples/ping-pong-test.js

console logs when the above example program is run

(dtlstransportchannel.cc:326): Jingle:Channel[data|1|__]: DTLS setup complete.
(port.cc:1160): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|C--W|0|0|9115038255631187454|-]: UpdateState(), ms since last received response=191659915, ms since last received data=191659915, rtt=3000, pings_since_last_response=
(port.cc:1221): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|C--W|0|0|9115038255631187454|-]: Sending STUN ping , id=30644b7a4658372b2b773269, nomination=0
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1411): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|C--W|0|0|9115038255631187454|-]: Sent STUN ping, id=30644b7a4658372b2b773269, use_candidate=0, nomination=0
(channel.cc:880): Channel enabled
(channel.cc:2363): Changing data state, recv=1 send=0
(p2ptransportchannel.cc:1263): Sorting 0 available connections:
(webrtcsession.cc:820): Session:4261948216217565865 Old state:STATE_SENTOFFER New state:STATE_INPROGRESS
(systeminfo.cc:82): Available number of cores: 4
(bitrate_prober.cc:49): Bandwidth probing enabled, set to inactive
(remote_bitrate_estimator_single_stream.cc:61): RemoteBitrateEstimatorSingleStream: Instantiating.
(bitrate_prober.cc:78): Probe cluster (bitrate:probes): (900000:6) 
(bitrate_prober.cc:78): Probe cluster (bitrate:probes): (1800000:5) 
(probe_controller.cc:95): Measured bitrate: 300000 Minimum to probe further: 1200000
(congestion_controller.cc:359): Bitrate estimate state changed, BWE: 300000 bps.
(bitrate_allocator.cc:79): Current BWE 300000
(channel.cc:2314): Setting remote data description
(channel.cc:2363): Changing data state, recv=1 send=0
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(webrtcsession.cc:1353): Changing IceConnectionState 0 => 1
(port.cc:312): Received STUN ping  id=30644b7a4658372b2b773269 from unknown address 192.168.1.220:38451
(port.cc:877): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->+/4ggiq1:1:1853824767:prflx:udp:192.168.1.220:38451|C--W|0|0|7962116751024340479|-]: Connection created
(p2ptransportchannel.cc:689): Adding connection from peer reflexive candidate: Cand[:3393155426:1:udp:1853824767:192.168.1.220:38451:prflx::0:rvAe:oVU8agKzu7PoZxUoQpPzJEMs:3:50:0]
(port.cc:933): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->+/4ggiq1:1:1853824767:prflx:udp:192.168.1.220:38451|C--W|0|0|7962116751024340479|-]: set_receiving to 1
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:607): Jingle:Port[0x726f91f8:data:1:0:local:Net[wlan0:192.168.1.0/24:Unknown]]: Sent STUN ping response, to=192.168.1.220:38451, id=30644b7a4658372b2b773269
(port.cc:1160): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->+/4ggiq1:1:1853824767:prflx:udp:192.168.1.220:38451|CR-W|0|0|7962116751024340479|-]: UpdateState(), ms since last received response=191659919, ms since last received data=191659919, rtt=3000, pings_since_last_response=
(p2ptransportchannel.cc:1263): Sorting 1 available connections:
(p2ptransportchannel.cc:1266): Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->+/4ggiq1:1:1853824767:prflx:udp:192.168.1.220:38451|CR-W|0|0|7962116751024340479|-]
(p2ptransportchannel.cc:1410): Jingle:Channel[data|1|__]: Transport channel state changed from 0 to 2
(transportcontroller.cc:639): data TransportChannel 1 state changed. Check if state is complete.
(dtlstransportchannel.cc:478): Jingle:Channel[data|1|__]: DTLSTransportChannelWrapper: channel receiving state changed to 1
(p2ptransportchannel.cc:1073): Jingle:Channel[data|1|R_]: Have a pingable connection for the first time; starting to ping.
(port.cc:1160): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->+/4ggiq1:1:1853824767:prflx:udp:192.168.1.220:38451|CR-W|0|0|7962116751024340479|-]: UpdateState(), ms since last received response=191659919, ms since last received data=191659919, rtt=3000, pings_since_last_response=
(p2ptransportchannel.cc:1263): Sorting 1 available connections:
(p2ptransportchannel.cc:1266): Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->+/4ggiq1:1:1853824767:prflx:udp:192.168.1.220:38451|CR-W|0|0|7962116751024340479|-]
(bitrate_prober.cc:49): Bandwidth probing enabled, set to inactive
(remote_bitrate_estimator_single_stream.cc:61): RemoteBitrateEstimatorSingleStream: Instantiating.
(bitrate_prober.cc:78): Probe cluster (bitrate:probes): (900000:6) 
(bitrate_prober.cc:78): Probe cluster (bitrate:probes): (1800000:5) 
(probe_controller.cc:95): Measured bitrate: 300000 Minimum to probe further: 1200000
(congestion_controller.cc:359): Bitrate estimate state changed, BWE: 300000 bps.
(bitrate_allocator.cc:79): Current BWE 300000
(port.cc:1160): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->+/4ggiq1:1:1853824767:prflx:udp:192.168.1.220:38451|CR-W|0|0|7962116751024340479|-]: UpdateState(), ms since last received response=191659920, ms since last received data=191659920, rtt=3000, pings_since_last_response=
(p2ptransportchannel.cc:1971): Selecting connection for triggered check: Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->+/4ggiq1:1:1853824767:prflx:udp:192.168.1.220:38451|CR-W|0|0|7962116751024340479|-]
(port.cc:1221): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->+/4ggiq1:1:1853824767:prflx:udp:192.168.1.220:38451|CR-W|0|0|7962116751024340479|-]: Sending STUN ping , id=7179476974504d5779737a78, nomination=0
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1411): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->+/4ggiq1:1:1853824767:prflx:udp:192.168.1.220:38451|CR-W|0|0|7962116751024340479|-]: Sent STUN ping, id=7179476974504d5779737a78, use_candidate=1, nomination=0
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1358): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|C--I|0|0|9115038255631187454|-]: Received STUN ping response, id=30644b7a4658372b2b773269, code=0, rtt=5, pings_since_last_response=30644b7a4658372b2b773269 
(port.cc:933): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|C--I|0|0|9115038255631187454|-]: set_receiving to 1
(port.cc:921): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWI|0|0|9115038255631187454|-]: set_write_state from: 2 to 0
(port.cc:943): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|0|0|9115038255631187454|-]: set_state
(port.cc:1160): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|0|0|9115038255631187454|2251]: UpdateState(), ms since last received response=1, ms since last received data=191659922, rtt=3000, pings_since_last_response=
(p2ptransportchannel.cc:1263): Sorting 1 available connections:
(p2ptransportchannel.cc:1266): Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|0|0|9115038255631187454|2251]
(p2ptransportchannel.cc:238): Switching selected connection due to sorting
(p2ptransportchannel.cc:1381): Jingle:Channel[data|1|__]: New selected connection: Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|0|0|9115038255631187454|2251]
(transportchannel.cc:38): Jingle:Channel[data|1|__]: set_writable from:0 to 1
(dtlstransportchannel.cc:445): Jingle:Channel[data|1|__]: DTLSTransportChannelWrapper: channel writable state changed to 1
(opensslstreamadapter.cc:793): BeginSSL with peer.
waiting
(opensslstreamadapter.cc:851): ContinueSSL
(openssladapter.cc:851): SSL_connect:before/connect initialization
(openssladapter.cc:851): SSL_connect:unknown state
(openssladapter.cc:861): SSL_connect:error in unknown state
(opensslstreamadapter.cc:882):  -- error want read
(dtlstransportchannel.cc:641): Jingle:Channel[data|1|__]: DtlsTransportChannelWrapper: Started DTLS handshake
(transportchannel.cc:51): Jingle:Channel[data|1|__]: set_dtls_state from:0 to 1
(dtlstransportchannel.cc:478): Jingle:Channel[data|1|__]: DTLSTransportChannelWrapper: channel receiving state changed to 1
(basicportallocator.cc:953): All candidates gathered for data:1:0
(p2ptransportchannel.cc:572): P2PTransportChannel: data, component 1 gathering complete
(dtlstransportchannel.cc:506): Jingle:Channel[data|1|__]: Packet received before DTLS started.
(dtlstransportchannel.cc:513): Jingle:Channel[data|1|__]: Caching DTLS ClientHello packet until DTLS is started.
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1003): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|0|0|9115038255631187454|2251]: Received STUN ping, id=7179476974504d5779737a78
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:607): Jingle:Port[0x726ff610:data:1:0:local:Net[wlan0:192.168.1.0/24:Unknown]]: Sent STUN ping response, to=192.168.1.220:44942, id=7179476974504d5779737a78
(port.cc:1160): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CR-I|0|0|9115038255631187454|-]: UpdateState(), ms since last received response=191659926, ms since last received data=1, rtt=3000, pings_since_last_response=7179476974504d5779737a78 
(p2ptransportchannel.cc:1263): Sorting 1 available connections:
(p2ptransportchannel.cc:1266): Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CR-I|0|0|9115038255631187454|-]
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1358): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CR-I|0|0|9115038255631187454|-]: Received STUN ping response, id=7179476974504d5779737a78, code=0, rtt=5, pings_since_last_response=7179476974504d5779737a78 
(port.cc:921): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWI|0|0|9115038255631187454|-]: set_write_state from: 2 to 0
(port.cc:943): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWS|0|0|9115038255631187454|-]: set_state
(basicportallocator.cc:953): All candidates gathered for data:1:0
(p2ptransportchannel.cc:572): P2PTransportChannel: data, component 1 gathering complete
(port.cc:1160): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWS|0|0|9115038255631187454|2251]: UpdateState(), ms since last received response=0, ms since last received data=2, rtt=3000, pings_since_last_response=
(p2ptransportchannel.cc:1263): Sorting 1 available connections:
(p2ptransportchannel.cc:1266): Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWS|0|0|9115038255631187454|2251]
(p2ptransportchannel.cc:238): Switching selected connection due to sorting
(p2ptransportchannel.cc:1381): Jingle:Channel[data|1|R_]: New selected connection: Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWS|0|0|9115038255631187454|2251]
(transportchannel.cc:38): Jingle:Channel[data|1|R_]: set_writable from:0 to 1
(dtlstransportchannel.cc:445): Jingle:Channel[data|1|__]: DTLSTransportChannelWrapper: channel writable state changed to 1
(opensslstreamadapter.cc:793): BeginSSL with peer.
(opensslstreamadapter.cc:851): ContinueSSL
(openssladapter.cc:851): SSL_accept:before/accept initialization
(openssladapter.cc:861): SSL_accept:error in unknown state
(opensslstreamadapter.cc:882):  -- error want read
(dtlstransportchannel.cc:641): Jingle:Channel[data|1|__]: DtlsTransportChannelWrapper: Started DTLS handshake
(transportchannel.cc:51): Jingle:Channel[data|1|__]: set_dtls_state from:0 to 1
(dtlstransportchannel.cc:648): Jingle:Channel[data|1|__]: Handling cached DTLS ClientHello packet.
(opensslstreamadapter.cc:755): OpenSSLStreamAdapter::OnEvent SE_READ
(opensslstreamadapter.cc:851): ContinueSSL
(openssladapter.cc:854): SSL3 alert write:fatal:handshake failure
(openssladapter.cc:861): SSL_accept:error in error
(opensslstreamadapter.cc:899):  -- error -1
(opensslstreamadapter.cc:916): OpenSSLStreamAdapter::Error(ContinueSSL, 1, 0)
(opensslstreamadapter.cc:926): Cleanup
(openssladapter.cc:854): SSL3 alert write:warning:close notify
(dtlstransportchannel.cc:621): Jingle:Channel[data|1|__]: DTLS channel error, code=1
(transportchannel.cc:51): Jingle:Channel[data|1|__]: set_dtls_state from:1 to 4
(opensslstreamadapter.cc:755): OpenSSLStreamAdapter::OnEvent SE_READ
(opensslstreamadapter.cc:851): ContinueSSL
(openssladapter.cc:854): SSL3 alert read:fatal:handshake failure
(openssladapter.cc:859): SSL_connect:failed in unknown state
(opensslstreamadapter.cc:899):  -- error 0
(opensslstreamadapter.cc:916): OpenSSLStreamAdapter::Error(ContinueSSL, 1, 0)
(opensslstreamadapter.cc:926): Cleanup
(opensslstreamadapter.cc:947): SSL_shutdown failed, error = 1
(dtlstransportchannel.cc:621): Jingle:Channel[data|1|__]: DTLS channel error, code=1
(transportchannel.cc:51): Jingle:Channel[data|1|__]: set_dtls_state from:1 to 4
(port.cc:1160): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|1|0|9115038255631187454|2251]: UpdateState(), ms since last received response=44, ms since last received data=36, rtt=3000, pings_since_last_response=
(port.cc:1221): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|1|0|9115038255631187454|2251]: Sending STUN ping , id=3066537a514c6141724e5379, nomination=0
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1411): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|1|0|9115038255631187454|2251]: Sent STUN ping, id=3066537a514c6141724e5379, use_candidate=0, nomination=0
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1003): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWS|0|0|9115038255631187454|2251]: Received STUN ping, id=3066537a514c6141724e5379
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:607): Jingle:Port[0x726f91f8:data:1:0:local:Net[wlan0:192.168.1.0/24:Unknown]]: Sent STUN ping response, to=192.168.1.220:38451, id=3066537a514c6141724e5379
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1358): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWI|1|0|9115038255631187454|2251]: Received STUN ping response, id=3066537a514c6141724e5379, code=0, rtt=1, pings_since_last_response=3066537a514c6141724e5379 
(port.cc:943): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|1|0|9115038255631187454|2251]: set_state
(port.cc:1160): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWS|0|0|9115038255631187454|2251]: UpdateState(), ms since last received response=43, ms since last received data=45, rtt=3000, pings_since_last_response=
(port.cc:1221): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWS|0|0|9115038255631187454|2251]: Sending STUN ping , id=526a4b332b4333345848492f, nomination=0
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1411): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWS|0|0|9115038255631187454|2251]: Sent STUN ping, id=526a4b332b4333345848492f, use_candidate=1, nomination=0
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1003): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|1|0|9115038255631187454|1688]: Received STUN ping, id=526a4b332b4333345848492f
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:607): Jingle:Port[0x726ff610:data:1:0:local:Net[wlan0:192.168.1.0/24:Unknown]]: Sent STUN ping response, to=192.168.1.220:44942, id=526a4b332b4333345848492f
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1358): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWI|0|0|9115038255631187454|2251]: Received STUN ping response, id=526a4b332b4333345848492f, code=0, rtt=1, pings_since_last_response=526a4b332b4333345848492f 
(port.cc:943): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWS|0|0|9115038255631187454|2251]: set_state
(port.cc:1160): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|1|0|9115038255631187454|1688]: UpdateState(), ms since last received response=47, ms since last received data=84, rtt=3000, pings_since_last_response=
(port.cc:1221): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|1|0|9115038255631187454|1688]: Sending STUN ping , id=57435a786c484d384a574b37, nomination=0
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1411): Jingle:Conn[0x72320138:data:ZjDyXa4g:1:0:local:udp:192.168.1.220:38451->jezzjYsc:1:2122260223:local:udp:192.168.1.220:44942|CRWS|1|0|9115038255631187454|1688]: Sent STUN ping, id=57435a786c484d384a574b37, use_candidate=0, nomination=0
(messagedigest.cc:43): MessageDigestFactory::Create: satender algo: sha-1
(openssldigest.cc:22): OpenSSLDigest::OpenSSLDigest: satender algo: sha-1
(port.cc:1003): Jingle:Conn[0x72329130:data:qnWw6MF0:1:0:local:udp:192.168.1.220:44942->XbQQPrTz:1:2122260223:local:udp:192.168.1.220:38451|CRWS|0|0|9115038255631187454|1688]: Received STUN ping, id=57435a786c484d384a574b37

any ideas on what should change for openssl handshake to work.

ssaroha commented 7 years ago

I have opened a new ticket with webrtc as well: https://bugs.chromium.org/p/webrtc/issues/detail?id=6763

the symptoms are very similar to something which was fixed a while back.

ssaroha commented 7 years ago

@markandrus at this point, I am thinking if I should try a version of node without ssl and link it with webrtc +boringssl, is that something possible. I was able to compile node 6.9.1 without ssl, but am having issues compiling node-webrtc without ssl. is that even a viable route?

webarchymeta commented 7 years ago

Have you tried to compile the wrtc.node using an ARM linux machine, using the static WebRTC lib cross compiled? You might get a different result, I guess. I am also interested in it but have not got a chance to set up the compilation environment and try it myself ...

ssaroha commented 7 years ago

good news.. the issue is finally resolved and am happily able to run the example ping-pong-test.js test and my own file transfer tests. the ssl handshake error was happening due to INCOMPATIBLE CIPHERSUITE. Turns out, its related to how ECDH named curves are used in openssl. According to the documentation here on https://wiki.openssl.org/index.php/Elliptic_Curve_Diffie_Hellman#ECDH_and_Named_Curves

Its required that the ECDSA certificates be created with a key using OPENSSL_EC_NAMED_CURVE.

In webrtc case, the EC key is being created correctly with EC_key_new_by_curve_name(NID_X9_62_prime256v1)

but its not setting the ASN1 flag explicitly on the key with OPENSSL_EC_NAMED_CURVE.

As a result OpenSSL is unable to negotiate the keys and throws SSL error of 0x1408a0c1 (no shared cipher)

once I added the call: EC_KEY_set_asn1_flag(key, OPENSSL_EC_NAMED_CURVE);

the generated self-signed certificate now has the correct ASN1OID: prime256v1 stamped

s shown in the below cert printed from webrtc logs:

(opensslidentity.cc:141): Returning certificate (opensslidentity.cc:274): Certificate: Data: Version: 3 (0x2) Serial Number: e0:fb:cc:eb:5f:58:b7:09 Signature Algorithm: ecdsa-with-SHA256 Issuer: CN=WebRTC Validity Not Before: Nov 26 23:10:27 2016 GMT Not After : Dec 27 23:10:27 2016 GMT Subject: CN=WebRTC Subject Public Key Info: Public Key Algorithm: id-ecPublicKey Public-Key: (256 bit) pub: 04:23:38:6a:ef:0b:17:88:a3:f0:2a:d7:75:2c:9f: 24:a2:58:af:70:af:2e:21:30:47:dd:da:1c:ab:b0: b7:23:0e:c4:f5:ce:7d:f1:3b:5e:fe:2d:30:6b:02: 4e:c3:c5:33:cd:b3:f7:b3:5a:2c:9c:1d:0e:8f:38: 07:aa:c1:18:18 ASN1 OID: prime256v1 NIST CURVE: P-256 Signature Algorithm: ecdsa-with-SHA256 30:45:02:20:64:e3:8e:3a:6e:32:c1:45:85:e2:f8:3c:08:1e: 99:a0:fa:e0:27:ae:81:6c:05:c3:42:86:f8:56:0e:14:05:26: 02:21:00:ff:77:b1:f8:6e:c1:cd:8a:ef:a7:c2:52:5b:1c:a6: 66:bc:8c:82:3f:64:c5:0e:46:0d:72:34:47:95:c3:4b:92

ssaroha commented 7 years ago

closing this out. my submitted patch has been merged in the webrtc mainline: https://chromium.googlesource.com/external/webrtc/+/bbfed52cf2912d5088abeb017049241e4d37d21f