DES functions, net-snmp, and ethereal

Gareth McCaughan gmccaughan at synaptics-uk.com
Tue Aug 10 05:59:20 PDT 2004


Executive summary: I'm getting "undefined reference to
`des_cbc_encrypt'" and similar errors when trying to compile
ethereal. How can I fix this?

Details:

I'm running 4.5-STABLE from April 2002, with a recently
cvsupped ports collection. When I attempt to build ethereal
(version 0.10.5) the compilation ends as follows (with
apologies for grossly overlong lines...)

  | /bin/sh /usr/local/bin/libtool15 --mode=link cc  -DINET6 -D_U_="__attribute__((unused))" -Wall -W -O -pipe  -I/usr/local/include -D_THREAD_SAFE -I/usr/local/include/atk-1.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/X11R6/include/gtk-2.0 -I/usr/X11R6/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/X11R6/include/pango-1.0 -I/usr/local/include/freetype2 -I/usr/local/include   -I/usr/X11R6/include -I/usr/local/lib/include -DINET6 -O -pipe -Dfreebsd4 -I/usr/libdata/perl/5.00503/mach/CORE -I. -I/usr/local/include -I/usr/include   -L/usr/local/lib -L/usr/local/lib/lib -L/usr/lib -L/usr/local/lib/lib -o ethereal -export-dynamic pcap-util-unix.o capture_stop_conditions.o  cfile.o conditions.o disabled_protos.o  pcap-util.o range.o ringbuffer.o  timestats.o version_info.o alert_box.o  capture.o file.o filters.o  g711.o merge.o proto_hier_stats.o  summary.o    gtk/libui.a             wiretap/libwiretap.la   epan/libethereal.la     -L/usr/local/lib -lnetsnmp -lcrypto -lm -lkvm -ldevstat -lcrypto                  "-dlopen" self  "-dlopen" plugins/acn/acn.la  "-dlopen" plugins/artnet/artnet.la  "-dlopen" plugins/asn1/asn1.la  "-dlopen" plugins/ciscosm/ciscosm.la  "-dlopen" plugins/docsis/docsis.la  "-dlopen" plugins/enttec/enttec.la  "-dlopen" plugins/giop/cosnaming.la  "-dlopen" plugins/giop/coseventcomm.la  "-dlopen" plugins/gryphon/gryphon.la  "-dlopen" plugins/irda/irda.la  "-dlopen" plugins/lwres/lwres.la  "-dlopen" plugins/megaco/megaco.la  "-dlopen" plugins/mgcp/mgcp.la  "-dlopen" plugins/pcli/pcli.la  "-dlopen" plugins/rdm/rdm.la  "-dlopen" plugins/rlm/rlm.la  "-dlopen" plugins/rtnet/rtnet.la  "-dlopen" plugins/rudp/rudp.la  "-dlopen" plugins/v5ua/v5ua.la                         -L/usr/local/lib/lib -lpcre -lz  -lpcap -Wl,--export-dynamic -pthread -L/usr/local/lib -L/usr/X11R6/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -lXrandr -lXi -lXinerama -lXcursor -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lXft -lfreetype -lz -lXrender -lXext -lfontconfig -lpangox-1.0 -lX11 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -liconv   -ladns -lz  -lpcre
  | rm -f .libs/ethereal.nm .libs/ethereal.nmS .libs/ethereal.nmT
  | creating .libs/etherealS.c
  | (cd .libs && cc -c -fno-builtin -fno-rtti -fno-exceptions "etherealS.c")
  | rm -f .libs/etherealS.c .libs/ethereal.nm .libs/ethereal.nmS .libs/ethereal.nmT
  | cc -DINET6 "-D_U_=__attribute__((unused))" -Wall -W -O -pipe -I/usr/local/include -D_THREAD_SAFE -I/usr/local/include/atk-1.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/X11R6/include/gtk-2.0 -I/usr/X11R6/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/X11R6/include/pango-1.0 -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/X11R6/include -I/usr/local/lib/include -DINET6 -O -pipe -Dfreebsd4 -I/usr/libdata/perl/5.00503/mach/CORE -I. -I/usr/local/include -I/usr/include -o .libs/ethereal pcap-util-unix.o capture_stop_conditions.o cfile.o conditions.o disabled_protos.o pcap-util.o range.o ringbuffer.o timestats.o version_info.o alert_box.o capture.o file.o filters.o g711.o merge.o proto_hier_stats.o summary.o .libs/etherealS.o -Wl,--export-dynamic -Wl,--export-dynamic  -L/usr/local/lib -L/usr/local/lib/lib -L/usr/lib gtk/libui.a wiretap/.libs/libwiretap.so epan/.libs/libethereal.so -lnetsnmp -lkvm -ldevstat -lcrypto -lpcap -pthread -L/usr/X11R6/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -lXrandr -lXi -lXinerama -lXcursor -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lXft /usr/local/lib/libfreetype.so -lXrender -lXext -lfontconfig -lpangox-1.0 -lX11 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -liconv -ladns -lz -lpcre -Wl,--rpath -Wl,/usr/X11R6/lib -Wl,--rpath -Wl,/usr/local/lib
  | /usr/lib/libc.so.4: WARNING!  setkey(3) not present in the system!
  | /usr/lib/libc.so.4: warning: this program uses gets(), which is unsafe.
  | /usr/lib/libc.so.4: warning: mktemp() possibly used unsafely; consider using mkstemp()
  | /usr/lib/libc.so.4: WARNING!  des_setkey(3) not present in the system!
  | /usr/lib/libc.so.4: WARNING!  encrypt(3) not present in the system!
  | /usr/lib/libc.so.4: warning: tmpnam() possibly used unsafely; consider using mkstemp()
  | /usr/lib/libc.so.4: warning: this program uses f_prealloc(), which is not recommended.
  | /usr/lib/libc.so.4: WARNING!  des_cipher(3) not present in the system!
  | /usr/lib/libc.so.4: warning: tempnam() possibly used unsafely; consider using mkstemp()
  | /usr/local/lib/libnetsnmp.so: undefined reference to `des_cbc_encrypt'
  | /usr/local/lib/libnetsnmp.so: undefined reference to `des_key_sched'
  | /usr/local/lib/libnetsnmp.so: undefined reference to `des_ncbc_encrypt'

at which point "make" gives up.

"nm /usr/local/lib/libnetsnmp.so | egrep des_key_sched" produces
only "U des_key_sched". I'd naively have expected the des_... functions
to be in libcrypto. According to "ldconfig -r" I have three different
versions of libcrypto, in three different places.

  | 50:-lcrypto.2 => /usr/lib/libcrypto.so.2
  | 91:-lcrypto.1 => /usr/lib/compat/libcrypto.so.1
  | 169:-lcrypto.3 => /usr/local/lib/libcrypto.so.3

Let's have a look inside those libraries. I'll ignore the /usr/lib/compat
one because it seems obviously irrelevant.

  | $ for x in /usr/lib/libcrypto.so.2 usr/local/lib/libcrypto.so.3; do echo $x; nm --dynamic $x | egrep -i des_key_sched; done
  | /usr/lib/libcrypto.so.2
  | 0004f154 T des_key_sched
  | /usr/local/lib/libcrypto.so.3
  | 0003e338 T DES_key_sched
  | 00044f78 T _ossl_old_des_key_sched

My installed version of OpenSSL is (in FreeBSD-ports-speak) 0.9.7d_1,
and my installed version of net-snmp is 5.1.1_6. I'm outside the USA
(and, more directly relevant, don't have USA_RESIDENT defined in
/etc/defaults/make.conf), if that makes a difference to what
crypto stuff I have installed where.

At this point I run out of shared-library-fu, not to mention
libtool-fu. Maybe I could coerce ethereal into building by
diddling with that command line until the linker consents to
use the older version of libcrypto, or by renaming the newer
version out of the way, but that all seems like obviously
the Wrong Thing.

    (Well, actually, I just tried the latter, and it worked.
    To get ethereal to actually install, it was also necessary
    to work around a bit of breakage in the version of "sed"
    I have, which has presumably been repaired in more recent
    4.x releases. Anyway, this still seems to me like the
    Wrong Thing, which is why I'm still asking this question.)

Can anyone enlighten me as to (1) exactly what's going on here
and (2) what I should do about it? Many thanks!

-- 
Gareth McCaughan



More information about the freebsd-questions mailing list