diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index ec1f00016..974391e98 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -153,6 +153,172 @@ srtp_rcv($sock_a, $port_b, rtpm(8, 1001, 3160, 0x1234, "\x00" x 160), $srtp_ctx_ + +($sock_a, $sock_b, $sock_c) = new_call([qw(198.51.100.1 7192)], [qw(198.51.100.3 7194)], [qw(198.51.100.5 5196)]); + +($port_a) = offer('SRTP hijack passthrough, control', { DTLS => 'off' }, < $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80}, + key => 'QjnnaukLn7iwASAs0YLzPUplJkjOhTZK2dvOwo6c', +}; +$srtp_ctx_b = { + cs => $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80}, + key => '1YiOLFFcF/OlCpW7u3fmSx1YllphIgh2cER3DWU3', +}; + +srtp_snd($sock_b, $port_a, rtp(8, 1000, 3000, 0x1234, "\x00" x 160), $srtp_ctx_b); +srtp_rcv($sock_a, $port_b, rtpm(8, 1000, 3000, 0x1234, "\x00" x 160), $srtp_ctx_b); + +srtp_snd($sock_a, $port_b, rtp(8, 2000, 4000, 0x6543, "\x11" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(8, 2000, 4000, 0x6543, "\x11" x 160), $srtp_ctx_a); + +# successful unguarded inject/hijack + + snd($sock_c, $port_b, rtp(8, 2001, 4160, 0x6543, "\x11" x 160)); + rcv($sock_b, $port_a, rtpm(8, 2001, 4160, 0x6543, "\x11" x 160)); + +srtp_snd($sock_b, $port_a, rtp(8, 1001, 3160, 0x1234, "\x00" x 160), $srtp_ctx_b); + rcv_no($sock_a); +srtp_rcv($sock_c, $port_b, rtpm(8, 1001, 3160, 0x1234, "\x00" x 160), $srtp_ctx_b); + + + + + +($sock_a, $sock_b, $sock_c) = new_call([qw(198.51.100.1 7196)], [qw(198.51.100.3 7198)], [qw(198.51.100.5 5200)]); + +($port_a) = offer('SRTP hijack passthrough, recrypt', { DTLS => 'off', flags => ['recrypt'] }, < ['recrypt'] }, < $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80}, + key => 'QjnnaukLn7iwASAs0YLzPUplJkjOhTZK2dvOwo6c', +}; +$srtp_ctx_b = { + cs => $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80}, + key => '1YiOLFFcF/OlCpW7u3fmSx1YllphIgh2cER3DWU3', +}; + +srtp_snd($sock_b, $port_a, rtp(8, 1000, 3000, 0x1234, "\x00" x 160), $srtp_ctx_b); +srtp_rcv($sock_a, $port_b, rtpm(8, 1000, 3000, 0x1234, "\x00" x 160), $srtp_ctx_b); + +srtp_snd($sock_a, $port_b, rtp(8, 2000, 4000, 0x6543, "\x11" x 160), $srtp_ctx_a); +srtp_rcv($sock_b, $port_a, rtpm(8, 2000, 4000, 0x6543, "\x11" x 160), $srtp_ctx_a); + +# attempt inject/hijack + + snd($sock_c, $port_b, rtp(8, 2001, 4160, 0x6543, "\x11" x 160)); + rcv_no($sock_b); + +srtp_snd($sock_b, $port_a, rtp(8, 1001, 3160, 0x1234, "\x00" x 160), $srtp_ctx_b); + rcv_no($sock_c); +srtp_rcv($sock_a, $port_b, rtpm(8, 1001, 3160, 0x1234, "\x00" x 160), $srtp_ctx_b); + + + + new_call; offer('L16 default', { codec => { transcode => ['L16/44100'] } }, <