Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed a DES implementation rather than relying on lib(x)crypt #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

zackw
Copy link

@zackw zackw commented Jun 21, 2021

Fixes #5 and #6 (the latter appears to be a duplicate). Also eliminates the dependency on libcrypto (the embedded MD4 implementation is used unconditionally), cleans up the code a little and the Makefiles a whole lot.

I copied the DES implementation over from libxcrypt, since that's the one that I have conveniently to hand. It was originally written for NetBSD and is therefore 3-clause BSD licensed, which I hope is OK.

Note: this compiles cleanly on one computer but has not been tested at all beyond that.

zackw added 5 commits June 20, 2021 19:12
Since all of the cryptographic primitives required by asleap (DES,
MD4, and SHA1) are obsolete, it is best to ship implementations
ourselves rather than rely on external libraries that may deprecate
them or remove them altogether.  SHA1 is already being supplied by
sha1.c, but MD4 is optionally supplied by OpenSSL (libcrypto) and for
DES we are relying on the obsolete SVID functions ‘encrypt’ and ‘setkey’.

Remove the ifdefs in common.c and genkeys.c allowing for the use of
OpenSSL’s implementation of MD4.  In the Makefile, remove both
-lxcrypt and -lcrypto from LDLIBS, and add md4.o to the link for both
asleap and genkeys.  This means the program will not compile right
now, with undefined references to ‘encrypt’ and ‘setkey’—this will be
corrected in the next commit.

While we’re messing with the Makefile, overhaul it with proper use of
object files, built-in rules and variables, and comprehensive .c:.h
dependency lists.

While we’re messing with the Makefile, eliminate the only place where
we need a -D_LINUX by instead using __GNU_LIBRARY__ to detect the
availability of <endian.h>.  This *may* mean makefile.cygwin is no
longer necessary.  Will come back to that.
This implementation was originally written by David Burren for NetBSD
and is therefore under a 3-clause BSD license.  By using it directly,
the Expand and Collapse operations in utils.c cease to be necessary.
- Crank up the warnings level (-Wextra -Wpedantic -Wstrict-prototypes)
- Explicitly request C2011 with extensions.
- Explicitly request 64-bit off_t.
- Fix all the resulting warnings.

The only code change of note is that I deleted struct dot11_mgmt from
ieee80211.h.  This was using the old GNU zero-length array extension
in a way that is not supported for C99 flexible array members, and
it’s unused in this program, so the easiest fix is to get rid of it.
The only differences are now:

 - use of .obj and .exe extensions instead of .o and null
 - -L$(WPDPACK)/lib -lwpcap instead of -lpcap
 - no ‘strip’ target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to compile
1 participant