From: Matthew Dillon Date: Thu, 27 Oct 2016 23:11:22 +0000 (-0700) Subject: build - Rewire secure, remove conflicts from libmd, libcrypt X-Git-Tag: v4.8.0rc~703 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/0fe46dc6296951eb138485d8c6b580bac0488fd8 build - Rewire secure, remove conflicts from libmd, libcrypt * Remove /usr/src/secure, folding all of its subsystems into /usr/src. There's no point having a /usr/src/secure any more, the system won't run without the secure stuff, the idea that some foreign actor could segregate it in order to legally download code without crypto is absurd on the modern internet, and the U.S. government stopped caring decades ago. * Remove conflicts from libmd and libcrypt. Essentially this removes the SHA*_*() and MD5_*() APIs from libmd because these APIs already exist in lib[re]ssl. The older SHA*() and MD5*() APIs are partially retained for legacy base code, but will be removed in a later stage (moved to direct-linking the needed support source). Conflicting routines in libcrypt have been renamed and internalized to be libcrypt-only. * Major rewiring of the Makefile's to support the changes. --- diff --git a/Makefile.inc1 b/Makefile.inc1 index c8e886fd49..bd215b5ecd 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -62,9 +62,6 @@ SUBDIR+= gnu .if exists(${.CURDIR}/sbin) SUBDIR+= sbin .endif -.if exists(${.CURDIR}/secure) && !defined(NO_CRYPT) -SUBDIR+= secure -.endif .if exists(${.CURDIR}/share) && !defined(NO_SHARE) SUBDIR+= share .endif @@ -1045,14 +1042,13 @@ _generic_libs+= lib .if !defined(NO_CRYPT) .if defined(FORCE_OPENSSL) -_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl +_prebuild_libs+= lib/libcrypto lib/libssl .endif .if !defined(NO_LIBRESSL) -_prebuild_libs+= secure/lib/librecrypto secure/lib/libressl -_prebuild_libs+= secure/lib/libssh -secure/lib/libssh__L: secure/lib/librecrypto__L lib/libz__L +_prebuild_libs+= lib/librecrypto lib/libressl +_prebuild_libs+= lib/libssh +lib/libssh__L: lib/librecrypto__L lib/libz__L .endif -_generic_libs+= secure/lib .endif _prebuild_libs+= lib/libradius lib/libsbuf lib/libtacplus lib/libm \ diff --git a/Makefile.ssh.common b/Makefile.ssh.common new file mode 100644 index 0000000000..c3080d3fd1 --- /dev/null +++ b/Makefile.ssh.common @@ -0,0 +1,27 @@ +# SSH common setup +# + +# Bad hack because .INCLUDEDFROMDIR does not work. +# +.if exists(${.CURDIR}/../../Makefile.inc1) +SSHC_SYSDIR=${.CURDIR}/../.. +.elif exists(${.CURDIR}/../../../Makefile.inc1) +SSHC_SYSDIR=${.CURDIR}/../../.. +.else +.error "Cannot find soure base" +.endif + +SSHDIR= ${SSHC_SYSDIR}/crypto/openssh + +XAUTH_PATH?= /usr/local/bin/xauth +CFLAGS+= -DXAUTH_PATH=\"${XAUTH_PATH}\" +CFLAGS+= -I${SSHC_SYSDIR}/crypto/libressl/include +CFLAGS+= -I${SSHC_SYSDIR}/lib/libssh -I${SSHDIR} + +.if ${.CURDIR:T} != "libssh" +DPADD+= ${LIBSSH} ${LIBRECRYPTO} ${LIBUTIL} ${LIBZ} ${LIBPTHREAD} +LDADD+= -lprivate_ssh -lprivate_crypto -lutil -lz -lpthread +LDFLAGS+= -rpath /lib/priv:/usr/lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv +.endif + +.PATH: ${SSHDIR} ${SSHDIR}/openbsd-compat diff --git a/bin/csh/Makefile b/bin/csh/Makefile index d577e5666c..0fd342b5a9 100644 --- a/bin/csh/Makefile +++ b/bin/csh/Makefile @@ -41,13 +41,13 @@ MLINKS= csh.1 tcsh.1 DPADD= /usr/lib/libtermcap.a ${LIBCRYPT} LDADD= -ltermcap -lcrypt . else -DPADD= ${LIBNCURSES} ${LIBCRYPT} -LDADD= -lprivate_ncurses -lcrypt +DPADD= ${LIBNCURSES} ${LIBCRYPT} ${LIBRECRYPTO} +LDADD= -lprivate_ncurses -lcrypt -lprivate_crypto LDFLAGS+= -rpath /lib/priv -L /usr/lib/priv . endif .else -DPADD= ${LIBNCURSES} ${LIBCRYPT} -LDADD= -lprivate_ncurses -lcrypt +DPADD= ${LIBNCURSES} ${LIBCRYPT} ${LIBRECRYPTO} +LDADD= -lprivate_ncurses -lcrypt -lprivate_crypto LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv .endif diff --git a/etc/Makefile b/etc/Makefile index 5379c1122b..44f8bed101 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -40,7 +40,7 @@ BIN1+= ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config .endif .if !defined(NO_LIBRESSL) -DIRS+= secure/lib/libssh \ +DIRS+= lib/libssh \ secure/usr.bin/ssh \ secure/usr.sbin/sshd \ secure/usr.bin/openssl @@ -201,8 +201,8 @@ upgrade_etc: upgrade_check preupgrade remove-obsolete-files rm -f ${DESTDIR}/usr/lib/${lib} .endif .endfor - cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc obj - cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc install + cd ${.CURDIR}/../lib/libssh; ${MAKE} -f Makefile.etc obj + cd ${.CURDIR}/../lib/libssh; ${MAKE} -f Makefile.etc install .if exists(${DESTDIR}/boot) .if exists(${DESTDIR}/kernel) chflags noschg ${DESTDIR}/kernel diff --git a/include/Makefile b/include/Makefile index 8bfd443ea1..d5fed88b29 100644 --- a/include/Makefile +++ b/include/Makefile @@ -196,6 +196,8 @@ copies: mtree_setup .for i in ${SHDRS} ${LN} -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i .endfor + cpdup -o ${.CURDIR}/../crypto/libressl/include/openssl \ + ${DESTDIR}/usr/include/openssl .for i in ${RMHEADERS} rm -f ${DESTDIR}/usr/include/$i .endfor @@ -219,6 +221,9 @@ symlinks: mtree_setup ${DESTDIR}/usr/include/machine cpdup -o ${.CURDIR}/../sys/platform/${MACHINE_PLATFORM}/include \ ${DESTDIR}/usr/include/machine + rm -rf ${DESTDIR}/usr/include/openssl + ${LN} -s ${.CURDIR}/../crypto/libressl/include/openssl \ + ${DESTDIR}/usr/include/openssl .include diff --git a/lib/Makefile b/lib/Makefile index fa3715c1fc..170a950ed0 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -12,7 +12,7 @@ # libpam must be built before pam_module # # libmd must be built before libfetch, libarchive. -# libcrypt must be built before libfetch and libradius. +# libcrypt must be built before libfetch, libarchive, and libradius. # libz must be built before libarchive, libmagic. # libbz2 must be built before libarchive # libncurses must be built before libedit. @@ -23,8 +23,18 @@ # # Otherwise, the SUBDIR list should be in alphabetical order. -SUBDIR_ORDERED= ${_libc_r} \ +SUBDIR_ORDERED= ${_libc_r} + +.if defined(FORCE_OPENSSL) # to be removed during 4.8 development +SUBDIR_ORDERED+=libcrypto libssl +.endif +.if !defined(NO_LIBRESSL) +SUBDIR_ORDERED+=librecrypto libressl libssh +.endif + +SUBDIR_ORDERED+= \ libcrypt \ + libarchive \ libz \ libmd \ libncurses \ @@ -35,7 +45,6 @@ SUBDIR_ORDERED= ${_libc_r} \ libutil \ libpthread \ liblzma \ - libarchive \ libfetch \ libedit \ libcam \ @@ -43,7 +52,9 @@ SUBDIR_ORDERED= ${_libc_r} \ libusb \ libelf \ libexecinfo + SUBDIR= ${SUBDIR_ORDERED} \ + libcipher \ csu \ i18n_module \ libalias \ diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile index ae20f8ddc0..8a146d4b40 100644 --- a/lib/libarchive/Makefile +++ b/lib/libarchive/Makefile @@ -13,8 +13,9 @@ CFLAGS+= -I${.OBJDIR} -I${.CURDIR} -I${CONTRIBDIR} SHARED_CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 WARNS?= 2 -DPADD= ${LIBBZ2} ${LIBLZMA} ${LIBMD} ${LIBZ} -LDADD= -lbz2 -llzma -lmd -lz +DPADD= ${LIBBZ2} ${LIBLZMA} ${LIBMD} ${LIBCRYPTO} ${LIBZ} +LDADD= -lbz2 -llzma -lmd -lprivate_crypto -lz +LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv INCS= archive.h archive_entry.h diff --git a/secure/lib/libcipher/Makefile b/lib/libcipher/Makefile similarity index 100% rename from secure/lib/libcipher/Makefile rename to lib/libcipher/Makefile diff --git a/secure/lib/libcipher/README b/lib/libcipher/README similarity index 100% rename from secure/lib/libcipher/README rename to lib/libcipher/README diff --git a/secure/lib/libcipher/README.FreeBSD b/lib/libcipher/README.FreeBSD similarity index 100% rename from secure/lib/libcipher/README.FreeBSD rename to lib/libcipher/README.FreeBSD diff --git a/secure/lib/libcipher/cipher.3 b/lib/libcipher/cipher.3 similarity index 100% rename from secure/lib/libcipher/cipher.3 rename to lib/libcipher/cipher.3 diff --git a/secure/lib/libcipher/crypt.c b/lib/libcipher/crypt.c similarity index 100% rename from secure/lib/libcipher/crypt.c rename to lib/libcipher/crypt.c diff --git a/secure/lib/libcipher/test/Makefile b/lib/libcipher/test/Makefile similarity index 100% rename from secure/lib/libcipher/test/Makefile rename to lib/libcipher/test/Makefile diff --git a/secure/lib/libcipher/test/README b/lib/libcipher/test/README similarity index 100% rename from secure/lib/libcipher/test/README rename to lib/libcipher/test/README diff --git a/secure/lib/libcipher/test/cert.c b/lib/libcipher/test/cert.c similarity index 100% rename from secure/lib/libcipher/test/cert.c rename to lib/libcipher/test/cert.c diff --git a/secure/lib/libcipher/test/cert.input b/lib/libcipher/test/cert.input similarity index 100% rename from secure/lib/libcipher/test/cert.input rename to lib/libcipher/test/cert.input diff --git a/secure/lib/libcipher/test/speedcrypt.c b/lib/libcipher/test/speedcrypt.c similarity index 100% rename from secure/lib/libcipher/test/speedcrypt.c rename to lib/libcipher/test/speedcrypt.c diff --git a/secure/lib/libcipher/test/speeddes.c b/lib/libcipher/test/speeddes.c similarity index 100% rename from secure/lib/libcipher/test/speeddes.c rename to lib/libcipher/test/speeddes.c diff --git a/lib/libcrypt/Makefile b/lib/libcrypt/Makefile index 584c4ade86..cf6147aa21 100644 --- a/lib/libcrypt/Makefile +++ b/lib/libcrypt/Makefile @@ -11,13 +11,14 @@ SHLIBDIR?= /lib SRCS= crypt.c crypt-md5.c \ crypt-sha256.c crypt-sha512.c \ deprecated-crypt-sha256.c deprecated-crypt-sha512.c \ - md5c.c sha256c.c sha512c.c misc.c + md5c.c misc.c WARNS?= 2 NO_STRICT_ALIASING= MAN= crypt.3 MLINKS= crypt.3 crypt_get_format.3 crypt.3 crypt_set_format.3 CFLAGS+= -I${.CURDIR}/../libmd -I${.CURDIR}/../libutil +CFLAGS+= -I${.CURDIR}/../../crypto/libressl/include CFLAGS+= -D_CTYPE_H_DISABLE_MACROS_ # Pull in the crypt-des.c source, assuming it is present. .if exists(${.CURDIR}/../../secure/lib/libcrypt/crypt-des.c) && \ @@ -30,10 +31,7 @@ CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH .PATH: ${.CURDIR}/../libutil SRCS+= auth.c property.c .for sym in MD5Init MD5Final MD5Update MD5Pad auth_getval \ - property_find properties_read properties_free \ - SHA256_Init SHA256_Update SHA256_Final SHA256_Transform \ - SHA384_Init SHA384_Update SHA384_Final SHA384_Transform \ - SHA512_Init SHA512_Update SHA512_Final SHA512_Transform + property_find properties_read properties_free CFLAGS+= -D${sym}=_libcrypt_${sym} .endfor PRECIOUSLIB= yes diff --git a/secure/lib/libcrypt/blowfish.c b/lib/libcrypt/blowfish.c similarity index 100% rename from secure/lib/libcrypt/blowfish.c rename to lib/libcrypt/blowfish.c diff --git a/secure/lib/libcrypt/blowfish.h b/lib/libcrypt/blowfish.h similarity index 100% rename from secure/lib/libcrypt/blowfish.h rename to lib/libcrypt/blowfish.h diff --git a/secure/lib/libcrypt/crypt-blowfish.c b/lib/libcrypt/crypt-blowfish.c similarity index 100% rename from secure/lib/libcrypt/crypt-blowfish.c rename to lib/libcrypt/crypt-blowfish.c diff --git a/secure/lib/libcrypt/crypt-des.c b/lib/libcrypt/crypt-des.c similarity index 100% rename from secure/lib/libcrypt/crypt-des.c rename to lib/libcrypt/crypt-des.c diff --git a/lib/libcrypt/crypt-sha256.c b/lib/libcrypt/crypt-sha256.c index 9af9980b4d..1f7f7e3b8e 100644 --- a/lib/libcrypt/crypt-sha256.c +++ b/lib/libcrypt/crypt-sha256.c @@ -13,17 +13,7 @@ #include #include - -/* Structure to save state of computation between the single steps. */ -struct sha256_ctx -{ - uint32_t H[8]; - - uint32_t total[2]; - uint32_t buflen; - char buffer[128]; /* NB: always correctly aligned for uint32_t. */ -}; - +#include "local.h" #if __BYTE_ORDER == __LITTLE_ENDIAN # define SWAP(n) \ @@ -62,8 +52,8 @@ static const uint32_t K[64] = /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 64 == 0. */ -static void -sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx) +void +__crypt__sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx) { const uint32_t *words = buffer; size_t nwords = len / sizeof (uint32_t); @@ -162,8 +152,8 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx) /* Initialize structure containing state of computation. (FIPS 180-2:5.3.2) */ -static void -sha256_init_ctx (struct sha256_ctx *ctx) +void +__crypt__sha256_init_ctx (struct sha256_ctx *ctx) { ctx->H[0] = 0x6a09e667; ctx->H[1] = 0xbb67ae85; @@ -184,8 +174,8 @@ sha256_init_ctx (struct sha256_ctx *ctx) IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ -static void * -sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf) +void * +__crypt__sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ uint32_t bytes = ctx->buflen; @@ -205,7 +195,7 @@ sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf) (ctx->total[0] >> 29)); /* Process last bytes. */ - sha256_process_block (ctx->buffer, bytes + pad + 8, ctx); + __crypt__sha256_process_block (ctx->buffer, bytes + pad + 8, ctx); /* Put result from CTX in first 32 bytes following RESBUF. */ for (unsigned int i = 0; i < 8; ++i) @@ -214,9 +204,8 @@ sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf) return resbuf; } - -static void -sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) +void +__crypt__sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) { /* When we already have some bits in our internal buffer concatenate both inputs first. */ @@ -230,7 +219,7 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) if (ctx->buflen > 64) { - sha256_process_block (ctx->buffer, ctx->buflen & ~63, ctx); + __crypt__sha256_process_block (ctx->buffer, ctx->buflen & ~63, ctx); ctx->buflen &= 63; /* The regions in the following copy operation cannot overlap. */ @@ -255,13 +244,13 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) if (UNALIGNED_P (buffer)) while (len > 64) { - sha256_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); + __crypt__sha256_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); buffer = (const char *) buffer + 64; len -= 64; } else { - sha256_process_block (buffer, len & ~63, ctx); + __crypt__sha256_process_block (buffer, len & ~63, ctx); buffer = (const char *) buffer + (len & ~63); len &= 63; } @@ -276,7 +265,7 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) left_over += len; if (left_over >= 64) { - sha256_process_block (ctx->buffer, 64, ctx); + __crypt__sha256_process_block (ctx->buffer, 64, ctx); left_over -= 64; memcpy (ctx->buffer, &ctx->buffer[64], left_over); } @@ -369,59 +358,59 @@ crypt_sha256_r (const char *key, const char *salt, char *buffer, int buflen) } /* Prepare for the real work. */ - sha256_init_ctx (&ctx); + __crypt__sha256_init_ctx (&ctx); /* Add the key string. */ - sha256_process_bytes (key, key_len, &ctx); + __crypt__sha256_process_bytes (key, key_len, &ctx); /* The last part is the salt string. This must be at most 16 characters and it ends at the first `$' character (for compatibility with existing implementations). */ - sha256_process_bytes (salt, salt_len, &ctx); + __crypt__sha256_process_bytes (salt, salt_len, &ctx); /* Compute alternate SHA256 sum with input KEY, SALT, and KEY. The final result will be added to the first context. */ - sha256_init_ctx (&alt_ctx); + __crypt__sha256_init_ctx (&alt_ctx); /* Add key. */ - sha256_process_bytes (key, key_len, &alt_ctx); + __crypt__sha256_process_bytes (key, key_len, &alt_ctx); /* Add salt. */ - sha256_process_bytes (salt, salt_len, &alt_ctx); + __crypt__sha256_process_bytes (salt, salt_len, &alt_ctx); /* Add key again. */ - sha256_process_bytes (key, key_len, &alt_ctx); + __crypt__sha256_process_bytes (key, key_len, &alt_ctx); /* Now get result of this (32 bytes) and add it to the other context. */ - sha256_finish_ctx (&alt_ctx, alt_result); + __crypt__sha256_finish_ctx (&alt_ctx, alt_result); /* Add for any character in the key one byte of the alternate sum. */ for (cnt = key_len; cnt > 32; cnt -= 32) - sha256_process_bytes (alt_result, 32, &ctx); - sha256_process_bytes (alt_result, cnt, &ctx); + __crypt__sha256_process_bytes (alt_result, 32, &ctx); + __crypt__sha256_process_bytes (alt_result, cnt, &ctx); /* Take the binary representation of the length of the key and for every 1 add the alternate sum, for every 0 the key. */ for (cnt = key_len; cnt > 0; cnt >>= 1) if ((cnt & 1) != 0) - sha256_process_bytes (alt_result, 32, &ctx); + __crypt__sha256_process_bytes (alt_result, 32, &ctx); else - sha256_process_bytes (key, key_len, &ctx); + __crypt__sha256_process_bytes (key, key_len, &ctx); /* Create intermediate result. */ - sha256_finish_ctx (&ctx, alt_result); + __crypt__sha256_finish_ctx (&ctx, alt_result); /* Start computation of P byte sequence. */ - sha256_init_ctx (&alt_ctx); + __crypt__sha256_init_ctx (&alt_ctx); /* For every character in the password add the entire password. */ for (cnt = 0; cnt < key_len; ++cnt) - sha256_process_bytes (key, key_len, &alt_ctx); + __crypt__sha256_process_bytes (key, key_len, &alt_ctx); /* Finish the digest. */ - sha256_finish_ctx (&alt_ctx, temp_result); + __crypt__sha256_finish_ctx (&alt_ctx, temp_result); /* Create byte sequence P. */ cp = p_bytes = alloca (key_len); @@ -430,14 +419,14 @@ crypt_sha256_r (const char *key, const char *salt, char *buffer, int buflen) memcpy (cp, temp_result, cnt); /* Start computation of S byte sequence. */ - sha256_init_ctx (&alt_ctx); + __crypt__sha256_init_ctx (&alt_ctx); /* For every character in the password add the entire password. */ for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt) - sha256_process_bytes (salt, salt_len, &alt_ctx); + __crypt__sha256_process_bytes (salt, salt_len, &alt_ctx); /* Finish the digest. */ - sha256_finish_ctx (&alt_ctx, temp_result); + __crypt__sha256_finish_ctx (&alt_ctx, temp_result); /* Create byte sequence S. */ cp = s_bytes = alloca (salt_len); @@ -450,30 +439,30 @@ crypt_sha256_r (const char *key, const char *salt, char *buffer, int buflen) for (cnt = 0; cnt < rounds; ++cnt) { /* New context. */ - sha256_init_ctx (&ctx); + __crypt__sha256_init_ctx (&ctx); /* Add key or last result. */ if ((cnt & 1) != 0) - sha256_process_bytes (p_bytes, key_len, &ctx); + __crypt__sha256_process_bytes (p_bytes, key_len, &ctx); else - sha256_process_bytes (alt_result, 32, &ctx); + __crypt__sha256_process_bytes (alt_result, 32, &ctx); /* Add salt for numbers not divisible by 3. */ if (cnt % 3 != 0) - sha256_process_bytes (s_bytes, salt_len, &ctx); + __crypt__sha256_process_bytes (s_bytes, salt_len, &ctx); /* Add key for numbers not divisible by 7. */ if (cnt % 7 != 0) - sha256_process_bytes (p_bytes, key_len, &ctx); + __crypt__sha256_process_bytes (p_bytes, key_len, &ctx); /* Add key or last result. */ if ((cnt & 1) != 0) - sha256_process_bytes (alt_result, 32, &ctx); + __crypt__sha256_process_bytes (alt_result, 32, &ctx); else - sha256_process_bytes (p_bytes, key_len, &ctx); + __crypt__sha256_process_bytes (p_bytes, key_len, &ctx); /* Create intermediate result. */ - sha256_finish_ctx (&ctx, alt_result); + __crypt__sha256_finish_ctx (&ctx, alt_result); } /* Now we can construct the result string. It consists of three @@ -533,8 +522,8 @@ crypt_sha256_r (const char *key, const char *salt, char *buffer, int buflen) attaching to processes or reading core dumps cannot get any information. We do it in this way to clear correct_words[] inside the SHA256 implementation as well. */ - sha256_init_ctx (&ctx); - sha256_finish_ctx (&ctx, alt_result); + __crypt__sha256_init_ctx (&ctx); + __crypt__sha256_finish_ctx (&ctx, alt_result); memset (temp_result, '\0', sizeof (temp_result)); memset (p_bytes, '\0', key_len); memset (s_bytes, '\0', salt_len); @@ -663,19 +652,19 @@ main (void) for (cnt = 0; cnt < (int) ntests; ++cnt) { - sha256_init_ctx (&ctx); - sha256_process_bytes (tests[cnt].input, strlen (tests[cnt].input), &ctx); - sha256_finish_ctx (&ctx, sum); + __crypt__sha256_init_ctx (&ctx); + __crypt__sha256_process_bytes (tests[cnt].input, strlen (tests[cnt].input), &ctx); + __crypt__sha256_finish_ctx (&ctx, sum); if (memcmp (tests[cnt].result, sum, 32) != 0) { printf ("test %d run %d failed\n", cnt, 1); result = 1; } - sha256_init_ctx (&ctx); + __crypt__sha256_init_ctx (&ctx); for (int i = 0; tests[cnt].input[i] != '\0'; ++i) - sha256_process_bytes (&tests[cnt].input[i], 1, &ctx); - sha256_finish_ctx (&ctx, sum); + __crypt__sha256_process_bytes (&tests[cnt].input[i], 1, &ctx); + __crypt__sha256_finish_ctx (&ctx, sum); if (memcmp (tests[cnt].result, sum, 32) != 0) { printf ("test %d run %d failed\n", cnt, 2); @@ -686,10 +675,10 @@ main (void) /* Test vector from FIPS 180-2: appendix B.3. */ char buf[1000]; memset (buf, 'a', sizeof (buf)); - sha256_init_ctx (&ctx); + __crypt__sha256_init_ctx (&ctx); for (int i = 0; i < 1000; ++i) - sha256_process_bytes (buf, sizeof (buf), &ctx); - sha256_finish_ctx (&ctx, sum); + __crypt__sha256_process_bytes (buf, sizeof (buf), &ctx); + __crypt__sha256_finish_ctx (&ctx, sum); static const char expected[32] = "\xcd\xc7\x6e\x5c\x99\x14\xfb\x92\x81\xa1\xc7\xe2\x84\xd7\x3e\x67" "\xf1\x80\x9a\x48\xa4\x97\x20\x0e\x04\x6d\x39\xcc\xc7\x11\x2c\xd0"; diff --git a/lib/libcrypt/crypt-sha512.c b/lib/libcrypt/crypt-sha512.c index 0773c37101..c11fc804c8 100644 --- a/lib/libcrypt/crypt-sha512.c +++ b/lib/libcrypt/crypt-sha512.c @@ -13,17 +13,7 @@ #include #include - -/* Structure to save state of computation between the single steps. */ -struct sha512_ctx -{ - uint64_t H[8]; - - uint64_t total[2]; - uint64_t buflen; - char buffer[256]; /* NB: always correctly aligned for uint64_t. */ -}; - +#include "local.h" #if __BYTE_ORDER == __LITTLE_ENDIAN # define SWAP(n) \ @@ -93,8 +83,8 @@ static const uint64_t K[80] = /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 128 == 0. */ -static void -sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx) +void +__crypt__sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx) { const uint64_t *words = buffer; size_t nwords = len / sizeof (uint64_t); @@ -193,8 +183,8 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx) /* Initialize structure containing state of computation. (FIPS 180-2:5.3.3) */ -static void -sha512_init_ctx (struct sha512_ctx *ctx) +void +__crypt__sha512_init_ctx (struct sha512_ctx *ctx) { ctx->H[0] = UINT64_C (0x6a09e667f3bcc908); ctx->H[1] = UINT64_C (0xbb67ae8584caa73b); @@ -215,8 +205,8 @@ sha512_init_ctx (struct sha512_ctx *ctx) IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ -static void * -sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf) +void * +__crypt__sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ uint64_t bytes = ctx->buflen; @@ -236,7 +226,7 @@ sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf) (ctx->total[0] >> 61)); /* Process last bytes. */ - sha512_process_block (ctx->buffer, bytes + pad + 16, ctx); + __crypt__sha512_process_block (ctx->buffer, bytes + pad + 16, ctx); /* Put result from CTX in first 64 bytes following RESBUF. */ for (unsigned int i = 0; i < 8; ++i) @@ -246,8 +236,8 @@ sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf) } -static void -sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) +void +__crypt__sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) { /* When we already have some bits in our internal buffer concatenate both inputs first. */ @@ -261,7 +251,7 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) if (ctx->buflen > 128) { - sha512_process_block (ctx->buffer, ctx->buflen & ~127, ctx); + __crypt__sha512_process_block (ctx->buffer, ctx->buflen & ~127, ctx); ctx->buflen &= 127; /* The regions in the following copy operation cannot overlap. */ @@ -287,7 +277,7 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) if (UNALIGNED_P (buffer)) while (len > 128) { - sha512_process_block (memcpy (ctx->buffer, buffer, 128), 128, + __crypt__sha512_process_block (memcpy (ctx->buffer, buffer, 128), 128, ctx); buffer = (const char *) buffer + 128; len -= 128; @@ -295,7 +285,7 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) else #endif { - sha512_process_block (buffer, len & ~127, ctx); + __crypt__sha512_process_block (buffer, len & ~127, ctx); buffer = (const char *) buffer + (len & ~127); len &= 127; } @@ -310,7 +300,7 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) left_over += len; if (left_over >= 128) { - sha512_process_block (ctx->buffer, 128, ctx); + __crypt__sha512_process_block (ctx->buffer, 128, ctx); left_over -= 128; memcpy (ctx->buffer, &ctx->buffer[128], left_over); } @@ -403,59 +393,59 @@ crypt_sha512_r (const char *key, const char *salt, char *buffer, int buflen) } /* Prepare for the real work. */ - sha512_init_ctx (&ctx); + __crypt__sha512_init_ctx (&ctx); /* Add the key string. */ - sha512_process_bytes (key, key_len, &ctx); + __crypt__sha512_process_bytes (key, key_len, &ctx); /* The last part is the salt string. This must be at most 16 characters and it ends at the first `$' character (for compatibility with existing implementations). */ - sha512_process_bytes (salt, salt_len, &ctx); + __crypt__sha512_process_bytes (salt, salt_len, &ctx); /* Compute alternate SHA512 sum with input KEY, SALT, and KEY. The final result will be added to the first context. */ - sha512_init_ctx (&alt_ctx); + __crypt__sha512_init_ctx (&alt_ctx); /* Add key. */ - sha512_process_bytes (key, key_len, &alt_ctx); + __crypt__sha512_process_bytes (key, key_len, &alt_ctx); /* Add salt. */ - sha512_process_bytes (salt, salt_len, &alt_ctx); + __crypt__sha512_process_bytes (salt, salt_len, &alt_ctx); /* Add key again. */ - sha512_process_bytes (key, key_len, &alt_ctx); + __crypt__sha512_process_bytes (key, key_len, &alt_ctx); /* Now get result of this (64 bytes) and add it to the other context. */ - sha512_finish_ctx (&alt_ctx, alt_result); + __crypt__sha512_finish_ctx (&alt_ctx, alt_result); /* Add for any character in the key one byte of the alternate sum. */ for (cnt = key_len; cnt > 64; cnt -= 64) - sha512_process_bytes (alt_result, 64, &ctx); - sha512_process_bytes (alt_result, cnt, &ctx); + __crypt__sha512_process_bytes (alt_result, 64, &ctx); + __crypt__sha512_process_bytes (alt_result, cnt, &ctx); /* Take the binary representation of the length of the key and for every 1 add the alternate sum, for every 0 the key. */ for (cnt = key_len; cnt > 0; cnt >>= 1) if ((cnt & 1) != 0) - sha512_process_bytes (alt_result, 64, &ctx); + __crypt__sha512_process_bytes (alt_result, 64, &ctx); else - sha512_process_bytes (key, key_len, &ctx); + __crypt__sha512_process_bytes (key, key_len, &ctx); /* Create intermediate result. */ - sha512_finish_ctx (&ctx, alt_result); + __crypt__sha512_finish_ctx (&ctx, alt_result); /* Start computation of P byte sequence. */ - sha512_init_ctx (&alt_ctx); + __crypt__sha512_init_ctx (&alt_ctx); /* For every character in the password add the entire password. */ for (cnt = 0; cnt < key_len; ++cnt) - sha512_process_bytes (key, key_len, &alt_ctx); + __crypt__sha512_process_bytes (key, key_len, &alt_ctx); /* Finish the digest. */ - sha512_finish_ctx (&alt_ctx, temp_result); + __crypt__sha512_finish_ctx (&alt_ctx, temp_result); /* Create byte sequence P. */ cp = p_bytes = alloca (key_len); @@ -464,14 +454,14 @@ crypt_sha512_r (const char *key, const char *salt, char *buffer, int buflen) memcpy (cp, temp_result, cnt); /* Start computation of S byte sequence. */ - sha512_init_ctx (&alt_ctx); + __crypt__sha512_init_ctx (&alt_ctx); /* For every character in the password add the entire password. */ for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt) - sha512_process_bytes (salt, salt_len, &alt_ctx); + __crypt__sha512_process_bytes (salt, salt_len, &alt_ctx); /* Finish the digest. */ - sha512_finish_ctx (&alt_ctx, temp_result); + __crypt__sha512_finish_ctx (&alt_ctx, temp_result); /* Create byte sequence S. */ cp = s_bytes = alloca (salt_len); @@ -484,30 +474,30 @@ crypt_sha512_r (const char *key, const char *salt, char *buffer, int buflen) for (cnt = 0; cnt < rounds; ++cnt) { /* New context. */ - sha512_init_ctx (&ctx); + __crypt__sha512_init_ctx (&ctx); /* Add key or last result. */ if ((cnt & 1) != 0) - sha512_process_bytes (p_bytes, key_len, &ctx); + __crypt__sha512_process_bytes (p_bytes, key_len, &ctx); else - sha512_process_bytes (alt_result, 64, &ctx); + __crypt__sha512_process_bytes (alt_result, 64, &ctx); /* Add salt for numbers not divisible by 3. */ if (cnt % 3 != 0) - sha512_process_bytes (s_bytes, salt_len, &ctx); + __crypt__sha512_process_bytes (s_bytes, salt_len, &ctx); /* Add key for numbers not divisible by 7. */ if (cnt % 7 != 0) - sha512_process_bytes (p_bytes, key_len, &ctx); + __crypt__sha512_process_bytes (p_bytes, key_len, &ctx); /* Add key or last result. */ if ((cnt & 1) != 0) - sha512_process_bytes (alt_result, 64, &ctx); + __crypt__sha512_process_bytes (alt_result, 64, &ctx); else - sha512_process_bytes (p_bytes, key_len, &ctx); + __crypt__sha512_process_bytes (p_bytes, key_len, &ctx); /* Create intermediate result. */ - sha512_finish_ctx (&ctx, alt_result); + __crypt__sha512_finish_ctx (&ctx, alt_result); } /* Now we can construct the result string. It consists of three @@ -579,8 +569,8 @@ crypt_sha512_r (const char *key, const char *salt, char *buffer, int buflen) attaching to processes or reading core dumps cannot get any information. We do it in this way to clear correct_words[] inside the SHA512 implementation as well. */ - sha512_init_ctx (&ctx); - sha512_finish_ctx (&ctx, alt_result); + __crypt__sha512_init_ctx (&ctx); + __crypt__sha512_finish_ctx (&ctx, alt_result); memset (temp_result, '\0', sizeof (temp_result)); memset (p_bytes, '\0', key_len); memset (s_bytes, '\0', salt_len); @@ -730,19 +720,19 @@ main (void) for (cnt = 0; cnt < (int) ntests; ++cnt) { - sha512_init_ctx (&ctx); - sha512_process_bytes (tests[cnt].input, strlen (tests[cnt].input), &ctx); - sha512_finish_ctx (&ctx, sum); + __crypt__sha512_init_ctx (&ctx); + __crypt__sha512_process_bytes (tests[cnt].input, strlen (tests[cnt].input), &ctx); + __crypt__sha512_finish_ctx (&ctx, sum); if (memcmp (tests[cnt].result, sum, 64) != 0) { printf ("test %d run %d failed\n", cnt, 1); result = 1; } - sha512_init_ctx (&ctx); + __crypt__sha512_init_ctx (&ctx); for (int i = 0; tests[cnt].input[i] != '\0'; ++i) - sha512_process_bytes (&tests[cnt].input[i], 1, &ctx); - sha512_finish_ctx (&ctx, sum); + __crypt__sha512_process_bytes (&tests[cnt].input[i], 1, &ctx); + __crypt__sha512_finish_ctx (&ctx, sum); if (memcmp (tests[cnt].result, sum, 64) != 0) { printf ("test %d run %d failed\n", cnt, 2); @@ -753,10 +743,10 @@ main (void) /* Test vector from FIPS 180-2: appendix C.3. */ char buf[1000]; memset (buf, 'a', sizeof (buf)); - sha512_init_ctx (&ctx); + __crypt__sha512_init_ctx (&ctx); for (int i = 0; i < 1000; ++i) - sha512_process_bytes (buf, sizeof (buf), &ctx); - sha512_finish_ctx (&ctx, sum); + __crypt__sha512_process_bytes (buf, sizeof (buf), &ctx); + __crypt__sha512_finish_ctx (&ctx, sum); static const char expected[64] = "\xe7\x18\x48\x3d\x0c\xe7\x69\x64\x4e\x2e\x42\xc7\xbc\x15\xb4\x63" "\x8e\x1f\x98\xb1\x3b\x20\x44\x28\x56\x32\xa8\x03\xaf\xa9\x73\xeb" diff --git a/lib/libcrypt/deprecated-crypt-sha256.c b/lib/libcrypt/deprecated-crypt-sha256.c index c8d2afaae9..dc4b2d6911 100644 --- a/lib/libcrypt/deprecated-crypt-sha256.c +++ b/lib/libcrypt/deprecated-crypt-sha256.c @@ -35,8 +35,9 @@ #include #include -#include + #include "crypt.h" +#include "local.h" /* * New password crypt. @@ -62,7 +63,7 @@ crypt_deprecated_sha256(const char *pw, const char *salt) static const char *sp, *ep; unsigned char final[SHA256_SIZE]; int sl; - SHA256_CTX ctx; + struct sha256_ctx ctx; unsigned long l; /* Refine the salt. */ @@ -79,23 +80,23 @@ crypt_deprecated_sha256(const char *pw, const char *salt) /* Get the actual salt length. */ sl = ep - sp; - SHA256_Init(&ctx); + __crypt__sha256_init_ctx(&ctx); /* Hash in the password first. */ - SHA256_Update(&ctx, pw, strlen(pw)); + __crypt__sha256_process_bytes(pw, strlen(pw), &ctx); /* * Then the magic string * * XXX: sizeof instead of strlen, must retain */ - SHA256_Update(&ctx, magic, sizeof(magic)); + __crypt__sha256_process_bytes(magic, sizeof(magic), &ctx); /* Then the raw salt. */ - SHA256_Update(&ctx, sp, sl); + __crypt__sha256_process_bytes(sp, sl, &ctx); /* Finish and create the output string. */ - SHA256_Final(final, &ctx); + __crypt__sha256_finish_ctx(&ctx, final); strcpy(passwd, magic); strncat(passwd, sp, sl); strcat(passwd, "$"); diff --git a/lib/libcrypt/deprecated-crypt-sha512.c b/lib/libcrypt/deprecated-crypt-sha512.c index b31da5e698..f710eeec3b 100644 --- a/lib/libcrypt/deprecated-crypt-sha512.c +++ b/lib/libcrypt/deprecated-crypt-sha512.c @@ -35,8 +35,9 @@ #include #include -#include + #include "crypt.h" +#include "local.h" /* * New password crypt. @@ -62,7 +63,7 @@ crypt_deprecated_sha512(const char *pw, const char *salt) static const char *sp, *ep; unsigned char final[SHA512_SIZE]; int sl, i; - SHA512_CTX ctx; + struct sha512_ctx ctx; unsigned long l; /* Refine the salt. */ @@ -79,23 +80,23 @@ crypt_deprecated_sha512(const char *pw, const char *salt) /* Get the actual salt length. */ sl = ep - sp; - SHA512_Init(&ctx); + __crypt__sha512_init_ctx(&ctx); /* Hash in the password first. */ - SHA512_Update(&ctx, pw, strlen(pw)); + __crypt__sha512_process_bytes(pw, strlen(pw), &ctx); /* * Then the magic string * * XXX: sizeof instead of strlen, must retain */ - SHA512_Update(&ctx, magic, sizeof(magic)); + __crypt__sha512_process_bytes(magic, sizeof(magic), &ctx); /* Then the raw salt. */ - SHA512_Update(&ctx, sp, sl); + __crypt__sha512_process_bytes(sp, sl, &ctx); /* Finish and create the output string. */ - SHA512_Final(final, &ctx); + __crypt__sha512_finish_ctx(&ctx, final); strcpy(passwd, magic); strncat(passwd, sp, sl); strcat(passwd, "$"); diff --git a/lib/libcrypt/local.h b/lib/libcrypt/local.h new file mode 100644 index 0000000000..58b469ceba --- /dev/null +++ b/lib/libcrypt/local.h @@ -0,0 +1,37 @@ +/* + * + */ + +struct sha256_ctx +{ + uint32_t H[8]; + + uint32_t total[2]; + uint32_t buflen; + char buffer[128]; /* NB: always correctly aligned for uint32_t. */ +}; + +struct sha512_ctx +{ + uint64_t H[8]; + + uint64_t total[2]; + uint64_t buflen; + char buffer[256]; /* NB: always correctly aligned for uint64_t. */ +}; + +void __crypt__sha256_process_block (const void *buffer, size_t len, + struct sha256_ctx *ctx); +void __crypt__sha256_init_ctx (struct sha256_ctx *ctx); +void *__crypt__sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf); +void __crypt__sha256_process_bytes (const void *buffer, size_t len, + struct sha256_ctx *ctx); + +void __crypt__sha512_process_block (const void *buffer, size_t len, + struct sha512_ctx *ctx); +void __crypt__sha512_init_ctx (struct sha512_ctx *ctx); +void *__crypt__sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf); +void __crypt__sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx); +void __crypt__sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx); +void __crypt__sha512_init_ctx (struct sha512_ctx *ctx); + diff --git a/secure/lib/libcrypto/Makefile b/lib/libcrypto/Makefile similarity index 100% rename from secure/lib/libcrypto/Makefile rename to lib/libcrypto/Makefile diff --git a/secure/lib/libcrypto/Makefile.inc b/lib/libcrypto/Makefile.inc similarity index 96% rename from secure/lib/libcrypto/Makefile.inc rename to lib/libcrypto/Makefile.inc index d62527d5a5..a38e9ff371 100644 --- a/secure/lib/libcrypto/Makefile.inc +++ b/lib/libcrypto/Makefile.inc @@ -1,6 +1,6 @@ OSSLVERSION= 1.0.2h OSSLDATE= 2016-05-03 -LCRYPTO_SRC= ${.CURDIR}/../../../crypto/openssl +LCRYPTO_SRC= ${.CURDIR}/../../crypto/openssl LCRYPTO_DOC= ${LCRYPTO_SRC}/doc CFLAGS+= -DOPENSSL_THREADS diff --git a/secure/lib/libcrypto/Makefile.man b/lib/libcrypto/Makefile.man similarity index 100% rename from secure/lib/libcrypto/Makefile.man rename to lib/libcrypto/Makefile.man diff --git a/secure/lib/libcrypto/asm/Makefile b/lib/libcrypto/asm/Makefile similarity index 97% rename from secure/lib/libcrypto/asm/Makefile rename to lib/libcrypto/asm/Makefile index a2cf18537c..d29ca82bbe 100644 --- a/secure/lib/libcrypto/asm/Makefile +++ b/lib/libcrypto/asm/Makefile @@ -1,7 +1,7 @@ # This file automatically generates the asm .s files after importing a new # version of OpenSSL. -OPENSSL_SRC= ../../../../crypto/openssl +OPENSSL_SRC= ../../../crypto/openssl .PATH: ${OPENSSL_SRC}/crypto \ ${OPENSSL_SRC}/crypto/aes/asm \ diff --git a/secure/lib/libcrypto/asm/aes-x86_64.s b/lib/libcrypto/asm/aes-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/aes-x86_64.s rename to lib/libcrypto/asm/aes-x86_64.s diff --git a/secure/lib/libcrypto/asm/aesni-gcm-x86_64.s b/lib/libcrypto/asm/aesni-gcm-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/aesni-gcm-x86_64.s rename to lib/libcrypto/asm/aesni-gcm-x86_64.s diff --git a/secure/lib/libcrypto/asm/aesni-mb-x86_64.s b/lib/libcrypto/asm/aesni-mb-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/aesni-mb-x86_64.s rename to lib/libcrypto/asm/aesni-mb-x86_64.s diff --git a/secure/lib/libcrypto/asm/aesni-sha1-x86_64.s b/lib/libcrypto/asm/aesni-sha1-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/aesni-sha1-x86_64.s rename to lib/libcrypto/asm/aesni-sha1-x86_64.s diff --git a/secure/lib/libcrypto/asm/aesni-sha256-x86_64.s b/lib/libcrypto/asm/aesni-sha256-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/aesni-sha256-x86_64.s rename to lib/libcrypto/asm/aesni-sha256-x86_64.s diff --git a/secure/lib/libcrypto/asm/aesni-x86_64.s b/lib/libcrypto/asm/aesni-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/aesni-x86_64.s rename to lib/libcrypto/asm/aesni-x86_64.s diff --git a/secure/lib/libcrypto/asm/bsaes-x86_64.s b/lib/libcrypto/asm/bsaes-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/bsaes-x86_64.s rename to lib/libcrypto/asm/bsaes-x86_64.s diff --git a/secure/lib/libcrypto/asm/cmll-x86_64.s b/lib/libcrypto/asm/cmll-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/cmll-x86_64.s rename to lib/libcrypto/asm/cmll-x86_64.s diff --git a/secure/lib/libcrypto/asm/ecp_nistz256-x86_64.s b/lib/libcrypto/asm/ecp_nistz256-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/ecp_nistz256-x86_64.s rename to lib/libcrypto/asm/ecp_nistz256-x86_64.s diff --git a/secure/lib/libcrypto/asm/ghash-x86_64.s b/lib/libcrypto/asm/ghash-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/ghash-x86_64.s rename to lib/libcrypto/asm/ghash-x86_64.s diff --git a/secure/lib/libcrypto/asm/md5-x86_64.s b/lib/libcrypto/asm/md5-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/md5-x86_64.s rename to lib/libcrypto/asm/md5-x86_64.s diff --git a/secure/lib/libcrypto/asm/rc4-md5-x86_64.s b/lib/libcrypto/asm/rc4-md5-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/rc4-md5-x86_64.s rename to lib/libcrypto/asm/rc4-md5-x86_64.s diff --git a/secure/lib/libcrypto/asm/rc4-x86_64.s b/lib/libcrypto/asm/rc4-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/rc4-x86_64.s rename to lib/libcrypto/asm/rc4-x86_64.s diff --git a/secure/lib/libcrypto/asm/rsaz-avx2.s b/lib/libcrypto/asm/rsaz-avx2.s similarity index 100% rename from secure/lib/libcrypto/asm/rsaz-avx2.s rename to lib/libcrypto/asm/rsaz-avx2.s diff --git a/secure/lib/libcrypto/asm/rsaz-x86_64.s b/lib/libcrypto/asm/rsaz-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/rsaz-x86_64.s rename to lib/libcrypto/asm/rsaz-x86_64.s diff --git a/secure/lib/libcrypto/asm/sha1-mb-x86_64.s b/lib/libcrypto/asm/sha1-mb-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/sha1-mb-x86_64.s rename to lib/libcrypto/asm/sha1-mb-x86_64.s diff --git a/secure/lib/libcrypto/asm/sha1-x86_64.s b/lib/libcrypto/asm/sha1-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/sha1-x86_64.s rename to lib/libcrypto/asm/sha1-x86_64.s diff --git a/secure/lib/libcrypto/asm/sha256-mb-x86_64.s b/lib/libcrypto/asm/sha256-mb-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/sha256-mb-x86_64.s rename to lib/libcrypto/asm/sha256-mb-x86_64.s diff --git a/secure/lib/libcrypto/asm/sha256-x86_64.s b/lib/libcrypto/asm/sha256-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/sha256-x86_64.s rename to lib/libcrypto/asm/sha256-x86_64.s diff --git a/secure/lib/libcrypto/asm/sha512-x86_64.s b/lib/libcrypto/asm/sha512-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/sha512-x86_64.s rename to lib/libcrypto/asm/sha512-x86_64.s diff --git a/secure/lib/libcrypto/asm/vpaes-x86_64.s b/lib/libcrypto/asm/vpaes-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/vpaes-x86_64.s rename to lib/libcrypto/asm/vpaes-x86_64.s diff --git a/secure/lib/libcrypto/asm/wp-x86_64.s b/lib/libcrypto/asm/wp-x86_64.s similarity index 100% rename from secure/lib/libcrypto/asm/wp-x86_64.s rename to lib/libcrypto/asm/wp-x86_64.s diff --git a/secure/lib/libcrypto/asm/x86_64-gf2m.s b/lib/libcrypto/asm/x86_64-gf2m.s similarity index 100% rename from secure/lib/libcrypto/asm/x86_64-gf2m.s rename to lib/libcrypto/asm/x86_64-gf2m.s diff --git a/secure/lib/libcrypto/asm/x86_64-mont.s b/lib/libcrypto/asm/x86_64-mont.s similarity index 100% rename from secure/lib/libcrypto/asm/x86_64-mont.s rename to lib/libcrypto/asm/x86_64-mont.s diff --git a/secure/lib/libcrypto/asm/x86_64-mont5.s b/lib/libcrypto/asm/x86_64-mont5.s similarity index 100% rename from secure/lib/libcrypto/asm/x86_64-mont5.s rename to lib/libcrypto/asm/x86_64-mont5.s diff --git a/secure/lib/libcrypto/asm/x86_64cpuid.s b/lib/libcrypto/asm/x86_64cpuid.s similarity index 100% rename from secure/lib/libcrypto/asm/x86_64cpuid.s rename to lib/libcrypto/asm/x86_64cpuid.s diff --git a/secure/lib/libcrypto/engines/Makefile b/lib/libcrypto/engines/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/Makefile rename to lib/libcrypto/engines/Makefile diff --git a/secure/lib/libcrypto/engines/Makefile.inc b/lib/libcrypto/engines/Makefile.inc similarity index 52% rename from secure/lib/libcrypto/engines/Makefile.inc rename to lib/libcrypto/engines/Makefile.inc index cae56ecd68..41aec4400a 100644 --- a/secure/lib/libcrypto/engines/Makefile.inc +++ b/lib/libcrypto/engines/Makefile.inc @@ -1,4 +1,4 @@ -LCRYPTO_SRC= ${.CURDIR}/../../../../../crypto/openssl +LCRYPTO_SRC= ${.CURDIR}/../../../../crypto/openssl SHLIBDIR?= /usr/lib/engines .PATH: ${LCRYPTO_SRC}/engines diff --git a/secure/lib/libcrypto/engines/lib4758cca/Makefile b/lib/libcrypto/engines/lib4758cca/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/lib4758cca/Makefile rename to lib/libcrypto/engines/lib4758cca/Makefile diff --git a/secure/lib/libcrypto/engines/libaep/Makefile b/lib/libcrypto/engines/libaep/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libaep/Makefile rename to lib/libcrypto/engines/libaep/Makefile diff --git a/secure/lib/libcrypto/engines/libatalla/Makefile b/lib/libcrypto/engines/libatalla/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libatalla/Makefile rename to lib/libcrypto/engines/libatalla/Makefile diff --git a/secure/lib/libcrypto/engines/libcapi/Makefile b/lib/libcrypto/engines/libcapi/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libcapi/Makefile rename to lib/libcrypto/engines/libcapi/Makefile diff --git a/secure/lib/libcrypto/engines/libchil/Makefile b/lib/libcrypto/engines/libchil/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libchil/Makefile rename to lib/libcrypto/engines/libchil/Makefile diff --git a/secure/lib/libcrypto/engines/libcswift/Makefile b/lib/libcrypto/engines/libcswift/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libcswift/Makefile rename to lib/libcrypto/engines/libcswift/Makefile diff --git a/secure/lib/libcrypto/engines/libgmp/Makefile b/lib/libcrypto/engines/libgmp/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libgmp/Makefile rename to lib/libcrypto/engines/libgmp/Makefile diff --git a/secure/lib/libcrypto/engines/libgost/Makefile b/lib/libcrypto/engines/libgost/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libgost/Makefile rename to lib/libcrypto/engines/libgost/Makefile diff --git a/secure/lib/libcrypto/engines/libnuron/Makefile b/lib/libcrypto/engines/libnuron/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libnuron/Makefile rename to lib/libcrypto/engines/libnuron/Makefile diff --git a/secure/lib/libcrypto/engines/libpadlock/Makefile b/lib/libcrypto/engines/libpadlock/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libpadlock/Makefile rename to lib/libcrypto/engines/libpadlock/Makefile diff --git a/secure/lib/libcrypto/engines/libsureware/Makefile b/lib/libcrypto/engines/libsureware/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libsureware/Makefile rename to lib/libcrypto/engines/libsureware/Makefile diff --git a/secure/lib/libcrypto/engines/libubsec/Makefile b/lib/libcrypto/engines/libubsec/Makefile similarity index 100% rename from secure/lib/libcrypto/engines/libubsec/Makefile rename to lib/libcrypto/engines/libubsec/Makefile diff --git a/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 b/lib/libcrypto/man/ASN1_OBJECT_new.3 similarity index 100% rename from secure/lib/libcrypto/man/ASN1_OBJECT_new.3 rename to lib/libcrypto/man/ASN1_OBJECT_new.3 diff --git a/secure/lib/libcrypto/man/ASN1_STRING_length.3 b/lib/libcrypto/man/ASN1_STRING_length.3 similarity index 100% rename from secure/lib/libcrypto/man/ASN1_STRING_length.3 rename to lib/libcrypto/man/ASN1_STRING_length.3 diff --git a/secure/lib/libcrypto/man/ASN1_STRING_new.3 b/lib/libcrypto/man/ASN1_STRING_new.3 similarity index 100% rename from secure/lib/libcrypto/man/ASN1_STRING_new.3 rename to lib/libcrypto/man/ASN1_STRING_new.3 diff --git a/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 b/lib/libcrypto/man/ASN1_STRING_print_ex.3 similarity index 100% rename from secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 rename to lib/libcrypto/man/ASN1_STRING_print_ex.3 diff --git a/secure/lib/libcrypto/man/ASN1_TIME_set.3 b/lib/libcrypto/man/ASN1_TIME_set.3 similarity index 100% rename from secure/lib/libcrypto/man/ASN1_TIME_set.3 rename to lib/libcrypto/man/ASN1_TIME_set.3 diff --git a/secure/lib/libcrypto/man/ASN1_generate_nconf.3 b/lib/libcrypto/man/ASN1_generate_nconf.3 similarity index 100% rename from secure/lib/libcrypto/man/ASN1_generate_nconf.3 rename to lib/libcrypto/man/ASN1_generate_nconf.3 diff --git a/secure/lib/libcrypto/man/BIO_ctrl.3 b/lib/libcrypto/man/BIO_ctrl.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_ctrl.3 rename to lib/libcrypto/man/BIO_ctrl.3 diff --git a/secure/lib/libcrypto/man/BIO_f_base64.3 b/lib/libcrypto/man/BIO_f_base64.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_f_base64.3 rename to lib/libcrypto/man/BIO_f_base64.3 diff --git a/secure/lib/libcrypto/man/BIO_f_buffer.3 b/lib/libcrypto/man/BIO_f_buffer.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_f_buffer.3 rename to lib/libcrypto/man/BIO_f_buffer.3 diff --git a/secure/lib/libcrypto/man/BIO_f_cipher.3 b/lib/libcrypto/man/BIO_f_cipher.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_f_cipher.3 rename to lib/libcrypto/man/BIO_f_cipher.3 diff --git a/secure/lib/libcrypto/man/BIO_f_md.3 b/lib/libcrypto/man/BIO_f_md.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_f_md.3 rename to lib/libcrypto/man/BIO_f_md.3 diff --git a/secure/lib/libcrypto/man/BIO_f_null.3 b/lib/libcrypto/man/BIO_f_null.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_f_null.3 rename to lib/libcrypto/man/BIO_f_null.3 diff --git a/secure/lib/libcrypto/man/BIO_f_ssl.3 b/lib/libcrypto/man/BIO_f_ssl.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_f_ssl.3 rename to lib/libcrypto/man/BIO_f_ssl.3 diff --git a/secure/lib/libcrypto/man/BIO_find_type.3 b/lib/libcrypto/man/BIO_find_type.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_find_type.3 rename to lib/libcrypto/man/BIO_find_type.3 diff --git a/secure/lib/libcrypto/man/BIO_new.3 b/lib/libcrypto/man/BIO_new.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_new.3 rename to lib/libcrypto/man/BIO_new.3 diff --git a/secure/lib/libcrypto/man/BIO_new_CMS.3 b/lib/libcrypto/man/BIO_new_CMS.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_new_CMS.3 rename to lib/libcrypto/man/BIO_new_CMS.3 diff --git a/secure/lib/libcrypto/man/BIO_push.3 b/lib/libcrypto/man/BIO_push.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_push.3 rename to lib/libcrypto/man/BIO_push.3 diff --git a/secure/lib/libcrypto/man/BIO_read.3 b/lib/libcrypto/man/BIO_read.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_read.3 rename to lib/libcrypto/man/BIO_read.3 diff --git a/secure/lib/libcrypto/man/BIO_s_accept.3 b/lib/libcrypto/man/BIO_s_accept.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_s_accept.3 rename to lib/libcrypto/man/BIO_s_accept.3 diff --git a/secure/lib/libcrypto/man/BIO_s_bio.3 b/lib/libcrypto/man/BIO_s_bio.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_s_bio.3 rename to lib/libcrypto/man/BIO_s_bio.3 diff --git a/secure/lib/libcrypto/man/BIO_s_connect.3 b/lib/libcrypto/man/BIO_s_connect.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_s_connect.3 rename to lib/libcrypto/man/BIO_s_connect.3 diff --git a/secure/lib/libcrypto/man/BIO_s_fd.3 b/lib/libcrypto/man/BIO_s_fd.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_s_fd.3 rename to lib/libcrypto/man/BIO_s_fd.3 diff --git a/secure/lib/libcrypto/man/BIO_s_file.3 b/lib/libcrypto/man/BIO_s_file.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_s_file.3 rename to lib/libcrypto/man/BIO_s_file.3 diff --git a/secure/lib/libcrypto/man/BIO_s_mem.3 b/lib/libcrypto/man/BIO_s_mem.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_s_mem.3 rename to lib/libcrypto/man/BIO_s_mem.3 diff --git a/secure/lib/libcrypto/man/BIO_s_null.3 b/lib/libcrypto/man/BIO_s_null.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_s_null.3 rename to lib/libcrypto/man/BIO_s_null.3 diff --git a/secure/lib/libcrypto/man/BIO_s_socket.3 b/lib/libcrypto/man/BIO_s_socket.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_s_socket.3 rename to lib/libcrypto/man/BIO_s_socket.3 diff --git a/secure/lib/libcrypto/man/BIO_set_callback.3 b/lib/libcrypto/man/BIO_set_callback.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_set_callback.3 rename to lib/libcrypto/man/BIO_set_callback.3 diff --git a/secure/lib/libcrypto/man/BIO_should_retry.3 b/lib/libcrypto/man/BIO_should_retry.3 similarity index 100% rename from secure/lib/libcrypto/man/BIO_should_retry.3 rename to lib/libcrypto/man/BIO_should_retry.3 diff --git a/secure/lib/libcrypto/man/BN_BLINDING_new.3 b/lib/libcrypto/man/BN_BLINDING_new.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_BLINDING_new.3 rename to lib/libcrypto/man/BN_BLINDING_new.3 diff --git a/secure/lib/libcrypto/man/BN_CTX_new.3 b/lib/libcrypto/man/BN_CTX_new.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_CTX_new.3 rename to lib/libcrypto/man/BN_CTX_new.3 diff --git a/secure/lib/libcrypto/man/BN_CTX_start.3 b/lib/libcrypto/man/BN_CTX_start.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_CTX_start.3 rename to lib/libcrypto/man/BN_CTX_start.3 diff --git a/secure/lib/libcrypto/man/BN_add.3 b/lib/libcrypto/man/BN_add.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_add.3 rename to lib/libcrypto/man/BN_add.3 diff --git a/secure/lib/libcrypto/man/BN_add_word.3 b/lib/libcrypto/man/BN_add_word.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_add_word.3 rename to lib/libcrypto/man/BN_add_word.3 diff --git a/secure/lib/libcrypto/man/BN_bn2bin.3 b/lib/libcrypto/man/BN_bn2bin.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_bn2bin.3 rename to lib/libcrypto/man/BN_bn2bin.3 diff --git a/secure/lib/libcrypto/man/BN_cmp.3 b/lib/libcrypto/man/BN_cmp.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_cmp.3 rename to lib/libcrypto/man/BN_cmp.3 diff --git a/secure/lib/libcrypto/man/BN_copy.3 b/lib/libcrypto/man/BN_copy.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_copy.3 rename to lib/libcrypto/man/BN_copy.3 diff --git a/secure/lib/libcrypto/man/BN_generate_prime.3 b/lib/libcrypto/man/BN_generate_prime.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_generate_prime.3 rename to lib/libcrypto/man/BN_generate_prime.3 diff --git a/secure/lib/libcrypto/man/BN_mod_inverse.3 b/lib/libcrypto/man/BN_mod_inverse.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_mod_inverse.3 rename to lib/libcrypto/man/BN_mod_inverse.3 diff --git a/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 b/lib/libcrypto/man/BN_mod_mul_montgomery.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 rename to lib/libcrypto/man/BN_mod_mul_montgomery.3 diff --git a/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 b/lib/libcrypto/man/BN_mod_mul_reciprocal.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 rename to lib/libcrypto/man/BN_mod_mul_reciprocal.3 diff --git a/secure/lib/libcrypto/man/BN_new.3 b/lib/libcrypto/man/BN_new.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_new.3 rename to lib/libcrypto/man/BN_new.3 diff --git a/secure/lib/libcrypto/man/BN_num_bytes.3 b/lib/libcrypto/man/BN_num_bytes.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_num_bytes.3 rename to lib/libcrypto/man/BN_num_bytes.3 diff --git a/secure/lib/libcrypto/man/BN_rand.3 b/lib/libcrypto/man/BN_rand.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_rand.3 rename to lib/libcrypto/man/BN_rand.3 diff --git a/secure/lib/libcrypto/man/BN_set_bit.3 b/lib/libcrypto/man/BN_set_bit.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_set_bit.3 rename to lib/libcrypto/man/BN_set_bit.3 diff --git a/secure/lib/libcrypto/man/BN_swap.3 b/lib/libcrypto/man/BN_swap.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_swap.3 rename to lib/libcrypto/man/BN_swap.3 diff --git a/secure/lib/libcrypto/man/BN_zero.3 b/lib/libcrypto/man/BN_zero.3 similarity index 100% rename from secure/lib/libcrypto/man/BN_zero.3 rename to lib/libcrypto/man/BN_zero.3 diff --git a/secure/lib/libcrypto/man/CMS_add0_cert.3 b/lib/libcrypto/man/CMS_add0_cert.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_add0_cert.3 rename to lib/libcrypto/man/CMS_add0_cert.3 diff --git a/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 b/lib/libcrypto/man/CMS_add1_recipient_cert.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 rename to lib/libcrypto/man/CMS_add1_recipient_cert.3 diff --git a/secure/lib/libcrypto/man/CMS_add1_signer.3 b/lib/libcrypto/man/CMS_add1_signer.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_add1_signer.3 rename to lib/libcrypto/man/CMS_add1_signer.3 diff --git a/secure/lib/libcrypto/man/CMS_compress.3 b/lib/libcrypto/man/CMS_compress.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_compress.3 rename to lib/libcrypto/man/CMS_compress.3 diff --git a/secure/lib/libcrypto/man/CMS_decrypt.3 b/lib/libcrypto/man/CMS_decrypt.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_decrypt.3 rename to lib/libcrypto/man/CMS_decrypt.3 diff --git a/secure/lib/libcrypto/man/CMS_encrypt.3 b/lib/libcrypto/man/CMS_encrypt.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_encrypt.3 rename to lib/libcrypto/man/CMS_encrypt.3 diff --git a/secure/lib/libcrypto/man/CMS_final.3 b/lib/libcrypto/man/CMS_final.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_final.3 rename to lib/libcrypto/man/CMS_final.3 diff --git a/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 b/lib/libcrypto/man/CMS_get0_RecipientInfos.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 rename to lib/libcrypto/man/CMS_get0_RecipientInfos.3 diff --git a/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 b/lib/libcrypto/man/CMS_get0_SignerInfos.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 rename to lib/libcrypto/man/CMS_get0_SignerInfos.3 diff --git a/secure/lib/libcrypto/man/CMS_get0_type.3 b/lib/libcrypto/man/CMS_get0_type.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_get0_type.3 rename to lib/libcrypto/man/CMS_get0_type.3 diff --git a/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 b/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 rename to lib/libcrypto/man/CMS_get1_ReceiptRequest.3 diff --git a/secure/lib/libcrypto/man/CMS_sign.3 b/lib/libcrypto/man/CMS_sign.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_sign.3 rename to lib/libcrypto/man/CMS_sign.3 diff --git a/secure/lib/libcrypto/man/CMS_sign_receipt.3 b/lib/libcrypto/man/CMS_sign_receipt.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_sign_receipt.3 rename to lib/libcrypto/man/CMS_sign_receipt.3 diff --git a/secure/lib/libcrypto/man/CMS_uncompress.3 b/lib/libcrypto/man/CMS_uncompress.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_uncompress.3 rename to lib/libcrypto/man/CMS_uncompress.3 diff --git a/secure/lib/libcrypto/man/CMS_verify.3 b/lib/libcrypto/man/CMS_verify.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_verify.3 rename to lib/libcrypto/man/CMS_verify.3 diff --git a/secure/lib/libcrypto/man/CMS_verify_receipt.3 b/lib/libcrypto/man/CMS_verify_receipt.3 similarity index 100% rename from secure/lib/libcrypto/man/CMS_verify_receipt.3 rename to lib/libcrypto/man/CMS_verify_receipt.3 diff --git a/secure/lib/libcrypto/man/CONF_modules_free.3 b/lib/libcrypto/man/CONF_modules_free.3 similarity index 100% rename from secure/lib/libcrypto/man/CONF_modules_free.3 rename to lib/libcrypto/man/CONF_modules_free.3 diff --git a/secure/lib/libcrypto/man/CONF_modules_load_file.3 b/lib/libcrypto/man/CONF_modules_load_file.3 similarity index 100% rename from secure/lib/libcrypto/man/CONF_modules_load_file.3 rename to lib/libcrypto/man/CONF_modules_load_file.3 diff --git a/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 b/lib/libcrypto/man/CRYPTO_set_ex_data.3 similarity index 100% rename from secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 rename to lib/libcrypto/man/CRYPTO_set_ex_data.3 diff --git a/secure/lib/libcrypto/man/DH_generate_key.3 b/lib/libcrypto/man/DH_generate_key.3 similarity index 100% rename from secure/lib/libcrypto/man/DH_generate_key.3 rename to lib/libcrypto/man/DH_generate_key.3 diff --git a/secure/lib/libcrypto/man/DH_generate_parameters.3 b/lib/libcrypto/man/DH_generate_parameters.3 similarity index 100% rename from secure/lib/libcrypto/man/DH_generate_parameters.3 rename to lib/libcrypto/man/DH_generate_parameters.3 diff --git a/secure/lib/libcrypto/man/DH_get_ex_new_index.3 b/lib/libcrypto/man/DH_get_ex_new_index.3 similarity index 100% rename from secure/lib/libcrypto/man/DH_get_ex_new_index.3 rename to lib/libcrypto/man/DH_get_ex_new_index.3 diff --git a/secure/lib/libcrypto/man/DH_new.3 b/lib/libcrypto/man/DH_new.3 similarity index 100% rename from secure/lib/libcrypto/man/DH_new.3 rename to lib/libcrypto/man/DH_new.3 diff --git a/secure/lib/libcrypto/man/DH_set_method.3 b/lib/libcrypto/man/DH_set_method.3 similarity index 100% rename from secure/lib/libcrypto/man/DH_set_method.3 rename to lib/libcrypto/man/DH_set_method.3 diff --git a/secure/lib/libcrypto/man/DH_size.3 b/lib/libcrypto/man/DH_size.3 similarity index 100% rename from secure/lib/libcrypto/man/DH_size.3 rename to lib/libcrypto/man/DH_size.3 diff --git a/secure/lib/libcrypto/man/DSA_SIG_new.3 b/lib/libcrypto/man/DSA_SIG_new.3 similarity index 100% rename from secure/lib/libcrypto/man/DSA_SIG_new.3 rename to lib/libcrypto/man/DSA_SIG_new.3 diff --git a/secure/lib/libcrypto/man/DSA_do_sign.3 b/lib/libcrypto/man/DSA_do_sign.3 similarity index 100% rename from secure/lib/libcrypto/man/DSA_do_sign.3 rename to lib/libcrypto/man/DSA_do_sign.3 diff --git a/secure/lib/libcrypto/man/DSA_dup_DH.3 b/lib/libcrypto/man/DSA_dup_DH.3 similarity index 100% rename from secure/lib/libcrypto/man/DSA_dup_DH.3 rename to lib/libcrypto/man/DSA_dup_DH.3 diff --git a/secure/lib/libcrypto/man/DSA_generate_key.3 b/lib/libcrypto/man/DSA_generate_key.3 similarity index 100% rename from secure/lib/libcrypto/man/DSA_generate_key.3 rename to lib/libcrypto/man/DSA_generate_key.3 diff --git a/secure/lib/libcrypto/man/DSA_generate_parameters.3 b/lib/libcrypto/man/DSA_generate_parameters.3 similarity index 100% rename from secure/lib/libcrypto/man/DSA_generate_parameters.3 rename to lib/libcrypto/man/DSA_generate_parameters.3 diff --git a/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 b/lib/libcrypto/man/DSA_get_ex_new_index.3 similarity index 100% rename from secure/lib/libcrypto/man/DSA_get_ex_new_index.3 rename to lib/libcrypto/man/DSA_get_ex_new_index.3 diff --git a/secure/lib/libcrypto/man/DSA_new.3 b/lib/libcrypto/man/DSA_new.3 similarity index 100% rename from secure/lib/libcrypto/man/DSA_new.3 rename to lib/libcrypto/man/DSA_new.3 diff --git a/secure/lib/libcrypto/man/DSA_set_method.3 b/lib/libcrypto/man/DSA_set_method.3 similarity index 100% rename from secure/lib/libcrypto/man/DSA_set_method.3 rename to lib/libcrypto/man/DSA_set_method.3 diff --git a/secure/lib/libcrypto/man/DSA_sign.3 b/lib/libcrypto/man/DSA_sign.3 similarity index 100% rename from secure/lib/libcrypto/man/DSA_sign.3 rename to lib/libcrypto/man/DSA_sign.3 diff --git a/secure/lib/libcrypto/man/DSA_size.3 b/lib/libcrypto/man/DSA_size.3 similarity index 100% rename from secure/lib/libcrypto/man/DSA_size.3 rename to lib/libcrypto/man/DSA_size.3 diff --git a/secure/lib/libcrypto/man/EC_GFp_simple_method.3 b/lib/libcrypto/man/EC_GFp_simple_method.3 similarity index 100% rename from secure/lib/libcrypto/man/EC_GFp_simple_method.3 rename to lib/libcrypto/man/EC_GFp_simple_method.3 diff --git a/secure/lib/libcrypto/man/EC_GROUP_copy.3 b/lib/libcrypto/man/EC_GROUP_copy.3 similarity index 100% rename from secure/lib/libcrypto/man/EC_GROUP_copy.3 rename to lib/libcrypto/man/EC_GROUP_copy.3 diff --git a/secure/lib/libcrypto/man/EC_GROUP_new.3 b/lib/libcrypto/man/EC_GROUP_new.3 similarity index 100% rename from secure/lib/libcrypto/man/EC_GROUP_new.3 rename to lib/libcrypto/man/EC_GROUP_new.3 diff --git a/secure/lib/libcrypto/man/EC_KEY_new.3 b/lib/libcrypto/man/EC_KEY_new.3 similarity index 100% rename from secure/lib/libcrypto/man/EC_KEY_new.3 rename to lib/libcrypto/man/EC_KEY_new.3 diff --git a/secure/lib/libcrypto/man/EC_POINT_add.3 b/lib/libcrypto/man/EC_POINT_add.3 similarity index 100% rename from secure/lib/libcrypto/man/EC_POINT_add.3 rename to lib/libcrypto/man/EC_POINT_add.3 diff --git a/secure/lib/libcrypto/man/EC_POINT_new.3 b/lib/libcrypto/man/EC_POINT_new.3 similarity index 100% rename from secure/lib/libcrypto/man/EC_POINT_new.3 rename to lib/libcrypto/man/EC_POINT_new.3 diff --git a/secure/lib/libcrypto/man/ERR_GET_LIB.3 b/lib/libcrypto/man/ERR_GET_LIB.3 similarity index 100% rename from secure/lib/libcrypto/man/ERR_GET_LIB.3 rename to lib/libcrypto/man/ERR_GET_LIB.3 diff --git a/secure/lib/libcrypto/man/ERR_clear_error.3 b/lib/libcrypto/man/ERR_clear_error.3 similarity index 100% rename from secure/lib/libcrypto/man/ERR_clear_error.3 rename to lib/libcrypto/man/ERR_clear_error.3 diff --git a/secure/lib/libcrypto/man/ERR_error_string.3 b/lib/libcrypto/man/ERR_error_string.3 similarity index 100% rename from secure/lib/libcrypto/man/ERR_error_string.3 rename to lib/libcrypto/man/ERR_error_string.3 diff --git a/secure/lib/libcrypto/man/ERR_get_error.3 b/lib/libcrypto/man/ERR_get_error.3 similarity index 100% rename from secure/lib/libcrypto/man/ERR_get_error.3 rename to lib/libcrypto/man/ERR_get_error.3 diff --git a/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 b/lib/libcrypto/man/ERR_load_crypto_strings.3 similarity index 100% rename from secure/lib/libcrypto/man/ERR_load_crypto_strings.3 rename to lib/libcrypto/man/ERR_load_crypto_strings.3 diff --git a/secure/lib/libcrypto/man/ERR_load_strings.3 b/lib/libcrypto/man/ERR_load_strings.3 similarity index 100% rename from secure/lib/libcrypto/man/ERR_load_strings.3 rename to lib/libcrypto/man/ERR_load_strings.3 diff --git a/secure/lib/libcrypto/man/ERR_print_errors.3 b/lib/libcrypto/man/ERR_print_errors.3 similarity index 100% rename from secure/lib/libcrypto/man/ERR_print_errors.3 rename to lib/libcrypto/man/ERR_print_errors.3 diff --git a/secure/lib/libcrypto/man/ERR_put_error.3 b/lib/libcrypto/man/ERR_put_error.3 similarity index 100% rename from secure/lib/libcrypto/man/ERR_put_error.3 rename to lib/libcrypto/man/ERR_put_error.3 diff --git a/secure/lib/libcrypto/man/ERR_remove_state.3 b/lib/libcrypto/man/ERR_remove_state.3 similarity index 100% rename from secure/lib/libcrypto/man/ERR_remove_state.3 rename to lib/libcrypto/man/ERR_remove_state.3 diff --git a/secure/lib/libcrypto/man/ERR_set_mark.3 b/lib/libcrypto/man/ERR_set_mark.3 similarity index 100% rename from secure/lib/libcrypto/man/ERR_set_mark.3 rename to lib/libcrypto/man/ERR_set_mark.3 diff --git a/secure/lib/libcrypto/man/EVP_BytesToKey.3 b/lib/libcrypto/man/EVP_BytesToKey.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_BytesToKey.3 rename to lib/libcrypto/man/EVP_BytesToKey.3 diff --git a/secure/lib/libcrypto/man/EVP_DigestInit.3 b/lib/libcrypto/man/EVP_DigestInit.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_DigestInit.3 rename to lib/libcrypto/man/EVP_DigestInit.3 diff --git a/secure/lib/libcrypto/man/EVP_DigestSignInit.3 b/lib/libcrypto/man/EVP_DigestSignInit.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_DigestSignInit.3 rename to lib/libcrypto/man/EVP_DigestSignInit.3 diff --git a/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 b/lib/libcrypto/man/EVP_DigestVerifyInit.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 rename to lib/libcrypto/man/EVP_DigestVerifyInit.3 diff --git a/secure/lib/libcrypto/man/EVP_EncodeInit.3 b/lib/libcrypto/man/EVP_EncodeInit.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_EncodeInit.3 rename to lib/libcrypto/man/EVP_EncodeInit.3 diff --git a/secure/lib/libcrypto/man/EVP_EncryptInit.3 b/lib/libcrypto/man/EVP_EncryptInit.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_EncryptInit.3 rename to lib/libcrypto/man/EVP_EncryptInit.3 diff --git a/secure/lib/libcrypto/man/EVP_OpenInit.3 b/lib/libcrypto/man/EVP_OpenInit.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_OpenInit.3 rename to lib/libcrypto/man/EVP_OpenInit.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 b/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 rename to lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 b/lib/libcrypto/man/EVP_PKEY_CTX_new.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 rename to lib/libcrypto/man/EVP_PKEY_CTX_new.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 b/lib/libcrypto/man/EVP_PKEY_cmp.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_cmp.3 rename to lib/libcrypto/man/EVP_PKEY_cmp.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 b/lib/libcrypto/man/EVP_PKEY_decrypt.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 rename to lib/libcrypto/man/EVP_PKEY_decrypt.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_derive.3 b/lib/libcrypto/man/EVP_PKEY_derive.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_derive.3 rename to lib/libcrypto/man/EVP_PKEY_derive.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 b/lib/libcrypto/man/EVP_PKEY_encrypt.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 rename to lib/libcrypto/man/EVP_PKEY_encrypt.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 b/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 rename to lib/libcrypto/man/EVP_PKEY_get_default_digest.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 b/lib/libcrypto/man/EVP_PKEY_keygen.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_keygen.3 rename to lib/libcrypto/man/EVP_PKEY_keygen.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_new.3 b/lib/libcrypto/man/EVP_PKEY_new.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_new.3 rename to lib/libcrypto/man/EVP_PKEY_new.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 b/lib/libcrypto/man/EVP_PKEY_print_private.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_print_private.3 rename to lib/libcrypto/man/EVP_PKEY_print_private.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 b/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 rename to lib/libcrypto/man/EVP_PKEY_set1_RSA.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_sign.3 b/lib/libcrypto/man/EVP_PKEY_sign.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_sign.3 rename to lib/libcrypto/man/EVP_PKEY_sign.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_verify.3 b/lib/libcrypto/man/EVP_PKEY_verify.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_verify.3 rename to lib/libcrypto/man/EVP_PKEY_verify.3 diff --git a/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 b/lib/libcrypto/man/EVP_PKEY_verify_recover.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 rename to lib/libcrypto/man/EVP_PKEY_verify_recover.3 diff --git a/secure/lib/libcrypto/man/EVP_SealInit.3 b/lib/libcrypto/man/EVP_SealInit.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_SealInit.3 rename to lib/libcrypto/man/EVP_SealInit.3 diff --git a/secure/lib/libcrypto/man/EVP_SignInit.3 b/lib/libcrypto/man/EVP_SignInit.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_SignInit.3 rename to lib/libcrypto/man/EVP_SignInit.3 diff --git a/secure/lib/libcrypto/man/EVP_VerifyInit.3 b/lib/libcrypto/man/EVP_VerifyInit.3 similarity index 100% rename from secure/lib/libcrypto/man/EVP_VerifyInit.3 rename to lib/libcrypto/man/EVP_VerifyInit.3 diff --git a/secure/lib/libcrypto/man/OBJ_nid2obj.3 b/lib/libcrypto/man/OBJ_nid2obj.3 similarity index 100% rename from secure/lib/libcrypto/man/OBJ_nid2obj.3 rename to lib/libcrypto/man/OBJ_nid2obj.3 diff --git a/secure/lib/libcrypto/man/OPENSSL_Applink.3 b/lib/libcrypto/man/OPENSSL_Applink.3 similarity index 100% rename from secure/lib/libcrypto/man/OPENSSL_Applink.3 rename to lib/libcrypto/man/OPENSSL_Applink.3 diff --git a/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 b/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 similarity index 100% rename from secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 rename to lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 diff --git a/secure/lib/libcrypto/man/OPENSSL_config.3 b/lib/libcrypto/man/OPENSSL_config.3 similarity index 100% rename from secure/lib/libcrypto/man/OPENSSL_config.3 rename to lib/libcrypto/man/OPENSSL_config.3 diff --git a/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 b/lib/libcrypto/man/OPENSSL_ia32cap.3 similarity index 100% rename from secure/lib/libcrypto/man/OPENSSL_ia32cap.3 rename to lib/libcrypto/man/OPENSSL_ia32cap.3 diff --git a/secure/lib/libcrypto/man/OPENSSL_instrument_bus.3 b/lib/libcrypto/man/OPENSSL_instrument_bus.3 similarity index 100% rename from secure/lib/libcrypto/man/OPENSSL_instrument_bus.3 rename to lib/libcrypto/man/OPENSSL_instrument_bus.3 diff --git a/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 b/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 similarity index 100% rename from secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 rename to lib/libcrypto/man/OPENSSL_load_builtin_modules.3 diff --git a/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 b/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 similarity index 100% rename from secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 rename to lib/libcrypto/man/OpenSSL_add_all_algorithms.3 diff --git a/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 b/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 similarity index 100% rename from secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 rename to lib/libcrypto/man/PEM_write_bio_CMS_stream.3 diff --git a/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 b/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 similarity index 100% rename from secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 rename to lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 diff --git a/secure/lib/libcrypto/man/PKCS12_create.3 b/lib/libcrypto/man/PKCS12_create.3 similarity index 100% rename from secure/lib/libcrypto/man/PKCS12_create.3 rename to lib/libcrypto/man/PKCS12_create.3 diff --git a/secure/lib/libcrypto/man/PKCS12_parse.3 b/lib/libcrypto/man/PKCS12_parse.3 similarity index 100% rename from secure/lib/libcrypto/man/PKCS12_parse.3 rename to lib/libcrypto/man/PKCS12_parse.3 diff --git a/secure/lib/libcrypto/man/PKCS7_decrypt.3 b/lib/libcrypto/man/PKCS7_decrypt.3 similarity index 100% rename from secure/lib/libcrypto/man/PKCS7_decrypt.3 rename to lib/libcrypto/man/PKCS7_decrypt.3 diff --git a/secure/lib/libcrypto/man/PKCS7_encrypt.3 b/lib/libcrypto/man/PKCS7_encrypt.3 similarity index 100% rename from secure/lib/libcrypto/man/PKCS7_encrypt.3 rename to lib/libcrypto/man/PKCS7_encrypt.3 diff --git a/secure/lib/libcrypto/man/PKCS7_sign.3 b/lib/libcrypto/man/PKCS7_sign.3 similarity index 100% rename from secure/lib/libcrypto/man/PKCS7_sign.3 rename to lib/libcrypto/man/PKCS7_sign.3 diff --git a/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 b/lib/libcrypto/man/PKCS7_sign_add_signer.3 similarity index 100% rename from secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 rename to lib/libcrypto/man/PKCS7_sign_add_signer.3 diff --git a/secure/lib/libcrypto/man/PKCS7_verify.3 b/lib/libcrypto/man/PKCS7_verify.3 similarity index 100% rename from secure/lib/libcrypto/man/PKCS7_verify.3 rename to lib/libcrypto/man/PKCS7_verify.3 diff --git a/secure/lib/libcrypto/man/RAND_add.3 b/lib/libcrypto/man/RAND_add.3 similarity index 100% rename from secure/lib/libcrypto/man/RAND_add.3 rename to lib/libcrypto/man/RAND_add.3 diff --git a/secure/lib/libcrypto/man/RAND_bytes.3 b/lib/libcrypto/man/RAND_bytes.3 similarity index 100% rename from secure/lib/libcrypto/man/RAND_bytes.3 rename to lib/libcrypto/man/RAND_bytes.3 diff --git a/secure/lib/libcrypto/man/RAND_cleanup.3 b/lib/libcrypto/man/RAND_cleanup.3 similarity index 100% rename from secure/lib/libcrypto/man/RAND_cleanup.3 rename to lib/libcrypto/man/RAND_cleanup.3 diff --git a/secure/lib/libcrypto/man/RAND_egd.3 b/lib/libcrypto/man/RAND_egd.3 similarity index 100% rename from secure/lib/libcrypto/man/RAND_egd.3 rename to lib/libcrypto/man/RAND_egd.3 diff --git a/secure/lib/libcrypto/man/RAND_load_file.3 b/lib/libcrypto/man/RAND_load_file.3 similarity index 100% rename from secure/lib/libcrypto/man/RAND_load_file.3 rename to lib/libcrypto/man/RAND_load_file.3 diff --git a/secure/lib/libcrypto/man/RAND_set_rand_method.3 b/lib/libcrypto/man/RAND_set_rand_method.3 similarity index 100% rename from secure/lib/libcrypto/man/RAND_set_rand_method.3 rename to lib/libcrypto/man/RAND_set_rand_method.3 diff --git a/secure/lib/libcrypto/man/RSA_blinding_on.3 b/lib/libcrypto/man/RSA_blinding_on.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_blinding_on.3 rename to lib/libcrypto/man/RSA_blinding_on.3 diff --git a/secure/lib/libcrypto/man/RSA_check_key.3 b/lib/libcrypto/man/RSA_check_key.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_check_key.3 rename to lib/libcrypto/man/RSA_check_key.3 diff --git a/secure/lib/libcrypto/man/RSA_generate_key.3 b/lib/libcrypto/man/RSA_generate_key.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_generate_key.3 rename to lib/libcrypto/man/RSA_generate_key.3 diff --git a/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 b/lib/libcrypto/man/RSA_get_ex_new_index.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_get_ex_new_index.3 rename to lib/libcrypto/man/RSA_get_ex_new_index.3 diff --git a/secure/lib/libcrypto/man/RSA_new.3 b/lib/libcrypto/man/RSA_new.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_new.3 rename to lib/libcrypto/man/RSA_new.3 diff --git a/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 b/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 rename to lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 diff --git a/secure/lib/libcrypto/man/RSA_print.3 b/lib/libcrypto/man/RSA_print.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_print.3 rename to lib/libcrypto/man/RSA_print.3 diff --git a/secure/lib/libcrypto/man/RSA_private_encrypt.3 b/lib/libcrypto/man/RSA_private_encrypt.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_private_encrypt.3 rename to lib/libcrypto/man/RSA_private_encrypt.3 diff --git a/secure/lib/libcrypto/man/RSA_public_encrypt.3 b/lib/libcrypto/man/RSA_public_encrypt.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_public_encrypt.3 rename to lib/libcrypto/man/RSA_public_encrypt.3 diff --git a/secure/lib/libcrypto/man/RSA_set_method.3 b/lib/libcrypto/man/RSA_set_method.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_set_method.3 rename to lib/libcrypto/man/RSA_set_method.3 diff --git a/secure/lib/libcrypto/man/RSA_sign.3 b/lib/libcrypto/man/RSA_sign.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_sign.3 rename to lib/libcrypto/man/RSA_sign.3 diff --git a/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 b/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 rename to lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 diff --git a/secure/lib/libcrypto/man/RSA_size.3 b/lib/libcrypto/man/RSA_size.3 similarity index 100% rename from secure/lib/libcrypto/man/RSA_size.3 rename to lib/libcrypto/man/RSA_size.3 diff --git a/secure/lib/libcrypto/man/SMIME_read_CMS.3 b/lib/libcrypto/man/SMIME_read_CMS.3 similarity index 100% rename from secure/lib/libcrypto/man/SMIME_read_CMS.3 rename to lib/libcrypto/man/SMIME_read_CMS.3 diff --git a/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 b/lib/libcrypto/man/SMIME_read_PKCS7.3 similarity index 100% rename from secure/lib/libcrypto/man/SMIME_read_PKCS7.3 rename to lib/libcrypto/man/SMIME_read_PKCS7.3 diff --git a/secure/lib/libcrypto/man/SMIME_write_CMS.3 b/lib/libcrypto/man/SMIME_write_CMS.3 similarity index 100% rename from secure/lib/libcrypto/man/SMIME_write_CMS.3 rename to lib/libcrypto/man/SMIME_write_CMS.3 diff --git a/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 b/lib/libcrypto/man/SMIME_write_PKCS7.3 similarity index 100% rename from secure/lib/libcrypto/man/SMIME_write_PKCS7.3 rename to lib/libcrypto/man/SMIME_write_PKCS7.3 diff --git a/secure/lib/libcrypto/man/SSLeay_version.3 b/lib/libcrypto/man/SSLeay_version.3 similarity index 100% rename from secure/lib/libcrypto/man/SSLeay_version.3 rename to lib/libcrypto/man/SSLeay_version.3 diff --git a/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 b/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 rename to lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 diff --git a/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 b/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 rename to lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 diff --git a/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 b/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 rename to lib/libcrypto/man/X509_NAME_get_index_by_NID.3 diff --git a/secure/lib/libcrypto/man/X509_NAME_print_ex.3 b/lib/libcrypto/man/X509_NAME_print_ex.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_NAME_print_ex.3 rename to lib/libcrypto/man/X509_NAME_print_ex.3 diff --git a/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 b/lib/libcrypto/man/X509_STORE_CTX_get_error.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 rename to lib/libcrypto/man/X509_STORE_CTX_get_error.3 diff --git a/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 b/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 rename to lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 diff --git a/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 b/lib/libcrypto/man/X509_STORE_CTX_new.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_STORE_CTX_new.3 rename to lib/libcrypto/man/X509_STORE_CTX_new.3 diff --git a/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 b/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 rename to lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 diff --git a/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 b/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 rename to lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 diff --git a/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 b/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 rename to lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 diff --git a/secure/lib/libcrypto/man/X509_check_host.3 b/lib/libcrypto/man/X509_check_host.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_check_host.3 rename to lib/libcrypto/man/X509_check_host.3 diff --git a/secure/lib/libcrypto/man/X509_new.3 b/lib/libcrypto/man/X509_new.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_new.3 rename to lib/libcrypto/man/X509_new.3 diff --git a/secure/lib/libcrypto/man/X509_verify_cert.3 b/lib/libcrypto/man/X509_verify_cert.3 similarity index 100% rename from secure/lib/libcrypto/man/X509_verify_cert.3 rename to lib/libcrypto/man/X509_verify_cert.3 diff --git a/secure/lib/libcrypto/man/bio.3 b/lib/libcrypto/man/bio.3 similarity index 100% rename from secure/lib/libcrypto/man/bio.3 rename to lib/libcrypto/man/bio.3 diff --git a/secure/lib/libcrypto/man/blowfish.3 b/lib/libcrypto/man/blowfish.3 similarity index 100% rename from secure/lib/libcrypto/man/blowfish.3 rename to lib/libcrypto/man/blowfish.3 diff --git a/secure/lib/libcrypto/man/bn.3 b/lib/libcrypto/man/bn.3 similarity index 100% rename from secure/lib/libcrypto/man/bn.3 rename to lib/libcrypto/man/bn.3 diff --git a/secure/lib/libcrypto/man/bn_internal.3 b/lib/libcrypto/man/bn_internal.3 similarity index 100% rename from secure/lib/libcrypto/man/bn_internal.3 rename to lib/libcrypto/man/bn_internal.3 diff --git a/secure/lib/libcrypto/man/buffer.3 b/lib/libcrypto/man/buffer.3 similarity index 100% rename from secure/lib/libcrypto/man/buffer.3 rename to lib/libcrypto/man/buffer.3 diff --git a/secure/lib/libcrypto/man/crypto.3 b/lib/libcrypto/man/crypto.3 similarity index 100% rename from secure/lib/libcrypto/man/crypto.3 rename to lib/libcrypto/man/crypto.3 diff --git a/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 b/lib/libcrypto/man/d2i_ASN1_OBJECT.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 rename to lib/libcrypto/man/d2i_ASN1_OBJECT.3 diff --git a/secure/lib/libcrypto/man/d2i_CMS_ContentInfo.3 b/lib/libcrypto/man/d2i_CMS_ContentInfo.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_CMS_ContentInfo.3 rename to lib/libcrypto/man/d2i_CMS_ContentInfo.3 diff --git a/secure/lib/libcrypto/man/d2i_DHparams.3 b/lib/libcrypto/man/d2i_DHparams.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_DHparams.3 rename to lib/libcrypto/man/d2i_DHparams.3 diff --git a/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 b/lib/libcrypto/man/d2i_DSAPublicKey.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_DSAPublicKey.3 rename to lib/libcrypto/man/d2i_DSAPublicKey.3 diff --git a/secure/lib/libcrypto/man/d2i_ECPKParameters.3 b/lib/libcrypto/man/d2i_ECPKParameters.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_ECPKParameters.3 rename to lib/libcrypto/man/d2i_ECPKParameters.3 diff --git a/secure/lib/libcrypto/man/d2i_ECPrivateKey.3 b/lib/libcrypto/man/d2i_ECPrivateKey.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_ECPrivateKey.3 rename to lib/libcrypto/man/d2i_ECPrivateKey.3 diff --git a/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 b/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 rename to lib/libcrypto/man/d2i_PKCS8PrivateKey.3 diff --git a/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 b/lib/libcrypto/man/d2i_RSAPublicKey.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_RSAPublicKey.3 rename to lib/libcrypto/man/d2i_RSAPublicKey.3 diff --git a/secure/lib/libcrypto/man/d2i_X509.3 b/lib/libcrypto/man/d2i_X509.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_X509.3 rename to lib/libcrypto/man/d2i_X509.3 diff --git a/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 b/lib/libcrypto/man/d2i_X509_ALGOR.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_X509_ALGOR.3 rename to lib/libcrypto/man/d2i_X509_ALGOR.3 diff --git a/secure/lib/libcrypto/man/d2i_X509_CRL.3 b/lib/libcrypto/man/d2i_X509_CRL.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_X509_CRL.3 rename to lib/libcrypto/man/d2i_X509_CRL.3 diff --git a/secure/lib/libcrypto/man/d2i_X509_NAME.3 b/lib/libcrypto/man/d2i_X509_NAME.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_X509_NAME.3 rename to lib/libcrypto/man/d2i_X509_NAME.3 diff --git a/secure/lib/libcrypto/man/d2i_X509_REQ.3 b/lib/libcrypto/man/d2i_X509_REQ.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_X509_REQ.3 rename to lib/libcrypto/man/d2i_X509_REQ.3 diff --git a/secure/lib/libcrypto/man/d2i_X509_SIG.3 b/lib/libcrypto/man/d2i_X509_SIG.3 similarity index 100% rename from secure/lib/libcrypto/man/d2i_X509_SIG.3 rename to lib/libcrypto/man/d2i_X509_SIG.3 diff --git a/secure/lib/libcrypto/man/des.3 b/lib/libcrypto/man/des.3 similarity index 100% rename from secure/lib/libcrypto/man/des.3 rename to lib/libcrypto/man/des.3 diff --git a/secure/lib/libcrypto/man/des_modes.7 b/lib/libcrypto/man/des_modes.7 similarity index 100% rename from secure/lib/libcrypto/man/des_modes.7 rename to lib/libcrypto/man/des_modes.7 diff --git a/secure/lib/libcrypto/man/dh.3 b/lib/libcrypto/man/dh.3 similarity index 100% rename from secure/lib/libcrypto/man/dh.3 rename to lib/libcrypto/man/dh.3 diff --git a/secure/lib/libcrypto/man/dsa.3 b/lib/libcrypto/man/dsa.3 similarity index 100% rename from secure/lib/libcrypto/man/dsa.3 rename to lib/libcrypto/man/dsa.3 diff --git a/secure/lib/libcrypto/man/ec.3 b/lib/libcrypto/man/ec.3 similarity index 100% rename from secure/lib/libcrypto/man/ec.3 rename to lib/libcrypto/man/ec.3 diff --git a/secure/lib/libcrypto/man/ecdsa.3 b/lib/libcrypto/man/ecdsa.3 similarity index 100% rename from secure/lib/libcrypto/man/ecdsa.3 rename to lib/libcrypto/man/ecdsa.3 diff --git a/secure/lib/libcrypto/man/engine.3 b/lib/libcrypto/man/engine.3 similarity index 100% rename from secure/lib/libcrypto/man/engine.3 rename to lib/libcrypto/man/engine.3 diff --git a/secure/lib/libcrypto/man/err.3 b/lib/libcrypto/man/err.3 similarity index 100% rename from secure/lib/libcrypto/man/err.3 rename to lib/libcrypto/man/err.3 diff --git a/secure/lib/libcrypto/man/evp.3 b/lib/libcrypto/man/evp.3 similarity index 100% rename from secure/lib/libcrypto/man/evp.3 rename to lib/libcrypto/man/evp.3 diff --git a/secure/lib/libcrypto/man/hmac.3 b/lib/libcrypto/man/hmac.3 similarity index 100% rename from secure/lib/libcrypto/man/hmac.3 rename to lib/libcrypto/man/hmac.3 diff --git a/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 b/lib/libcrypto/man/i2d_CMS_bio_stream.3 similarity index 100% rename from secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 rename to lib/libcrypto/man/i2d_CMS_bio_stream.3 diff --git a/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 b/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 similarity index 100% rename from secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 rename to lib/libcrypto/man/i2d_PKCS7_bio_stream.3 diff --git a/secure/lib/libcrypto/man/lh_stats.3 b/lib/libcrypto/man/lh_stats.3 similarity index 100% rename from secure/lib/libcrypto/man/lh_stats.3 rename to lib/libcrypto/man/lh_stats.3 diff --git a/secure/lib/libcrypto/man/lhash.3 b/lib/libcrypto/man/lhash.3 similarity index 100% rename from secure/lib/libcrypto/man/lhash.3 rename to lib/libcrypto/man/lhash.3 diff --git a/secure/lib/libcrypto/man/md5.3 b/lib/libcrypto/man/md5.3 similarity index 100% rename from secure/lib/libcrypto/man/md5.3 rename to lib/libcrypto/man/md5.3 diff --git a/secure/lib/libcrypto/man/mdc2.3 b/lib/libcrypto/man/mdc2.3 similarity index 100% rename from secure/lib/libcrypto/man/mdc2.3 rename to lib/libcrypto/man/mdc2.3 diff --git a/secure/lib/libcrypto/man/pem.3 b/lib/libcrypto/man/pem.3 similarity index 100% rename from secure/lib/libcrypto/man/pem.3 rename to lib/libcrypto/man/pem.3 diff --git a/secure/lib/libcrypto/man/rand.3 b/lib/libcrypto/man/rand.3 similarity index 100% rename from secure/lib/libcrypto/man/rand.3 rename to lib/libcrypto/man/rand.3 diff --git a/secure/lib/libcrypto/man/rc4.3 b/lib/libcrypto/man/rc4.3 similarity index 100% rename from secure/lib/libcrypto/man/rc4.3 rename to lib/libcrypto/man/rc4.3 diff --git a/secure/lib/libcrypto/man/ripemd.3 b/lib/libcrypto/man/ripemd.3 similarity index 100% rename from secure/lib/libcrypto/man/ripemd.3 rename to lib/libcrypto/man/ripemd.3 diff --git a/secure/lib/libcrypto/man/rsa.3 b/lib/libcrypto/man/rsa.3 similarity index 100% rename from secure/lib/libcrypto/man/rsa.3 rename to lib/libcrypto/man/rsa.3 diff --git a/secure/lib/libcrypto/man/sha.3 b/lib/libcrypto/man/sha.3 similarity index 100% rename from secure/lib/libcrypto/man/sha.3 rename to lib/libcrypto/man/sha.3 diff --git a/secure/lib/libcrypto/man/threads.3 b/lib/libcrypto/man/threads.3 similarity index 100% rename from secure/lib/libcrypto/man/threads.3 rename to lib/libcrypto/man/threads.3 diff --git a/secure/lib/libcrypto/man/ui.3 b/lib/libcrypto/man/ui.3 similarity index 100% rename from secure/lib/libcrypto/man/ui.3 rename to lib/libcrypto/man/ui.3 diff --git a/secure/lib/libcrypto/man/ui_compat.3 b/lib/libcrypto/man/ui_compat.3 similarity index 100% rename from secure/lib/libcrypto/man/ui_compat.3 rename to lib/libcrypto/man/ui_compat.3 diff --git a/secure/lib/libcrypto/man/x509.3 b/lib/libcrypto/man/x509.3 similarity index 100% rename from secure/lib/libcrypto/man/x509.3 rename to lib/libcrypto/man/x509.3 diff --git a/secure/lib/libcrypto/opensslconf.h b/lib/libcrypto/opensslconf.h similarity index 100% rename from secure/lib/libcrypto/opensslconf.h rename to lib/libcrypto/opensslconf.h diff --git a/lib/libmd/Makefile b/lib/libmd/Makefile index e54ab57d5c..72ad1c8722 100644 --- a/lib/libmd/Makefile +++ b/lib/libmd/Makefile @@ -2,18 +2,20 @@ LIB= md SHLIBDIR?= /lib -SRCS= md2c.c md4c.c md5c.c md2hl.c md4hl.c md5hl.c \ - rmd160c.c rmd160hl.c \ - sha0c.c sha0hl.c sha1c.c sha1hl.c \ - sha256c.c sha256hl.c sha512c.c sha512hl.c -INCS= md2.h md4.h md5.h ripemd.h sha.h sha256.h sha512.h +SRCS= md2c.c md4c.c md5c.c \ + md2hl.c md4hl.c md5hl.c rmd160hl.c \ + sha256hl.c sha512hl.c + +#sha0hl.c sha1hl.c + +INCS= md2.h md4.h md5.h sha.h sha256.h sha512.h ripemd.h WARNS?= 2 NO_STRICT_ALIASING= VERSION_DEF= ${.CURDIR}/../libc/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map -MAN+= md2.3 md4.3 md5.3 ripemd.3 sha.3 sha256.3 sha384.3 sha512.3 +MAN+= md2.3 md4.3 md5.3 sha.3 sha256.3 sha384.3 sha512.3 MLINKS+=md2.3 MD2Init.3 md2.3 MD2Update.3 md2.3 MD2Pad.3 md2.3 MD2Final.3 MLINKS+=md2.3 MD2End.3 md2.3 MD2File.3 md2.3 MD2FileChunk.3 MLINKS+=md2.3 MD2Data.3 @@ -23,32 +25,22 @@ MLINKS+=md4.3 MD4Data.3 MLINKS+=md5.3 MD5Init.3 md5.3 MD5Update.3 md5.3 MD5Pad.3 md5.3 MD5Final.3 MLINKS+=md5.3 MD5End.3 md5.3 MD5File.3 md5.3 MD5FileChunk.3 MLINKS+=md5.3 MD5Data.3 -MLINKS+=ripemd.3 RIPEMD160_Init.3 ripemd.3 RIPEMD160_Update.3 -MLINKS+=ripemd.3 RIPEMD160_Final.3 ripemd.3 RIPEMD160_Data.3 -MLINKS+=ripemd.3 RIPEMD160_End.3 ripemd.3 RIPEMD160_File.3 -MLINKS+=ripemd.3 RIPEMD160_FileChunk.3 -MLINKS+=sha.3 SHA_Init.3 sha.3 SHA_Update.3 sha.3 SHA_Final.3 MLINKS+=sha.3 SHA_End.3 sha.3 SHA_File.3 sha.3 SHA_FileChunk.3 MLINKS+=sha.3 SHA_Data.3 -MLINKS+=sha.3 SHA1_Init.3 sha.3 SHA1_Update.3 sha.3 SHA1_Final.3 MLINKS+=sha.3 SHA1_End.3 sha.3 SHA1_File.3 sha.3 SHA1_FileChunk.3 MLINKS+=sha.3 SHA1_Data.3 -MLINKS+=sha256.3 SHA256_Init.3 sha256.3 SHA256_Update.3 -MLINKS+=sha256.3 SHA256_Final.3 sha256.3 SHA256_End.3 +MLINKS+=sha256.3 SHA256_End.3 MLINKS+=sha256.3 SHA256_File.3 sha256.3 SHA256_FileChunk.3 MLINKS+=sha256.3 SHA256_Data.3 -MLINKS+=sha384.3 SHA384_Init.3 sha384.3 SHA384_Update.3 -MLINKS+=sha384.3 SHA384_Final.3 -MLINKS+=sha512.3 SHA512_Init.3 sha512.3 SHA512_Update.3 -MLINKS+=sha512.3 SHA512_Final.3 sha512.3 SHA512_End.3 -MLINKS+=sha512.3 SHA512_File.3 sha512.3 SHA512_FileChunk.3 +MLINKS+=sha512.3 SHA512_End.3 +MLINKS+=sha512.3 SHA512_File.3 sha512.3 SHA512_FileChunk.3 MLINKS+=sha512.3 SHA512_Data.3 CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \ - rmd160.ref rmd160hl.c rmddriver \ - sha0.ref sha0hl.c sha1.ref sha1hl.c shadriver \ + sha0.ref sha0hl.c rmd160hl.c sha1.ref sha1hl.c shadriver \ sha256.ref sha256hl.c sha512.ref sha512hl.c CFLAGS+= -I${.CURDIR} +CFLAGS+= -I${.CURDIR}/../../crypto/libressl/include md2hl.c: mdXhl.c (echo '#define LENGTH 16'; \ @@ -62,15 +54,21 @@ md5hl.c: mdXhl.c (echo '#define LENGTH 16'; \ sed -e 's/mdX/md5/g' -e 's/MDX/MD5/g' ${.ALLSRC}) > ${.TARGET} -sha0hl.c: mdXhl.c +rmd160hl.c: mdXhl.c (echo '#define LENGTH 20'; \ - sed -e 's/mdX/sha/g' -e 's/MDX/SHA_/g' -e 's/SHA__/SHA_/g' \ - ${.ALLSRC}) > ${.TARGET} + sed -e 's/mdX/ripemd/g' -e 's/MDX/RIPEMD160_/g' \ + -e 's/RIPEMD160__/RIPEMD160_/g' \ + ${.ALLSRC}) > ${.TARGET} -sha1hl.c: mdXhl.c - (echo '#define LENGTH 20'; \ - sed -e 's/mdX/sha/g' -e 's/MDX/SHA1_/g' -e 's/SHA1__/SHA1_/g' \ - ${.ALLSRC}) > ${.TARGET} +#sha0hl.c: mdXhl.c +# (echo '#define LENGTH 20'; \ +# sed -e 's/mdX/sha/g' -e 's/MDX/SHA_/g' -e 's/SHA__/SHA_/g' \ +# ${.ALLSRC}) > ${.TARGET} +# +#sha1hl.c: mdXhl.c +# (echo '#define LENGTH 20'; \ +# sed -e 's/mdX/sha/g' -e 's/MDX/SHA1_/g' -e 's/SHA1__/SHA1_/g' \ +# ${.ALLSRC}) > ${.TARGET} sha256hl.c: mdXhl.c (echo '#define LENGTH 32'; \ @@ -84,13 +82,6 @@ sha512hl.c: mdXhl.c -e 's/SHA512__/SHA512_/g' \ ${.ALLSRC}) > ${.TARGET} - -rmd160hl.c: mdXhl.c - (echo '#define LENGTH 20'; \ - sed -e 's/mdX/ripemd/g' -e 's/MDX/RIPEMD160_/g' \ - -e 's/RIPEMD160__/RIPEMD160_/g' \ - ${.ALLSRC}) > ${.TARGET} - .for i in 2 4 5 md${i}.3: ${.CURDIR}/mdX.3 sed -e "s/mdX/md${i}/g" -e "s/MDX/MD${i}/g" ${.ALLSRC} > ${.TARGET} @@ -171,20 +162,7 @@ sha512.ref: @echo 'SHA-512 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894' >> ${.TARGET} @echo 'SHA-512 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843' >> ${.TARGET} -rmd160.ref: - (echo 'RIPEMD160 test suite:'; \ - echo 'RIPEMD160 ("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31'; \ - echo 'RIPEMD160 ("abc") = 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc'; \ - echo 'RIPEMD160 ("message digest") =' \ - '5d0689ef49d2fae572b881b123a85ffa21595f36'; \ - echo 'RIPEMD160 ("abcdefghijklmnopqrstuvwxyz") =' \ - 'f71c27109c692c1b56bbdceb5b9d2865b3708dbc'; \ - echo 'RIPEMD160 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ - 'b0e20b6e3116640286ed3a87a5713079b21f5189'; \ - echo 'RIPEMD160 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ - '9b752e45573d4b39f4dbd3323cab82bf63326bfb' ) > ${.TARGET} - -test: md2.ref md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha512.ref +test: md2.ref md4.ref md5.ref sha0.ref sha1.ref sha256.ref sha512.ref @${ECHO} if any of these test fail, the code produces wrong results @${ECHO} and should NOT be used. ${CC} ${CFLAGS} ${LDFLAGS} -DMD=2 -o mddriver ${.CURDIR}/mddriver.c -L. -lmd @@ -197,10 +175,6 @@ test: md2.ref md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha512.ref ./mddriver | cmp md5.ref - @${ECHO} MD5 passed test -rm -f mddriver - ${CC} ${CFLAGS} ${LDFLAGS} -o rmddriver ${.CURDIR}/rmddriver.c -L. -lmd - ./rmddriver | cmp rmd160.ref - - @${ECHO} RIPEMD160 passed test - -rm -f rmddriver ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=0 -o shadriver ${.CURDIR}/shadriver.c -L. -lmd ./shadriver | cmp sha0.ref - @${ECHO} SHA-0 passed test diff --git a/lib/libmd/OBSOLETE b/lib/libmd/OBSOLETE new file mode 100644 index 0000000000..3a7d8e5038 --- /dev/null +++ b/lib/libmd/OBSOLETE @@ -0,0 +1,7 @@ + + LIBMD IS OBSOLETE + + LIBMD contains old crypto hash APIs and is considered obsolete, meaning + that it is our desire to vector any remaining code dependencies away + from this library. + diff --git a/lib/libmd/Symbol.map b/lib/libmd/Symbol.map index 2d8f9d7031..21e4ae25d8 100644 --- a/lib/libmd/Symbol.map +++ b/lib/libmd/Symbol.map @@ -27,47 +27,12 @@ DF306.0 { RIPEMD160_End; RIPEMD160_File; RIPEMD160_FileChunk; - RIPEMD160_Final; - RIPEMD160_Init; - RIPEMD160_Transform; - RIPEMD160_Update; - RMD160_version; - SHA1_Data; - SHA1_End; - SHA1_File; - SHA1_FileChunk; - SHA1_Final; - SHA1_Init; - SHA1_Transform; - SHA1_Update; - SHA1_version; SHA256_Data; SHA256_End; SHA256_File; SHA256_FileChunk; - SHA256_Final; - SHA256_Init; - SHA256_Update; - SHA384_Final; - SHA384_Init; - SHA384_Update; SHA512_Data; SHA512_End; SHA512_File; SHA512_FileChunk; - SHA512_Final; - SHA512_Init; - SHA512_Update; - SHA_Data; - SHA_End; - SHA_File; - SHA_FileChunk; - SHA_Final; - SHA_Init; - SHA_Transform; - SHA_Update; - SHA_version; - ripemd160_block; - sha1_block; - sha_block; }; diff --git a/lib/libmd/md4.h b/lib/libmd/md4.h index 04afb3dbef..62b676612d 100644 --- a/lib/libmd/md4.h +++ b/lib/libmd/md4.h @@ -1,49 +1,55 @@ -/* MD4.H - header file for MD4C.C - * $FreeBSD: src/lib/libmd/md4.h,v 1.11 2006/01/17 15:35:56 phk Exp $ - * $DragonFly: src/lib/libmd/md4.h,v 1.3 2008/09/11 20:25:34 swildner Exp $ +/* + * Copyright (c) 2016 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD4 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD4 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. +/* + * libmd shims for openssl + non-conflicting old API functions. */ #ifndef _MD4_H_ #define _MD4_H_ -/* MD4 context. */ -typedef struct MD4Context { - u_int32_t state[4]; /* state (ABCD) */ - u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64]; /* input buffer */ -} MD4_CTX; #include +#include __BEGIN_DECLS -int MD4Init(MD4_CTX *); -void MD4Update(MD4_CTX *, const void *, unsigned int); -void MD4Pad(MD4_CTX *); -void MD4Final(unsigned char [16], MD4_CTX *); -char * MD4End(MD4_CTX *, char *); -char * MD4File(const char *, char *); -char * MD4FileChunk(const char *, char *, off_t, off_t); -char * MD4Data(const void *, unsigned int, char *); +int MD4Init(MD4_CTX *); +void MD4Update(MD4_CTX *, const void *, unsigned int); +void MD4Pad(MD4_CTX *); +void MD4Final(unsigned char [16], MD4_CTX *); +char *MD4End(MD4_CTX *, char *); +char *MD4File(const char *, char *); +char *MD4FileChunk(const char *, char *, off_t, off_t); +char *MD4Data(const void *, unsigned int, char *); __END_DECLS #endif /* _MD4_H_ */ diff --git a/lib/libmd/md4c.c b/lib/libmd/md4c.c index 045675ee7e..76050af7ea 100644 --- a/lib/libmd/md4c.c +++ b/lib/libmd/md4c.c @@ -50,7 +50,7 @@ typedef u_int32_t UINT4; #define S33 11 #define S34 15 -static void MD4Transform PROTO_LIST ((UINT4 [4], const unsigned char [64])); +static void MD4Transform PROTO_LIST ((UINT4 *, const unsigned char *)); static void Encode PROTO_LIST ((unsigned char *, UINT4 *, unsigned int)); static void Decode PROTO_LIST @@ -92,14 +92,14 @@ static unsigned char PADDING[64] = { int MD4Init (MD4_CTX *context) { - context->count[0] = context->count[1] = 0; + context->Nl = context->Nh = 0; /* Load magic initialization constants. */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; + context->A = 0x67452301; + context->B = 0xefcdab89; + context->C = 0x98badcfe; + context->D = 0x10325476; return 1; } @@ -114,23 +114,23 @@ MD4Update (MD4_CTX *context, const void *in, unsigned int inputLen) const unsigned char *input = in; /* Compute number of bytes mod 64 */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3F); + idx = (unsigned int)((context->Nl >> 3) & 0x3F); /* Update number of bits */ - if ((context->count[0] += ((UINT4)inputLen << 3)) + if ((context->Nl += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3)) - context->count[1]++; - context->count[1] += ((UINT4)inputLen >> 29); + context->Nh++; + context->Nh += ((UINT4)inputLen >> 29); partLen = 64 - idx; /* Transform as many times as possible. */ if (inputLen >= partLen) { memcpy - ((POINTER)&context->buffer[idx], (CONST_POINTER)input, partLen); - MD4Transform (context->state, context->buffer); + ((POINTER)&((char *)context->data)[idx], (CONST_POINTER)input, partLen); + MD4Transform (&context->A, (unsigned char *)context->data); for (i = partLen; i + 63 < inputLen; i += 64) - MD4Transform (context->state, &input[i]); + MD4Transform (&context->A, &input[i]); idx = 0; } @@ -139,7 +139,7 @@ MD4Update (MD4_CTX *context, const void *in, unsigned int inputLen) /* Buffer remaining input */ memcpy - ((POINTER)&context->buffer[idx], (CONST_POINTER)&input[i], + ((POINTER)&((char *)context->data)[idx], (CONST_POINTER)&input[i], inputLen-i); } @@ -151,11 +151,11 @@ MD4Pad (MD4_CTX *context) unsigned int idx, padLen; /* Save number of bits */ - Encode (bits, context->count, 8); + Encode (bits, &context->Nl, 8); /* Pad out to 56 mod 64. */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3f); + idx = (unsigned int)((context->Nl >> 3) & 0x3f); padLen = (idx < 56) ? (56 - idx) : (120 - idx); MD4Update (context, PADDING, padLen); @@ -173,7 +173,7 @@ MD4Final (unsigned char digest[16], MD4_CTX *context) MD4Pad (context); /* Store state in digest */ - Encode (digest, context->state, 16); + Encode (digest, &context->A, 16); /* Zeroize sensitive information. */ @@ -183,7 +183,7 @@ MD4Final (unsigned char digest[16], MD4_CTX *context) /* MD4 basic transformation. Transforms state based on block. */ static void -MD4Transform (UINT4 state[4], const unsigned char block[64]) +MD4Transform (UINT4 *state, const unsigned char *block) { UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; diff --git a/lib/libmd/md5.h b/lib/libmd/md5.h index 803a88fc6b..b5244d1637 100644 --- a/lib/libmd/md5.h +++ b/lib/libmd/md5.h @@ -1,4 +1,43 @@ +/* + * Copyright (c) 2016 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * libmd shims for openssl + non-conflicting old API functions. + */ + #ifndef _MD5_H_ #define _MD5_H_ + #include -#endif /* _MD5_H_ */ + +#endif diff --git a/lib/libmd/md5c.c b/lib/libmd/md5c.c index 704076a30f..2dfcf863b0 100644 --- a/lib/libmd/md5c.c +++ b/lib/libmd/md5c.c @@ -40,8 +40,6 @@ #include #include -static void MD5Transform(u_int32_t [4], const unsigned char [64]); - #ifdef _KERNEL #define memset(x,y,z) bzero(x,z); #define memcpy(x,y,z) bcopy(y, x, z) @@ -129,13 +127,13 @@ int MD5Init (MD5_CTX *context) { - context->count[0] = context->count[1] = 0; + context->Nl = context->Nh = 0; /* Load magic initialization constants. */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; + context->A = 0x67452301; + context->B = 0xefcdab89; + context->C = 0x98badcfe; + context->D = 0x10325476; return 1; } @@ -152,24 +150,24 @@ MD5Update (MD5_CTX *context, const void *in, unsigned int inputLen) const unsigned char *input = in; /* Compute number of bytes mod 64 */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3F); + idx = (unsigned int)((context->Nl >> 3) & 0x3F); /* Update number of bits */ - if ((context->count[0] += ((u_int32_t)inputLen << 3)) + if ((context->Nl += ((u_int32_t)inputLen << 3)) < ((u_int32_t)inputLen << 3)) - context->count[1]++; - context->count[1] += ((u_int32_t)inputLen >> 29); + context->Nh++; + context->Nh += ((u_int32_t)inputLen >> 29); partLen = 64 - idx; /* Transform as many times as possible. */ if (inputLen >= partLen) { - memcpy((void *)&context->buffer[idx], (const void *)input, + memcpy(&((char *)context->data)[idx], (const void *)input, partLen); - MD5Transform (context->state, context->buffer); + MD5Transform (&context->A, (char *)context->data); for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform (context->state, &input[i]); + MD5Transform (&context->A, &input[i]); idx = 0; } @@ -177,7 +175,7 @@ MD5Update (MD5_CTX *context, const void *in, unsigned int inputLen) i = 0; /* Buffer remaining input */ - memcpy ((void *)&context->buffer[idx], (const void *)&input[i], + memcpy (&((char *)context->data)[idx], (const void *)&input[i], inputLen-i); } @@ -192,10 +190,10 @@ MD5Pad (MD5_CTX *context) unsigned int idx, padLen; /* Save number of bits */ - Encode (bits, context->count, 8); + Encode (bits, &context->Nl, 8); /* Pad out to 56 mod 64. */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3f); + idx = (unsigned int)((context->Nl >> 3) & 0x3f); padLen = (idx < 56) ? (56 - idx) : (120 - idx); MD5Update (context, PADDING, padLen); @@ -215,7 +213,7 @@ MD5Final (unsigned char digest[16], MD5_CTX *context) MD5Pad (context); /* Store state in digest */ - Encode (digest, context->state, 16); + Encode (digest, &context->A, 16); /* Zeroize sensitive information. */ memset ((void *)context, 0, sizeof (*context)); @@ -223,8 +221,8 @@ MD5Final (unsigned char digest[16], MD5_CTX *context) /* MD5 basic transformation. Transforms state based on block. */ -static void -MD5Transform (u_int32_t state[4], const unsigned char block[64]) +void +MD5Transform (u_int32_t *state, const unsigned char *block) { u_int32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; diff --git a/lib/libmd/ripemd.3 b/lib/libmd/ripemd.3 deleted file mode 100644 index 1cd473e1e2..0000000000 --- a/lib/libmd/ripemd.3 +++ /dev/null @@ -1,142 +0,0 @@ -.\" -.\" ---------------------------------------------------------------------------- -.\" "THE BEER-WARE LICENSE" (Revision 42): -.\" wrote this file. As long as you retain this notice you -.\" can do whatever you want with this stuff. If we meet some day, and you think -.\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp -.\" ---------------------------------------------------------------------------- -.\" -.\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp -.\" $FreeBSD: src/lib/libmd/ripemd.3,v 1.15 2005/02/13 22:25:13 ru Exp $ -.\" $DragonFly: src/lib/libmd/ripemd.3,v 1.4 2008/09/11 20:25:34 swildner Exp $ -.\" -.Dd February 26, 1999 -.Dt RIPEMD 3 -.Os -.Sh NAME -.Nm RIPEMD160_Init , -.Nm RIPEMD160_Update , -.Nm RIPEMD160_Final , -.Nm RIPEMD160_End , -.Nm RIPEMD160_File , -.Nm RIPEMD160_FileChunk , -.Nm RIPEMD160_Data -.Nd calculate the RIPEMD160 message digest -.Sh LIBRARY -.Lb libmd -.Sh SYNOPSIS -.In sys/types.h -.In ripemd.h -.Ft void -.Fn RIPEMD160_Init "RIPEMD160_CTX *context" -.Ft void -.Fn RIPEMD160_Update "RIPEMD160_CTX *context" "const unsigned char *data" "unsigned int len" -.Ft void -.Fn RIPEMD160_Final "unsigned char digest[20]" "RIPEMD160_CTX *context" -.Ft "char *" -.Fn RIPEMD160_End "RIPEMD160_CTX *context" "char *buf" -.Ft "char *" -.Fn RIPEMD160_File "const char *filename" "char *buf" -.Ft "char *" -.Fn RIPEMD160_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" -.Ft "char *" -.Fn RIPEMD160_Data "const unsigned char *data" "unsigned int len" "char *buf" -.Sh DESCRIPTION -The -.Li RIPEMD160_ -functions calculate a 160-bit cryptographic checksum (digest) -for any number of input bytes. -A cryptographic checksum is a one-way -hash function; that is, it is computationally impractical to find -the input corresponding to a particular output. -This net result is a -.Dq fingerprint -of the input-data, which does not disclose the actual input. -.Pp -The -.Fn RIPEMD160_Init , -.Fn RIPEMD160_Update , -and -.Fn RIPEMD160_Final -functions are the core functions. -Allocate an -.Vt RIPEMD160_CTX , -initialize it with -.Fn RIPEMD160_Init , -run over the data with -.Fn RIPEMD160_Update , -and finally extract the result using -.Fn RIPEMD160_Final . -.Pp -The -.Fn RIPEMD160_End -function is a wrapper for -.Fn RIPEMD160_Final -which converts the return value to a 41-character -(including the terminating '\e0') -.Tn ASCII -string which represents the 160 bits in hexadecimal. -.Pp -The -.Fn RIPEMD160_File -function calculates the digest of a file, and uses -.Fn RIPEMD160_End -to return the result. -If the file cannot be opened, a null pointer is returned. -The -.Fn RIPEMD160_FileChunk -function is similar to -.Fn RIPEMD160_File , -but it only calculates the digest over a byte-range of the file specified, -starting at -.Fa offset -and spanning -.Fa length -bytes. -If the -.Fa length -parameter is specified as 0, or more than the length of the remaining part -of the file, -.Fn RIPEMD160_FileChunk -calculates the digest from -.Fa offset -to the end of file. -The -.Fn RIPEMD160_Data -function calculates the digest of a chunk of data in memory, and uses -.Fn RIPEMD160_End -to return the result. -.Pp -When using -.Fn RIPEMD160_End , -.Fn RIPEMD160_File , -or -.Fn RIPEMD160_Data , -the -.Fa buf -argument can be a null pointer, in which case the returned string -is allocated with -.Xr malloc 3 -and subsequently must be explicitly deallocated using -.Xr free 3 -after use. -If the -.Fa buf -argument is non-null it must point to at least 41 characters of buffer space. -.Sh SEE ALSO -.Xr md2 3 , -.Xr md4 3 , -.Xr md5 3 , -.Xr sha 3 -.Sh HISTORY -These functions appeared in -.Fx 4.0 . -.Sh AUTHORS -The core hash routines were implemented by Eric Young based on the -published -.Tn RIPEMD160 -specification. -.Sh BUGS -No method is known to exist which finds two files having the same hash value, -nor to find a file with a specific hash value. -There is on the other hand no guarantee that such a method does not exist. diff --git a/lib/libmd/ripemd.h b/lib/libmd/ripemd.h index 623c6f5da1..b6791c79f8 100644 --- a/lib/libmd/ripemd.h +++ b/lib/libmd/ripemd.h @@ -1,95 +1,55 @@ -/* crypto/ripemd/ripemd.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. +/* + * Copyright (c) 2016 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * 1. Redistributions of source code must retain the copyright + * + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] */ - /* - * $FreeBSD: src/lib/libmd/ripemd.h,v 1.3 2006/01/17 15:35:56 phk Exp $ - * $DragonFly: src/lib/libmd/ripemd.h,v 1.3 2008/09/11 20:25:34 swildner Exp $ + * libmd shims for openssl + non-conflicting old API functions. */ - -#ifndef HEADER_RIPEMD_H -#define HEADER_RIPEMD_H +#ifndef _RIPEMD_H_ +#define _RIPEMD_H_ #include -#include /* XXX switch to machine/stdint.h and __ types */ - -#define RIPEMD160_CBLOCK 64 -#define RIPEMD160_LBLOCK 16 -#define RIPEMD160_BLOCK 16 -#define RIPEMD160_LAST_BLOCK 56 -#define RIPEMD160_LENGTH_BLOCK 8 -#define RIPEMD160_DIGEST_LENGTH 20 - -typedef struct RIPEMD160state_st { - u_int32_t A,B,C,D,E; - u_int32_t Nl,Nh; - u_int32_t data[RIPEMD160_LBLOCK]; - int num; -} RIPEMD160_CTX; +#include /* XXX switch to machine/stdint.h and __ types */ +#include __BEGIN_DECLS -int RIPEMD160_Init(RIPEMD160_CTX *c); -void RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, - size_t len); -void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); -char *RIPEMD160_End(RIPEMD160_CTX *, char *); -char *RIPEMD160_File(const char *, char *); -char *RIPEMD160_FileChunk(const char *, char *, off_t, off_t); -char *RIPEMD160_Data(const void *, unsigned int, char *); +char *RIPEMD160_End(RIPEMD160_CTX *, char *); +char *RIPEMD160_File(const char *, char *); +char *RIPEMD160_FileChunk(const char *, char *, off_t, off_t); +char *RIPEMD160_Data(const void *, unsigned int, char *); +char *RIPEMD1601_End(RIPEMD160_CTX *, char *); +char *RIPEMD1601_File(const char *, char *); +char *RIPEMD1601_FileChunk(const char *, char *, off_t, off_t); +char *RIPEMD1601_Data(const void *, unsigned int, char *); __END_DECLS #endif diff --git a/lib/libmd/rmd160c.c b/lib/libmd/rmd160c.c deleted file mode 100644 index 7fbe80cad7..0000000000 --- a/lib/libmd/rmd160c.c +++ /dev/null @@ -1,539 +0,0 @@ -/* crypto/ripemd/rmd_dgst.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - * - * $FreeBSD: src/lib/libmd/rmd160c.c,v 1.7 2006/01/17 15:35:56 phk Exp $ - * $DragonFly: src/lib/libmd/rmd160c.c,v 1.6 2008/09/30 16:57:05 swildner Exp $ - */ - -#include - -#include -#include - -#include - -#include "rmd_locl.h" - -/* - * The assembly-language code is not position-independent, so don't - * try to use it in a shared library. - */ -#ifdef PIC -#undef RMD160_ASM -#endif - -char *RMD160_version="RIPEMD160 part of SSLeay 0.9.0b 11-Oct-1998"; - -#ifdef RMD160_ASM -void ripemd160_block_x86(RIPEMD160_CTX *c, const u_int32_t *p,int num); -#define ripemd160_block ripemd160_block_x86 -#else -void ripemd160_block(RIPEMD160_CTX *c, const u_int32_t *p,int num); -#endif - -int -RIPEMD160_Init(RIPEMD160_CTX *c) - { - c->A=RIPEMD160_A; - c->B=RIPEMD160_B; - c->C=RIPEMD160_C; - c->D=RIPEMD160_D; - c->E=RIPEMD160_E; - c->Nl=0; - c->Nh=0; - c->num=0; - return 1; - } - -void -RIPEMD160_Update(RIPEMD160_CTX *c, const void *in, size_t len) - { - u_int32_t *p; - int sw,sc; - u_int32_t l; - const unsigned char *data = in; - - if (len == 0) return; - - l=(c->Nl+(len<<3))&0xffffffffL; - if (l < c->Nl) /* overflow */ - c->Nh++; - c->Nh+=(len>>29); - c->Nl=l; - - if (c->num != 0) - { - p=c->data; - sw=c->num>>2; - sc=c->num&0x03; - - if ((c->num+len) >= RIPEMD160_CBLOCK) - { - l= p[sw]; - p_c2l(data,l,sc); - p[sw++]=l; - for (; swnum); - - ripemd160_block(c,p,64); - c->num=0; - /* drop through and do the rest */ - } - else - { - int ew,ec; - - c->num+=(int)len; - if ((sc+len) < 4) /* ugly, add char's to a word */ - { - l= p[sw]; - p_c2l_p(data,l,sc,len); - p[sw]=l; - } - else - { - ew=(c->num>>2); - ec=(c->num&0x03); - l= p[sw]; - p_c2l(data,l,sc); - p[sw++]=l; - for (; sw < ew; sw++) - { c2l(data,l); p[sw]=l; } - if (ec) - { - c2l_p(data,l,ec); - p[sw]=l; - } - } - return; - } - } - /* we now can process the input data in blocks of RIPEMD160_CBLOCK - * chars and save the leftovers to c->data. */ -#if BYTE_ORDER == LITTLE_ENDIAN - if ((((unsigned long)data)%sizeof(u_int32_t)) == 0) - { - sw=(int)len/RIPEMD160_CBLOCK; - if (sw > 0) - { - sw*=RIPEMD160_CBLOCK; - ripemd160_block(c,(u_int32_t *)data,sw); - data+=sw; - len-=sw; - } - } -#endif - p=c->data; - while (len >= RIPEMD160_CBLOCK) - { -#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == BIG_ENDIAN - if (p != (u_int32_t *)data) - memcpy(p,data,RIPEMD160_CBLOCK); - data+=RIPEMD160_CBLOCK; -#if BYTE_ORDER == BIG_ENDIAN - for (sw=(RIPEMD160_LBLOCK/4); sw; sw--) - { - Endian_Reverse32(p[0]); - Endian_Reverse32(p[1]); - Endian_Reverse32(p[2]); - Endian_Reverse32(p[3]); - p+=4; - } -#endif -#else - for (sw=(RIPEMD160_LBLOCK/4); sw; sw--) - { - c2l(data,l); *(p++)=l; - c2l(data,l); *(p++)=l; - c2l(data,l); *(p++)=l; - c2l(data,l); *(p++)=l; - } -#endif - p=c->data; - ripemd160_block(c,p,64); - len-=RIPEMD160_CBLOCK; - } - sc=(int)len; - c->num=sc; - if (sc) - { - sw=sc>>2; /* words to copy */ -#if BYTE_ORDER == LITTLE_ENDIAN - p[sw]=0; - memcpy(p,data,sc); -#else - sc&=0x03; - for ( ; sw; sw--) - { c2l(data,l); *(p++)=l; } - c2l_p(data,l,sc); - *p=l; -#endif - } - } - -void -RIPEMD160_Transform(RIPEMD160_CTX *c, unsigned char *b) - { - u_int32_t p[16]; -#if BYTE_ORDER != LITTLE_ENDIAN - u_int32_t *q; - int i; -#endif - -#if BYTE_ORDER == BIG_ENDIAN || BYTE_ORDER == LITTLE_ENDIAN - memcpy(p,b,64); -#if BYTE_ORDER == BIG_ENDIAN - q=p; - for (i=(RIPEMD160_LBLOCK/4); i; i--) - { - Endian_Reverse32(q[0]); - Endian_Reverse32(q[1]); - Endian_Reverse32(q[2]); - Endian_Reverse32(q[3]); - q+=4; - } -#endif -#else - q=p; - for (i=(RIPEMD160_LBLOCK/4); i; i--) - { - u_int32_t l; - c2l(b,l); *(q++)=l; - c2l(b,l); *(q++)=l; - c2l(b,l); *(q++)=l; - c2l(b,l); *(q++)=l; - } -#endif - ripemd160_block(c,p,64); - } - -#ifndef RMD160_ASM - -void -ripemd160_block(RIPEMD160_CTX *ctx, const u_int32_t *X, int num) - { - u_int32_t A,B,C,D,E; - u_int32_t a,b,c,d,e; - - for (;;) - { - A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E; - - RIP1(A,B,C,D,E,WL00,SL00); - RIP1(E,A,B,C,D,WL01,SL01); - RIP1(D,E,A,B,C,WL02,SL02); - RIP1(C,D,E,A,B,WL03,SL03); - RIP1(B,C,D,E,A,WL04,SL04); - RIP1(A,B,C,D,E,WL05,SL05); - RIP1(E,A,B,C,D,WL06,SL06); - RIP1(D,E,A,B,C,WL07,SL07); - RIP1(C,D,E,A,B,WL08,SL08); - RIP1(B,C,D,E,A,WL09,SL09); - RIP1(A,B,C,D,E,WL10,SL10); - RIP1(E,A,B,C,D,WL11,SL11); - RIP1(D,E,A,B,C,WL12,SL12); - RIP1(C,D,E,A,B,WL13,SL13); - RIP1(B,C,D,E,A,WL14,SL14); - RIP1(A,B,C,D,E,WL15,SL15); - - RIP2(E,A,B,C,D,WL16,SL16,KL1); - RIP2(D,E,A,B,C,WL17,SL17,KL1); - RIP2(C,D,E,A,B,WL18,SL18,KL1); - RIP2(B,C,D,E,A,WL19,SL19,KL1); - RIP2(A,B,C,D,E,WL20,SL20,KL1); - RIP2(E,A,B,C,D,WL21,SL21,KL1); - RIP2(D,E,A,B,C,WL22,SL22,KL1); - RIP2(C,D,E,A,B,WL23,SL23,KL1); - RIP2(B,C,D,E,A,WL24,SL24,KL1); - RIP2(A,B,C,D,E,WL25,SL25,KL1); - RIP2(E,A,B,C,D,WL26,SL26,KL1); - RIP2(D,E,A,B,C,WL27,SL27,KL1); - RIP2(C,D,E,A,B,WL28,SL28,KL1); - RIP2(B,C,D,E,A,WL29,SL29,KL1); - RIP2(A,B,C,D,E,WL30,SL30,KL1); - RIP2(E,A,B,C,D,WL31,SL31,KL1); - - RIP3(D,E,A,B,C,WL32,SL32,KL2); - RIP3(C,D,E,A,B,WL33,SL33,KL2); - RIP3(B,C,D,E,A,WL34,SL34,KL2); - RIP3(A,B,C,D,E,WL35,SL35,KL2); - RIP3(E,A,B,C,D,WL36,SL36,KL2); - RIP3(D,E,A,B,C,WL37,SL37,KL2); - RIP3(C,D,E,A,B,WL38,SL38,KL2); - RIP3(B,C,D,E,A,WL39,SL39,KL2); - RIP3(A,B,C,D,E,WL40,SL40,KL2); - RIP3(E,A,B,C,D,WL41,SL41,KL2); - RIP3(D,E,A,B,C,WL42,SL42,KL2); - RIP3(C,D,E,A,B,WL43,SL43,KL2); - RIP3(B,C,D,E,A,WL44,SL44,KL2); - RIP3(A,B,C,D,E,WL45,SL45,KL2); - RIP3(E,A,B,C,D,WL46,SL46,KL2); - RIP3(D,E,A,B,C,WL47,SL47,KL2); - - RIP4(C,D,E,A,B,WL48,SL48,KL3); - RIP4(B,C,D,E,A,WL49,SL49,KL3); - RIP4(A,B,C,D,E,WL50,SL50,KL3); - RIP4(E,A,B,C,D,WL51,SL51,KL3); - RIP4(D,E,A,B,C,WL52,SL52,KL3); - RIP4(C,D,E,A,B,WL53,SL53,KL3); - RIP4(B,C,D,E,A,WL54,SL54,KL3); - RIP4(A,B,C,D,E,WL55,SL55,KL3); - RIP4(E,A,B,C,D,WL56,SL56,KL3); - RIP4(D,E,A,B,C,WL57,SL57,KL3); - RIP4(C,D,E,A,B,WL58,SL58,KL3); - RIP4(B,C,D,E,A,WL59,SL59,KL3); - RIP4(A,B,C,D,E,WL60,SL60,KL3); - RIP4(E,A,B,C,D,WL61,SL61,KL3); - RIP4(D,E,A,B,C,WL62,SL62,KL3); - RIP4(C,D,E,A,B,WL63,SL63,KL3); - - RIP5(B,C,D,E,A,WL64,SL64,KL4); - RIP5(A,B,C,D,E,WL65,SL65,KL4); - RIP5(E,A,B,C,D,WL66,SL66,KL4); - RIP5(D,E,A,B,C,WL67,SL67,KL4); - RIP5(C,D,E,A,B,WL68,SL68,KL4); - RIP5(B,C,D,E,A,WL69,SL69,KL4); - RIP5(A,B,C,D,E,WL70,SL70,KL4); - RIP5(E,A,B,C,D,WL71,SL71,KL4); - RIP5(D,E,A,B,C,WL72,SL72,KL4); - RIP5(C,D,E,A,B,WL73,SL73,KL4); - RIP5(B,C,D,E,A,WL74,SL74,KL4); - RIP5(A,B,C,D,E,WL75,SL75,KL4); - RIP5(E,A,B,C,D,WL76,SL76,KL4); - RIP5(D,E,A,B,C,WL77,SL77,KL4); - RIP5(C,D,E,A,B,WL78,SL78,KL4); - RIP5(B,C,D,E,A,WL79,SL79,KL4); - - a=A; b=B; c=C; d=D; e=E; - /* Do other half */ - A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E; - - RIP5(A,B,C,D,E,WR00,SR00,KR0); - RIP5(E,A,B,C,D,WR01,SR01,KR0); - RIP5(D,E,A,B,C,WR02,SR02,KR0); - RIP5(C,D,E,A,B,WR03,SR03,KR0); - RIP5(B,C,D,E,A,WR04,SR04,KR0); - RIP5(A,B,C,D,E,WR05,SR05,KR0); - RIP5(E,A,B,C,D,WR06,SR06,KR0); - RIP5(D,E,A,B,C,WR07,SR07,KR0); - RIP5(C,D,E,A,B,WR08,SR08,KR0); - RIP5(B,C,D,E,A,WR09,SR09,KR0); - RIP5(A,B,C,D,E,WR10,SR10,KR0); - RIP5(E,A,B,C,D,WR11,SR11,KR0); - RIP5(D,E,A,B,C,WR12,SR12,KR0); - RIP5(C,D,E,A,B,WR13,SR13,KR0); - RIP5(B,C,D,E,A,WR14,SR14,KR0); - RIP5(A,B,C,D,E,WR15,SR15,KR0); - - RIP4(E,A,B,C,D,WR16,SR16,KR1); - RIP4(D,E,A,B,C,WR17,SR17,KR1); - RIP4(C,D,E,A,B,WR18,SR18,KR1); - RIP4(B,C,D,E,A,WR19,SR19,KR1); - RIP4(A,B,C,D,E,WR20,SR20,KR1); - RIP4(E,A,B,C,D,WR21,SR21,KR1); - RIP4(D,E,A,B,C,WR22,SR22,KR1); - RIP4(C,D,E,A,B,WR23,SR23,KR1); - RIP4(B,C,D,E,A,WR24,SR24,KR1); - RIP4(A,B,C,D,E,WR25,SR25,KR1); - RIP4(E,A,B,C,D,WR26,SR26,KR1); - RIP4(D,E,A,B,C,WR27,SR27,KR1); - RIP4(C,D,E,A,B,WR28,SR28,KR1); - RIP4(B,C,D,E,A,WR29,SR29,KR1); - RIP4(A,B,C,D,E,WR30,SR30,KR1); - RIP4(E,A,B,C,D,WR31,SR31,KR1); - - RIP3(D,E,A,B,C,WR32,SR32,KR2); - RIP3(C,D,E,A,B,WR33,SR33,KR2); - RIP3(B,C,D,E,A,WR34,SR34,KR2); - RIP3(A,B,C,D,E,WR35,SR35,KR2); - RIP3(E,A,B,C,D,WR36,SR36,KR2); - RIP3(D,E,A,B,C,WR37,SR37,KR2); - RIP3(C,D,E,A,B,WR38,SR38,KR2); - RIP3(B,C,D,E,A,WR39,SR39,KR2); - RIP3(A,B,C,D,E,WR40,SR40,KR2); - RIP3(E,A,B,C,D,WR41,SR41,KR2); - RIP3(D,E,A,B,C,WR42,SR42,KR2); - RIP3(C,D,E,A,B,WR43,SR43,KR2); - RIP3(B,C,D,E,A,WR44,SR44,KR2); - RIP3(A,B,C,D,E,WR45,SR45,KR2); - RIP3(E,A,B,C,D,WR46,SR46,KR2); - RIP3(D,E,A,B,C,WR47,SR47,KR2); - - RIP2(C,D,E,A,B,WR48,SR48,KR3); - RIP2(B,C,D,E,A,WR49,SR49,KR3); - RIP2(A,B,C,D,E,WR50,SR50,KR3); - RIP2(E,A,B,C,D,WR51,SR51,KR3); - RIP2(D,E,A,B,C,WR52,SR52,KR3); - RIP2(C,D,E,A,B,WR53,SR53,KR3); - RIP2(B,C,D,E,A,WR54,SR54,KR3); - RIP2(A,B,C,D,E,WR55,SR55,KR3); - RIP2(E,A,B,C,D,WR56,SR56,KR3); - RIP2(D,E,A,B,C,WR57,SR57,KR3); - RIP2(C,D,E,A,B,WR58,SR58,KR3); - RIP2(B,C,D,E,A,WR59,SR59,KR3); - RIP2(A,B,C,D,E,WR60,SR60,KR3); - RIP2(E,A,B,C,D,WR61,SR61,KR3); - RIP2(D,E,A,B,C,WR62,SR62,KR3); - RIP2(C,D,E,A,B,WR63,SR63,KR3); - - RIP1(B,C,D,E,A,WR64,SR64); - RIP1(A,B,C,D,E,WR65,SR65); - RIP1(E,A,B,C,D,WR66,SR66); - RIP1(D,E,A,B,C,WR67,SR67); - RIP1(C,D,E,A,B,WR68,SR68); - RIP1(B,C,D,E,A,WR69,SR69); - RIP1(A,B,C,D,E,WR70,SR70); - RIP1(E,A,B,C,D,WR71,SR71); - RIP1(D,E,A,B,C,WR72,SR72); - RIP1(C,D,E,A,B,WR73,SR73); - RIP1(B,C,D,E,A,WR74,SR74); - RIP1(A,B,C,D,E,WR75,SR75); - RIP1(E,A,B,C,D,WR76,SR76); - RIP1(D,E,A,B,C,WR77,SR77); - RIP1(C,D,E,A,B,WR78,SR78); - RIP1(B,C,D,E,A,WR79,SR79); - - D =ctx->B+c+D; - ctx->B=ctx->C+d+E; - ctx->C=ctx->D+e+A; - ctx->D=ctx->E+a+B; - ctx->E=ctx->A+b+C; - ctx->A=D; - - X+=16; - num-=64; - if (num <= 0) break; - } - } -#endif - -void -RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c) - { - int i,j; - u_int32_t l; - u_int32_t *p; - static unsigned char end[4]={0x80,0x00,0x00,0x00}; - unsigned char *cp=end; - - /* c->num should definitly have room for at least one more byte. */ - p=c->data; - j=c->num; - i=j>>2; - - /* purify often complains about the following line as an - * Uninitialized Memory Read. While this can be true, the - * following p_c2l macro will reset l when that case is true. - * This is because j&0x03 contains the number of 'valid' bytes - * already in p[i]. If and only if j&0x03 == 0, the UMR will - * occur but this is also the only time p_c2l will do - * l= *(cp++) instead of l|= *(cp++) - * Many thanks to Alex Tang for pickup this - * 'potential bug' */ -#ifdef PURIFY - if ((j&0x03) == 0) p[i]=0; -#endif - l=p[i]; - p_c2l(cp,l,j&0x03); - p[i]=l; - i++; - /* i is the next 'undefined word' */ - if (c->num >= RIPEMD160_LAST_BLOCK) - { - for (; iNl; - p[RIPEMD160_LBLOCK-1]=c->Nh; - ripemd160_block(c,p,64); - cp=md; - l=c->A; l2c(l,cp); - l=c->B; l2c(l,cp); - l=c->C; l2c(l,cp); - l=c->D; l2c(l,cp); - l=c->E; l2c(l,cp); - - /* clear stuff, ripemd160_block may be leaving some stuff on the stack - * but I'm not worried :-) */ - c->num=0; -/* memset((char *)&c,0,sizeof(c));*/ - } - -#ifdef undef -int -printit(unsigned long *l) - { - int i,ii; - - for (i=0; i<2; i++) - { - for (ii=0; ii<8; ii++) - { - fprintf(stderr,"%08lx ",l[i*8+ii]); - } - fprintf(stderr,"\n"); - } - } -#endif diff --git a/lib/libmd/rmddriver.c b/lib/libmd/rmddriver.c deleted file mode 100644 index 4081cf1c08..0000000000 --- a/lib/libmd/rmddriver.c +++ /dev/null @@ -1,51 +0,0 @@ -/* RIPEMD160DRIVER.C - test driver for RIPEMD160 - * $FreeBSD: src/lib/libmd/rmddriver.c,v 1.3 2001/09/30 21:56:22 dillon Exp $ - * $DragonFly: src/lib/libmd/rmddriver.c,v 1.3 2008/09/11 20:25:34 swildner Exp $ - */ - -/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All - rights reserved. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -#include - -#include -#include -#include -#include "ripemd.h" - -/* Digests a string and prints the result. - */ -static void RIPEMD160String (char *string) -{ - char buf[2*20+1]; - - printf ("RIPEMD160 (\"%s\") = %s\n", - string, RIPEMD160_Data(string,strlen(string),buf)); -} - -/* Digests a reference suite of strings and prints the results. - */ -int main(void) -{ - printf ("RIPEMD160 test suite:\n"); - - RIPEMD160String (""); - RIPEMD160String ("abc"); - RIPEMD160String ("message digest"); - RIPEMD160String ("abcdefghijklmnopqrstuvwxyz"); - RIPEMD160String - ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); - RIPEMD160String - ("1234567890123456789012345678901234567890\ -1234567890123456789012345678901234567890"); - return 0; -} diff --git a/lib/libmd/sha.h b/lib/libmd/sha.h index 490bfa72de..1565a9e348 100644 --- a/lib/libmd/sha.h +++ b/lib/libmd/sha.h @@ -1,99 +1,67 @@ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. +/* + * Copyright (c) 2016 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * 1. Redistributions of source code must retain the copyright + * + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. * - * $FreeBSD: src/lib/libmd/sha.h,v 1.5 2006/01/17 15:35:56 phk Exp $ - * $DragonFly: src/lib/libmd/sha.h,v 1.4 2008/09/11 20:25:34 swildner Exp $ + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * libmd shims for openssl + non-conflicting old API functions. */ - #ifndef _SHA_H_ -#define _SHA_H_ 1 +#define _SHA_H_ #include -#include /* XXX switch to machine/stdint.h and __ types */ +#include /* XXX switch to machine/stdint.h and __ types */ +#include -#define SHA_CBLOCK 64 -#define SHA_LBLOCK 16 #define SHA_BLOCK 16 -#define SHA_LAST_BLOCK 56 #define SHA_LENGTH_BLOCK 8 -#define SHA_DIGEST_LENGTH 20 -typedef struct SHAstate_st { - u_int32_t h0, h1, h2, h3, h4; - u_int32_t Nl, Nh; - u_int32_t data[SHA_LBLOCK]; - int num; -} SHA_CTX; #define SHA1_CTX SHA_CTX __BEGIN_DECLS -int SHA_Init(SHA_CTX *c); -void SHA_Update(SHA_CTX *c, const void *data, size_t len); -void SHA_Final(unsigned char *md, SHA_CTX *c); -char *SHA_End(SHA_CTX *, char *); -char *SHA_File(const char *, char *); -char *SHA_FileChunk(const char *, char *, off_t, off_t); -char *SHA_Data(const void *, unsigned int, char *); -int SHA1_Init(SHA_CTX *c); -void SHA1_Update(SHA_CTX *c, const void *data, size_t len); -void SHA1_Final(unsigned char *md, SHA_CTX *c); -char *SHA1_End(SHA_CTX *, char *); -char *SHA1_File(const char *, char *); -char *SHA1_FileChunk(const char *, char *, off_t, off_t); -char *SHA1_Data(const void *, unsigned int, char *); +/* these three are not included in libressl for reasons unknown */ +int SHA_Init(SHA_CTX *c); +int SHA_Update(SHA_CTX *c, const void *data, size_t len); +int SHA_Final(unsigned char *md, SHA_CTX *c); + +#if 0 +char *SHA_End(SHA_CTX *, char *); +char *SHA_File(const char *, char *); +char *SHA_FileChunk(const char *, char *, off_t, off_t); +char *SHA_Data(const void *, unsigned int, char *); +char *SHA1_End(SHA_CTX *, char *); +char *SHA1_File(const char *, char *); +char *SHA1_FileChunk(const char *, char *, off_t, off_t); +char *SHA1_Data(const void *, unsigned int, char *); +#endif __END_DECLS -#endif /* !_SHA_H_ */ +#endif diff --git a/lib/libmd/sha0c.c b/lib/libmd/sha0c.c deleted file mode 100644 index 333b8c4487..0000000000 --- a/lib/libmd/sha0c.c +++ /dev/null @@ -1,446 +0,0 @@ -/* crypto/sha/sha_dgst.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - * - * $FreeBSD: src/lib/libmd/sha0c.c,v 1.6 2006/01/17 15:35:56 phk Exp $ - * $DragonFly: src/lib/libmd/sha0c.c,v 1.6 2008/09/30 16:57:05 swildner Exp $ - */ - -#include - -#include -#include - -#include - -#define SHA_0 -#undef SHA_1 -#include "sha.h" -#include "sha_locl.h" - -char *SHA_version="SHA part of SSLeay 0.9.0b 11-Oct-1998"; - -/* Implemented from SHA-0 document - The Secure Hash Algorithm - */ - -#define INIT_DATA_h0 (unsigned long)0x67452301L -#define INIT_DATA_h1 (unsigned long)0xefcdab89L -#define INIT_DATA_h2 (unsigned long)0x98badcfeL -#define INIT_DATA_h3 (unsigned long)0x10325476L -#define INIT_DATA_h4 (unsigned long)0xc3d2e1f0L - -#define K_00_19 0x5a827999L -#define K_20_39 0x6ed9eba1L -#define K_40_59 0x8f1bbcdcL -#define K_60_79 0xca62c1d6L - -#ifndef NOPROTO - void sha_block(SHA_CTX *c, const u_int32_t *p, int num); -#else - void sha_block(); -#endif - -#define M_c2nl c2nl -#define M_p_c2nl p_c2nl -#define M_c2nl_p c2nl_p -#define M_p_c2nl_p p_c2nl_p -#define M_nl2c nl2c - -int -SHA_Init(SHA_CTX *c) - { - c->h0=INIT_DATA_h0; - c->h1=INIT_DATA_h1; - c->h2=INIT_DATA_h2; - c->h3=INIT_DATA_h3; - c->h4=INIT_DATA_h4; - c->Nl=0; - c->Nh=0; - c->num=0; - return 1; - } - -void -SHA_Update(SHA_CTX *c, const void *in, size_t len) - { - u_int32_t *p; - int ew,ec,sw,sc; - u_int32_t l; - const unsigned char *data = in; - - if (len == 0) return; - - l=(c->Nl+(len<<3))&0xffffffffL; - if (l < c->Nl) /* overflow */ - c->Nh++; - c->Nh+=(len>>29); - c->Nl=l; - - if (c->num != 0) - { - p=c->data; - sw=c->num>>2; - sc=c->num&0x03; - - if ((c->num+len) >= SHA_CBLOCK) - { - l= p[sw]; - M_p_c2nl(data,l,sc); - p[sw++]=l; - for (; swnum); - - sha_block(c,p,64); - c->num=0; - /* drop through and do the rest */ - } - else - { - c->num+=(int)len; - if ((sc+len) < 4) /* ugly, add char's to a word */ - { - l= p[sw]; - M_p_c2nl_p(data,l,sc,len); - p[sw]=l; - } - else - { - ew=(c->num>>2); - ec=(c->num&0x03); - l= p[sw]; - M_p_c2nl(data,l,sc); - p[sw++]=l; - for (; sw < ew; sw++) - { M_c2nl(data,l); p[sw]=l; } - if (ec) - { - M_c2nl_p(data,l,ec); - p[sw]=l; - } - } - return; - } - } - /* We can only do the following code for assember, the reason - * being that the sha_block 'C' version changes the values - * in the 'data' array. The assember code avoids this and - * copies it to a local array. I should be able to do this for - * the C version as well.... - */ -#if 1 -#if BYTE_ORDER == BIG_ENDIAN || defined(SHA_ASM) - if ((((unsigned int)data)%sizeof(u_int32_t)) == 0) - { - sw=len/SHA_CBLOCK; - if (sw) - { - sw*=SHA_CBLOCK; - sha_block(c,(u_int32_t *)data,sw); - data+=sw; - len-=sw; - } - } -#endif -#endif - /* we now can process the input data in blocks of SHA_CBLOCK - * chars and save the leftovers to c->data. */ - p=c->data; - while (len >= SHA_CBLOCK) - { -#if BYTE_ORDER == BIG_ENDIAN || BYTE_ORDER == LITTLE_ENDIAN - if (p != (u_int32_t *)data) - memcpy(p,data,SHA_CBLOCK); - data+=SHA_CBLOCK; -# if BYTE_ORDER == LITTLE_ENDIAN -# ifndef SHA_ASM /* Will not happen */ - for (sw=(SHA_LBLOCK/4); sw; sw--) - { - Endian_Reverse32(p[0]); - Endian_Reverse32(p[1]); - Endian_Reverse32(p[2]); - Endian_Reverse32(p[3]); - p+=4; - } - p=c->data; -# endif -# endif -#else - for (sw=(SHA_BLOCK/4); sw; sw--) - { - M_c2nl(data,l); *(p++)=l; - M_c2nl(data,l); *(p++)=l; - M_c2nl(data,l); *(p++)=l; - M_c2nl(data,l); *(p++)=l; - } - p=c->data; -#endif - sha_block(c,p,64); - len-=SHA_CBLOCK; - } - ec=(int)len; - c->num=ec; - ew=(ec>>2); - ec&=0x03; - - for (sw=0; sw < ew; sw++) - { M_c2nl(data,l); p[sw]=l; } - M_c2nl_p(data,l,ec); - p[sw]=l; - } - -void -SHA_Transform(SHA_CTX *c, unsigned char *b) - { - u_int32_t p[16]; -#if BYTE_ORDER == LITTLE_ENDIAN - u_int32_t *q; - int i; -#endif - -#if BYTE_ORDER == BIG_ENDIAN || BYTE_ORDER == LITTLE_ENDIAN - memcpy(p,b,64); -#if BYTE_ORDER == LITTLE_ENDIAN - q=p; - for (i=(SHA_LBLOCK/4); i; i--) - { - Endian_Reverse32(q[0]); - Endian_Reverse32(q[1]); - Endian_Reverse32(q[2]); - Endian_Reverse32(q[3]); - q+=4; - } -#endif -#else - q=p; - for (i=(SHA_LBLOCK/4); i; i--) - { - u_int32_t l; - c2nl(b,l); *(q++)=l; - c2nl(b,l); *(q++)=l; - c2nl(b,l); *(q++)=l; - c2nl(b,l); *(q++)=l; - } -#endif - sha_block(c,p,64); - } - -void -sha_block(SHA_CTX *c, const u_int32_t *W, int num) - { - u_int32_t A,B,C,D,E,T; - u_int32_t X[16]; - - A=c->h0; - B=c->h1; - C=c->h2; - D=c->h3; - E=c->h4; - - for (;;) - { - BODY_00_15( 0,A,B,C,D,E,T,W); - BODY_00_15( 1,T,A,B,C,D,E,W); - BODY_00_15( 2,E,T,A,B,C,D,W); - BODY_00_15( 3,D,E,T,A,B,C,W); - BODY_00_15( 4,C,D,E,T,A,B,W); - BODY_00_15( 5,B,C,D,E,T,A,W); - BODY_00_15( 6,A,B,C,D,E,T,W); - BODY_00_15( 7,T,A,B,C,D,E,W); - BODY_00_15( 8,E,T,A,B,C,D,W); - BODY_00_15( 9,D,E,T,A,B,C,W); - BODY_00_15(10,C,D,E,T,A,B,W); - BODY_00_15(11,B,C,D,E,T,A,W); - BODY_00_15(12,A,B,C,D,E,T,W); - BODY_00_15(13,T,A,B,C,D,E,W); - BODY_00_15(14,E,T,A,B,C,D,W); - BODY_00_15(15,D,E,T,A,B,C,W); - BODY_16_19(16,C,D,E,T,A,B,W,W,W,W); - BODY_16_19(17,B,C,D,E,T,A,W,W,W,W); - BODY_16_19(18,A,B,C,D,E,T,W,W,W,W); - BODY_16_19(19,T,A,B,C,D,E,W,W,W,X); - - BODY_20_31(20,E,T,A,B,C,D,W,W,W,X); - BODY_20_31(21,D,E,T,A,B,C,W,W,W,X); - BODY_20_31(22,C,D,E,T,A,B,W,W,W,X); - BODY_20_31(23,B,C,D,E,T,A,W,W,W,X); - BODY_20_31(24,A,B,C,D,E,T,W,W,X,X); - BODY_20_31(25,T,A,B,C,D,E,W,W,X,X); - BODY_20_31(26,E,T,A,B,C,D,W,W,X,X); - BODY_20_31(27,D,E,T,A,B,C,W,W,X,X); - BODY_20_31(28,C,D,E,T,A,B,W,W,X,X); - BODY_20_31(29,B,C,D,E,T,A,W,W,X,X); - BODY_20_31(30,A,B,C,D,E,T,W,X,X,X); - BODY_20_31(31,T,A,B,C,D,E,W,X,X,X); - BODY_32_39(32,E,T,A,B,C,D,X); - BODY_32_39(33,D,E,T,A,B,C,X); - BODY_32_39(34,C,D,E,T,A,B,X); - BODY_32_39(35,B,C,D,E,T,A,X); - BODY_32_39(36,A,B,C,D,E,T,X); - BODY_32_39(37,T,A,B,C,D,E,X); - BODY_32_39(38,E,T,A,B,C,D,X); - BODY_32_39(39,D,E,T,A,B,C,X); - - BODY_40_59(40,C,D,E,T,A,B,X); - BODY_40_59(41,B,C,D,E,T,A,X); - BODY_40_59(42,A,B,C,D,E,T,X); - BODY_40_59(43,T,A,B,C,D,E,X); - BODY_40_59(44,E,T,A,B,C,D,X); - BODY_40_59(45,D,E,T,A,B,C,X); - BODY_40_59(46,C,D,E,T,A,B,X); - BODY_40_59(47,B,C,D,E,T,A,X); - BODY_40_59(48,A,B,C,D,E,T,X); - BODY_40_59(49,T,A,B,C,D,E,X); - BODY_40_59(50,E,T,A,B,C,D,X); - BODY_40_59(51,D,E,T,A,B,C,X); - BODY_40_59(52,C,D,E,T,A,B,X); - BODY_40_59(53,B,C,D,E,T,A,X); - BODY_40_59(54,A,B,C,D,E,T,X); - BODY_40_59(55,T,A,B,C,D,E,X); - BODY_40_59(56,E,T,A,B,C,D,X); - BODY_40_59(57,D,E,T,A,B,C,X); - BODY_40_59(58,C,D,E,T,A,B,X); - BODY_40_59(59,B,C,D,E,T,A,X); - - BODY_60_79(60,A,B,C,D,E,T,X); - BODY_60_79(61,T,A,B,C,D,E,X); - BODY_60_79(62,E,T,A,B,C,D,X); - BODY_60_79(63,D,E,T,A,B,C,X); - BODY_60_79(64,C,D,E,T,A,B,X); - BODY_60_79(65,B,C,D,E,T,A,X); - BODY_60_79(66,A,B,C,D,E,T,X); - BODY_60_79(67,T,A,B,C,D,E,X); - BODY_60_79(68,E,T,A,B,C,D,X); - BODY_60_79(69,D,E,T,A,B,C,X); - BODY_60_79(70,C,D,E,T,A,B,X); - BODY_60_79(71,B,C,D,E,T,A,X); - BODY_60_79(72,A,B,C,D,E,T,X); - BODY_60_79(73,T,A,B,C,D,E,X); - BODY_60_79(74,E,T,A,B,C,D,X); - BODY_60_79(75,D,E,T,A,B,C,X); - BODY_60_79(76,C,D,E,T,A,B,X); - BODY_60_79(77,B,C,D,E,T,A,X); - BODY_60_79(78,A,B,C,D,E,T,X); - BODY_60_79(79,T,A,B,C,D,E,X); - - c->h0=(c->h0+E)&0xffffffffL; - c->h1=(c->h1+T)&0xffffffffL; - c->h2=(c->h2+A)&0xffffffffL; - c->h3=(c->h3+B)&0xffffffffL; - c->h4=(c->h4+C)&0xffffffffL; - - num-=64; - if (num <= 0) break; - - A=c->h0; - B=c->h1; - C=c->h2; - D=c->h3; - E=c->h4; - - W+=16; - } - } - -void -SHA_Final(unsigned char *md, SHA_CTX *c) - { - int i,j; - u_int32_t l; - u_int32_t *p; - static unsigned char end[4]={0x80,0x00,0x00,0x00}; - unsigned char *cp=end; - - /* c->num should definitly have room for at least one more byte. */ - p=c->data; - j=c->num; - i=j>>2; -#ifdef PURIFY - if ((j&0x03) == 0) p[i]=0; -#endif - l=p[i]; - M_p_c2nl(cp,l,j&0x03); - p[i]=l; - i++; - /* i is the next 'undefined word' */ - if (c->num >= SHA_LAST_BLOCK) - { - for (; iNh; - p[SHA_LBLOCK-1]=c->Nl; - sha_block(c,p,64); - cp=md; - l=c->h0; nl2c(l,cp); - l=c->h1; nl2c(l,cp); - l=c->h2; nl2c(l,cp); - l=c->h3; nl2c(l,cp); - l=c->h4; nl2c(l,cp); - - /* clear stuff, sha_block may be leaving some stuff on the stack - * but I'm not worried :-) */ - c->num=0; -/* memset((char *)&c,0,sizeof(c));*/ - } - diff --git a/lib/libmd/sha1c.c b/lib/libmd/sha1c.c deleted file mode 100644 index f555649152..0000000000 --- a/lib/libmd/sha1c.c +++ /dev/null @@ -1,480 +0,0 @@ -/* crypto/sha/sha1dgst.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - * - * $FreeBSD: src/lib/libmd/sha1c.c,v 1.5 2006/01/17 15:35:56 phk Exp $ - * $DragonFly: src/lib/libmd/sha1c.c,v 1.5 2008/09/30 16:57:05 swildner Exp $ - */ - -#include - -#include -#include - -#include - -#undef SHA_0 -#define SHA_1 -#include "sha.h" -#include "sha_locl.h" - -/* - * The assembly-language code is not position-independent, so don't - * try to use it in a shared library. - */ -#ifdef PIC -#undef SHA1_ASM -#endif - -char *SHA1_version="SHA1 part of SSLeay 0.9.0b 11-Oct-1998"; - -/* Implemented from SHA-1 document - The Secure Hash Algorithm - */ - -#define INIT_DATA_h0 (unsigned long)0x67452301L -#define INIT_DATA_h1 (unsigned long)0xefcdab89L -#define INIT_DATA_h2 (unsigned long)0x98badcfeL -#define INIT_DATA_h3 (unsigned long)0x10325476L -#define INIT_DATA_h4 (unsigned long)0xc3d2e1f0L - -#define K_00_19 0x5a827999L -#define K_20_39 0x6ed9eba1L -#define K_40_59 0x8f1bbcdcL -#define K_60_79 0xca62c1d6L - -#ifndef NOPROTO -# ifdef SHA1_ASM - void sha1_block_x86(SHA_CTX *c, const u_int32_t *p, int num); -# define sha1_block sha1_block_x86 -# else - void sha1_block(SHA_CTX *c, const u_int32_t *p, int num); -# endif -#else -# ifdef SHA1_ASM - void sha1_block_x86(); -# define sha1_block sha1_block_x86 -# else - void sha1_block(); -# endif -#endif - - -#if BYTE_ORDER == LITTLE_ENDIAN && defined(SHA1_ASM) -# define M_c2nl c2l -# define M_p_c2nl p_c2l -# define M_c2nl_p c2l_p -# define M_p_c2nl_p p_c2l_p -# define M_nl2c l2c -#else -# define M_c2nl c2nl -# define M_p_c2nl p_c2nl -# define M_c2nl_p c2nl_p -# define M_p_c2nl_p p_c2nl_p -# define M_nl2c nl2c -#endif - -int -SHA1_Init(SHA_CTX *c) - { - c->h0=INIT_DATA_h0; - c->h1=INIT_DATA_h1; - c->h2=INIT_DATA_h2; - c->h3=INIT_DATA_h3; - c->h4=INIT_DATA_h4; - c->Nl=0; - c->Nh=0; - c->num=0; - return 1; - } - -void -SHA1_Update(SHA_CTX *c, const void *in, size_t len) -{ - u_int32_t *p; - int ew,ec,sw,sc; - u_int32_t l; - const unsigned char *data = in; - - if (len == 0) return; - - l=(c->Nl+(len<<3))&0xffffffffL; - if (l < c->Nl) /* overflow */ - c->Nh++; - c->Nh+=(len>>29); - c->Nl=l; - - if (c->num != 0) - { - p=c->data; - sw=c->num>>2; - sc=c->num&0x03; - - if ((c->num+len) >= SHA_CBLOCK) - { - l= p[sw]; - M_p_c2nl(data,l,sc); - p[sw++]=l; - for (; swnum); - - sha1_block(c,p,64); - c->num=0; - /* drop through and do the rest */ - } - else - { - c->num+=(int)len; - if ((sc+len) < 4) /* ugly, add char's to a word */ - { - l= p[sw]; - M_p_c2nl_p(data,l,sc,len); - p[sw]=l; - } - else - { - ew=(c->num>>2); - ec=(c->num&0x03); - l= p[sw]; - M_p_c2nl(data,l,sc); - p[sw++]=l; - for (; sw < ew; sw++) - { M_c2nl(data,l); p[sw]=l; } - if (ec) - { - M_c2nl_p(data,l,ec); - p[sw]=l; - } - } - return; - } - } - /* We can only do the following code for assember, the reason - * being that the sha1_block 'C' version changes the values - * in the 'data' array. The assember code avoids this and - * copies it to a local array. I should be able to do this for - * the C version as well.... - */ -#if 1 -#if BYTE_ORDER == BIG_ENDIAN || defined(SHA1_ASM) - if ((((unsigned int)data)%sizeof(u_int32_t)) == 0) - { - sw=len/SHA_CBLOCK; - if (sw) - { - sw*=SHA_CBLOCK; - sha1_block(c,(u_int32_t *)data,sw); - data+=sw; - len-=sw; - } - } -#endif -#endif - /* we now can process the input data in blocks of SHA_CBLOCK - * chars and save the leftovers to c->data. */ - p=c->data; - while (len >= SHA_CBLOCK) - { -#if BYTE_ORDER == BIG_ENDIAN || BYTE_ORDER == LITTLE_ENDIAN - if (p != (u_int32_t *)data) - memcpy(p,data,SHA_CBLOCK); - data+=SHA_CBLOCK; -# if BYTE_ORDER == LITTLE_ENDIAN -# ifndef SHA1_ASM /* Will not happen */ - for (sw=(SHA_LBLOCK/4); sw; sw--) - { - Endian_Reverse32(p[0]); - Endian_Reverse32(p[1]); - Endian_Reverse32(p[2]); - Endian_Reverse32(p[3]); - p+=4; - } - p=c->data; -# endif -# endif -#else - for (sw=(SHA_BLOCK/4); sw; sw--) - { - M_c2nl(data,l); *(p++)=l; - M_c2nl(data,l); *(p++)=l; - M_c2nl(data,l); *(p++)=l; - M_c2nl(data,l); *(p++)=l; - } - p=c->data; -#endif - sha1_block(c,p,64); - len-=SHA_CBLOCK; - } - ec=(int)len; - c->num=ec; - ew=(ec>>2); - ec&=0x03; - - for (sw=0; sw < ew; sw++) - { M_c2nl(data,l); p[sw]=l; } - M_c2nl_p(data,l,ec); - p[sw]=l; - } - -void -SHA1_Transform(SHA_CTX *c, unsigned char *b) - { - u_int32_t p[16]; -#if BYTE_ORDER != BIG_ENDIAN - u_int32_t *q; - int i; -#endif - -#if BYTE_ORDER == BIG_ENDIAN || BYTE_ORDER == LITTLE_ENDIAN - memcpy(p,b,64); -#if BYTE_ORDER == LITTLE_ENDIAN - q=p; - for (i=(SHA_LBLOCK/4); i; i--) - { - Endian_Reverse32(q[0]); - Endian_Reverse32(q[1]); - Endian_Reverse32(q[2]); - Endian_Reverse32(q[3]); - q+=4; - } -#endif -#else - q=p; - for (i=(SHA_LBLOCK/4); i; i--) - { - u_int32_t l; - c2nl(b,l); *(q++)=l; - c2nl(b,l); *(q++)=l; - c2nl(b,l); *(q++)=l; - c2nl(b,l); *(q++)=l; - } -#endif - sha1_block(c,p,64); - } - -#ifndef SHA1_ASM - -void -sha1_block(SHA_CTX *c, const u_int32_t *W, int num) -{ - u_int32_t A,B,C,D,E,T; - u_int32_t X[16]; - - A=c->h0; - B=c->h1; - C=c->h2; - D=c->h3; - E=c->h4; - - for (;;) - { - BODY_00_15( 0,A,B,C,D,E,T,W); - BODY_00_15( 1,T,A,B,C,D,E,W); - BODY_00_15( 2,E,T,A,B,C,D,W); - BODY_00_15( 3,D,E,T,A,B,C,W); - BODY_00_15( 4,C,D,E,T,A,B,W); - BODY_00_15( 5,B,C,D,E,T,A,W); - BODY_00_15( 6,A,B,C,D,E,T,W); - BODY_00_15( 7,T,A,B,C,D,E,W); - BODY_00_15( 8,E,T,A,B,C,D,W); - BODY_00_15( 9,D,E,T,A,B,C,W); - BODY_00_15(10,C,D,E,T,A,B,W); - BODY_00_15(11,B,C,D,E,T,A,W); - BODY_00_15(12,A,B,C,D,E,T,W); - BODY_00_15(13,T,A,B,C,D,E,W); - BODY_00_15(14,E,T,A,B,C,D,W); - BODY_00_15(15,D,E,T,A,B,C,W); - BODY_16_19(16,C,D,E,T,A,B,W,W,W,W); - BODY_16_19(17,B,C,D,E,T,A,W,W,W,W); - BODY_16_19(18,A,B,C,D,E,T,W,W,W,W); - BODY_16_19(19,T,A,B,C,D,E,W,W,W,X); - - BODY_20_31(20,E,T,A,B,C,D,W,W,W,X); - BODY_20_31(21,D,E,T,A,B,C,W,W,W,X); - BODY_20_31(22,C,D,E,T,A,B,W,W,W,X); - BODY_20_31(23,B,C,D,E,T,A,W,W,W,X); - BODY_20_31(24,A,B,C,D,E,T,W,W,X,X); - BODY_20_31(25,T,A,B,C,D,E,W,W,X,X); - BODY_20_31(26,E,T,A,B,C,D,W,W,X,X); - BODY_20_31(27,D,E,T,A,B,C,W,W,X,X); - BODY_20_31(28,C,D,E,T,A,B,W,W,X,X); - BODY_20_31(29,B,C,D,E,T,A,W,W,X,X); - BODY_20_31(30,A,B,C,D,E,T,W,X,X,X); - BODY_20_31(31,T,A,B,C,D,E,W,X,X,X); - BODY_32_39(32,E,T,A,B,C,D,X); - BODY_32_39(33,D,E,T,A,B,C,X); - BODY_32_39(34,C,D,E,T,A,B,X); - BODY_32_39(35,B,C,D,E,T,A,X); - BODY_32_39(36,A,B,C,D,E,T,X); - BODY_32_39(37,T,A,B,C,D,E,X); - BODY_32_39(38,E,T,A,B,C,D,X); - BODY_32_39(39,D,E,T,A,B,C,X); - - BODY_40_59(40,C,D,E,T,A,B,X); - BODY_40_59(41,B,C,D,E,T,A,X); - BODY_40_59(42,A,B,C,D,E,T,X); - BODY_40_59(43,T,A,B,C,D,E,X); - BODY_40_59(44,E,T,A,B,C,D,X); - BODY_40_59(45,D,E,T,A,B,C,X); - BODY_40_59(46,C,D,E,T,A,B,X); - BODY_40_59(47,B,C,D,E,T,A,X); - BODY_40_59(48,A,B,C,D,E,T,X); - BODY_40_59(49,T,A,B,C,D,E,X); - BODY_40_59(50,E,T,A,B,C,D,X); - BODY_40_59(51,D,E,T,A,B,C,X); - BODY_40_59(52,C,D,E,T,A,B,X); - BODY_40_59(53,B,C,D,E,T,A,X); - BODY_40_59(54,A,B,C,D,E,T,X); - BODY_40_59(55,T,A,B,C,D,E,X); - BODY_40_59(56,E,T,A,B,C,D,X); - BODY_40_59(57,D,E,T,A,B,C,X); - BODY_40_59(58,C,D,E,T,A,B,X); - BODY_40_59(59,B,C,D,E,T,A,X); - - BODY_60_79(60,A,B,C,D,E,T,X); - BODY_60_79(61,T,A,B,C,D,E,X); - BODY_60_79(62,E,T,A,B,C,D,X); - BODY_60_79(63,D,E,T,A,B,C,X); - BODY_60_79(64,C,D,E,T,A,B,X); - BODY_60_79(65,B,C,D,E,T,A,X); - BODY_60_79(66,A,B,C,D,E,T,X); - BODY_60_79(67,T,A,B,C,D,E,X); - BODY_60_79(68,E,T,A,B,C,D,X); - BODY_60_79(69,D,E,T,A,B,C,X); - BODY_60_79(70,C,D,E,T,A,B,X); - BODY_60_79(71,B,C,D,E,T,A,X); - BODY_60_79(72,A,B,C,D,E,T,X); - BODY_60_79(73,T,A,B,C,D,E,X); - BODY_60_79(74,E,T,A,B,C,D,X); - BODY_60_79(75,D,E,T,A,B,C,X); - BODY_60_79(76,C,D,E,T,A,B,X); - BODY_60_79(77,B,C,D,E,T,A,X); - BODY_60_79(78,A,B,C,D,E,T,X); - BODY_60_79(79,T,A,B,C,D,E,X); - - c->h0=(c->h0+E)&0xffffffffL; - c->h1=(c->h1+T)&0xffffffffL; - c->h2=(c->h2+A)&0xffffffffL; - c->h3=(c->h3+B)&0xffffffffL; - c->h4=(c->h4+C)&0xffffffffL; - - num-=64; - if (num <= 0) break; - - A=c->h0; - B=c->h1; - C=c->h2; - D=c->h3; - E=c->h4; - - W+=16; - } - } -#endif - -void -SHA1_Final(unsigned char *md, SHA_CTX *c) - { - int i,j; - u_int32_t l; - u_int32_t *p; - static unsigned char end[4]={0x80,0x00,0x00,0x00}; - unsigned char *cp=end; - - /* c->num should definitly have room for at least one more byte. */ - p=c->data; - j=c->num; - i=j>>2; -#ifdef PURIFY - if ((j&0x03) == 0) p[i]=0; -#endif - l=p[i]; - M_p_c2nl(cp,l,j&0x03); - p[i]=l; - i++; - /* i is the next 'undefined word' */ - if (c->num >= SHA_LAST_BLOCK) - { - for (; iNh; - p[SHA_LBLOCK-1]=c->Nl; -#if BYTE_ORDER == LITTLE_ENDIAN && defined(SHA1_ASM) - Endian_Reverse32(p[SHA_LBLOCK-2]); - Endian_Reverse32(p[SHA_LBLOCK-1]); -#endif - sha1_block(c,p,64); - cp=md; - l=c->h0; nl2c(l,cp); - l=c->h1; nl2c(l,cp); - l=c->h2; nl2c(l,cp); - l=c->h3; nl2c(l,cp); - l=c->h4; nl2c(l,cp); - - /* clear stuff, sha1_block may be leaving some stuff on the stack - * but I'm not worried :-) */ - c->num=0; -/* memset((char *)&c,0,sizeof(c));*/ - } - diff --git a/lib/libmd/sha256.h b/lib/libmd/sha256.h index 34d94ada32..e3720bf504 100644 --- a/lib/libmd/sha256.h +++ b/lib/libmd/sha256.h @@ -1,51 +1,50 @@ -/*- - * Copyright 2005 Colin Percival - * All rights reserved. +/* + * Copyright (c) 2016 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/lib/libmd/sha256.h,v 1.2 2006/01/17 15:35:56 phk Exp $ - * $DragonFly: src/lib/libmd/sha256.h,v 1.2 2008/09/11 20:25:34 swildner Exp $ */ - +/* + * libmd shims for openssl + non-conflicting old API functions. + */ #ifndef _SHA256_H_ #define _SHA256_H_ #include - -typedef struct SHA256Context { - uint32_t state[8]; - uint32_t count[2]; - unsigned char buf[64]; -} SHA256_CTX; +#include __BEGIN_DECLS -int SHA256_Init(SHA256_CTX *); -void SHA256_Update(SHA256_CTX *, const void *, size_t); -void SHA256_Final(unsigned char [32], SHA256_CTX *); -char *SHA256_End(SHA256_CTX *, char *); -char *SHA256_File(const char *, char *); -char *SHA256_FileChunk(const char *, char *, off_t, off_t); -char *SHA256_Data(const void *, unsigned int, char *); +char *SHA256_End(SHA256_CTX *, char *); +char *SHA256_File(const char *, char *); +char *SHA256_FileChunk(const char *, char *, off_t, off_t); +char *SHA256_Data(const void *, unsigned int, char *); __END_DECLS -#endif /* !_SHA256_H_ */ +#endif diff --git a/lib/libmd/sha256c.c b/lib/libmd/sha256c.c deleted file mode 100644 index f3665b5ec9..0000000000 --- a/lib/libmd/sha256c.c +++ /dev/null @@ -1,300 +0,0 @@ -/*- - * Copyright 2005 Colin Percival - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/lib/libmd/sha256c.c,v 1.2 2006/01/17 15:35:56 phk Exp $ - */ - -#include -#include - -#include - -#include "sha256.h" - -#if BYTE_ORDER == BIG_ENDIAN - -/* Copy a vector of big-endian uint32_t into a vector of bytes */ -#define be32enc_vect(dst, src, len) \ - memcpy((void *)dst, (const void *)src, (size_t)len) - -/* Copy a vector of bytes into a vector of big-endian uint32_t */ -#define be32dec_vect(dst, src, len) \ - memcpy((void *)dst, (const void *)src, (size_t)len) - -#else /* BYTE_ORDER != BIG_ENDIAN */ - -/* - * Encode a length len/4 vector of (uint32_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 4. - */ -static void -be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len) -{ - size_t i; - - for (i = 0; i < len / 4; i++) - be32enc(dst + i * 4, src[i]); -} - -/* - * Decode a big-endian length len vector of (unsigned char) into a length - * len/4 vector of (uint32_t). Assumes len is a multiple of 4. - */ -static void -be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len) -{ - size_t i; - - for (i = 0; i < len / 4; i++) - dst[i] = be32dec(src + i * 4); -} - -#endif /* BYTE_ORDER != BIG_ENDIAN */ - -/* Elementary functions used by SHA256 */ -#define Ch(x, y, z) ((x & (y ^ z)) ^ z) -#define Maj(x, y, z) ((x & (y | z)) | (y & z)) -#define SHR(x, n) (x >> n) -#define ROTR(x, n) ((x >> n) | (x << (32 - n))) -#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) -#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) -#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3)) -#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10)) - -/* SHA256 round function */ -#define RND(a, b, c, d, e, f, g, h, k) \ - t0 = h + S1(e) + Ch(e, f, g) + k; \ - t1 = S0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; - -/* Adjusted round function for rotating state */ -#define RNDr(S, W, i, k) \ - RND(S[(64 - i) % 8], S[(65 - i) % 8], \ - S[(66 - i) % 8], S[(67 - i) % 8], \ - S[(68 - i) % 8], S[(69 - i) % 8], \ - S[(70 - i) % 8], S[(71 - i) % 8], \ - W[i] + k) - -/* - * SHA256 block compression function. The 256-bit state is transformed via - * the 512-bit input block to produce a new state. - */ -static void -SHA256_Transform(uint32_t * state, const unsigned char block[64]) -{ - uint32_t W[64]; - uint32_t S[8]; - uint32_t t0, t1; - int i; - - /* 1. Prepare message schedule W. */ - be32dec_vect(W, block, 64); - for (i = 16; i < 64; i++) - W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; - - /* 2. Initialize working variables. */ - memcpy(S, state, 32); - - /* 3. Mix. */ - RNDr(S, W, 0, 0x428a2f98); - RNDr(S, W, 1, 0x71374491); - RNDr(S, W, 2, 0xb5c0fbcf); - RNDr(S, W, 3, 0xe9b5dba5); - RNDr(S, W, 4, 0x3956c25b); - RNDr(S, W, 5, 0x59f111f1); - RNDr(S, W, 6, 0x923f82a4); - RNDr(S, W, 7, 0xab1c5ed5); - RNDr(S, W, 8, 0xd807aa98); - RNDr(S, W, 9, 0x12835b01); - RNDr(S, W, 10, 0x243185be); - RNDr(S, W, 11, 0x550c7dc3); - RNDr(S, W, 12, 0x72be5d74); - RNDr(S, W, 13, 0x80deb1fe); - RNDr(S, W, 14, 0x9bdc06a7); - RNDr(S, W, 15, 0xc19bf174); - RNDr(S, W, 16, 0xe49b69c1); - RNDr(S, W, 17, 0xefbe4786); - RNDr(S, W, 18, 0x0fc19dc6); - RNDr(S, W, 19, 0x240ca1cc); - RNDr(S, W, 20, 0x2de92c6f); - RNDr(S, W, 21, 0x4a7484aa); - RNDr(S, W, 22, 0x5cb0a9dc); - RNDr(S, W, 23, 0x76f988da); - RNDr(S, W, 24, 0x983e5152); - RNDr(S, W, 25, 0xa831c66d); - RNDr(S, W, 26, 0xb00327c8); - RNDr(S, W, 27, 0xbf597fc7); - RNDr(S, W, 28, 0xc6e00bf3); - RNDr(S, W, 29, 0xd5a79147); - RNDr(S, W, 30, 0x06ca6351); - RNDr(S, W, 31, 0x14292967); - RNDr(S, W, 32, 0x27b70a85); - RNDr(S, W, 33, 0x2e1b2138); - RNDr(S, W, 34, 0x4d2c6dfc); - RNDr(S, W, 35, 0x53380d13); - RNDr(S, W, 36, 0x650a7354); - RNDr(S, W, 37, 0x766a0abb); - RNDr(S, W, 38, 0x81c2c92e); - RNDr(S, W, 39, 0x92722c85); - RNDr(S, W, 40, 0xa2bfe8a1); - RNDr(S, W, 41, 0xa81a664b); - RNDr(S, W, 42, 0xc24b8b70); - RNDr(S, W, 43, 0xc76c51a3); - RNDr(S, W, 44, 0xd192e819); - RNDr(S, W, 45, 0xd6990624); - RNDr(S, W, 46, 0xf40e3585); - RNDr(S, W, 47, 0x106aa070); - RNDr(S, W, 48, 0x19a4c116); - RNDr(S, W, 49, 0x1e376c08); - RNDr(S, W, 50, 0x2748774c); - RNDr(S, W, 51, 0x34b0bcb5); - RNDr(S, W, 52, 0x391c0cb3); - RNDr(S, W, 53, 0x4ed8aa4a); - RNDr(S, W, 54, 0x5b9cca4f); - RNDr(S, W, 55, 0x682e6ff3); - RNDr(S, W, 56, 0x748f82ee); - RNDr(S, W, 57, 0x78a5636f); - RNDr(S, W, 58, 0x84c87814); - RNDr(S, W, 59, 0x8cc70208); - RNDr(S, W, 60, 0x90befffa); - RNDr(S, W, 61, 0xa4506ceb); - RNDr(S, W, 62, 0xbef9a3f7); - RNDr(S, W, 63, 0xc67178f2); - - /* 4. Mix local working variables into global state */ - for (i = 0; i < 8; i++) - state[i] += S[i]; -} - -static unsigned char PAD[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* Add padding and terminating bit-count. */ -static void -SHA256_Pad(SHA256_CTX * ctx) -{ - unsigned char len[8]; - uint32_t r, plen; - - /* - * Convert length to a vector of bytes -- we do this now rather - * than later because the length will change after we pad. - */ - be32enc_vect(len, ctx->count, 8); - - /* Add 1--64 bytes so that the resulting length is 56 mod 64 */ - r = (ctx->count[1] >> 3) & 0x3f; - plen = (r < 56) ? (56 - r) : (120 - r); - SHA256_Update(ctx, PAD, (size_t)plen); - - /* Add the terminating bit-count */ - SHA256_Update(ctx, len, 8); -} - -/* SHA-256 initialization. Begins a SHA-256 operation. */ -int -SHA256_Init(SHA256_CTX * ctx) -{ - - /* Zero bits processed so far */ - ctx->count[0] = ctx->count[1] = 0; - - /* Magic initialization constants */ - ctx->state[0] = 0x6A09E667; - ctx->state[1] = 0xBB67AE85; - ctx->state[2] = 0x3C6EF372; - ctx->state[3] = 0xA54FF53A; - ctx->state[4] = 0x510E527F; - ctx->state[5] = 0x9B05688C; - ctx->state[6] = 0x1F83D9AB; - ctx->state[7] = 0x5BE0CD19; - return 1; -} - -/* Add bytes into the hash */ -void -SHA256_Update(SHA256_CTX * ctx, const void *in, size_t len) -{ - uint32_t bitlen[2]; - uint32_t r; - const unsigned char *src = in; - - /* Number of bytes left in the buffer from previous updates */ - r = (ctx->count[1] >> 3) & 0x3f; - - /* Convert the length into a number of bits */ - bitlen[1] = ((uint32_t)len) << 3; - bitlen[0] = (uint32_t)(len >> 29); - - /* Update number of bits */ - if ((ctx->count[1] += bitlen[1]) < bitlen[1]) - ctx->count[0]++; - ctx->count[0] += bitlen[0]; - - /* Handle the case where we don't need to perform any transforms */ - if (len < 64 - r) { - memcpy(&ctx->buf[r], src, len); - return; - } - - /* Finish the current block */ - memcpy(&ctx->buf[r], src, 64 - r); - SHA256_Transform(ctx->state, ctx->buf); - src += 64 - r; - len -= 64 - r; - - /* Perform complete blocks */ - while (len >= 64) { - SHA256_Transform(ctx->state, src); - src += 64; - len -= 64; - } - - /* Copy left over data into buffer */ - memcpy(ctx->buf, src, len); -} - -/* - * SHA-256 finalization. Pads the input data, exports the hash value, - * and clears the context state. - */ -void -SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx) -{ - - /* Add padding */ - SHA256_Pad(ctx); - - /* Write the hash */ - be32enc_vect(digest, ctx->state, 32); - - /* Clear the context state */ - memset((void *)ctx, 0, sizeof(*ctx)); -} diff --git a/lib/libmd/sha512.h b/lib/libmd/sha512.h index 1871a20115..a7b398aa65 100644 --- a/lib/libmd/sha512.h +++ b/lib/libmd/sha512.h @@ -1,62 +1,57 @@ -/*- - * Copyright 2005 Colin Percival - * All rights reserved. +/* + * Copyright (c) 2016 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/lib/libmd/sha256.h,v 1.2 2006/01/17 15:35:56 phk Exp $ - * $DragonFly: src/lib/libmd/sha256.h,v 1.2 2008/09/11 20:25:34 swildner Exp $ */ - +/* + * libmd shims for openssl + non-conflicting old API functions. + */ #ifndef _SHA512_H_ #define _SHA512_H_ #include +#include + #define SHA384_BLOCK_LENGTH 128 -#define SHA384_DIGEST_LENGTH 48 #define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) #define SHA512_BLOCK_LENGTH 128 -#define SHA512_DIGEST_LENGTH 64 #define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) -typedef struct _SHA512_CTX { - u_int64_t state[8]; - u_int64_t bitcount[2]; - u_int8_t buffer[SHA512_BLOCK_LENGTH]; -} SHA512_CTX; - -typedef SHA512_CTX SHA384_CTX; +#define SHA384_CTX SHA512_CTX __BEGIN_DECLS -int SHA384_Init(SHA384_CTX *); -void SHA384_Update(SHA384_CTX *, const u_int8_t *, size_t); -void SHA384_Final(u_int8_t[SHA384_DIGEST_LENGTH], SHA384_CTX *); -int SHA512_Init(SHA512_CTX*); -void SHA512_Update(SHA512_CTX*, const void *, size_t); -void SHA512_Final(unsigned char [SHA512_DIGEST_LENGTH], SHA512_CTX *); -char* SHA512_End(SHA512_CTX *, char *); -char *SHA512_Data(const void *, unsigned int, char *); -char *SHA512_File(const char *, char *); -char *SHA512_FileChunk(const char *, char *, off_t, off_t); +char *SHA512_End(SHA512_CTX *, char *); +char *SHA512_Data(const void *, unsigned int, char *); +char *SHA512_File(const char *, char *); +char *SHA512_FileChunk(const char *, char *, off_t, off_t); __END_DECLS -#endif /* !_SHA512_H_ */ +#endif diff --git a/lib/libmd/sha512c.c b/lib/libmd/sha512c.c deleted file mode 100644 index 5eb50db9ca..0000000000 --- a/lib/libmd/sha512c.c +++ /dev/null @@ -1,500 +0,0 @@ -/* - * sha2.c - * - * Version 1.0.0beta1 - * - * Written by Aaron D. Gifford - * - * Copyright 2000 Aaron D. Gifford. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the names of contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "sha512.h" - -#define SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16) - -/* - * Macro for incrementally adding the unsigned 64-bit integer n to the - * unsigned 128-bit integer (represented using a two-element array of - * 64-bit words): - */ -#define ADDINC128(w,n) { \ - (w)[0] += (sha2_word64)(n); \ - if ((w)[0] < (n)) { \ - (w)[1]++; \ - } \ -} - -/*** ENDIAN REVERSAL MACROS *******************************************/ -#if BYTE_ORDER == LITTLE_ENDIAN -#define REVERSE32(w,x) { \ - sha2_word32 tmp = (w); \ - tmp = (tmp >> 16) | (tmp << 16); \ - (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \ -} -#define REVERSE64(w,x) { \ - sha2_word64 tmp = (w); \ - tmp = (tmp >> 32) | (tmp << 32); \ - tmp = ((tmp & 0xff00ff00ff00ff00ULL) >> 8) | \ - ((tmp & 0x00ff00ff00ff00ffULL) << 8); \ - (x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \ - ((tmp & 0x0000ffff0000ffffULL) << 16); \ -} -#endif /* BYTE_ORDER == LITTLE_ENDIAN */ - -/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */ -#define R(b,x) ((x) >> (b)) -/* 32-bit Rotate-right (used in SHA-256): */ -#define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) -/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */ -#define S64(b,x) (((x) >> (b)) | ((x) << (64 - (b)))) - -/* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */ -#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) -#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - -/* Four of six logical functions used in SHA-384 and SHA-512: */ -#define Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x))) -#define Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x))) -#define sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x))) -#define sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x))) - -typedef u_int8_t sha2_byte; /* Exactly 1 byte */ -typedef u_int32_t sha2_word32; /* Exactly 4 bytes */ -typedef u_int64_t sha2_word64; /* Exactly 8 bytes */ - -/* Initial hash value H for SHA-384 */ -static const sha2_word64 sha384_initial_hash_value[8] = { - 0xcbbb9d5dc1059ed8ULL, - 0x629a292a367cd507ULL, - 0x9159015a3070dd17ULL, - 0x152fecd8f70e5939ULL, - 0x67332667ffc00b31ULL, - 0x8eb44a8768581511ULL, - 0xdb0c2e0d64f98fa7ULL, - 0x47b5481dbefa4fa4ULL -}; - -/* Initial hash value H for SHA-512 */ -static const sha2_word64 sha512_initial_hash_value[8] = { - 0x6a09e667f3bcc908ULL, - 0xbb67ae8584caa73bULL, - 0x3c6ef372fe94f82bULL, - 0xa54ff53a5f1d36f1ULL, - 0x510e527fade682d1ULL, - 0x9b05688c2b3e6c1fULL, - 0x1f83d9abfb41bd6bULL, - 0x5be0cd19137e2179ULL -}; - -#if 0 -/* - * Constant used by SHA256/384/512_End() functions for converting the - * digest to a readable hexadecimal character string: - */ -static const char *sha2_hex_digits = "0123456789abcdef"; -#endif - -/* Hash constant words K for SHA-384 and SHA-512: */ -static const sha2_word64 K512[80] = { - 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, - 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, - 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, - 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, - 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, - 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, - 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, - 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, - 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, - 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, - 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, - 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, - 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, - 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, - 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, - 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, - 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, - 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, - 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, - 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, - 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, - 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, - 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, - 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, - 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, - 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, - 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, - 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, - 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, - 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, - 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, - 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, - 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, - 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, - 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, - 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, - 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, - 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, - 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, - 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL -}; -/*** SHA-512: *********************************************************/ -int SHA512_Init(SHA512_CTX* context) { - if (context == NULL) { - return 0; - } - bcopy(sha512_initial_hash_value, context->state, SHA512_DIGEST_LENGTH); - bzero(context->buffer, SHA512_BLOCK_LENGTH); - context->bitcount[0] = context->bitcount[1] = 0; - return 1; -} - -/* Unrolled SHA-512 round macros: */ -#if BYTE_ORDER == LITTLE_ENDIAN - -#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ - REVERSE64(*data++, W512[j]); \ - T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ - K512[j] + W512[j]; \ - (d) += T1, \ - (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \ - j++ - - -#else /* BYTE_ORDER == LITTLE_ENDIAN */ - -#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ - T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ - K512[j] + (W512[j] = *data++); \ - (d) += T1; \ - (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ - j++ - -#endif /* BYTE_ORDER == LITTLE_ENDIAN */ - -#define ROUND512(a,b,c,d,e,f,g,h) \ - s0 = W512[(j+1)&0x0f]; \ - s0 = sigma0_512(s0); \ - s1 = W512[(j+14)&0x0f]; \ - s1 = sigma1_512(s1); \ - T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \ - (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \ - (d) += T1; \ - (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ - j++ -static -void -SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { - sha2_word64 a, b, c, d, e, f, g, h, s0, s1; - sha2_word64 T1 = 0, /*T2 = 0, */*W512 = (sha2_word64*)context->buffer; - int j; - - /* Initialize registers with the prev. intermediate value */ - a = context->state[0]; - b = context->state[1]; - c = context->state[2]; - d = context->state[3]; - e = context->state[4]; - f = context->state[5]; - g = context->state[6]; - h = context->state[7]; - - j = 0; - do { - ROUND512_0_TO_15(a,b,c,d,e,f,g,h); - ROUND512_0_TO_15(h,a,b,c,d,e,f,g); - ROUND512_0_TO_15(g,h,a,b,c,d,e,f); - ROUND512_0_TO_15(f,g,h,a,b,c,d,e); - ROUND512_0_TO_15(e,f,g,h,a,b,c,d); - ROUND512_0_TO_15(d,e,f,g,h,a,b,c); - ROUND512_0_TO_15(c,d,e,f,g,h,a,b); - ROUND512_0_TO_15(b,c,d,e,f,g,h,a); - } while (j < 16); - - /* Now for the remaining rounds up to 79: */ - do { - ROUND512(a,b,c,d,e,f,g,h); - ROUND512(h,a,b,c,d,e,f,g); - ROUND512(g,h,a,b,c,d,e,f); - ROUND512(f,g,h,a,b,c,d,e); - ROUND512(e,f,g,h,a,b,c,d); - ROUND512(d,e,f,g,h,a,b,c); - ROUND512(c,d,e,f,g,h,a,b); - ROUND512(b,c,d,e,f,g,h,a); - } while (j < 80); - - /* Compute the current intermediate hash value */ - context->state[0] += a; - context->state[1] += b; - context->state[2] += c; - context->state[3] += d; - context->state[4] += e; - context->state[5] += f; - context->state[6] += g; - context->state[7] += h; - - /* Clean up */ - a = b = c = d = e = f = g = h = T1 = 0; -} - -void SHA512_Update(SHA512_CTX* context, const void *data_arg, size_t len) { - const sha2_byte *data = (const sha2_byte *)data_arg; - unsigned int freespace, usedspace; - - if (len == 0) { - /* Calling with no data is valid - we do nothing */ - return; - } - - /* Sanity check: */ - assert(context != NULL && data != NULL); - - usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; - if (usedspace > 0) { - /* Calculate how much free space is available in the buffer */ - freespace = SHA512_BLOCK_LENGTH - usedspace; - - if (len >= freespace) { - /* Fill the buffer completely and process it */ - bcopy(data, &context->buffer[usedspace], freespace); - ADDINC128(context->bitcount, freespace << 3); - len -= freespace; - data += freespace; - SHA512_Transform(context, (sha2_word64*)context->buffer); - } else { - /* The buffer is not yet full */ - bcopy(data, &context->buffer[usedspace], len); - ADDINC128(context->bitcount, len << 3); - /* Clean up: */ - usedspace = freespace = 0; - return; - } - } - while (len >= SHA512_BLOCK_LENGTH) { - /* Process as many complete blocks as we can */ - SHA512_Transform(context, (const sha2_word64*)data); - ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3); - len -= SHA512_BLOCK_LENGTH; - data += SHA512_BLOCK_LENGTH; - } - if (len > 0) { - /* There's left-overs, so save 'em */ - bcopy(data, context->buffer, len); - ADDINC128(context->bitcount, len << 3); - } - /* Clean up: */ - usedspace = freespace = 0; -} - -static -void SHA512_Last(SHA512_CTX* context) { - unsigned int usedspace; - - usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; -#if BYTE_ORDER == LITTLE_ENDIAN - /* Convert FROM host byte order */ - REVERSE64(context->bitcount[0],context->bitcount[0]); - REVERSE64(context->bitcount[1],context->bitcount[1]); -#endif - if (usedspace > 0) { - /* Begin padding with a 1 bit: */ - context->buffer[usedspace++] = 0x80; - - if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) { - /* Set-up for the last transform: */ - bzero(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace); - } else { - if (usedspace < SHA512_BLOCK_LENGTH) { - bzero(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace); - } - /* Do second-to-last transform: */ - SHA512_Transform(context, (sha2_word64*)context->buffer); - - /* And set-up for the last transform: */ - bzero(context->buffer, SHA512_BLOCK_LENGTH - 2); - } - } else { - /* Prepare for final transform: */ - bzero(context->buffer, SHA512_SHORT_BLOCK_LENGTH); - - /* Begin padding with a 1 bit: */ - *context->buffer = 0x80; - } - /* Store the length of input data (in bits): */ - *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; - *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; - - /* Final transform: */ - SHA512_Transform(context, (sha2_word64*)context->buffer); -} - -void SHA512_Final(unsigned char digest[], SHA512_CTX* context) { - sha2_word64 *d = (sha2_word64*)digest; - - /* Sanity check: */ - assert(context != NULL); - - /* If no digest buffer is passed, we don't bother doing this: */ - if (digest != NULL) { - SHA512_Last(context); - - /* Save the hash data for output: */ -#if BYTE_ORDER == LITTLE_ENDIAN - { - /* Convert TO host byte order */ - int j; - for (j = 0; j < 8; j++) { - REVERSE64(context->state[j],context->state[j]); - *d++ = context->state[j]; - } - } -#else - bcopy(context->state, d, SHA512_DIGEST_LENGTH); -#endif - } - - /* Zero out state data */ - bzero(context, sizeof(*context)); -} - -#if 0 -char *SHA512_End(SHA512_CTX* context, char *buffer) { - sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest; - int i; - - /* Sanity check: */ - assert(context != NULL); - - if (buffer != NULL) { - SHA512_Final(digest, context); - - for (i = 0; i < SHA512_DIGEST_LENGTH; i++) { - *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; - *buffer++ = sha2_hex_digits[*d & 0x0f]; - d++; - } - *buffer = (char)0; - } else { - bzero(context, sizeof(*context)); - } - bzero(digest, SHA512_DIGEST_LENGTH); - return buffer; -} - -char* SHA512_Data(const void *data, size_t len, char *digest) { - SHA512_CTX context; - - SHA512_Init(&context); - SHA512_Update(&context, data, len); - return SHA512_End(&context, digest); -} -#endif - - -/*** SHA-384: *********************************************************/ -int SHA384_Init(SHA384_CTX* context) { - if (context == NULL) { - return 0; - } - bcopy(sha384_initial_hash_value, context->state, SHA512_DIGEST_LENGTH); - bzero(context->buffer, SHA384_BLOCK_LENGTH); - context->bitcount[0] = context->bitcount[1] = 0; - return 1; -} - -void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { - SHA512_Update((SHA512_CTX*)context, data, len); -} - -void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { - sha2_word64 *d = (sha2_word64*)digest; - - /* Sanity check: */ - assert(context != NULL); - - /* If no digest buffer is passed, we don't bother doing this: */ - if (digest != NULL) { - SHA512_Last((SHA512_CTX*)context); - - /* Save the hash data for output: */ -#if BYTE_ORDER == LITTLE_ENDIAN - { - /* Convert TO host byte order */ - int j; - for (j = 0; j < 6; j++) { - REVERSE64(context->state[j],context->state[j]); - *d++ = context->state[j]; - } - } -#else - bcopy(context->state, d, SHA384_DIGEST_LENGTH); -#endif - } - - /* Zero out state data */ - bzero(context, sizeof(*context)); -} - -#if 0 -char *SHA384_End(SHA384_CTX* context, char buffer[]) { - sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest; - int i; - - /* Sanity check: */ - assert(context != NULL); - - if (buffer != NULL) { - SHA384_Final(digest, context); - - for (i = 0; i < SHA384_DIGEST_LENGTH; i++) { - *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; - *buffer++ = sha2_hex_digits[*d & 0x0f]; - d++; - } - *buffer = (char)0; - } else { - bzero(context, sizeof(*context)); - } - bzero(digest, SHA384_DIGEST_LENGTH); - return buffer; -} - -char* SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) { - SHA384_CTX context; - - SHA384_Init(&context); - SHA384_Update(&context, data, len); - return SHA384_End(&context, digest); -} -#endif diff --git a/lib/libopie/Makefile b/lib/libopie/Makefile index 927acd4adc..4a4bbc36f0 100644 --- a/lib/libopie/Makefile +++ b/lib/libopie/Makefile @@ -31,6 +31,7 @@ CFLAGS+= -DINSECURE_OVERRIDE -DPATH_ACCESS_FILE=${ACCESSFILE} LDADD+= -lmd DPADD+= ${LIBMD} +#LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv MAN= ${OPIE_DIST}/opie.4 ${OPIE_DIST}/opiekeys.5 ${OPIE_DIST}/opieaccess.5 diff --git a/secure/lib/librecrypto/Makefile b/lib/librecrypto/Makefile similarity index 100% rename from secure/lib/librecrypto/Makefile rename to lib/librecrypto/Makefile diff --git a/secure/lib/librecrypto/Makefile.inc b/lib/librecrypto/Makefile.inc similarity index 86% rename from secure/lib/librecrypto/Makefile.inc rename to lib/librecrypto/Makefile.inc index 2d1230f346..4261e629fe 100644 --- a/secure/lib/librecrypto/Makefile.inc +++ b/lib/librecrypto/Makefile.inc @@ -1,7 +1,13 @@ OPENSSL_VER= 2.4.2 OPENSSL_DATE= 2016-08-01 +.if exists (${.CURDIR}/../../Makefile.inc1) +LIBRESSL_SRC= ${.CURDIR}/../../crypto/libressl +.elif exists (${.CURDIR}/../../../Makefile.inc1) LIBRESSL_SRC= ${.CURDIR}/../../../crypto/libressl +.else +.error "Cannot find base directory" +.endif LCRYPTO_SRC= ${LIBRESSL_SRC}/crypto LSSL_SRC= ${LIBRESSL_SRC}/ssl diff --git a/secure/lib/libressl/Makefile b/lib/libressl/Makefile similarity index 100% rename from secure/lib/libressl/Makefile rename to lib/libressl/Makefile diff --git a/secure/lib/libssh/Makefile b/lib/libssh/Makefile similarity index 100% rename from secure/lib/libssh/Makefile rename to lib/libssh/Makefile diff --git a/secure/lib/libssh/Makefile.etc b/lib/libssh/Makefile.etc similarity index 100% rename from secure/lib/libssh/Makefile.etc rename to lib/libssh/Makefile.etc diff --git a/secure/lib/libssh/config.h b/lib/libssh/config.h similarity index 100% rename from secure/lib/libssh/config.h rename to lib/libssh/config.h diff --git a/secure/lib/libssl/Makefile b/lib/libssl/Makefile similarity index 100% rename from secure/lib/libssl/Makefile rename to lib/libssl/Makefile diff --git a/secure/lib/libssl/Makefile.man b/lib/libssl/Makefile.man similarity index 100% rename from secure/lib/libssl/Makefile.man rename to lib/libssl/Makefile.man diff --git a/secure/lib/libssl/man/SSL_CIPHER_get_name.3 b/lib/libssl/man/SSL_CIPHER_get_name.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CIPHER_get_name.3 rename to lib/libssl/man/SSL_CIPHER_get_name.3 diff --git a/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 b/lib/libssl/man/SSL_COMP_add_compression_method.3 similarity index 100% rename from secure/lib/libssl/man/SSL_COMP_add_compression_method.3 rename to lib/libssl/man/SSL_COMP_add_compression_method.3 diff --git a/secure/lib/libssl/man/SSL_CONF_CTX_new.3 b/lib/libssl/man/SSL_CONF_CTX_new.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CONF_CTX_new.3 rename to lib/libssl/man/SSL_CONF_CTX_new.3 diff --git a/secure/lib/libssl/man/SSL_CONF_CTX_set1_prefix.3 b/lib/libssl/man/SSL_CONF_CTX_set1_prefix.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CONF_CTX_set1_prefix.3 rename to lib/libssl/man/SSL_CONF_CTX_set1_prefix.3 diff --git a/secure/lib/libssl/man/SSL_CONF_CTX_set_flags.3 b/lib/libssl/man/SSL_CONF_CTX_set_flags.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CONF_CTX_set_flags.3 rename to lib/libssl/man/SSL_CONF_CTX_set_flags.3 diff --git a/secure/lib/libssl/man/SSL_CONF_CTX_set_ssl_ctx.3 b/lib/libssl/man/SSL_CONF_CTX_set_ssl_ctx.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CONF_CTX_set_ssl_ctx.3 rename to lib/libssl/man/SSL_CONF_CTX_set_ssl_ctx.3 diff --git a/secure/lib/libssl/man/SSL_CONF_cmd.3 b/lib/libssl/man/SSL_CONF_cmd.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CONF_cmd.3 rename to lib/libssl/man/SSL_CONF_cmd.3 diff --git a/secure/lib/libssl/man/SSL_CONF_cmd_argv.3 b/lib/libssl/man/SSL_CONF_cmd_argv.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CONF_cmd_argv.3 rename to lib/libssl/man/SSL_CONF_cmd_argv.3 diff --git a/secure/lib/libssl/man/SSL_CTX_add1_chain_cert.3 b/lib/libssl/man/SSL_CTX_add1_chain_cert.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_add1_chain_cert.3 rename to lib/libssl/man/SSL_CTX_add1_chain_cert.3 diff --git a/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 b/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 rename to lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 diff --git a/secure/lib/libssl/man/SSL_CTX_add_session.3 b/lib/libssl/man/SSL_CTX_add_session.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_add_session.3 rename to lib/libssl/man/SSL_CTX_add_session.3 diff --git a/secure/lib/libssl/man/SSL_CTX_ctrl.3 b/lib/libssl/man/SSL_CTX_ctrl.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_ctrl.3 rename to lib/libssl/man/SSL_CTX_ctrl.3 diff --git a/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 b/lib/libssl/man/SSL_CTX_flush_sessions.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_flush_sessions.3 rename to lib/libssl/man/SSL_CTX_flush_sessions.3 diff --git a/secure/lib/libssl/man/SSL_CTX_free.3 b/lib/libssl/man/SSL_CTX_free.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_free.3 rename to lib/libssl/man/SSL_CTX_free.3 diff --git a/secure/lib/libssl/man/SSL_CTX_get0_param.3 b/lib/libssl/man/SSL_CTX_get0_param.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_get0_param.3 rename to lib/libssl/man/SSL_CTX_get0_param.3 diff --git a/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 b/lib/libssl/man/SSL_CTX_get_ex_new_index.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 rename to lib/libssl/man/SSL_CTX_get_ex_new_index.3 diff --git a/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 b/lib/libssl/man/SSL_CTX_get_verify_mode.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 rename to lib/libssl/man/SSL_CTX_get_verify_mode.3 diff --git a/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 b/lib/libssl/man/SSL_CTX_load_verify_locations.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 rename to lib/libssl/man/SSL_CTX_load_verify_locations.3 diff --git a/secure/lib/libssl/man/SSL_CTX_new.3 b/lib/libssl/man/SSL_CTX_new.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_new.3 rename to lib/libssl/man/SSL_CTX_new.3 diff --git a/secure/lib/libssl/man/SSL_CTX_sess_number.3 b/lib/libssl/man/SSL_CTX_sess_number.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_sess_number.3 rename to lib/libssl/man/SSL_CTX_sess_number.3 diff --git a/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 b/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 rename to lib/libssl/man/SSL_CTX_sess_set_cache_size.3 diff --git a/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 b/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 rename to lib/libssl/man/SSL_CTX_sess_set_get_cb.3 diff --git a/secure/lib/libssl/man/SSL_CTX_sessions.3 b/lib/libssl/man/SSL_CTX_sessions.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_sessions.3 rename to lib/libssl/man/SSL_CTX_sessions.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set1_curves.3 b/lib/libssl/man/SSL_CTX_set1_curves.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set1_curves.3 rename to lib/libssl/man/SSL_CTX_set1_curves.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set1_verify_cert_store.3 b/lib/libssl/man/SSL_CTX_set1_verify_cert_store.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set1_verify_cert_store.3 rename to lib/libssl/man/SSL_CTX_set1_verify_cert_store.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 b/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 rename to lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_cert_cb.3 b/lib/libssl/man/SSL_CTX_set_cert_cb.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_cert_cb.3 rename to lib/libssl/man/SSL_CTX_set_cert_cb.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 b/lib/libssl/man/SSL_CTX_set_cert_store.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_cert_store.3 rename to lib/libssl/man/SSL_CTX_set_cert_store.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 b/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 rename to lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 b/lib/libssl/man/SSL_CTX_set_cipher_list.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 rename to lib/libssl/man/SSL_CTX_set_cipher_list.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 b/lib/libssl/man/SSL_CTX_set_client_CA_list.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 rename to lib/libssl/man/SSL_CTX_set_client_CA_list.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 b/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 rename to lib/libssl/man/SSL_CTX_set_client_cert_cb.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_custom_cli_ext.3 b/lib/libssl/man/SSL_CTX_set_custom_cli_ext.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_custom_cli_ext.3 rename to lib/libssl/man/SSL_CTX_set_custom_cli_ext.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 b/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 rename to lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 b/lib/libssl/man/SSL_CTX_set_generate_session_id.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 rename to lib/libssl/man/SSL_CTX_set_generate_session_id.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 b/lib/libssl/man/SSL_CTX_set_info_callback.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_info_callback.3 rename to lib/libssl/man/SSL_CTX_set_info_callback.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 b/lib/libssl/man/SSL_CTX_set_max_cert_list.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 rename to lib/libssl/man/SSL_CTX_set_max_cert_list.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_mode.3 b/lib/libssl/man/SSL_CTX_set_mode.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_mode.3 rename to lib/libssl/man/SSL_CTX_set_mode.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 b/lib/libssl/man/SSL_CTX_set_msg_callback.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 rename to lib/libssl/man/SSL_CTX_set_msg_callback.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_options.3 b/lib/libssl/man/SSL_CTX_set_options.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_options.3 rename to lib/libssl/man/SSL_CTX_set_options.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 b/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 rename to lib/libssl/man/SSL_CTX_set_psk_client_callback.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 b/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 rename to lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_read_ahead.3 b/lib/libssl/man/SSL_CTX_set_read_ahead.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_read_ahead.3 rename to lib/libssl/man/SSL_CTX_set_read_ahead.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 b/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 rename to lib/libssl/man/SSL_CTX_set_session_cache_mode.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 b/lib/libssl/man/SSL_CTX_set_session_id_context.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 rename to lib/libssl/man/SSL_CTX_set_session_id_context.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 b/lib/libssl/man/SSL_CTX_set_ssl_version.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 rename to lib/libssl/man/SSL_CTX_set_ssl_version.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_timeout.3 b/lib/libssl/man/SSL_CTX_set_timeout.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_timeout.3 rename to lib/libssl/man/SSL_CTX_set_timeout.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 b/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 rename to lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 b/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 rename to lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 b/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 rename to lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 b/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 rename to lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 diff --git a/secure/lib/libssl/man/SSL_CTX_set_verify.3 b/lib/libssl/man/SSL_CTX_set_verify.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_set_verify.3 rename to lib/libssl/man/SSL_CTX_set_verify.3 diff --git a/secure/lib/libssl/man/SSL_CTX_use_certificate.3 b/lib/libssl/man/SSL_CTX_use_certificate.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_use_certificate.3 rename to lib/libssl/man/SSL_CTX_use_certificate.3 diff --git a/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 b/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 rename to lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 diff --git a/secure/lib/libssl/man/SSL_CTX_use_serverinfo.3 b/lib/libssl/man/SSL_CTX_use_serverinfo.3 similarity index 100% rename from secure/lib/libssl/man/SSL_CTX_use_serverinfo.3 rename to lib/libssl/man/SSL_CTX_use_serverinfo.3 diff --git a/secure/lib/libssl/man/SSL_SESSION_free.3 b/lib/libssl/man/SSL_SESSION_free.3 similarity index 100% rename from secure/lib/libssl/man/SSL_SESSION_free.3 rename to lib/libssl/man/SSL_SESSION_free.3 diff --git a/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 b/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 similarity index 100% rename from secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 rename to lib/libssl/man/SSL_SESSION_get_ex_new_index.3 diff --git a/secure/lib/libssl/man/SSL_SESSION_get_time.3 b/lib/libssl/man/SSL_SESSION_get_time.3 similarity index 100% rename from secure/lib/libssl/man/SSL_SESSION_get_time.3 rename to lib/libssl/man/SSL_SESSION_get_time.3 diff --git a/secure/lib/libssl/man/SSL_accept.3 b/lib/libssl/man/SSL_accept.3 similarity index 100% rename from secure/lib/libssl/man/SSL_accept.3 rename to lib/libssl/man/SSL_accept.3 diff --git a/secure/lib/libssl/man/SSL_alert_type_string.3 b/lib/libssl/man/SSL_alert_type_string.3 similarity index 100% rename from secure/lib/libssl/man/SSL_alert_type_string.3 rename to lib/libssl/man/SSL_alert_type_string.3 diff --git a/secure/lib/libssl/man/SSL_check_chain.3 b/lib/libssl/man/SSL_check_chain.3 similarity index 100% rename from secure/lib/libssl/man/SSL_check_chain.3 rename to lib/libssl/man/SSL_check_chain.3 diff --git a/secure/lib/libssl/man/SSL_clear.3 b/lib/libssl/man/SSL_clear.3 similarity index 100% rename from secure/lib/libssl/man/SSL_clear.3 rename to lib/libssl/man/SSL_clear.3 diff --git a/secure/lib/libssl/man/SSL_connect.3 b/lib/libssl/man/SSL_connect.3 similarity index 100% rename from secure/lib/libssl/man/SSL_connect.3 rename to lib/libssl/man/SSL_connect.3 diff --git a/secure/lib/libssl/man/SSL_do_handshake.3 b/lib/libssl/man/SSL_do_handshake.3 similarity index 100% rename from secure/lib/libssl/man/SSL_do_handshake.3 rename to lib/libssl/man/SSL_do_handshake.3 diff --git a/secure/lib/libssl/man/SSL_free.3 b/lib/libssl/man/SSL_free.3 similarity index 100% rename from secure/lib/libssl/man/SSL_free.3 rename to lib/libssl/man/SSL_free.3 diff --git a/secure/lib/libssl/man/SSL_get_SSL_CTX.3 b/lib/libssl/man/SSL_get_SSL_CTX.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_SSL_CTX.3 rename to lib/libssl/man/SSL_get_SSL_CTX.3 diff --git a/secure/lib/libssl/man/SSL_get_ciphers.3 b/lib/libssl/man/SSL_get_ciphers.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_ciphers.3 rename to lib/libssl/man/SSL_get_ciphers.3 diff --git a/secure/lib/libssl/man/SSL_get_client_CA_list.3 b/lib/libssl/man/SSL_get_client_CA_list.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_client_CA_list.3 rename to lib/libssl/man/SSL_get_client_CA_list.3 diff --git a/secure/lib/libssl/man/SSL_get_current_cipher.3 b/lib/libssl/man/SSL_get_current_cipher.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_current_cipher.3 rename to lib/libssl/man/SSL_get_current_cipher.3 diff --git a/secure/lib/libssl/man/SSL_get_default_timeout.3 b/lib/libssl/man/SSL_get_default_timeout.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_default_timeout.3 rename to lib/libssl/man/SSL_get_default_timeout.3 diff --git a/secure/lib/libssl/man/SSL_get_error.3 b/lib/libssl/man/SSL_get_error.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_error.3 rename to lib/libssl/man/SSL_get_error.3 diff --git a/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 b/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 rename to lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 diff --git a/secure/lib/libssl/man/SSL_get_ex_new_index.3 b/lib/libssl/man/SSL_get_ex_new_index.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_ex_new_index.3 rename to lib/libssl/man/SSL_get_ex_new_index.3 diff --git a/secure/lib/libssl/man/SSL_get_fd.3 b/lib/libssl/man/SSL_get_fd.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_fd.3 rename to lib/libssl/man/SSL_get_fd.3 diff --git a/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 b/lib/libssl/man/SSL_get_peer_cert_chain.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_peer_cert_chain.3 rename to lib/libssl/man/SSL_get_peer_cert_chain.3 diff --git a/secure/lib/libssl/man/SSL_get_peer_certificate.3 b/lib/libssl/man/SSL_get_peer_certificate.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_peer_certificate.3 rename to lib/libssl/man/SSL_get_peer_certificate.3 diff --git a/secure/lib/libssl/man/SSL_get_psk_identity.3 b/lib/libssl/man/SSL_get_psk_identity.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_psk_identity.3 rename to lib/libssl/man/SSL_get_psk_identity.3 diff --git a/secure/lib/libssl/man/SSL_get_rbio.3 b/lib/libssl/man/SSL_get_rbio.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_rbio.3 rename to lib/libssl/man/SSL_get_rbio.3 diff --git a/secure/lib/libssl/man/SSL_get_session.3 b/lib/libssl/man/SSL_get_session.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_session.3 rename to lib/libssl/man/SSL_get_session.3 diff --git a/secure/lib/libssl/man/SSL_get_verify_result.3 b/lib/libssl/man/SSL_get_verify_result.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_verify_result.3 rename to lib/libssl/man/SSL_get_verify_result.3 diff --git a/secure/lib/libssl/man/SSL_get_version.3 b/lib/libssl/man/SSL_get_version.3 similarity index 100% rename from secure/lib/libssl/man/SSL_get_version.3 rename to lib/libssl/man/SSL_get_version.3 diff --git a/secure/lib/libssl/man/SSL_library_init.3 b/lib/libssl/man/SSL_library_init.3 similarity index 100% rename from secure/lib/libssl/man/SSL_library_init.3 rename to lib/libssl/man/SSL_library_init.3 diff --git a/secure/lib/libssl/man/SSL_load_client_CA_file.3 b/lib/libssl/man/SSL_load_client_CA_file.3 similarity index 100% rename from secure/lib/libssl/man/SSL_load_client_CA_file.3 rename to lib/libssl/man/SSL_load_client_CA_file.3 diff --git a/secure/lib/libssl/man/SSL_new.3 b/lib/libssl/man/SSL_new.3 similarity index 100% rename from secure/lib/libssl/man/SSL_new.3 rename to lib/libssl/man/SSL_new.3 diff --git a/secure/lib/libssl/man/SSL_pending.3 b/lib/libssl/man/SSL_pending.3 similarity index 100% rename from secure/lib/libssl/man/SSL_pending.3 rename to lib/libssl/man/SSL_pending.3 diff --git a/secure/lib/libssl/man/SSL_read.3 b/lib/libssl/man/SSL_read.3 similarity index 100% rename from secure/lib/libssl/man/SSL_read.3 rename to lib/libssl/man/SSL_read.3 diff --git a/secure/lib/libssl/man/SSL_rstate_string.3 b/lib/libssl/man/SSL_rstate_string.3 similarity index 100% rename from secure/lib/libssl/man/SSL_rstate_string.3 rename to lib/libssl/man/SSL_rstate_string.3 diff --git a/secure/lib/libssl/man/SSL_session_reused.3 b/lib/libssl/man/SSL_session_reused.3 similarity index 100% rename from secure/lib/libssl/man/SSL_session_reused.3 rename to lib/libssl/man/SSL_session_reused.3 diff --git a/secure/lib/libssl/man/SSL_set_bio.3 b/lib/libssl/man/SSL_set_bio.3 similarity index 100% rename from secure/lib/libssl/man/SSL_set_bio.3 rename to lib/libssl/man/SSL_set_bio.3 diff --git a/secure/lib/libssl/man/SSL_set_connect_state.3 b/lib/libssl/man/SSL_set_connect_state.3 similarity index 100% rename from secure/lib/libssl/man/SSL_set_connect_state.3 rename to lib/libssl/man/SSL_set_connect_state.3 diff --git a/secure/lib/libssl/man/SSL_set_fd.3 b/lib/libssl/man/SSL_set_fd.3 similarity index 100% rename from secure/lib/libssl/man/SSL_set_fd.3 rename to lib/libssl/man/SSL_set_fd.3 diff --git a/secure/lib/libssl/man/SSL_set_session.3 b/lib/libssl/man/SSL_set_session.3 similarity index 100% rename from secure/lib/libssl/man/SSL_set_session.3 rename to lib/libssl/man/SSL_set_session.3 diff --git a/secure/lib/libssl/man/SSL_set_shutdown.3 b/lib/libssl/man/SSL_set_shutdown.3 similarity index 100% rename from secure/lib/libssl/man/SSL_set_shutdown.3 rename to lib/libssl/man/SSL_set_shutdown.3 diff --git a/secure/lib/libssl/man/SSL_set_verify_result.3 b/lib/libssl/man/SSL_set_verify_result.3 similarity index 100% rename from secure/lib/libssl/man/SSL_set_verify_result.3 rename to lib/libssl/man/SSL_set_verify_result.3 diff --git a/secure/lib/libssl/man/SSL_shutdown.3 b/lib/libssl/man/SSL_shutdown.3 similarity index 100% rename from secure/lib/libssl/man/SSL_shutdown.3 rename to lib/libssl/man/SSL_shutdown.3 diff --git a/secure/lib/libssl/man/SSL_state_string.3 b/lib/libssl/man/SSL_state_string.3 similarity index 100% rename from secure/lib/libssl/man/SSL_state_string.3 rename to lib/libssl/man/SSL_state_string.3 diff --git a/secure/lib/libssl/man/SSL_want.3 b/lib/libssl/man/SSL_want.3 similarity index 100% rename from secure/lib/libssl/man/SSL_want.3 rename to lib/libssl/man/SSL_want.3 diff --git a/secure/lib/libssl/man/SSL_write.3 b/lib/libssl/man/SSL_write.3 similarity index 100% rename from secure/lib/libssl/man/SSL_write.3 rename to lib/libssl/man/SSL_write.3 diff --git a/secure/lib/libssl/man/d2i_SSL_SESSION.3 b/lib/libssl/man/d2i_SSL_SESSION.3 similarity index 100% rename from secure/lib/libssl/man/d2i_SSL_SESSION.3 rename to lib/libssl/man/d2i_SSL_SESSION.3 diff --git a/secure/lib/libssl/man/ssl.3 b/lib/libssl/man/ssl.3 similarity index 100% rename from secure/lib/libssl/man/ssl.3 rename to lib/libssl/man/ssl.3 diff --git a/libexec/Makefile b/libexec/Makefile index b68db90a88..eda5fcc792 100644 --- a/libexec/Makefile +++ b/libexec/Makefile @@ -31,6 +31,12 @@ SUBDIR= atrun \ utmp_update \ ypxfr +.if !defined(NO_LIBRESSL) +SUBDIR+= sftp-server \ + ssh-keysign \ + ssh-pkcs11-helper +.endif + # maximum parallelism # SUBDIR_ORDERED= diff --git a/secure/libexec/sftp-server/Makefile b/libexec/sftp-server/Makefile similarity index 100% rename from secure/libexec/sftp-server/Makefile rename to libexec/sftp-server/Makefile diff --git a/secure/libexec/ssh-keysign/Makefile b/libexec/ssh-keysign/Makefile similarity index 97% rename from secure/libexec/ssh-keysign/Makefile rename to libexec/ssh-keysign/Makefile index d90c812e01..9787a6a0ac 100644 --- a/secure/libexec/ssh-keysign/Makefile +++ b/libexec/ssh-keysign/Makefile @@ -9,5 +9,7 @@ MAN= ssh-keysign.8 BINMODE=4511 .endif +WARNS= 3 + .include "../../Makefile.ssh.common" .include diff --git a/secure/libexec/ssh-pkcs11-helper/Makefile b/libexec/ssh-pkcs11-helper/Makefile similarity index 93% rename from secure/libexec/ssh-pkcs11-helper/Makefile rename to libexec/ssh-pkcs11-helper/Makefile index fc8f6556ad..3179e34a62 100644 --- a/secure/libexec/ssh-pkcs11-helper/Makefile +++ b/libexec/ssh-pkcs11-helper/Makefile @@ -2,5 +2,7 @@ PROG= ssh-pkcs11-helper SRCS= ssh-pkcs11-helper.c ssh-pkcs11.c MAN= ssh-pkcs11-helper.8 +WARNS= 3 + .include "../../Makefile.ssh.common" .include diff --git a/sbin/hammer/Makefile b/sbin/hammer/Makefile index fa6ecb396f..aa0a4430ea 100644 --- a/sbin/hammer/Makefile +++ b/sbin/hammer/Makefile @@ -9,8 +9,9 @@ SRCS= hammer.c ondisk.c blockmap.c cache.c misc.c cycle.c \ MAN= hammer.8 CFLAGS+= -I${.CURDIR}/../../sys -LDADD= -lm -lutil -lmd -lhammer -DPADD= ${LIBM} ${LIBUTIL} ${LIBMD} ${LIBHAMMER} +LDADD= -lm -lutil -lhammer -lprivate_crypto +DPADD= ${LIBM} ${LIBUTIL} ${LIBHAMMER} ${LIBCRYPTO} +LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv .PATH: ${.CURDIR}/../../sys/libkern SRCS+= crc32.c icrc32.c diff --git a/sbin/hammer2/Makefile b/sbin/hammer2/Makefile index 6b318d21eb..a9f797773f 100644 --- a/sbin/hammer2/Makefile +++ b/sbin/hammer2/Makefile @@ -12,8 +12,9 @@ DEBUG_FLAGS=-g CFLAGS+= -DXXH_NAMESPACE=h2_ CFLAGS+= -I${.CURDIR}/../../sys CFLAGS+= -pthread -LDADD= -ldmsg -lm -lutil -lmd -DPADD= ${LIBDMSG} ${LIBM} ${LIBUTIL} ${LIBMD} +LDADD= -ldmsg -lm -lutil -lprivate_crypto +DPADD= ${LIBDMSG} ${LIBM} ${LIBUTIL} ${LIBCRYPTO} +LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv DPADD+= ${LIBRECRYPTO} LDADD+= -lprivate_crypto diff --git a/sbin/init/Makefile b/sbin/init/Makefile index 1d92ee2060..42d9d643de 100644 --- a/sbin/init/Makefile +++ b/sbin/init/Makefile @@ -11,8 +11,9 @@ INSTALLFLAGS= -b -B.bak INSTALLFLAGS+= -fschg .endif CFLAGS+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP -DCOMPAT_SYSV_INIT -DSUPPORT_UTMPX -DPADD= ${LIBUTIL} ${LIBCRYPT} -LDADD= -lutil -lcrypt +DPADD= ${LIBUTIL} ${LIBCRYPT} ${LIBRECRYPTO} +LDADD= -lutil -lcrypt -lprivate_crypto +LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv NOSHARED=yes diff --git a/sbin/iscontrol/Makefile b/sbin/iscontrol/Makefile index c9b606e855..a436efddfd 100644 --- a/sbin/iscontrol/Makefile +++ b/sbin/iscontrol/Makefile @@ -2,8 +2,9 @@ SRCS= iscontrol.c pdu.c fsm.c config.c login.c auth_subr.c misc.c PROG= iscontrol -DPADD= ${LIBCAM} ${LIBMD} -LDADD= -lcam -lmd +DPADD= ${LIBCAM} ${LIBMD} ${LIBCRYPTO} +LDADD= -lcam -lmd -lprivate_crypto +LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv CFLAGS += -I${.CURDIR}/../../sys/dev/disk/iscsi/initiator #CFLAGS += -g -DDEBUG diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile index b9ffe1c125..846b892424 100644 --- a/sbin/md5/Makefile +++ b/sbin/md5/Makefile @@ -4,6 +4,8 @@ PROG= md5 +SRCS= md5.c sha1hl.c + LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ ${BINDIR}/md5 ${BINDIR}/sha1 \ ${BINDIR}/md5 ${BINDIR}/sha256 @@ -12,7 +14,8 @@ MLINKS= md5.1 rmd160.1 \ md5.1 sha1.1 \ md5.1 sha256.1 -DPADD= ${LIBMD} -LDADD= -lmd +DPADD= ${LIBMD} ${LIBCRYPTO} +LDADD= -lmd -lprivate_crypto +LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv .include diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index f5e7c02dc3..7125cdfde0 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -37,6 +37,8 @@ #include #include +#include "sha1hl.h" + /* * Length of test block, number of test blocks. */ @@ -68,7 +70,6 @@ typedef struct Algorithm_t { char *(*File)(const char *, char *); } Algorithm_t; -static void MD5_Update(MD5_CTX *, const unsigned char *, size_t); static void MDString(Algorithm_t *, const char *); static void MDTimeTrial(Algorithm_t *); static void MDTestSuite(Algorithm_t *); @@ -103,12 +104,6 @@ struct Algorithm_t Algorithm[] = { (DIGEST_End*)&RIPEMD160_End, &RIPEMD160_Data, &RIPEMD160_File } }; -static void -MD5_Update(MD5_CTX *c, const unsigned char *data, size_t len) -{ - MD5Update(c, data, len); -} - /* * There is no need to use a huge mmap, just pick something * reasonable. diff --git a/sbin/md5/sha1hl.c b/sbin/md5/sha1hl.c new file mode 100644 index 0000000000..5068fc9f74 --- /dev/null +++ b/sbin/md5/sha1hl.c @@ -0,0 +1,108 @@ +/* mdXhl.c * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + * + * $FreeBSD: src/lib/libmd/mdXhl.c,v 1.19 2006/01/17 15:35:56 phk Exp $ + * $DragonFly: src/lib/libmd/mdXhl.c,v 1.3 2008/09/11 20:25:34 swildner Exp $ + */ +/* + * This code has been deprecated, do not put this in libmd or anywhere else please. + * The few base system programs that use this code will .PATH it in. + * + * Note that libcrypto/lib[re]ssl provides the standard API that this file extends + * for these functions. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "sha1hl.h" + +#define LENGTH 20 + +char * +SHA1_End(SHA1_CTX *ctx, char *buf) +{ + int i; + unsigned char digest[LENGTH]; + static const char hex[]="0123456789abcdef"; + + if (!buf) + buf = malloc(2*LENGTH + 1); + if (!buf) + return 0; + SHA1_Final(digest, ctx); + for (i = 0; i < LENGTH; i++) { + buf[i+i] = hex[digest[i] >> 4]; + buf[i+i+1] = hex[digest[i] & 0x0f]; + } + buf[i+i] = '\0'; + return buf; +} + +char * +SHA1_File(const char *filename, char *buf) +{ + return (SHA1_FileChunk(filename, buf, 0, 0)); +} + +char * +SHA1_FileChunk(const char *filename, char *buf, off_t ofs, off_t len) +{ + unsigned char buffer[8192]; + SHA1_CTX ctx; + struct stat stbuf; + int f, i, e; + off_t n; + + SHA1_Init(&ctx); + f = open(filename, O_RDONLY); + if (f < 0) + return 0; + if (fstat(f, &stbuf) < 0) + return 0; + if (ofs > stbuf.st_size) + ofs = stbuf.st_size; + if ((len == 0) || (len > stbuf.st_size - ofs)) + len = stbuf.st_size - ofs; + if (lseek(f, ofs, SEEK_SET) < 0) + return 0; + n = len; + i = 0; + while (n > 0) { + if ((size_t)n > sizeof(buffer)) + i = read(f, buffer, sizeof(buffer)); + else + i = read(f, buffer, n); + if (i < 0) + break; + SHA1_Update(&ctx, buffer, i); + n -= i; + } + e = errno; + close(f); + errno = e; + if (i < 0) + return 0; + return (SHA1_End(&ctx, buf)); +} + +char * +SHA1_Data (const void *data, unsigned int len, char *buf) +{ + SHA1_CTX ctx; + + SHA1_Init(&ctx); + SHA1_Update(&ctx,data,len); + return (SHA1_End(&ctx, buf)); +} diff --git a/sbin/md5/sha1hl.h b/sbin/md5/sha1hl.h new file mode 100644 index 0000000000..cad616a622 --- /dev/null +++ b/sbin/md5/sha1hl.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +__BEGIN_DECLS +char *SHA_End(SHA_CTX *, char *); +char *SHA_File(const char *, char *); +char *SHA_FileChunk(const char *, char *, off_t, off_t); +char *SHA_Data(const void *, unsigned int, char *); +char *SHA1_End(SHA_CTX *, char *); +char *SHA1_File(const char *, char *); +char *SHA1_FileChunk(const char *, char *, off_t, off_t); +char *SHA1_Data(const void *, unsigned int, char *); +__END_DECLS diff --git a/sbin/ping6/Makefile b/sbin/ping6/Makefile index dd670fc1f4..35c140fa2b 100644 --- a/sbin/ping6/Makefile +++ b/sbin/ping6/Makefile @@ -8,8 +8,9 @@ CFLAGS+=-DINET6 -DIPSEC -DHAVE_POLL_H -DHAVE_ARC4RANDOM -DUSE_RFC3542 BINOWN= root BINMODE=4555 -LDADD= -lipsec -lm -lmd -DPADD= ${LIBIPSEC} ${LIBM} ${LIBMD} +LDADD= -lipsec -lm -lmd -lprivate_crypto +DPADD= ${LIBIPSEC} ${LIBM} ${LIBMD} ${LIBCRYPTO} +LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv NO_STRICT_ALIASING= # kame scopeid hack diff --git a/secure/Makefile b/secure/Makefile deleted file mode 100644 index 1b01075489..0000000000 --- a/secure/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# $FreeBSD: src/secure/Makefile,v 1.16.2.1 2002/07/25 09:33:13 ru Exp $ -# $DragonFly: src/secure/Makefile,v 1.3 2004/01/31 06:56:41 dillon Exp $ - -# lib must be first, or it will not work. This is because we reference -# the lib's in the directory where they are built from the binaries we -# want to build. - -SUBDIR= lib libexec usr.bin usr.sbin - -SDIR= ${.CURDIR}/.. - -CODAI= ${MAKE} ${MFLAGS} cleandir; \ - ${MAKE} ${MFLAGS} obj; \ - ${MAKE} ${MFLAGS} depend all install - -# These are the programs which depend on secure libs -sprog: - cd ${SDIR}/bin/ed; ${CODAI} - cd ${SDIR}/sbin/init; ${CODAI} - -bootstrap: - ( cd include; ${MAKE} ${MFLAGS} install ) - ( cd lib; ${MAKE} ${MFLAGS} depend all install ) - ${MAKE} ${MFLAGS} cleandir - ${MAKE} ${MFLAGS} obj - ${MAKE} ${MFLAGS} depend all install sprog - -.include diff --git a/secure/Makefile.inc b/secure/Makefile.inc deleted file mode 100644 index e93c0e6d6d..0000000000 --- a/secure/Makefile.inc +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: src/secure/Makefile.inc,v 1.13.2.5 2002/07/03 22:13:19 des Exp $ -# $DragonFly: src/secure/Makefile.inc,v 1.4 2005/09/06 18:55:25 dillon Exp $ - -.if exists(${.CURDIR}/../../lib/libcrypt/obj) -CRYPTOBJDIR= ${.CURDIR}/../../lib/libcrypt/obj -.else -CRYPTOBJDIR= ${.CURDIR}/../../lib/libcrypt -.endif diff --git a/secure/Makefile.ssh.common b/secure/Makefile.ssh.common deleted file mode 100644 index 7922bf49f2..0000000000 --- a/secure/Makefile.ssh.common +++ /dev/null @@ -1,14 +0,0 @@ -SSHDIR= ${.CURDIR}/../../../crypto/openssh - -XAUTH_PATH?= /usr/local/bin/xauth -CFLAGS+= -DXAUTH_PATH=\"${XAUTH_PATH}\" -CFLAGS+= -I${.CURDIR}/../../../crypto/libressl/include -CFLAGS+= -I${.CURDIR}/../../lib/libssh -I${SSHDIR} - -.if ${.CURDIR:T} != "libssh" -DPADD+= ${LIBSSH} ${LIBRECRYPTO} ${LIBUTIL} ${LIBZ} ${LIBPTHREAD} -LDADD+= -lprivate_ssh -lprivate_crypto -lutil -lz -lpthread -LDFLAGS+= -rpath /lib/priv:/usr/lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv -.endif - -.PATH: ${SSHDIR} ${SSHDIR}/openbsd-compat diff --git a/secure/lib/Makefile b/secure/lib/Makefile deleted file mode 100644 index 369852df96..0000000000 --- a/secure/lib/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD: src/secure/lib/Makefile,v 1.19.2.5 2003/04/04 21:33:15 ru Exp $ - -SUBDIR= libcipher -.if defined(FORCE_OPENSSL) # to be removed during 4.8 development -SUBDIR+=libcrypto libssl -.endif -.if !defined(NO_LIBRESSL) -SUBDIR+=librecrypto libressl libssh -.endif - -# maximum parallelism -# Note: libssl depends on libcrypto and libressl depends on librecrypto -# This dependency is taken care of by Makefile.inc1 -# -SUBDIR_ORDERED= - -.include diff --git a/secure/lib/Makefile.inc b/secure/lib/Makefile.inc deleted file mode 100644 index 492048f8fc..0000000000 --- a/secure/lib/Makefile.inc +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: src/secure/lib/Makefile.inc,v 1.7 1999/08/28 01:30:18 peter Exp $ -# $DragonFly: src/secure/lib/Makefile.inc,v 1.2 2003/06/17 04:27:48 dillon Exp $ - -.include "${.CURDIR}/../../Makefile.inc" -.if exists(${.CURDIR}/../../../lib/Makefile.inc) -.include "${.CURDIR}/../../../lib/Makefile.inc" -.endif diff --git a/secure/libexec/Makefile b/secure/libexec/Makefile deleted file mode 100644 index be6bf87c67..0000000000 --- a/secure/libexec/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: src/secure/libexec/Makefile,v 1.4.2.6 2002/07/05 11:10:51 des Exp $ - -SUBDIR= -.if !defined(NO_LIBRESSL) -SUBDIR+= sftp-server ssh-keysign ssh-pkcs11-helper -.endif - -.include diff --git a/secure/libexec/Makefile.inc b/secure/libexec/Makefile.inc deleted file mode 100644 index 22a1017b1c..0000000000 --- a/secure/libexec/Makefile.inc +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: src/secure/libexec/Makefile.inc,v 1.5.2.1 2002/04/19 12:03:57 ru Exp $ -# $DragonFly: src/secure/libexec/Makefile.inc,v 1.2 2003/06/17 04:27:48 dillon Exp $ - -BINDIR?= /usr/libexec -WARNS?= 3 - -.include "${.CURDIR}/../../Makefile.inc" diff --git a/secure/usr.bin/Makefile b/secure/usr.bin/Makefile deleted file mode 100644 index 17192ff831..0000000000 --- a/secure/usr.bin/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -SUBDIR= -.if !defined(NO_LIBRESSL) -SUBDIR+=bdes openssl scp sftp ssh ssh-add ssh-agent ssh-keygen ssh-keyscan -.endif - -.include diff --git a/secure/usr.bin/Makefile.inc b/secure/usr.bin/Makefile.inc deleted file mode 100644 index 152da5008c..0000000000 --- a/secure/usr.bin/Makefile.inc +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: src/secure/usr.bin/Makefile.inc,v 1.5.2.1 2002/04/19 12:03:57 ru Exp $ -# $DragonFly: src/secure/usr.bin/Makefile.inc,v 1.2 2003/06/17 04:27:48 dillon Exp $ - -BINDIR?= /usr/bin - -.include "${.CURDIR}/../../Makefile.inc" diff --git a/secure/usr.sbin/Makefile b/secure/usr.sbin/Makefile deleted file mode 100644 index a5bc62ec52..0000000000 --- a/secure/usr.sbin/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: src/secure/usr.sbin/Makefile,v 1.1.2.1 2000/07/30 22:26:29 kris Exp $ - -SUBDIR= -.if !defined(NO_LIBRESSL) -SUBDIR+=sshd -.endif - -.include diff --git a/secure/usr.sbin/Makefile.inc b/secure/usr.sbin/Makefile.inc deleted file mode 100644 index d531b05ec5..0000000000 --- a/secure/usr.sbin/Makefile.inc +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: src/secure/usr.sbin/Makefile.inc,v 1.1.2.2 2002/07/03 22:20:33 des Exp $ -# $DragonFly: src/secure/usr.sbin/Makefile.inc,v 1.2 2003/06/17 04:27:48 dillon Exp $ - -BINDIR?= /usr/sbin -WARNS?= 2 - -.include "${.CURDIR}/../../Makefile.inc" diff --git a/share/initrd/bin/Makefile b/share/initrd/bin/Makefile index f9665f0fdf..d9e27e73e9 100644 --- a/share/initrd/bin/Makefile +++ b/share/initrd/bin/Makefile @@ -54,11 +54,8 @@ CRUNCH_ALIAS_rm= unlink CRUNCH_SRCDIRS+= usr.bin -CRUNCH_PROGS_usr.bin= du less undo +CRUNCH_PROGS_usr.bin= du less undo ssh CRUNCH_ALIAS_less= more - -CRUNCH_SRCDIRS+= secure/usr.bin -CRUNCH_PROGS_secure/usr.bin= ssh CRUNCH_ALIAS_ssh= scp CRUNCH_KEEP_ssh= roaming_write roaming_read add_recv_bytes diff --git a/share/initrd/sbin.libcrypto/Makefile b/share/initrd/sbin.libcrypto/Makefile index 542a39d829..d50d6395da 100644 --- a/share/initrd/sbin.libcrypto/Makefile +++ b/share/initrd/sbin.libcrypto/Makefile @@ -9,16 +9,22 @@ PROG= sbin.libcrypto BINDIR= /usr/share/initrd/sbin CRUNCH_SRCDIRS+= sbin -CRUNCH_PROGS_sbin= tcplay +CRUNCH_PROGS_sbin= tcplay \ + md5 \ + hammer \ + ping \ + ping6 CRUNCH_SRCDIRS+= gnu/sbin CRUNCH_PROGS_gnu/sbin= cryptsetup -CRUNCH_LIBS+= -ldm -lprop -lutil +CRUNCH_LIBS+= -ldm -lprop -lutil -lhammer -lm +CRUNCH_ALIAS_md5= rmd160 CRUNCH_SRCDIRS+= usr.sbin/802_11 CRUNCH_PROGS_usr.sbin/802_11= wpa_supplicant -CRUNCH_LIBS+= -lpcap -lprivate_ssl -lprivate_crypto +CRUNCH_LIBS+= -lpcap -lprivate_ssl -lmd -lprivate_crypto +CRUNCH_LIBS+= -lipsec CRUNCH_LIBS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv .include diff --git a/share/initrd/sbin/Makefile b/share/initrd/sbin/Makefile index b18590368f..781e96fde3 100644 --- a/share/initrd/sbin/Makefile +++ b/share/initrd/sbin/Makefile @@ -27,13 +27,11 @@ CRUNCH_PROGS_sbin= \ fsck_msdosfs \ gpt \ growfs \ - hammer \ ifconfig \ kldconfig \ kldload \ kldstat \ kldunload \ - md5 \ mount \ mount_cd9660 \ mount_hammer \ @@ -47,8 +45,6 @@ CRUNCH_PROGS_sbin= \ newfs \ newfs_hammer \ newfs_msdos \ - ping \ - ping6 \ rconfig \ reboot \ route \ @@ -61,13 +57,12 @@ CRUNCH_PROGS_sbin= \ vinum CRUNCH_ALIAS_disklabel64= disklabel -CRUNCH_ALIAS_md5= rmd160 CRUNCH_ALIAS_newfs= mount_mfs CRUNCH_ALIAS_reboot= halt CRUNCH_ALIAS_shutdown= poweroff CRUNCH_ALIAS_swapon= swapoff swapctl -CRUNCH_LIBS+= -lcam -lsbuf -lutil -lkvm -lm -lmd -lhammer -lkiconv +CRUNCH_LIBS+= -lcam -lsbuf -lutil -lkvm -lm -lhammer -lkiconv CRUNCH_LIBS+= -lprivate_edit -lprivate_ncurses -ldevstat -lprop -lpthread CRUNCH_LIBS+= -lbsdxml -lipsec CRUNCH_LIBS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index 2dd717a7a4..5fb40ab803 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -46,9 +46,12 @@ __targets+= mandiff # XXX temporary target _SUBDIR_${__target}: ${SUBDIR:S/^/_SUBDIR_${__target}_/} -# Now create the command set for each subdirectory and target +# order subdirectories for each target, set up dependency # +.ORDER: ${SUBDIR_ORDERED:S/^/_SUBDIR_${__target}_/} +# Now create the command set for each subdirectory and target +# .for entry in ${SUBDIR} _SUBDIR_${__target}_${entry}: @(if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ @@ -61,14 +64,11 @@ _SUBDIR_${__target}_${entry}: cd ${.CURDIR}/$${edir}; \ fi; \ ${MAKE} ${__target:realinstall=install} \ - DIRPRFX=${DIRPRFX}$$edir/;) + DIRPRFX=${DIRPRFX}$$edir/;) + @${ECHODIR} "<=== ${DIRPRFX}${entry}" .endfor -# order subdirectories for each target, set up dependency -# -.ORDER: ${SUBDIR_ORDERED:S/^/_SUBDIR_${__target}_/} - .else _SUBDIR_${__target}: .USE diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 444103cd5d..08992e8a86 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -45,6 +45,10 @@ INCLUDES+= -I$S/../include INCLUDES+= -I/usr/include .endif +# For +# +INCLUDES+= -I$S/../crypto/libressl/include + # This hack lets us use the Intel ACPICA code without spamming a new # include path into 100+ source files. .include "$S/conf/acpi.mk" diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 3b1ec5f228..0761c87d04 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -119,6 +119,11 @@ CLEANDIRS+= ${_MACHINE_FWD} .endif .endif CFLAGS+= -I${_MACHINE_FWD}/include + +# For +# +CFLAGS+=-I@/../crypto/libressl/include + .include "kern.fwd.mk" # Add a -I path to standard headers like . Use a relative diff --git a/sys/dev/crypto/safe/safe.c b/sys/dev/crypto/safe/safe.c index 8a0bb43546..f4f8705ae6 100644 --- a/sys/dev/crypto/safe/safe.c +++ b/sys/dev/crypto/safe/safe.c @@ -662,7 +662,7 @@ safe_setup_mackey(struct safe_session *ses, int algo, caddr_t key, int klen) MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); MD5Update(&md5ctx, hmac_ipad_buffer, MD5_HMAC_BLOCK_LEN - klen); - bcopy(md5ctx.state, ses->ses_hminner, sizeof(md5ctx.state)); + bcopy(&md5ctx.A, ses->ses_hminner, sizeof(md5ctx.A) * 4); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); @@ -678,7 +678,7 @@ safe_setup_mackey(struct safe_session *ses, int algo, caddr_t key, int klen) MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); MD5Update(&md5ctx, hmac_opad_buffer, MD5_HMAC_BLOCK_LEN - klen); - bcopy(md5ctx.state, ses->ses_hmouter, sizeof(md5ctx.state)); + bcopy(&md5ctx.A, ses->ses_hmouter, sizeof(md5ctx.A) * 4); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); diff --git a/sys/dev/crypto/ubsec/ubsec.c b/sys/dev/crypto/ubsec/ubsec.c index 7922c1ae2e..23352703a1 100644 --- a/sys/dev/crypto/ubsec/ubsec.c +++ b/sys/dev/crypto/ubsec/ubsec.c @@ -851,7 +851,7 @@ ubsec_setup_mackey(struct ubsec_session *ses, int algo, caddr_t key, int klen) MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); MD5Update(&md5ctx, hmac_ipad_buffer, MD5_HMAC_BLOCK_LEN - klen); - bcopy(md5ctx.state, ses->ses_hminner, sizeof(md5ctx.state)); + bcopy(&md5ctx.A, ses->ses_hminner, sizeof(md5ctx.A) * 4); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); @@ -867,7 +867,7 @@ ubsec_setup_mackey(struct ubsec_session *ses, int algo, caddr_t key, int klen) MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); MD5Update(&md5ctx, hmac_opad_buffer, MD5_HMAC_BLOCK_LEN - klen); - bcopy(md5ctx.state, ses->ses_hmouter, sizeof(md5ctx.state)); + bcopy(&md5ctx.A, ses->ses_hmouter, sizeof(md5ctx.A) * 4); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); diff --git a/sys/kern/md5c.c b/sys/kern/md5c.c index 62e3244868..766ad18ccc 100644 --- a/sys/kern/md5c.c +++ b/sys/kern/md5c.c @@ -129,17 +129,19 @@ static unsigned char PADDING[64] = { /* MD5 initialization. Begins an MD5 operation, writing a new context. */ -void +int MD5Init (MD5_CTX *context) { - context->count[0] = context->count[1] = 0; + context->Nl = context->Nh = 0; /* Load magic initialization constants. */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; + context->A = 0x67452301; + context->B = 0xefcdab89; + context->C = 0x98badcfe; + context->D = 0x10325476; + + return 1; } /* @@ -155,24 +157,24 @@ MD5Update (MD5_CTX *context, const void *in, unsigned int inputLen) const unsigned char *input = in; /* Compute number of bytes mod 64 */ - index = (unsigned int)((context->count[0] >> 3) & 0x3F); + index = (unsigned int)((context->Nl >> 3) & 0x3F); /* Update number of bits */ - if ((context->count[0] += ((u_int32_t)inputLen << 3)) + if ((context->Nl += ((u_int32_t)inputLen << 3)) < ((u_int32_t)inputLen << 3)) - context->count[1]++; - context->count[1] += ((u_int32_t)inputLen >> 29); + context->Nh++; + context->Nh += ((u_int32_t)inputLen >> 29); partLen = 64 - index; /* Transform as many times as possible. */ if (inputLen >= partLen) { - memcpy((void *)&context->buffer[index], (const void *)input, + memcpy((void *)&((char *)context->data)[index], (const void *)input, partLen); - MD5Transform (context->state, context->buffer); + MD5Transform (&context->A, (char *)context->data); for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform (context->state, &input[i]); + MD5Transform (&context->A, &input[i]); index = 0; } @@ -180,7 +182,7 @@ MD5Update (MD5_CTX *context, const void *in, unsigned int inputLen) i = 0; /* Buffer remaining input */ - memcpy ((void *)&context->buffer[index], (const void *)&input[i], + memcpy ((void *)&((char *)context->data)[index], (const void *)&input[i], inputLen-i); } @@ -195,10 +197,10 @@ MD5Pad (MD5_CTX *context) unsigned int index, padLen; /* Save number of bits */ - Encode (bits, context->count, 8); + Encode (bits, &context->Nl, 8); /* Pad out to 56 mod 64. */ - index = (unsigned int)((context->count[0] >> 3) & 0x3f); + index = (unsigned int)((context->Nl >> 3) & 0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); MD5Update (context, PADDING, padLen); @@ -218,7 +220,7 @@ MD5Final (unsigned char digest[16], MD5_CTX *context) MD5Pad (context); /* Store state in digest */ - Encode (digest, context->state, 16); + Encode (digest, &context->A, 16); /* Zeroize sensitive information. */ memset ((void *)context, 0, sizeof (*context)); diff --git a/sys/sys/md5.h b/sys/sys/md5.h index 784d556bf7..93f5aeae6b 100644 --- a/sys/sys/md5.h +++ b/sys/sys/md5.h @@ -1,65 +1,64 @@ -/* MD5.H - header file for MD5C.C - * $FreeBSD: src/sys/sys/md5.h,v 1.20 2006/03/15 19:47:12 andre Exp $ +/* + * Copyright (c) 2016 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ - -/*- - Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -rights reserved. - -License to copy and use this software is granted provided that it -is identified as the "RSA Data Security, Inc. MD5 Message-Digest -Algorithm" in all material mentioning or referencing this software -or this function. - -License is also granted to make and use derivative works provided -that such works are identified as "derived from the RSA Data -Security, Inc. MD5 Message-Digest Algorithm" in all material -mentioning or referencing the derived work. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - -These notices must be retained in any copies of any part of this -documentation and/or software. +/* + * libmd shims for openssl + non-conflicting old API functions. */ #ifndef _SYS_MD5_H_ #define _SYS_MD5_H_ +#include #ifndef _SYS_TYPES_H_ #include #endif +#include -#define MD5_BLOCK_LENGTH 64 -#define MD5_DIGEST_LENGTH 16 +#define MD5_BLOCK_LENGTH MD5_CBLOCK #define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1) -/* MD5 context. */ -typedef struct MD5Context { - u_int32_t state[4]; /* state (ABCD) */ - u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64]; /* input buffer */ -} MD5_CTX; - -#include - __BEGIN_DECLS -#ifdef _KERNEL -void MD5Init (MD5_CTX *); -#else -int MD5Init (MD5_CTX *); -#endif -void MD5Update (MD5_CTX *, const void *, unsigned int); -void MD5Final (unsigned char [16], MD5_CTX *); +int MD5Init (MD5_CTX *); +void MD5Update (MD5_CTX *, const void *, unsigned int); +void MD5Pad (MD5_CTX *); +void MD5Final (unsigned char [16], MD5_CTX *); +char *MD5End(MD5_CTX *, char *); #ifndef _KERNEL -void MD5Pad(MD5_CTX *); -char * MD5End(MD5_CTX *, char *); -char * MD5File(const char *, char *); -char * MD5FileChunk(const char *, char *, off_t, off_t); -char * MD5Data(const void *, unsigned int, char *); +char *MD5File(const char *, char *); +char *MD5FileChunk(const char *, char *, off_t, off_t); #endif +char *MD5Data(const void *, unsigned int, char *); +void MD5Transform (u_int32_t [4], const unsigned char [64]); __END_DECLS -#endif /* _SYS_MD5_H_ */ +#endif /* _MD5_H_ */ diff --git a/sys/vfs/hammer/hammer.h b/sys/vfs/hammer/hammer.h index aacefaaa3d..3131c6301f 100644 --- a/sys/vfs/hammer/hammer.h +++ b/sys/vfs/hammer/hammer.h @@ -152,6 +152,8 @@ struct hammer_lock { #define HAMMER_LOCKF_EXCLUSIVE 0x40000000 #define HAMMER_LOCKF_WANTED 0x20000000 +#define HAMMER_LIMIT_RECLAIMS 16384 /* maximum reclaims in-prog */ + static __inline int hammer_notlocked(struct hammer_lock *lock) { diff --git a/sys/vfs/hammer/hammer_vfsops.c b/sys/vfs/hammer/hammer_vfsops.c index 212424c610..1a84842695 100644 --- a/sys/vfs/hammer/hammer_vfsops.c +++ b/sys/vfs/hammer/hammer_vfsops.c @@ -350,8 +350,11 @@ hammer_vfs_init(struct vfsconf *conf) * This limits the number of inodes in this state to prevent a * memory pool blowout. */ - if (hammer_limit_reclaims == 0) + if (hammer_limit_reclaims == 0) { hammer_limit_reclaims = maxvnodes / 10; + if (hammer_limit_reclaims > HAMMER_LIMIT_RECLAIMS) + hammer_limit_reclaims = HAMMER_LIMIT_RECLAIMS; + } return(0); } diff --git a/sys/vfs/hammer2/hammer2.h b/sys/vfs/hammer2/hammer2.h index 52e9c0ea96..8442b2f2c2 100644 --- a/sys/vfs/hammer2/hammer2.h +++ b/sys/vfs/hammer2/hammer2.h @@ -159,8 +159,10 @@ hammer2_mtx_upgrade_try(hammer2_mtx_t *mtx) */ typedef uint32_t hammer2_xid_t; -#define HAMMER2_XID_MIN 0x00000000U -#define HAMMER2_XID_MAX 0x7FFFFFFFU +#define HAMMER2_XID_MIN 0x00000000U +#define HAMMER2_XID_MAX 0x7FFFFFFFU + +#define HAMMER2_LIMIT_DIRTY_CHAINS (65536) /* * The chain structure tracks a portion of the media topology from the diff --git a/sys/vfs/hammer2/hammer2_vfsops.c b/sys/vfs/hammer2/hammer2_vfsops.c index f07b275278..6060f0445c 100644 --- a/sys/vfs/hammer2/hammer2_vfsops.c +++ b/sys/vfs/hammer2/hammer2_vfsops.c @@ -289,6 +289,8 @@ hammer2_vfs_init(struct vfsconf *conf) TAILQ_INIT(&hammer2_pfslist); hammer2_limit_dirty_chains = maxvnodes / 10; + if (hammer2_limit_dirty_chains > HAMMER2_LIMIT_DIRTY_CHAINS) + hammer2_limit_dirty_chains = HAMMER2_LIMIT_DIRTY_CHAINS; return (error); } diff --git a/tools/make_libdeps.sh b/tools/make_libdeps.sh index 13c6377ec1..9ed6a3c6c8 100644 --- a/tools/make_libdeps.sh +++ b/tools/make_libdeps.sh @@ -37,7 +37,6 @@ LIBS=" gnu/lib gnu/usr.bin/perl/libperl kerberos5/lib - secure/lib usr.bin/lex/lib " # where to scan for libraries @@ -49,7 +48,6 @@ sed -E -e's;$;!;' -e's;-lm!;lib/msun;g' -e's;-l(asn1|gssapi|krb5|roken)!;kerberos5/lib/lib\1;g' - -e's;-l(crypto|ssh)!;secure/lib/lib\1;g' -e's;-l([^!]+)!;lib/lib\1;g' " diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 2dd2aafee9..a2de9861f3 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -256,7 +256,16 @@ SUBDIR+=chkey \ dc \ drill \ fetch \ - newkey + newkey \ + bdes \ + openssl \ + scp \ + sftp \ + ssh \ + ssh-add \ + ssh-agent \ + ssh-keygen \ + ssh-keyscan .endif .include diff --git a/secure/usr.bin/bdes/Makefile b/usr.bin/bdes/Makefile similarity index 83% rename from secure/usr.bin/bdes/Makefile rename to usr.bin/bdes/Makefile index a33adfc8eb..ec400045cb 100644 --- a/secure/usr.bin/bdes/Makefile +++ b/usr.bin/bdes/Makefile @@ -8,6 +8,6 @@ WARNS?= 2 DPADD= ${LIBRECRYPTO} LDADD= -lprivate_crypto LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv -CFLAGS+= -I${.CURDIR}/../../../crypto/libressl/include +CFLAGS+= -I${.CURDIR}/../../crypto/libressl/include .include diff --git a/secure/usr.bin/bdes/bdes.1 b/usr.bin/bdes/bdes.1 similarity index 100% rename from secure/usr.bin/bdes/bdes.1 rename to usr.bin/bdes/bdes.1 diff --git a/secure/usr.bin/bdes/bdes.c b/usr.bin/bdes/bdes.c similarity index 100% rename from secure/usr.bin/bdes/bdes.c rename to usr.bin/bdes/bdes.c diff --git a/secure/usr.bin/bdes/bdes.ps b/usr.bin/bdes/bdes.ps similarity index 100% rename from secure/usr.bin/bdes/bdes.ps rename to usr.bin/bdes/bdes.ps diff --git a/usr.bin/nc/Makefile b/usr.bin/nc/Makefile new file mode 100644 index 0000000000..32df17b72c --- /dev/null +++ b/usr.bin/nc/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../contrib/netcat + +PROG= nc +SRCS= netcat.c atomicio.c socks.c + +#CFLAGS+=-DIPSEC +LIBADD= ipsec + +WARNS?= 2 + +.include diff --git a/secure/usr.bin/openssl/Makefile b/usr.bin/openssl/Makefile similarity index 94% rename from secure/usr.bin/openssl/Makefile rename to usr.bin/openssl/Makefile index 22e0f83f87..84b55d7000 100644 --- a/secure/usr.bin/openssl/Makefile +++ b/usr.bin/openssl/Makefile @@ -9,7 +9,7 @@ WARNS?= 2 DPADD+= ${LIBRESSL} ${LIBRECRYPTO} LDADD+= -lprivate_ssl -lprivate_crypto LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv -CFLAGS+= -I${.CURDIR}/../../../crypto/libressl/include +CFLAGS+= -I${.CURDIR}/../../crypto/libressl/include CFLAGS+= -DMONOLITH -I${.CURDIR} SRCS= apps.c apps_posix.c asn1pars.c ca.c certhash.c ciphers.c cms.c crl.c \ diff --git a/secure/usr.bin/openssl/Makefile.etc b/usr.bin/openssl/Makefile.etc similarity index 100% rename from secure/usr.bin/openssl/Makefile.etc rename to usr.bin/openssl/Makefile.etc diff --git a/secure/usr.bin/openssl/Makefile.man b/usr.bin/openssl/Makefile.man similarity index 100% rename from secure/usr.bin/openssl/Makefile.man rename to usr.bin/openssl/Makefile.man diff --git a/secure/usr.bin/openssl/man/CA.pl.1 b/usr.bin/openssl/man/CA.pl.1 similarity index 100% rename from secure/usr.bin/openssl/man/CA.pl.1 rename to usr.bin/openssl/man/CA.pl.1 diff --git a/secure/usr.bin/openssl/man/asn1parse.1 b/usr.bin/openssl/man/asn1parse.1 similarity index 100% rename from secure/usr.bin/openssl/man/asn1parse.1 rename to usr.bin/openssl/man/asn1parse.1 diff --git a/secure/usr.bin/openssl/man/c_rehash.1 b/usr.bin/openssl/man/c_rehash.1 similarity index 100% rename from secure/usr.bin/openssl/man/c_rehash.1 rename to usr.bin/openssl/man/c_rehash.1 diff --git a/secure/usr.bin/openssl/man/ca.1 b/usr.bin/openssl/man/ca.1 similarity index 100% rename from secure/usr.bin/openssl/man/ca.1 rename to usr.bin/openssl/man/ca.1 diff --git a/secure/usr.bin/openssl/man/ciphers.1 b/usr.bin/openssl/man/ciphers.1 similarity index 100% rename from secure/usr.bin/openssl/man/ciphers.1 rename to usr.bin/openssl/man/ciphers.1 diff --git a/secure/usr.bin/openssl/man/cms.1 b/usr.bin/openssl/man/cms.1 similarity index 100% rename from secure/usr.bin/openssl/man/cms.1 rename to usr.bin/openssl/man/cms.1 diff --git a/secure/usr.bin/openssl/man/config.5 b/usr.bin/openssl/man/config.5 similarity index 100% rename from secure/usr.bin/openssl/man/config.5 rename to usr.bin/openssl/man/config.5 diff --git a/secure/usr.bin/openssl/man/crl.1 b/usr.bin/openssl/man/crl.1 similarity index 100% rename from secure/usr.bin/openssl/man/crl.1 rename to usr.bin/openssl/man/crl.1 diff --git a/secure/usr.bin/openssl/man/crl2pkcs7.1 b/usr.bin/openssl/man/crl2pkcs7.1 similarity index 100% rename from secure/usr.bin/openssl/man/crl2pkcs7.1 rename to usr.bin/openssl/man/crl2pkcs7.1 diff --git a/secure/usr.bin/openssl/man/dgst.1 b/usr.bin/openssl/man/dgst.1 similarity index 100% rename from secure/usr.bin/openssl/man/dgst.1 rename to usr.bin/openssl/man/dgst.1 diff --git a/secure/usr.bin/openssl/man/dhparam.1 b/usr.bin/openssl/man/dhparam.1 similarity index 100% rename from secure/usr.bin/openssl/man/dhparam.1 rename to usr.bin/openssl/man/dhparam.1 diff --git a/secure/usr.bin/openssl/man/dsa.1 b/usr.bin/openssl/man/dsa.1 similarity index 100% rename from secure/usr.bin/openssl/man/dsa.1 rename to usr.bin/openssl/man/dsa.1 diff --git a/secure/usr.bin/openssl/man/dsaparam.1 b/usr.bin/openssl/man/dsaparam.1 similarity index 100% rename from secure/usr.bin/openssl/man/dsaparam.1 rename to usr.bin/openssl/man/dsaparam.1 diff --git a/secure/usr.bin/openssl/man/ec.1 b/usr.bin/openssl/man/ec.1 similarity index 100% rename from secure/usr.bin/openssl/man/ec.1 rename to usr.bin/openssl/man/ec.1 diff --git a/secure/usr.bin/openssl/man/ecparam.1 b/usr.bin/openssl/man/ecparam.1 similarity index 100% rename from secure/usr.bin/openssl/man/ecparam.1 rename to usr.bin/openssl/man/ecparam.1 diff --git a/secure/usr.bin/openssl/man/enc.1 b/usr.bin/openssl/man/enc.1 similarity index 100% rename from secure/usr.bin/openssl/man/enc.1 rename to usr.bin/openssl/man/enc.1 diff --git a/secure/usr.bin/openssl/man/errstr.1 b/usr.bin/openssl/man/errstr.1 similarity index 100% rename from secure/usr.bin/openssl/man/errstr.1 rename to usr.bin/openssl/man/errstr.1 diff --git a/secure/usr.bin/openssl/man/gendsa.1 b/usr.bin/openssl/man/gendsa.1 similarity index 100% rename from secure/usr.bin/openssl/man/gendsa.1 rename to usr.bin/openssl/man/gendsa.1 diff --git a/secure/usr.bin/openssl/man/genpkey.1 b/usr.bin/openssl/man/genpkey.1 similarity index 100% rename from secure/usr.bin/openssl/man/genpkey.1 rename to usr.bin/openssl/man/genpkey.1 diff --git a/secure/usr.bin/openssl/man/genrsa.1 b/usr.bin/openssl/man/genrsa.1 similarity index 100% rename from secure/usr.bin/openssl/man/genrsa.1 rename to usr.bin/openssl/man/genrsa.1 diff --git a/secure/usr.bin/openssl/man/nseq.1 b/usr.bin/openssl/man/nseq.1 similarity index 100% rename from secure/usr.bin/openssl/man/nseq.1 rename to usr.bin/openssl/man/nseq.1 diff --git a/secure/usr.bin/openssl/man/ocsp.1 b/usr.bin/openssl/man/ocsp.1 similarity index 100% rename from secure/usr.bin/openssl/man/ocsp.1 rename to usr.bin/openssl/man/ocsp.1 diff --git a/secure/usr.bin/openssl/man/openssl.1 b/usr.bin/openssl/man/openssl.1 similarity index 100% rename from secure/usr.bin/openssl/man/openssl.1 rename to usr.bin/openssl/man/openssl.1 diff --git a/secure/usr.bin/openssl/man/passwd.1 b/usr.bin/openssl/man/passwd.1 similarity index 100% rename from secure/usr.bin/openssl/man/passwd.1 rename to usr.bin/openssl/man/passwd.1 diff --git a/secure/usr.bin/openssl/man/pkcs12.1 b/usr.bin/openssl/man/pkcs12.1 similarity index 100% rename from secure/usr.bin/openssl/man/pkcs12.1 rename to usr.bin/openssl/man/pkcs12.1 diff --git a/secure/usr.bin/openssl/man/pkcs7.1 b/usr.bin/openssl/man/pkcs7.1 similarity index 100% rename from secure/usr.bin/openssl/man/pkcs7.1 rename to usr.bin/openssl/man/pkcs7.1 diff --git a/secure/usr.bin/openssl/man/pkcs8.1 b/usr.bin/openssl/man/pkcs8.1 similarity index 100% rename from secure/usr.bin/openssl/man/pkcs8.1 rename to usr.bin/openssl/man/pkcs8.1 diff --git a/secure/usr.bin/openssl/man/pkey.1 b/usr.bin/openssl/man/pkey.1 similarity index 100% rename from secure/usr.bin/openssl/man/pkey.1 rename to usr.bin/openssl/man/pkey.1 diff --git a/secure/usr.bin/openssl/man/pkeyparam.1 b/usr.bin/openssl/man/pkeyparam.1 similarity index 100% rename from secure/usr.bin/openssl/man/pkeyparam.1 rename to usr.bin/openssl/man/pkeyparam.1 diff --git a/secure/usr.bin/openssl/man/pkeyutl.1 b/usr.bin/openssl/man/pkeyutl.1 similarity index 100% rename from secure/usr.bin/openssl/man/pkeyutl.1 rename to usr.bin/openssl/man/pkeyutl.1 diff --git a/secure/usr.bin/openssl/man/rand.1 b/usr.bin/openssl/man/rand.1 similarity index 100% rename from secure/usr.bin/openssl/man/rand.1 rename to usr.bin/openssl/man/rand.1 diff --git a/secure/usr.bin/openssl/man/req.1 b/usr.bin/openssl/man/req.1 similarity index 100% rename from secure/usr.bin/openssl/man/req.1 rename to usr.bin/openssl/man/req.1 diff --git a/secure/usr.bin/openssl/man/rsa.1 b/usr.bin/openssl/man/rsa.1 similarity index 100% rename from secure/usr.bin/openssl/man/rsa.1 rename to usr.bin/openssl/man/rsa.1 diff --git a/secure/usr.bin/openssl/man/rsautl.1 b/usr.bin/openssl/man/rsautl.1 similarity index 100% rename from secure/usr.bin/openssl/man/rsautl.1 rename to usr.bin/openssl/man/rsautl.1 diff --git a/secure/usr.bin/openssl/man/s_client.1 b/usr.bin/openssl/man/s_client.1 similarity index 100% rename from secure/usr.bin/openssl/man/s_client.1 rename to usr.bin/openssl/man/s_client.1 diff --git a/secure/usr.bin/openssl/man/s_server.1 b/usr.bin/openssl/man/s_server.1 similarity index 100% rename from secure/usr.bin/openssl/man/s_server.1 rename to usr.bin/openssl/man/s_server.1 diff --git a/secure/usr.bin/openssl/man/s_time.1 b/usr.bin/openssl/man/s_time.1 similarity index 100% rename from secure/usr.bin/openssl/man/s_time.1 rename to usr.bin/openssl/man/s_time.1 diff --git a/secure/usr.bin/openssl/man/sess_id.1 b/usr.bin/openssl/man/sess_id.1 similarity index 100% rename from secure/usr.bin/openssl/man/sess_id.1 rename to usr.bin/openssl/man/sess_id.1 diff --git a/secure/usr.bin/openssl/man/smime.1 b/usr.bin/openssl/man/smime.1 similarity index 100% rename from secure/usr.bin/openssl/man/smime.1 rename to usr.bin/openssl/man/smime.1 diff --git a/secure/usr.bin/openssl/man/speed.1 b/usr.bin/openssl/man/speed.1 similarity index 100% rename from secure/usr.bin/openssl/man/speed.1 rename to usr.bin/openssl/man/speed.1 diff --git a/secure/usr.bin/openssl/man/spkac.1 b/usr.bin/openssl/man/spkac.1 similarity index 100% rename from secure/usr.bin/openssl/man/spkac.1 rename to usr.bin/openssl/man/spkac.1 diff --git a/secure/usr.bin/openssl/man/ts.1 b/usr.bin/openssl/man/ts.1 similarity index 100% rename from secure/usr.bin/openssl/man/ts.1 rename to usr.bin/openssl/man/ts.1 diff --git a/secure/usr.bin/openssl/man/tsget.1 b/usr.bin/openssl/man/tsget.1 similarity index 100% rename from secure/usr.bin/openssl/man/tsget.1 rename to usr.bin/openssl/man/tsget.1 diff --git a/secure/usr.bin/openssl/man/verify.1 b/usr.bin/openssl/man/verify.1 similarity index 100% rename from secure/usr.bin/openssl/man/verify.1 rename to usr.bin/openssl/man/verify.1 diff --git a/secure/usr.bin/openssl/man/version.1 b/usr.bin/openssl/man/version.1 similarity index 100% rename from secure/usr.bin/openssl/man/version.1 rename to usr.bin/openssl/man/version.1 diff --git a/secure/usr.bin/openssl/man/x509.1 b/usr.bin/openssl/man/x509.1 similarity index 100% rename from secure/usr.bin/openssl/man/x509.1 rename to usr.bin/openssl/man/x509.1 diff --git a/secure/usr.bin/openssl/man/x509v3_config.5 b/usr.bin/openssl/man/x509v3_config.5 similarity index 100% rename from secure/usr.bin/openssl/man/x509v3_config.5 rename to usr.bin/openssl/man/x509v3_config.5 diff --git a/secure/usr.bin/scp/Makefile b/usr.bin/scp/Makefile similarity index 100% rename from secure/usr.bin/scp/Makefile rename to usr.bin/scp/Makefile diff --git a/secure/usr.bin/sftp/Makefile b/usr.bin/sftp/Makefile similarity index 100% rename from secure/usr.bin/sftp/Makefile rename to usr.bin/sftp/Makefile diff --git a/secure/usr.bin/ssh-add/Makefile b/usr.bin/ssh-add/Makefile similarity index 100% rename from secure/usr.bin/ssh-add/Makefile rename to usr.bin/ssh-add/Makefile diff --git a/secure/usr.bin/ssh-agent/Makefile b/usr.bin/ssh-agent/Makefile similarity index 100% rename from secure/usr.bin/ssh-agent/Makefile rename to usr.bin/ssh-agent/Makefile diff --git a/secure/usr.bin/ssh-keygen/Makefile b/usr.bin/ssh-keygen/Makefile similarity index 100% rename from secure/usr.bin/ssh-keygen/Makefile rename to usr.bin/ssh-keygen/Makefile diff --git a/secure/usr.bin/ssh-keyscan/Makefile b/usr.bin/ssh-keyscan/Makefile similarity index 100% rename from secure/usr.bin/ssh-keyscan/Makefile rename to usr.bin/ssh-keyscan/Makefile diff --git a/secure/usr.bin/ssh/Makefile b/usr.bin/ssh/Makefile similarity index 100% rename from secure/usr.bin/ssh/Makefile rename to usr.bin/ssh/Makefile diff --git a/secure/usr.bin/ssh/Makefile.etc b/usr.bin/ssh/Makefile.etc similarity index 100% rename from secure/usr.bin/ssh/Makefile.etc rename to usr.bin/ssh/Makefile.etc diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index e7d71cc705..67413554e1 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -142,10 +142,15 @@ SUBDIR= 802_11 \ zic # Uses LibreSSL but can build without it +# SUBDIR+=ppp \ pppd \ tcpdump +# from old secure/ +# +SUBDIR+=sshd + .if !defined(NO_LIBRESSL) SUBDIR+=keyserv .endif diff --git a/usr.sbin/mtree/Makefile b/usr.sbin/mtree/Makefile index c563c93e9a..540ea42494 100644 --- a/usr.sbin/mtree/Makefile +++ b/usr.sbin/mtree/Makefile @@ -3,6 +3,7 @@ # $DragonFly: src/usr.sbin/mtree/Makefile,v 1.2 2003/06/17 04:29:57 dillon Exp $ .PATH: ${.CURDIR}/../../usr.bin/cksum +.PATH: ${.CURDIR}/../../sbin/md5 PROG= mtree MAN= mtree.8 @@ -12,9 +13,11 @@ SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c verify.c .PATH: ${.CURDIR}/../../lib/libc/gen SRCS+= strtofflags.c .else -CFLAGS+= -DMD5 -DSHA1 -DRMD160 -DPADD= ${LIBMD} -LDADD= -lmd +SRCS+= sha1hl.c +CFLAGS+= -DUSE_MD5 -DUSE_SHA1 -DUSE_RMD160 +DPADD= ${LIBMD} ${LIBCRYPTO} +LDADD= -lmd -lprivate_crypto +LDFLAGS+= -rpath /lib/priv -L ${_SHLIBDIRPREFIX}/usr/lib/priv .endif .include diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c index af783fc36f..0269e27f8a 100644 --- a/usr.sbin/mtree/compare.c +++ b/usr.sbin/mtree/compare.c @@ -37,13 +37,14 @@ #include #include #include -#ifdef MD5 +#ifdef USE_MD5 #include #endif -#ifdef SHA1 +#ifdef USE_SHA1 #include +#include "../../sbin/md5/sha1hl.h" #endif -#ifdef RMD160 +#ifdef USE_RMD160 #include #endif #include @@ -225,7 +226,7 @@ typeerr: LABEL; printf("\n"); tab = "\t"; } -#ifdef MD5 +#ifdef USE_MD5 if (s->flags & F_MD5) { char *new_digest, buf[33]; @@ -243,7 +244,7 @@ typeerr: LABEL; } } #endif /* MD5 */ -#ifdef SHA1 +#ifdef USE_SHA1 if (s->flags & F_SHA1) { char *new_digest, buf[41]; @@ -261,7 +262,7 @@ typeerr: LABEL; } } #endif /* SHA1 */ -#ifdef RMD160 +#ifdef USE_RMD160 if (s->flags & F_RMD160) { char *new_digest, buf[41]; diff --git a/usr.sbin/ppp/chap_ms.c b/usr.sbin/ppp/chap_ms.c index 4ccb5dc59b..5c87c7a7f0 100644 --- a/usr.sbin/ppp/chap_ms.c +++ b/usr.sbin/ppp/chap_ms.c @@ -31,8 +31,10 @@ #include #ifdef __DragonFly__ +#include #include #include +#include #else #include #include @@ -187,7 +189,6 @@ GenerateNTResponse(char *AuthenticatorChallenge, char *PeerChallenge, ChallengeResponse(Challenge, PasswordHash, Response); } -#ifndef __DragonFly__ #define LENGTH 20 static char * SHA1_End(SHA_CTX *ctx, char *buf) @@ -208,7 +209,6 @@ SHA1_End(SHA_CTX *ctx, char *buf) buf[i+i] = '\0'; return buf; } -#endif void GenerateAuthenticatorResponse(char *Password, int PasswordLen, diff --git a/secure/usr.sbin/sshd/Makefile b/usr.sbin/sshd/Makefile similarity index 100% rename from secure/usr.sbin/sshd/Makefile rename to usr.sbin/sshd/Makefile diff --git a/secure/usr.sbin/sshd/Makefile.etc b/usr.sbin/sshd/Makefile.etc similarity index 84% rename from secure/usr.sbin/sshd/Makefile.etc rename to usr.sbin/sshd/Makefile.etc index b7e569257e..37a4f0f155 100644 --- a/secure/usr.sbin/sshd/Makefile.etc +++ b/usr.sbin/sshd/Makefile.etc @@ -7,5 +7,5 @@ FILESMODE= 644 FILESOWN= ${BINOWN} FILESGRP= ${BINGRP} -.include "../../Makefile.ssh.common" +.include "../../../Makefile.ssh.common" .include diff --git a/secure/usr.sbin/sshd/auth-passwd-freebsd.c b/usr.sbin/sshd/auth-passwd-freebsd.c similarity index 100% rename from secure/usr.sbin/sshd/auth-passwd-freebsd.c rename to usr.sbin/sshd/auth-passwd-freebsd.c