summaryrefslogtreecommitdiff
path: root/res/res_srtp.c
AgeCommit message (Collapse)Author
2018-03-12res_srtp: Add support for libsrtp2.x on openSUSE.Alexander Traud
Since ASTERISK-27253, no symbols from the header srtp2/crypto_types.h are used anymore. Therefore, its include statement can be removed. This allows to compile Asterisk on platforms which do not offer this private header, like openSUSE. ASTERISK-27733 Change-Id: I25c5cb8fa966043d1506ebef449e5a724412b4b6
2017-12-22Remove as much trailing whitespace as possible.Sean Bright
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-09-20res_srtp: lower log level of auth failuresAlexander Traud
Previously, sRTP authentication failures were reported on log level WARNING. When such failures happen, each RT(C)P packet is affected, spamming the log. Now, those failures are reported at log level VERBOSE 2. Furthermore, the amount is further reduced (previously all two seconds, now all three seconds). Additionally, the new log entry informs whether media (RTP) or statistics (RTCP) are affected. ASTERISK-16898 #close Change-Id: I6c98d46b711f56e08655abeb01c951ab8e8d7fa0
2017-05-26res_srtp: Add support for libsrtp2Sean Bright
ASTERISK-25294 #close Reported by: Tzafrir Cohen ASTERISK-26976 #close Reported by: Alex Change-Id: I789b1c3d1ed31365bbd9339fa58ef36f48833c40
2017-03-29srtp: Allow zero as tag value for a sRTP Crypto Suite.Alexander Traud
ASTERISK-25490 #close Change-Id: I1c5fc0942c33c96d62b24203aad0f1e1a1a0131f
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes all traces of it. Previously exported symbols removed: * __ast_register_file * __ast_unregister_file * ast_complete_source_filename This also removes the mtx_prof static variable that was declared when MTX_PROFILE was enabled. This variable was only used in lock.c so it is now initialized in that file only. ASTERISK-26480 #close Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-08-10res_srtp: Move SDP SRTP code from the core to res_srtp.Richard Mudgett
A patch made to the master branch (Now the 14 branch) inadvertently made libsrtp a required dependency in order to compile Asterisk. Rather than create dummy defines to substitute for the defines supplied by libsrtp when libsrtp is not available, most of the code in sdp_srtp.c is moved into res_srtp.c. This gets more code out of Asterisk's core that isn't used when SRTP is not available. This also makes another inadvertent required dependency on libsrtp by Asterisk's core unlikely. ASTERISK-26253 #close Reported by: Ben Merrills Change-Id: I0a46cde81501c0405399c2588633ae32706d1ee7
2016-07-21res_srtp: Enable AES-256 and AES-GCM.Alexander Traud
ASTERISK-26190 #close Change-Id: I11326d80edd656524a51a19450e586c583aa0a0b
2016-06-07res_srtp: Instead of libSRTP use OpenSSL as random source.Alexander Traud
Since libSRTP 1.5, its Random Number Generator (RNG) is not maintained anymore. Therefore, the symbol RAND_bytes is used instead of crypto_get_random. ASTERISK-24436 #close Change-Id: Iea0bae4d4e3c9aa0926ea442b6484b5159789d96
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2014-10-27res/res_srtp: Fix include issue for libsrtp 1.5.0Matthew Jordan
In libsrtp 1.5.0, crypto_get_random is no longer resolved simply by including srtp.h. Now, one must include crypto_kernel.h as well. As it turns out, this header file has been provided by the library since 2006, so this is a relatively benign change. ASTERISK-24436 #close Reported by: Patrick Laimbock ........ Merged revisions 426140 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 426141 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 426142 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 426143 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426144 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09Allow Asterisk to compile under GCC 4.10Kinsey Moore
This resolves a large number of compiler warnings from GCC 4.10 which cause the build to fail under dev mode. The vast majority are signed/unsigned mismatches in printf-style format strings. ........ Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-15Use srtp_shutdown when availableKinsey Moore
This allows the SRTP library to be shut down properly when the functionality is offered by libsrtp. Review: https://reviewboard.asterisk.org/r/2538/ (closes issue ASTERISK-21719) ........ Merged revisions 388768 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 388769 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388770 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-13Revert r388529 for nowKinsey Moore
Adding the cleanup function needs some deeper thought since it apparently doesn't exist for all variants of libsrtp. ........ Merged revisions 388596 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 388597 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-13Close libsrtp properlyKinsey Moore
Ensure that libsrtp is shutdown properly when res_srtp is unloaded. (closes issue ASTERISK-21719) Reported by: Corey Farrell Patches: res_srtp-library-shutdown.patch uploaded by Corey Farrell ........ Merged revisions 388529 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 388530 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388531 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-04res_srtp: Prevent a crash from occurring due to srtp_create failures in ↵Jonathan Rose
srtp_create Under some circumstances, libsrtp's srtp_create function deallocates memory that it wasn't initially responsible for allocating. Because we weren't initially aware of this behavior, this memory was still used in spite of being unallocated during the course of the srtp_unprotect function. A while back I made a patch which would set this value to NULL, but that exposed a possible condition where we would then try to check a member of the struct which would cause a segfault. In order to address these problems, ast_srtp_unprotect will now set an error value when it ends without a valid SRTP session which will result in the caller of srtp_unprotect observing this error and hanging up the relevant channel instead of trying to keep using the invalid session address. (closes issue ASTERISK-20499) Reported by: Tootai Review: https://reviewboard.asterisk.org/r/2228/diff/#index_header ........ Merged revisions 378591 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 378592 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378593 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-05res_srtp: Fix a crash caused by srtp_dealloc on an already dealloced sessionJonathan Rose
When srtp_create fails, the session may be dealloced or just not alloced. At the same time though, the session pointer might not be set to NULL in this process and attempting to srtp_dealloc it again will cause a segfault. This patch checks for failure of srtp_create and sets the session pointer to NULL if it fails. (closes issue ASTERISK-20499) Reported by: tootai Review: https://reviewboard.asterisk.org/r/2228/ ........ Merged revisions 377256 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 377261 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 377262 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18Fix a variety of memory leaksMatthew Jordan
This patch addresses a number of memory leaks in a variety of modules that were found by a static analysis tool. A brief summary of the changes: * app_minivm: free ast_str objects on off nominal paths * app_page: free the ast_dial object if the requested channel technology cannot be appended to the dialing structure * app_queue: if a penalty rule failed to match any existing rule list names, the created rule would not be inserted and its memory would be leaked * app_read: dispose of the created silence detector in the presence of off nominal circumstances * app_voicemail: dispose of an allocated unique ID field for MWI event un-subscribe requests in off nominal paths; dispose of configuration objects when using the secret.conf option * chan_dahdi: dispose of the allocated frame produced by ast_dsp_process * chan_iax2: properly unref peer in CLI command "iax2 unregister" * chan_sip: dispose of the allocated frame produced by sip_rtp_read's call of ast_dsp_process; free memory in parse unit tests * func_dialgroup: properly deref ao2 object grhead in nominal path of dialgroup_read * func_odbc: free resultset in off nominal paths of odbc_read * cli: free match_list in off nominal paths of CLI match completion * config: free comment_buffer/list_buffer when configuration file load is unchanged; free the same buffers any time they were created and config files were processed * data: free XML nodes in various places * enum: free context buffer in off nominal paths * features: free ast_call_feature in off nominal paths of applicationmap config processing * netsock2: users of ast_sockaddr_resolve pass in an ast_sockaddr struct that is allocated by the method. Failures in ast_sockaddr_resolve could result in the users of the method not knowing whether or not the buffer was allocated. The method will now not allocate the ast_sockaddr struct if it will return failure. * pbx: cleanup hash table traversals in off nominal paths; free ignore pattern buffer if it already exists for the specified context * xmldoc: cleanup various nodes when we no longer need them * main/editline: various cleanup of pointers not being freed before being assigned to other memory, cleanup along off nominal paths * menuselect/mxml: cleanup of value buffer for an attribute when that attribute did not specify a value * res_calendar*: responses are allocated via the various *_request method returns and should not be allocated in the various write_event methods; ensure attendee buffer is freed if no data exists in the parsed node; ensure that calendar objects are de-ref'd appropriately * res_jabber: free buffer in off nominal path * res_musiconhold: close the DIR* object in off nominal paths * res_rtp_asterisk: if we run out of ports, close the rtp socket object and free the rtp object * res_srtp: if we fail to create the session in libsrtp, destroy the temporary ast_srtp object (issue ASTERISK-19665) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1922 ........ Merged revisions 366880 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 366881 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366917 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-06Add missing newlines to CLI loggingKinsey Moore
........ Merged revisions 361471 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 361472 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361476 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24Remove srtp_shutdown from res_srtpMatthew Jordan
The patch for ASTERISK-19253 included properly shutting down the libsrtp library in the case of module unload. Unfortunately, not all distributions have the srtp_shutdown call. As such, this patch removes calling srtp_shutdown. ........ Merged revisions 356650 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 356651 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24Allow SRTP policies to be reloadedMatthew Jordan
Currently, when using res_srtp, once the SRTP policy has been added to the current session the policy is locked into place. Any attempt to replace an existing policy, which would be needed if the remote endpoint negotiated a new cryptographic key, is instead rejected in res_srtp. This happens in particular in transfer scenarios, where the endpoint that Asterisk is communicating with changes but uses the same RTP session. This patch modifies res_srtp to allow remote and local policies to be reloaded in the underlying SRTP library. From the perspective of users of the SRTP API, the only change is that the adding of remote and local policies are now added in a single method call, whereas they previously were added separately. This was changed to account for the differences in handling remote and local policies in libsrtp. Review: https://reviewboard.asterisk.org/r/1741/ (closes issue ASTERISK-19253) Reported by: Thomas Arimont Tested by: Thomas Arimont Patches: srtp_renew_keys_2012_02_22.diff uploaded by Matt Jordan (license 6283) (with some small modifications for this check-in) ........ Merged revisions 356604 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 356605 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356606 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-27Audit of ao2_iterator_init() usage for v1.8.Richard Mudgett
Fixes numerous reference leaks and missing ao2_iterator_destroy() calls as a result. Review: https://reviewboard.asterisk.org/r/1697/ ........ Merged revisions 352955 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 352956 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-19Add a separate buffer for SRTCP packetsTerry Wilson
The function ast_srtp_protect used a common buffer for both SRTP and SRTCP packets. Since this function can be called from multiple threads for the same SRTP session (scheduler for SRTCP and channel for SRTP) it was possible for the packets to become corrupted as the buffer was used by both threads simultaneously. This patch adds a separate buffer for SRTCP packets to avoid the problem. (closes issue ASTERISK-18889, Reported/patch by Daniel Collins) ........ Merged revisions 347995 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 347996 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348567 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-22Merged revisions 337542 via svnmerge from Gregory Nietsky
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r337542 | irroot | 2011-09-22 13:44:22 +0200 (Thu, 22 Sep 2011) | 14 lines Merged revisions 337541 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r337541 | irroot | 2011-09-22 13:39:49 +0200 (Thu, 22 Sep 2011) | 8 lines Add warned to ast_srtp to prevent errors on each frame from libsrtp The first 9 frames are not reported as some devices dont use srtp from first frame these are suppresed. the warning is then output only once every 100 frames. ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-14Merged revisions 328247 via svnmerge from Leif Madsen
https://origsvn.digium.com/svn/asterisk/branches/1.10 ................ r328247 | lmadsen | 2011-07-14 16:25:31 -0400 (Thu, 14 Jul 2011) | 14 lines Merged revisions 328209 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r328209 | lmadsen | 2011-07-14 16:13:06 -0400 (Thu, 14 Jul 2011) | 6 lines Introduce <support_level> tags in MODULEINFO. This change introduces MODULEINFO into many modules in Asterisk in order to show the community support level for those modules. This is used by changes committed to menuselect by Russell Bryant recently (r917 in menuselect). More information about the support level types and what they mean is available on the wiki at https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-13Merged revisions 318919 via svnmerge from Brett Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r318919 | bbryant | 2011-05-13 14:04:50 -0400 (Fri, 13 May 2011) | 10 lines This patch fixes an issue with SRTP which makes HOLD/UNHOLD impossible when too much time has passed between sending audio. (closes issue #18206) Reported by: bernhardsi Patches: res_srtp_unhold.patch uploaded by bernhards (license 1138) Tested by: bernhards, notthematrix ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@318920 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-02Replacing doc/* with wiki linksAndrew Latham
Adding links to http(s)://wiki.asterisk.org git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@305799 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-19Merged revisions 292309 via svnmerge from Terry Wilson
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r292309 | twilson | 2010-10-19 12:27:32 -0700 (Tue, 19 Oct 2010) | 10 lines Add sip show peer info about crypto and remove dated comment This patch adds information about the encryption setting to 'sip show peers' and removes an out-of-date comment from res_srtp.c and instead directs users to the proper documentation. (closes issue #18140) Reported by: chodorenko ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@292310 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-15Merged revisions 292016 via svnmerge from Terry Wilson
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r292016 | twilson | 2010-10-15 16:40:56 -0500 (Fri, 15 Oct 2010) | 5 lines Ref/unref res_srtp when we create/destroy a session This avoids unhappy crashing when we try to 'core stop gracefully' and res_srtp tries to unload before chan_sip does. Thanks, Russell! ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@292017 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-15Merged revisions 287056 via svnmerge from Terry Wilson
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r287056 | twilson | 2010-09-15 17:17:17 -0500 (Wed, 15 Sep 2010) | 10 lines Don't hang up a call on an SRTP unprotect failure Also make it more obvious when there is an issue en/decrypting. (closes issue #17563) Reported by: Alexcr Patches: res_srtp.c.patch uploaded by sfritsch (license 1089) Tested by: twilson ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@287057 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-01Merged revisions 284477 via svnmerge from Terry Wilson
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r284477 | twilson | 2010-09-01 13:44:36 -0500 (Wed, 01 Sep 2010) | 17 lines Fix SRTP for changing SSRC and multiple a=crypto SDP lines Adding code to Asterisk that changed the SSRC during bridges and masquerades broke SRTP functionality. Also broken was handling the situation where an incoming INVITE had more than one crypto offer. This patch caches the SRTP policies the we use so that we can change the ssrc and inform libsrtp of the new streams. It also uses the first acceptable a=crypto line from the incoming INVITE. (closes issue #17563) Reported by: Alexcr Patches: srtp.diff uploaded by twilson (license 396) Tested by: twilson Review: https://reviewboard.asterisk.org/r/878/ ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@284479 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-20Add load priority order, such that preload becomes unnecessary in most casesTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-08Add SRTP support for AsteriskTerry Wilson
After 5 years in mantis and over a year on reviewboard, SRTP support is finally being comitted. This includes generic CHANNEL dialplan functions that work for getting the status of whether a call has secure media or signaling as defined by the underlying channel technology and for setting whether or not a new channel being bridged to a calling channel should have secure signaling or media. See doc/tex/secure-calls.tex for examples. Original patch by mikma, updated for trunk and revised by me. (closes issue #5413) Reported by: mikma Tested by: twilson, notthematrix, hemanshurpatel Review: https://reviewboard.asterisk.org/r/191/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268894 65c4cc65-6c06-0410-ace0-fbb531ad65f3