[Home]

Summary:ASTERISK-24436: Missing header in res/res_srtp.c when compiling against libsrtp-1.5.0
Reporter:Patrick Laimbock (laimbock)Labels:
Date Opened:2014-10-17 11:33:17Date Closed:2016-06-07 09:15:33
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_srtp
Versions:11.13.0 Frequency of
Occurrence
Constant
Related
Issues:
is duplicated byASTERISK-25294 srtp's crypto_get_random deprecated
Environment:CentOS 6.5 x86_64, Asterisk 11.13.0 and libsrtp 1.5.0Attachments:( 0) asterisk_with_libsrtp1.5.x.patch
Description:Compilation of 11.13.0 against libsrtp 1.5.0 fails with the following error:

gcc -o res_srtp.o -c res_srtp.c -MD -MT res_srtp.o -MF .res_srtp.o.d -MP -pthread -I/home/mockbuild/rpmbuild/BUILD/asterisk-11.13.0/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Werror-implicit-function-declaration  -I/usr/include/libxml2 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations     -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -DAST_MODULE=\"res_srtp\"   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Werror-implicit-function-declaration
res_srtp.c: In function 'ast_srtp_get_random':
res_srtp.c:307: error: implicit declaration of function 'crypto_get_random'
make[1]: *** [res_srtp.o] Error 1

This seems to be caused by a missing header. The following pseudo patch fixes the problem for me:

ASTERISK_FILE_VERSION(__FILE__, "$Revision: 413587 $")

#include <srtp/srtp.h>
+#include <srtp/crypto_kernel.h>

#include "asterisk/lock.h"
Comments:By: Alexander Traud (traud) 2016-06-07 05:35:46.774-0500

Although the [intro|https://github.com/cisco/libsrtp/blob/master/doc/intro.txt] of libSRTP still suggests to use {{crypto_get_random}}, it was moved to a private header as of [commit 4494760|https://github.com/cisco/libsrtp/commits/1_5_x_throttle/include/srtp.h]. Furthermore according to several commit messages ([1|https://github.com/cisco/libsrtp/commit/339b61dce67b78cd5f8c2b08194b9fadbdf8a832], [2|https://github.com/cisco/libsrtp/commit/fb838419fa133be8140ed0c0a50fa305dfa0a671]), the random-number generator (RNG) of the libSRTP 1.5.x branch might not be maintained anymore either. Because Asterisk uses OpenSSL anyway, the attached patch does not change the inclusion for a private header file but instead goes for OpenSSL. PJSIP took the [same approach|http://trac.pjsip.org/repos/changeset/5079/pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c]. Please, consider this patch for inclusion.