Reputation: 3
I got a problem during compiling my C program for DES encrytion/decryption using OpenSSL project on ubuntu.The compiling command is :
gcc -o des_cbc des_cbc.c -lcrypt
and I got the following errors:
In function main':
des_cbc.c:(.text+0x1fb): undefined reference to `DES_set_key_checked'
des_cbc.c:(.text+0x283): undefined reference to `DES_encrypt1'
des_cbc.c:(.text+0x2da): undefined reference to `DES_encrypt1'
collect2: ld returned 1 exit status
Upvotes: 0
Views: 881
Reputation: 14549
You are probably needing to add the -lssl
flag... let me read the nm
output of the libraries to see where those functions are...
EDIT:
Here is what I am seeing on my system, you shouldn't need the -lssl
flag because, the symbols are showing up in the libcrypto library...
nm /usr/lib/libcrypto.dylib | grep DES_set_key_checked
000000000008c9d0 T _DES_set_key_checked
and:
nm programing/src/openssl/libcrypto-1.0.0e.a | grep DES_set_key_checked
0000000000000340 T _DES_set_key_checked
0000000000000f00 S _DES_set_key_checked.eh
but it is possible that your version is missing these symbols because they were intentionally not compiled into the library.
Upvotes: 1