[Home]

Summary:ASTERISK-17608: func_aes.so cannot be loaded if res_crypto / openssl not compiled
Reporter:Warren Selby (wcselby)Labels:
Date Opened:2011-03-25 15:53:09Date Closed:2015-04-13 08:02:01
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Functions/General
Versions:1.8.3 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Just built a new asterisk system from scratch, and did not install the openssl-devel package.  I was able to successfully run ./configure, and then make menuselect allowed me to select fun_aes, but not res_crypto.  I then completed my compile and install (make, make install, make samples, make config) and then started asterisk with 'asterisk -cvvvvv' from the command line and was presented with the following error:

[Mar 25 15:07:07] WARNING[3900]: loader.c:387 load_dynamic_module: Error loading module 'res_crypto': /usr/lib/asterisk/modules/res_crypto.so: cannot open shared object file: No such file or directory
[Mar 25 15:07:07] WARNING[3900]: loader.c:449 load_dynamic_module: Error loading module 'func_aes.so': /usr/lib/asterisk/modules/func_aes.so: undefined symbol: ast_aes_set_decrypt_key
[Mar 25 15:07:07] WARNING[3900]: loader.c:839 load_resource: Module 'func_aes.so' could not be loaded.

I then installed openssl-devel, then re-ran ./configure, make menuselect (at which point I chose to install res_crypto), then re-installed (make, make install), and started asterisk again with 'asterisk -cvvvvv' and the error was gone, func_aes properly loads.

This issue also appears to affect the following modules: chan_iax2.so, pbx_dundi.so, chan_mgcp.so.  These modules are all compilable without res_crypto, but they will fail to load when starting asterisk.  I would suggest marking res_crypto as a dependency on all of these modules before allowing them to be compiled via make menuselect.

****** ADDITIONAL INFORMATION ******

Errors generated by default install of asterisk without res_crypto / openssl.

[Mar 25 15:07:07] WARNING[3900]: loader.c:387 load_dynamic_module: Error loading module 'res_crypto': /usr/lib/asterisk/modules/res_crypto.so: cannot open shared object file: No such file or directory
[Mar 25 15:07:07] WARNING[3900]: loader.c:387 load_dynamic_module: Error loading module 'res_pktccops': /usr/lib/asterisk/modules/res_pktccops.so: cannot open shared object file: No such file or directory
[Mar 25 15:07:07] WARNING[3900]: loader.c:449 load_dynamic_module: Error loading module 'chan_mgcp.so': /usr/lib/asterisk/modules/chan_mgcp.so: undefined symbol: ast_pktccops_gate_alloc
[Mar 25 15:07:07] WARNING[3900]: loader.c:839 load_resource: Module 'chan_mgcp.so' could not be loaded.
[Mar 25 15:07:07] WARNING[3900]: loader.c:387 load_dynamic_module: Error loading module 'res_crypto': /usr/lib/asterisk/modules/res_crypto.so: cannot open shared object file: No such file or directory
[Mar 25 15:07:07] WARNING[3900]: loader.c:449 load_dynamic_module: Error loading module 'pbx_dundi.so': /usr/lib/asterisk/modules/pbx_dundi.so: undefined symbol: ast_check_signature_bin
[Mar 25 15:07:07] WARNING[3900]: loader.c:839 load_resource: Module 'pbx_dundi.so' could not be loaded.
[Mar 25 15:07:07] WARNING[3900]: loader.c:387 load_dynamic_module: Error loading module 'res_crypto': /usr/lib/asterisk/modules/res_crypto.so: cannot open shared object file: No such file or directory
[Mar 25 15:07:07] WARNING[3900]: loader.c:449 load_dynamic_module: Error loading module 'chan_iax2.so': /usr/lib/asterisk/modules/chan_iax2.so: undefined symbol: ast_aes_set_decrypt_key
[Mar 25 15:07:07] WARNING[3900]: loader.c:839 load_resource: Module 'chan_iax2.so' could not be loaded.
Comments:By: Paul Belanger (pabelanger) 2011-03-25 22:03:39

What OS and version of gcc are you using?

By: Warren Selby (wcselby) 2011-03-25 22:43:28

CentOS 5.5, gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)

I did a clean install of CentOS 5.5, then did a yum install gcc gcc-c++, so it's the current CentOS repository version of gcc.

By: Corey Farrell (coreyfarrell) 2015-03-31 04:54:25.812-0500

I can confirm this issue in the latest 11.  Running Linux Mint 17 - Ubuntu EGLIBC 2.19-0ubuntu6.5 / gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1).
{noformat}
$ grep include/asterisk/autoconfig.h -e HAVE_ATTRIBUTE_weak
/* #undef HAVE_ATTRIBUTE_weak */
/* #undef HAVE_ATTRIBUTE_weak_import */
/* #undef HAVE_ATTRIBUTE_weakref */
{noformat}

So OPTIONAL_API isn't supported on my desktop, meaning res_crypto.so is required for any module that uses it.  Where in Linux is the old OPTIONAL_API functional?  If it doesn't work in Asterisk 11 then I somewhat agree with the reporter, it might be best to list res_crypto as a required dependency for it's consumers.

OPTIONAL_API seems to have been rewritten in Asterisk 13, and this issue is mostly resolved.  One exception I've found, if a module exports global symbols, OPTIONAL_API's are no longer optional.  So func_periodic_hook is not optional to load res_monitor.  There are a couple other examples in Asterisk 13+ of optional API use that is not really optional, I think we should update the MODULEINFO blocks to reflect these.

By: Corey Farrell (coreyfarrell) 2015-04-04 07:20:39.731-0500

I've posted fixes for trunk (and possibly 13) to https://reviewboard.asterisk.org/r/4590/.  Once I get feedback I will determine the correct way to deal with 11 and 13.  Version 1.8 is in security fix only mode so no fix will be provided for that branch.

By: ibercom (ibercom) 2015-04-04 08:48:18.870-0500

[~coreyfarrell] : Maybe your problem is related to [ASTERISK-22559]. It is simpler.

"Your OS / gcc version doesn't detect the weakref attribute, but it is supported."

I use Debian 7 with gcc 4.7, Ubuntu versions are similar. I need to force "#define HAVE_ATTRIBUTE_weakref 1" in include/asterisk/autoconfig.h and menuselect/autoconfig.h and it compiles OK without unwanted dependencies.

The last comment in [ASTERISK-22559] can help.

By: ibercom (ibercom) 2015-04-04 09:04:29.564-0500

You have a possible patch in https://reviewboard.asterisk.org/r/1330/

By: Corey Farrell (coreyfarrell) 2015-04-13 08:10:04.316-0500

A fix has been committed to master (trunk).  The workaround for 13 will follow soon.  This will not fix the problem in 11, ASTERISK-22559 should be used for that version.