Compiling for iOS with TLS and SRTP support

MD
Matan D
Thu, Sep 29, 2016 7:31 PM

Hey everyone :)

I am unable to compile the pjsip library for iOS with TLS and SRTP support.

my config_site.h file:

#define PJ_CONFIG_IPHONE 1
#define PJ_HAS_SSL_SOCK 1
#define PJSIP_HAS_TLS_TRANSPORT 1
#define PJMEDIA_HAS_SRTP 1
#include <pj/config_site_sample.h>

I have verified that OpenSSL is identified and included:

checking for OpenSSL installations..
Using SSL prefix... /Users/matan/voip/test/pjsip/build/openssl
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... no
aconfigure: WARNING: openssl/ssl.h: accepted by the compiler, rejected by
the preprocessor!
aconfigure: WARNING: openssl/ssl.h: proceeding with the compiler's result
checking for openssl/ssl.h... yes
checking for ERR_load_BIO_strings in -lcrypto... yes
checking for SSL_library_init in -lssl... yes
OpenSSL library found, SSL support enabled

I am running the configure script with the following command:

 ./configure iphone --with-openssl /compiled/ssl/dir

And when I run make dep && make it fails with the following errors:

../src/pjmedia/transport_srtp.c:84:5: error: unknown type name 'sec_serv_t'
    sec_serv_t           service;
    ^
../src/pjmedia/transport_srtp.c:90:50: error: use of undeclared identifier
'sec_serv_none'
    {"NULL", NULL_CIPHER, 0, NULL_AUTH, 0, 0, 0, sec_serv_none},
                                                 ^
../src/pjmedia/transport_srtp.c:94:2: error: use of undeclared identifier
'sec_serv_conf_and_auth'
        sec_serv_conf_and_auth},
        ^
../src/pjmedia/transport_srtp.c:98:9: error: use of undeclared identifier
'sec_serv_conf_and_auth'
        sec_serv_conf_and_auth},
        ^
../src/pjmedia/transport_srtp.c:110:2: error: use of undeclared identifier
'sec_serv_conf_and_auth'
        sec_serv_conf_and_auth},
        ^
../src/pjmedia/transport_srtp.c:114:2: error: use of undeclared identifier
'sec_serv_conf_and_auth'
        sec_serv_conf_and_auth},
        ^
../src/pjmedia/transport_srtp.c:146:5: error: unknown type name 'srtp_t'
    srtp_t               srtp_tx_ctx;
    ^
../src/pjmedia/transport_srtp.c:147:5: error: unknown type name 'srtp_t'
    srtp_t               srtp_rx_ctx;
    ^
../src/pjmedia/transport_srtp.c:317:8: warning: implicit declaration of
function 'srtp_init' is invalid in C99 [-Wimplicit-function-declaration]
        err = srtp_init();
              ^
../src/pjmedia/transport_srtp.c:363:11: warning: implicit declaration of
function 'srtp_shutdown' is invalid in C99 [-Wimplicit-function-declaration]
    err = srtp_shutdown();
          ^
../src/pjmedia/transport_srtp.c:379:24: error: invalid application of
'sizeof' to an incomplete type 'crypto_suite []'
    int cs_cnt = sizeof(crypto_suites)/sizeof(crypto_suites[0]);
                       ^~~~~~~~~~~~~~~
../src/pjmedia/transport_srtp.c:428:31: error: invalid application of
'sizeof' to an incomplete type 'crypto_suite []'
    opt->crypto_count = sizeof(crypto_suites)/sizeof(crypto_suites[0]) - 1;
                              ^~~~~~~~~~~~~~~
../src/pjmedia/transport_srtp.c:541:5: error: use of undeclared identifier
'srtp_policy_t'
    srtp_policy_t    tx_;
    ^
../src/pjmedia/transport_srtp.c:542:5: error: use of undeclared identifier
'srtp_policy_t'
    srtp_policy_t    rx_;
    ^
../src/pjmedia/transport_srtp.c:594:27: error: use of undeclared identifier
'srtp_policy_t'; did you mean 'setiopolicy_np'?
    pj_bzero(&tx_, sizeof(srtp_policy_t));
                          ^~~~~~~~~~~~~
                          setiopolicy_np
/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/usr/include/sys/resource.h:393:5:
note: 'setiopolicy_np' declared here
int     setiopolicy_np(int, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5,
__IPHONE_2_0);
        ^
../src/pjmedia/transport_srtp.c:594:15: error: use of undeclared identifier
'tx_'; did you mean 'tx'?
    pj_bzero(&tx_, sizeof(srtp_policy_t));
              ^~~
              tx
../src/pjmedia/transport_srtp.c:537:34: note: 'tx' declared here
                           const pjmedia_srtp_crypto *tx,
                                                      ^
../src/pjmedia/transport_srtp.c:597:2: error: use of undeclared identifier
'tx_'; did you mean 'tx'?
        tx_.rtp.sec_serv    = sec_serv_conf_and_auth;
        ^~~
        tx
../src/pjmedia/transport_srtp.c:537:34: note: 'tx' declared here
                           const pjmedia_srtp_crypto *tx,
                                                      ^
../src/pjmedia/transport_srtp.c:597:5: error: member reference type 'const
pjmedia_srtp_crypto *' (aka 'const struct pjmedia_srtp_crypto *') is a
pointer; did you mean to use '->'?
        tx_.rtp.sec_serv    = sec_serv_conf_and_auth;
        ~~~^
           ->
../src/pjmedia/transport_srtp.c:597:6: error: no member named 'rtp' in
'struct pjmedia_srtp_crypto'
        tx_.rtp.sec_serv    = sec_serv_conf_and_auth;
        ~~~ ^
../src/pjmedia/transport_srtp.c:597:24: error: use of undeclared identifier
'sec_serv_conf_and_auth'
        tx_.rtp.sec_serv    = sec_serv_conf_and_auth;
                              ^
../src/pjmedia/transport_srtp.c:599:2: error: use of undeclared identifier
'tx_'; did you mean 'tx'?
        tx_.rtp.sec_serv    = sec_serv_conf;
        ^~~
        tx
../src/pjmedia/transport_srtp.c:537:34: note: 'tx' declared here
                           const pjmedia_srtp_crypto *tx,
                                                      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Any suggestions would be appreciated :)

Hey everyone :) I am unable to compile the pjsip library for iOS with TLS and SRTP support. my `config_site.h` file: ``` #define PJ_CONFIG_IPHONE 1 #define PJ_HAS_SSL_SOCK 1 #define PJSIP_HAS_TLS_TRANSPORT 1 #define PJMEDIA_HAS_SRTP 1 #include <pj/config_site_sample.h> ``` I have verified that OpenSSL is identified and included: ``` checking for OpenSSL installations.. Using SSL prefix... /Users/matan/voip/test/pjsip/build/openssl checking openssl/ssl.h usability... yes checking openssl/ssl.h presence... no aconfigure: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor! aconfigure: WARNING: openssl/ssl.h: proceeding with the compiler's result checking for openssl/ssl.h... yes checking for ERR_load_BIO_strings in -lcrypto... yes checking for SSL_library_init in -lssl... yes OpenSSL library found, SSL support enabled ``` I am running the configure script with the following command: ``` ./configure iphone --with-openssl /compiled/ssl/dir ``` And when I run `make dep && make` it fails with the following errors: ``` ../src/pjmedia/transport_srtp.c:84:5: error: unknown type name 'sec_serv_t' sec_serv_t service; ^ ../src/pjmedia/transport_srtp.c:90:50: error: use of undeclared identifier 'sec_serv_none' {"NULL", NULL_CIPHER, 0, NULL_AUTH, 0, 0, 0, sec_serv_none}, ^ ../src/pjmedia/transport_srtp.c:94:2: error: use of undeclared identifier 'sec_serv_conf_and_auth' sec_serv_conf_and_auth}, ^ ../src/pjmedia/transport_srtp.c:98:9: error: use of undeclared identifier 'sec_serv_conf_and_auth' sec_serv_conf_and_auth}, ^ ../src/pjmedia/transport_srtp.c:110:2: error: use of undeclared identifier 'sec_serv_conf_and_auth' sec_serv_conf_and_auth}, ^ ../src/pjmedia/transport_srtp.c:114:2: error: use of undeclared identifier 'sec_serv_conf_and_auth' sec_serv_conf_and_auth}, ^ ../src/pjmedia/transport_srtp.c:146:5: error: unknown type name 'srtp_t' srtp_t srtp_tx_ctx; ^ ../src/pjmedia/transport_srtp.c:147:5: error: unknown type name 'srtp_t' srtp_t srtp_rx_ctx; ^ ../src/pjmedia/transport_srtp.c:317:8: warning: implicit declaration of function 'srtp_init' is invalid in C99 [-Wimplicit-function-declaration] err = srtp_init(); ^ ../src/pjmedia/transport_srtp.c:363:11: warning: implicit declaration of function 'srtp_shutdown' is invalid in C99 [-Wimplicit-function-declaration] err = srtp_shutdown(); ^ ../src/pjmedia/transport_srtp.c:379:24: error: invalid application of 'sizeof' to an incomplete type 'crypto_suite []' int cs_cnt = sizeof(crypto_suites)/sizeof(crypto_suites[0]); ^~~~~~~~~~~~~~~ ../src/pjmedia/transport_srtp.c:428:31: error: invalid application of 'sizeof' to an incomplete type 'crypto_suite []' opt->crypto_count = sizeof(crypto_suites)/sizeof(crypto_suites[0]) - 1; ^~~~~~~~~~~~~~~ ../src/pjmedia/transport_srtp.c:541:5: error: use of undeclared identifier 'srtp_policy_t' srtp_policy_t tx_; ^ ../src/pjmedia/transport_srtp.c:542:5: error: use of undeclared identifier 'srtp_policy_t' srtp_policy_t rx_; ^ ../src/pjmedia/transport_srtp.c:594:27: error: use of undeclared identifier 'srtp_policy_t'; did you mean 'setiopolicy_np'? pj_bzero(&tx_, sizeof(srtp_policy_t)); ^~~~~~~~~~~~~ setiopolicy_np /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/usr/include/sys/resource.h:393:5: note: 'setiopolicy_np' declared here int setiopolicy_np(int, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); ^ ../src/pjmedia/transport_srtp.c:594:15: error: use of undeclared identifier 'tx_'; did you mean 'tx'? pj_bzero(&tx_, sizeof(srtp_policy_t)); ^~~ tx ../src/pjmedia/transport_srtp.c:537:34: note: 'tx' declared here const pjmedia_srtp_crypto *tx, ^ ../src/pjmedia/transport_srtp.c:597:2: error: use of undeclared identifier 'tx_'; did you mean 'tx'? tx_.rtp.sec_serv = sec_serv_conf_and_auth; ^~~ tx ../src/pjmedia/transport_srtp.c:537:34: note: 'tx' declared here const pjmedia_srtp_crypto *tx, ^ ../src/pjmedia/transport_srtp.c:597:5: error: member reference type 'const pjmedia_srtp_crypto *' (aka 'const struct pjmedia_srtp_crypto *') is a pointer; did you mean to use '->'? tx_.rtp.sec_serv = sec_serv_conf_and_auth; ~~~^ -> ../src/pjmedia/transport_srtp.c:597:6: error: no member named 'rtp' in 'struct pjmedia_srtp_crypto' tx_.rtp.sec_serv = sec_serv_conf_and_auth; ~~~ ^ ../src/pjmedia/transport_srtp.c:597:24: error: use of undeclared identifier 'sec_serv_conf_and_auth' tx_.rtp.sec_serv = sec_serv_conf_and_auth; ^ ../src/pjmedia/transport_srtp.c:599:2: error: use of undeclared identifier 'tx_'; did you mean 'tx'? tx_.rtp.sec_serv = sec_serv_conf; ^~~ tx ../src/pjmedia/transport_srtp.c:537:34: note: 'tx' declared here const pjmedia_srtp_crypto *tx, ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] ``` Any suggestions would be appreciated :)