<div dir="ltr">Nevermind, i was missing some directives ;)<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 14, 2020 at 1:45 AM David Villasmil <<a href="mailto:david.villasmil.work@gmail.com">david.villasmil.work@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello all,<div><br></div><div>If anyone can help with my confusion here:</div><div><br></div><div>Let's say i'm working on an already existing module. </div><div><br>I've created modules in the past, this is not really my problem. My problem comes from an already existing module, let's call it my_module. In this module I'm adding a new functionality where i need to decrypt a jwt token parameter encrypted in AES.<br><br>The existing module main file, the file loaded by the main freeSWITCH loader is in C., let's say something like this:<br><br><font face="monospace">#include <switch.h><br>#include <switch_json.h><br>#include <switch_stun.h><br>#include <jwt.h><br><br>#include "token_crypto.h" <-- This is my addition<br><br>...</font><br><font face="monospace"><some stuff goes here></font><br>at some point i do this:<br><br><font face="monospace"> plaintext_len = token_decrypt( *token_encoded, plaintext );</font></div><div><font face="monospace"><br></font>my token_crypto.h is<br><br><font face="monospace">SWITCH_BEGIN_EXTERN_C<br><br>#include <stdio.h><br>#include <string.h><br>#include <openssl/ssl.h><br>#include <openssl/evp.h><br>#include <openssl/err.h><br>#include <openssl/bio.h><br>#include <openssl/buffer.h><br>#include <openssl/sha.h><br><br><br>void handleErrors(unsigned char *ciphertext);<br>int gcm_decrypt(unsigned char *ciphertext, int ciphertext_len,<br> unsigned char *aad, int aad_len,<br> unsigned char *tag,<br> unsigned char *key,<br> unsigned char *iv, int iv_len,<br> unsigned char *plaintext);<br>int token_decrypt( const char token_encoded, unsigned char *plaintext );<br><br><br>SWITCH_END_EXTERN_C</font></div><div><font face="monospace"><br></font>And then the actual implementation in token_crypto.cpp<br><br>I added the requirement to compile token_crypto in the Makefile.am like this:<br><br><font face="monospace">mod_mymodule_la_SOURCES = \<br> base64url.cpp \<br> token_crypto.cpp \<br> mod_mymodule.c</font></div><div><font face="monospace"><br></font>The code then compiles ok, but when i try to load it i'm getting:<br><br><font face="monospace">**/usr/local/freeswitch/mod/mod_mymodule.so: undefined symbol: token_decrypt**</font></div><div><font face="monospace"><br></font>I know the linker can't find the compiled references, but i just can't figure out how to link it all up...<br></div><div><br></div><div>call me stupid, but help me out 🤔<br clear="all"><div><div dir="ltr"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div></div></div>
</blockquote></div>