Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Commit

Permalink
* get rid of the openssl dependency
Browse files Browse the repository at this point in the history
* make libuuid optional (based on http://git.io/vqbwu)
  • Loading branch information
tpoechtrager committed Jul 11, 2015
1 parent 54b2241 commit cf084ee
Show file tree
Hide file tree
Showing 9 changed files with 557 additions and 43 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ armv7m, armv7em, armv8, arm64, arm64v8, i386, x86_64 and x86_64h.

`Clang 3.2+ or gcc/g++/gcc-objc 4.5+`, `automake`, `autogen` and `libtool`.

On non-Mac OS X systems you also need to install:
Optional, but recommended:

`uuid-devel` and `openssl-devel`.

Optional, but recommended deps:

`llvm-devel` (Enables Link Time Optimization)
`llvm-devel` (For Link Time Optimization Support)
`uuid-devel` (For ld64 `-random_uuid` Support)

## INSTALLATION ##

Expand Down
20 changes: 4 additions & 16 deletions cctools/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,6 @@ AM_PROG_AS([clang])
AC_CHECK_TOOL([HOST_RANLIB], [ranlib], :)
AC_CHECK_TOOL([HOST_AR], [ar], :)

if test "x$isdarwin" != "xyes"; then
AC_CHECK_HEADERS([openssl/md5.h], [], [AC_MSG_ERROR([*** md5.h not found, please install ssl dev packages according to your system])])
CRYPTO_LIB=-lcrypto
SSL_LIB=-lssl
AC_SUBST([CRYPTO_LIB])
AC_SUBST([SSL_LIB])
fi

AC_CHECK_HEADERS([uuid/uuid.h], [], [AC_MSG_ERROR([*** uuid.h not found, please install uuid dev packages according to your system])])


#for libstuff emulated.c
case $target_cpu in
powerpc)
Expand Down Expand Up @@ -273,14 +262,13 @@ AC_SUBST(DL_LIB)
AC_CHECK_LIB([pthread],[pthread_create],[PTHREAD_FLAGS=-pthread])
AC_SUBST(PTHREAD_FLAGS)

if test "x$isdarwin" = "xno"; then
AC_CHECK_LIB([uuid],[uuid_generate_random],[UUID_LIB=-luuid],[exit 1])
AC_SUBST(UUID_LIB)
fi

AC_CHECK_LIB([execinfo],[backtrace],[DL_LIB=-lexecinfo])
AC_SUBST(EXECINFO_LIB)

AC_CHECK_HEADERS([uuid/uuid.h], [
AC_CHECK_LIB([uuid],[uuid_generate_random],[UUID_LIB=-luuid])], [])
AC_SUBST(UUID_LIB)

AC_CHECK_FUNCS([strmode])

### Check for __cxa_demangle in various C++ ABI libs ###
Expand Down
17 changes: 0 additions & 17 deletions cctools/include/foreign/CommonCrypto/CommonDigest.h

This file was deleted.

3 changes: 2 additions & 1 deletion cctools/ld64/src/3rd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ libhelper_la_SOURCES = \
qsort_r.c \
strlcat.c \
strlcpy.c \
eprintf.c
eprintf.c \
md5.c
48 changes: 48 additions & 0 deletions cctools/ld64/src/3rd/include/CommonCrypto/CommonDigest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#ifdef __APPLE__

#include_next <CommonCrypto/CommonDigest.h>

#else

#include "md5.h"
#include "assert.h"

#define CC_MD5_DIGEST_LENGTH 16
#define CC_MD5_CTX md5_state_t

static int CC_MD5_Init(CC_MD5_CTX *c) {
md5_init(c);
return 1;
}

static int CC_MD5_Update(CC_MD5_CTX *c, const unsigned char *data,
unsigned long nbytes) {
assert(nbytes <= 0x7fffffff && "would overflow");
md5_append(c, data, nbytes);
return 1;
}

static int CC_MD5_Final(unsigned char digest[CC_MD5_DIGEST_LENGTH],
CC_MD5_CTX *c) {
md5_finish(c, digest);
return 1;
}

static unsigned char *CC_MD5(const unsigned char *data,
unsigned long nbytes, unsigned char *md) {
static unsigned char smd[CC_MD5_DIGEST_LENGTH];

if (!md)
md = smd;

assert(nbytes <= 0x7fffffff && "would overflow");

CC_MD5_CTX c;
CC_MD5_Init(&c);
CC_MD5_Update(&c, data, nbytes);
CC_MD5_Final(md, &c);

return md;
}

#endif /* __APPLE__ */
Loading

0 comments on commit cf084ee

Please sign in to comment.