summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/crypto/arcfour.c (renamed from source4/lib/crypto/arcfour.c)2
-rw-r--r--lib/crypto/config.mk (renamed from source4/lib/crypto/config.mk)0
-rw-r--r--lib/crypto/crc32.c (renamed from source4/lib/crypto/crc32.c)0
-rw-r--r--lib/crypto/crc32.h (renamed from source4/lib/crypto/crc32.h)0
-rw-r--r--lib/crypto/crypto.h (renamed from source4/lib/crypto/crypto.h)12
-rw-r--r--lib/crypto/hmacmd5.c (renamed from source4/lib/crypto/hmacmd5.c)2
-rw-r--r--lib/crypto/hmacmd5.h (renamed from source4/lib/crypto/hmacmd5.h)3
-rw-r--r--lib/crypto/hmacmd5test.c (renamed from source4/lib/crypto/hmacmd5test.c)2
-rw-r--r--lib/crypto/hmacsha256.c (renamed from source4/lib/crypto/hmacsha256.c)2
-rw-r--r--lib/crypto/hmacsha256.h (renamed from source4/lib/crypto/hmacsha256.h)0
-rw-r--r--lib/crypto/md4.c (renamed from source4/lib/crypto/md4.c)0
-rw-r--r--lib/crypto/md4.h (renamed from source4/lib/crypto/md4.h)0
-rw-r--r--lib/crypto/md4test.c (renamed from source4/lib/crypto/md4test.c)2
-rw-r--r--lib/crypto/md5.c (renamed from source4/lib/crypto/md5.c)0
-rw-r--r--lib/crypto/md5.h (renamed from source4/lib/crypto/md5.h)0
-rw-r--r--lib/crypto/md5test.c (renamed from source4/lib/crypto/md5test.c)2
-rw-r--r--lib/crypto/sha256.c (renamed from source4/lib/crypto/sha256.c)0
-rw-r--r--lib/crypto/sha256.h (renamed from source4/lib/crypto/sha256.h)0
-rw-r--r--source3/Makefile.in4
-rw-r--r--source3/include/hmacmd5.h29
-rw-r--r--source3/include/includes.h4
-rw-r--r--source3/include/md5.h19
-rw-r--r--source3/include/proto.h16
-rw-r--r--source3/lib/hmacmd5.c135
-rw-r--r--source3/lib/md4.c174
-rw-r--r--source3/lib/md5.c247
-rw-r--r--source4/Makefile5
-rw-r--r--source4/auth/credentials/credentials_ntlm.c2
-rw-r--r--source4/auth/gensec/schannel_sign.c2
-rw-r--r--source4/auth/ntlm/ntlm_check.c2
-rw-r--r--source4/auth/ntlmssp/ntlmssp_client.c2
-rw-r--r--source4/auth/ntlmssp/ntlmssp_server.c2
-rw-r--r--source4/auth/ntlmssp/ntlmssp_sign.c2
-rw-r--r--source4/dsdb/repl/replicated_objects.c2
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c2
-rw-r--r--source4/kdc/hdb-ldb.c2
-rw-r--r--source4/lib/util/genrand.c2
-rw-r--r--source4/libcli/auth/credentials.c2
-rw-r--r--source4/libcli/auth/smbencrypt.c2
-rw-r--r--source4/libcli/raw/smb_signing.c2
-rw-r--r--source4/libcli/smb2/signing.c2
-rw-r--r--source4/libnet/libnet_passwd.c2
-rw-r--r--source4/main.mk2
-rw-r--r--source4/ntp_signd/ntp_signd.c2
-rw-r--r--source4/rpc_server/lsa/dcesrv_lsa.c2
-rw-r--r--source4/rpc_server/samr/samr_password.c2
-rw-r--r--source4/torture/local/local.c2
-rw-r--r--source4/torture/rpc/dssync.c2
-rw-r--r--source4/torture/rpc/lsa.c2
-rw-r--r--source4/torture/rpc/samba3rpc.c2
-rw-r--r--source4/torture/rpc/samlogon.c2
-rw-r--r--source4/torture/rpc/samr.c2
-rw-r--r--source4/torture/rpc/samsync.c2
-rw-r--r--source4/torture/rpc/testjoin.c2
-rw-r--r--source4/torture/rpc/wkssvc.c2
55 files changed, 51 insertions, 665 deletions
diff --git a/source4/lib/crypto/arcfour.c b/lib/crypto/arcfour.c
index 94196fa1ee..c57e05d0e9 100644
--- a/source4/lib/crypto/arcfour.c
+++ b/lib/crypto/arcfour.c
@@ -20,7 +20,7 @@
*/
#include "includes.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/arcfour.h"
/* initialise the arcfour sbox with key */
_PUBLIC_ void arcfour_init(struct arcfour_state *state, const DATA_BLOB *key)
diff --git a/source4/lib/crypto/config.mk b/lib/crypto/config.mk
index ee111bd088..ee111bd088 100644
--- a/source4/lib/crypto/config.mk
+++ b/lib/crypto/config.mk
diff --git a/source4/lib/crypto/crc32.c b/lib/crypto/crc32.c
index 5b9d9b108d..5b9d9b108d 100644
--- a/source4/lib/crypto/crc32.c
+++ b/lib/crypto/crc32.c
diff --git a/source4/lib/crypto/crc32.h b/lib/crypto/crc32.h
index 7854abf865..7854abf865 100644
--- a/source4/lib/crypto/crc32.h
+++ b/lib/crypto/crc32.h
diff --git a/source4/lib/crypto/crypto.h b/lib/crypto/crypto.h
index fc283f72ba..9cb16ad344 100644
--- a/source4/lib/crypto/crypto.h
+++ b/lib/crypto/crypto.h
@@ -17,12 +17,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "lib/crypto/crc32.h"
-#include "lib/crypto/md4.h"
-#include "lib/crypto/md5.h"
-#include "lib/crypto/hmacmd5.h"
-#include "lib/crypto/sha256.h"
-#include "lib/crypto/hmacsha256.h"
+#include "../lib/crypto/crc32.h"
+#include "../lib/crypto/md4.h"
+#include "../lib/crypto/md5.h"
+#include "../lib/crypto/hmacmd5.h"
+#include "../lib/crypto/sha256.h"
+#include "../lib/crypto/hmacsha256.h"
struct arcfour_state {
uint8_t sbox[256];
diff --git a/source4/lib/crypto/hmacmd5.c b/lib/crypto/hmacmd5.c
index 3a9ec38a27..0c8d1ab598 100644
--- a/source4/lib/crypto/hmacmd5.c
+++ b/lib/crypto/hmacmd5.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/hmacmd5.h"
/***********************************************************************
the rfc 2104 version of hmac_md5 initialisation.
diff --git a/source4/lib/crypto/hmacmd5.h b/lib/crypto/hmacmd5.h
index 5769737fcd..91b8ca586c 100644
--- a/source4/lib/crypto/hmacmd5.h
+++ b/lib/crypto/hmacmd5.h
@@ -19,6 +19,9 @@
*/
#ifndef _HMAC_MD5_H
+#define _HMAC_MD5_H
+
+#include "../lib/crypto/md5.h"
typedef struct
{
diff --git a/source4/lib/crypto/hmacmd5test.c b/lib/crypto/hmacmd5test.c
index 07ed54c98d..0a98404eda 100644
--- a/source4/lib/crypto/hmacmd5test.c
+++ b/lib/crypto/hmacmd5test.c
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
struct torture_context;
diff --git a/source4/lib/crypto/hmacsha256.c b/lib/crypto/hmacsha256.c
index 6b0af9ee83..53d4fe3883 100644
--- a/source4/lib/crypto/hmacsha256.c
+++ b/lib/crypto/hmacsha256.c
@@ -27,7 +27,7 @@
*/
#include "includes.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
/***********************************************************************
the rfc 2104/2202 version of hmac_sha256 initialisation.
diff --git a/source4/lib/crypto/hmacsha256.h b/lib/crypto/hmacsha256.h
index 8960c636c1..8960c636c1 100644
--- a/source4/lib/crypto/hmacsha256.h
+++ b/lib/crypto/hmacsha256.h
diff --git a/source4/lib/crypto/md4.c b/lib/crypto/md4.c
index 7ad93ce786..7ad93ce786 100644
--- a/source4/lib/crypto/md4.c
+++ b/lib/crypto/md4.c
diff --git a/source4/lib/crypto/md4.h b/lib/crypto/md4.h
index 234e488e4f..234e488e4f 100644
--- a/source4/lib/crypto/md4.h
+++ b/lib/crypto/md4.h
diff --git a/source4/lib/crypto/md4test.c b/lib/crypto/md4test.c
index 5e0451973c..dddf9e61a0 100644
--- a/source4/lib/crypto/md4test.c
+++ b/lib/crypto/md4test.c
@@ -18,7 +18,7 @@
*/
#include "includes.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
struct torture_context;
diff --git a/source4/lib/crypto/md5.c b/lib/crypto/md5.c
index 584c46ef2d..584c46ef2d 100644
--- a/source4/lib/crypto/md5.c
+++ b/lib/crypto/md5.c
diff --git a/source4/lib/crypto/md5.h b/lib/crypto/md5.h
index 4064d6f003..4064d6f003 100644
--- a/source4/lib/crypto/md5.h
+++ b/lib/crypto/md5.h
diff --git a/source4/lib/crypto/md5test.c b/lib/crypto/md5test.c
index 702e0fcf41..1244dca753 100644
--- a/source4/lib/crypto/md5test.c
+++ b/lib/crypto/md5test.c
@@ -18,7 +18,7 @@
*/
#include "includes.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
struct torture_context;
diff --git a/source4/lib/crypto/sha256.c b/lib/crypto/sha256.c
index a2def25814..a2def25814 100644
--- a/source4/lib/crypto/sha256.c
+++ b/lib/crypto/sha256.c
diff --git a/source4/lib/crypto/sha256.h b/lib/crypto/sha256.h
index 4a5f2cbe94..4a5f2cbe94 100644
--- a/source4/lib/crypto/sha256.h
+++ b/lib/crypto/sha256.h
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 333c5f3001..20adeeb222 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -315,7 +315,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) \
lib/async_sock.o \
$(TDB_LIB_OBJ) \
$(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
- lib/interface.o lib/md4.o \
+ lib/interface.o ../lib/crypto/md4.o \
lib/pidfile.o \
lib/signal.o lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \
lib/ufc.o lib/genrand.o lib/username.o \
@@ -328,7 +328,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) \
lib/substitute.o lib/fsusage.o lib/dbwrap_util.o \
lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \
lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \
- lib/md5.o lib/hmacmd5.o lib/arc4.o lib/iconv.o \
+ ../lib/crypto/md5.o ../lib/crypto/hmacmd5.o lib/arc4.o lib/iconv.o \
lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \
lib/adt_tree.o lib/gencache.o \
lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \
diff --git a/source3/include/hmacmd5.h b/source3/include/hmacmd5.h
deleted file mode 100644
index ae588fb889..0000000000
--- a/source3/include/hmacmd5.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Interface header: Scheduler service
- Copyright (C) Luke Kenneth Casson Leighton 1996-1999
- Copyright (C) Andrew Tridgell 1992-1999
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _HMAC_MD5_H
-
-typedef struct {
- struct MD5Context ctx;
- unsigned char k_ipad[65];
- unsigned char k_opad[65];
-} HMACMD5Context;
-
-#endif /* _HMAC_MD5_H */
diff --git a/source3/include/includes.h b/source3/include/includes.h
index fbf5ca6cd0..de50eab8c5 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -686,8 +686,8 @@ typedef char fstring[FSTRING_LEN];
#include "authdata.h"
#include "msdfs.h"
#include "rap.h"
-#include "md5.h"
-#include "hmacmd5.h"
+#include "../lib/crypto/md5.h"
+#include "../lib/crypto/hmacmd5.h"
#include "ntlmssp.h"
#include "auth.h"
#include "ntdomain.h"
diff --git a/source3/include/md5.h b/source3/include/md5.h
deleted file mode 100644
index e4cd08ed5e..0000000000
--- a/source3/include/md5.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef MD5_H
-#define MD5_H
-#ifndef HEADER_MD5_H
-/* Try to avoid clashes with OpenSSL */
-#define HEADER_MD5_H
-#endif
-
-struct MD5Context {
- uint32 buf[4];
- uint32 bits[2];
- unsigned char in[64];
-};
-
-void MD5Init(struct MD5Context *context);
-void MD5Update(struct MD5Context *context, unsigned char const *buf,
- unsigned len);
-void MD5Final(unsigned char digest[16], struct MD5Context *context);
-
-#endif /* !MD5_H */
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 4a51835f3d..a5f43aad4c 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -596,16 +596,6 @@ void set_need_random_reseed(void);
void generate_random_buffer( unsigned char *out, int len);
char *generate_random_str(size_t len);
-/* The following definitions come from lib/hmacmd5.c */
-
-void hmac_md5_init_rfc2104(const unsigned char *key, int key_len, HMACMD5Context *ctx);
-void hmac_md5_init_limK_to_64(const unsigned char* key, int key_len,
- HMACMD5Context *ctx);
-void hmac_md5_update(const unsigned char *text, int text_len, HMACMD5Context *ctx);
-void hmac_md5_final(unsigned char *digest, HMACMD5Context *ctx);
-void hmac_md5( unsigned char key[16], const unsigned char *data, int data_len,
- unsigned char *digest);
-
/* The following definitions come from lib/iconv.c */
NTSTATUS smb_register_charset(struct charset_functions *funcs) ;
@@ -649,12 +639,6 @@ char *escape_rdn_val_string_alloc(const char *s);
void mdfour(unsigned char *out, const unsigned char *in, int n);
-/* The following definitions come from lib/md5.c */
-
-void MD5Init(struct MD5Context *ctx);
-void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len);
-void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
-
/* The following definitions come from lib/module.c */
NTSTATUS smb_load_module(const char *module_name);
diff --git a/source3/lib/hmacmd5.c b/source3/lib/hmacmd5.c
deleted file mode 100644
index 86db3aa236..0000000000
--- a/source3/lib/hmacmd5.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- HMAC MD5 code for use in NTLMv2
- Copyright (C) Luke Kenneth Casson Leighton 1996-2000
- Copyright (C) Andrew Tridgell 1992-2000
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/* taken direct from rfc2104 implementation and modified for suitable use
- * for ntlmv2.
- */
-
-#include "includes.h"
-
-/***********************************************************************
- the rfc 2104 version of hmac_md5 initialisation.
-***********************************************************************/
-
-void hmac_md5_init_rfc2104(const unsigned char *key, int key_len, HMACMD5Context *ctx)
-{
- int i;
- unsigned char tk[16];
-
- /* if key is longer than 64 bytes reset it to key=MD5(key) */
- if (key_len > 64) {
- struct MD5Context tctx;
-
- MD5Init(&tctx);
- MD5Update(&tctx, key, key_len);
- MD5Final(tk, &tctx);
-
- key = tk;
- key_len = 16;
- }
-
- /* start out by storing key in pads */
- ZERO_STRUCT(ctx->k_ipad);
- ZERO_STRUCT(ctx->k_opad);
- memcpy( ctx->k_ipad, key, key_len);
- memcpy( ctx->k_opad, key, key_len);
-
- /* XOR key with ipad and opad values */
- for (i=0; i<64; i++) {
- ctx->k_ipad[i] ^= 0x36;
- ctx->k_opad[i] ^= 0x5c;
- }
-
- MD5Init(&ctx->ctx);
- MD5Update(&ctx->ctx, ctx->k_ipad, 64);
-}
-
-/***********************************************************************
- the microsoft version of hmac_md5 initialisation.
-***********************************************************************/
-
-void hmac_md5_init_limK_to_64(const unsigned char* key, int key_len,
- HMACMD5Context *ctx)
-{
- int i;
-
- /* if key is longer than 64 bytes truncate it */
- if (key_len > 64) {
- key_len = 64;
- }
-
- /* start out by storing key in pads */
- ZERO_STRUCT(ctx->k_ipad);
- ZERO_STRUCT(ctx->k_opad);
- memcpy( ctx->k_ipad, key, key_len);
- memcpy( ctx->k_opad, key, key_len);
-
- /* XOR key with ipad and opad values */
- for (i=0; i<64; i++) {
- ctx->k_ipad[i] ^= 0x36;
- ctx->k_opad[i] ^= 0x5c;
- }
-
- MD5Init(&ctx->ctx);
- MD5Update(&ctx->ctx, ctx->k_ipad, 64);
-}
-
-/***********************************************************************
- update hmac_md5 "inner" buffer
-***********************************************************************/
-
-void hmac_md5_update(const unsigned char *text, int text_len, HMACMD5Context *ctx)
-{
- MD5Update(&ctx->ctx, text, text_len); /* then text of datagram */
-}
-
-/***********************************************************************
- finish off hmac_md5 "inner" buffer and generate outer one.
-***********************************************************************/
-void hmac_md5_final(unsigned char *digest, HMACMD5Context *ctx)
-
-{
- struct MD5Context ctx_o;
-
- MD5Final(digest, &ctx->ctx);
-
- MD5Init(&ctx_o);
- MD5Update(&ctx_o, ctx->k_opad, 64);
- MD5Update(&ctx_o, digest, 16);
- MD5Final(digest, &ctx_o);
-}
-
-/***********************************************************
- single function to calculate an HMAC MD5 digest from data.
- use the microsoft hmacmd5 init method because the key is 16 bytes.
-************************************************************/
-
-void hmac_md5( unsigned char key[16], const unsigned char *data, int data_len,
- unsigned char *digest)
-{
- HMACMD5Context ctx;
- hmac_md5_init_limK_to_64(key, 16, &ctx);
- if (data_len != 0)
- {
- hmac_md5_update(data, data_len, &ctx);
- }
- hmac_md5_final(digest, &ctx);
-}
-
diff --git a/source3/lib/md4.c b/source3/lib/md4.c
deleted file mode 100644
index bae0091e36..0000000000
--- a/source3/lib/md4.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- a implementation of MD4 designed for use in the SMB authentication protocol
- Copyright (C) Andrew Tridgell 1997-1998.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-
-/* NOTE: This code makes no attempt to be fast!
-
- It assumes that a int is at least 32 bits long
-*/
-
-#if 0
-static uint32 A, B, C, D;
-#else
-#define A (state[0])
-#define B (state[1])
-#define C (state[2])
-#define D (state[3])
-#endif
-
-static uint32 F(uint32 X, uint32 Y, uint32 Z)
-{
- return (X&Y) | ((~X)&Z);
-}
-
-static uint32 G(uint32 X, uint32 Y, uint32 Z)
-{
- return (X&Y) | (X&Z) | (Y&Z);
-}
-
-static uint32 H(uint32 X, uint32 Y, uint32 Z)
-{
- return X^Y^Z;
-}
-
-static uint32 lshift(uint32 x, int s)
-{
- x &= 0xFFFFFFFF;
- return ((x<<s)&0xFFFFFFFF) | (x>>(32-s));
-}
-
-#define ROUND1(a,b,c,d,k,s) a = lshift(a + F(b,c,d) + X[k], s)
-#define ROUND2(a,b,c,d,k,s) a = lshift(a + G(b,c,d) + X[k] + (uint32)0x5A827999,s)
-#define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + (uint32)0x6ED9EBA1,s)
-
-/* this applies md4 to 64 byte chunks */
-static void mdfour64(uint32_t *state, uint32 *M)
-{
- int j;
- uint32 AA, BB, CC, DD;
- uint32 X[16];
-
- for (j=0;j<16;j++)
- X[j] = M[j];
-
- AA = A; BB = B; CC = C; DD = D;
-
- ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7);
- ROUND1(C,D,A,B, 2, 11); ROUND1(B,C,D,A, 3, 19);
- ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7);
- ROUND1(C,D,A,B, 6, 11); ROUND1(B,C,D,A, 7, 19);
- ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7);
- ROUND1(C,D,A,B, 10, 11); ROUND1(B,C,D,A, 11, 19);
- ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7);
- ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19);
-
- ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5);
- ROUND2(C,D,A,B, 8, 9); ROUND2(B,C,D,A, 12, 13);
- ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5);
- ROUND2(C,D,A,B, 9, 9); ROUND2(B,C,D,A, 13, 13);
- ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5);
- ROUND2(C,D,A,B, 10, 9); ROUND2(B,C,D,A, 14, 13);
- ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5);
- ROUND2(C,D,A,B, 11, 9); ROUND2(B,C,D,A, 15, 13);
-
- ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9);
- ROUND3(C,D,A,B, 4, 11); ROUND3(B,C,D,A, 12, 15);
- ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9);
- ROUND3(C,D,A,B, 6, 11); ROUND3(B,C,D,A, 14, 15);
- ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9);
- ROUND3(C,D,A,B, 5, 11); ROUND3(B,C,D,A, 13, 15);
- ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9);
- ROUND3(C,D,A,B, 7, 11); ROUND3(B,C,D,A, 15, 15);
-
- A += AA; B += BB; C += CC; D += DD;
-
- A &= 0xFFFFFFFF; B &= 0xFFFFFFFF;
- C &= 0xFFFFFFFF; D &= 0xFFFFFFFF;
-
- for (j=0;j<16;j++)
- X[j] = 0;
-}
-
-static void copy64(uint32 *M, const unsigned char *in)
-{
- int i;
-
- for (i=0;i<16;i++)
- M[i] = (in[i*4+3]<<24) | (in[i*4+2]<<16) |
- (in[i*4+1]<<8) | (in[i*4+0]<<0);
-}
-
-static void copy4(unsigned char *out, uint32 x)
-{
- out[0] = x&0xFF;
- out[1] = (x>>8)&0xFF;
- out[2] = (x>>16)&0xFF;
- out[3] = (x>>24)&0xFF;
-}
-
-/* produce a md4 message digest from data of length n bytes */
-void mdfour(unsigned char *out, const unsigned char *in, int n)
-{
- unsigned char buf[128];
- uint32 M[16];
- uint32 state[4];
- uint32 b = n * 8;
- int i;
-
- A = 0x67452301;
- B = 0xefcdab89;
- C = 0x98badcfe;
- D = 0x10325476;
-
- while (n > 64) {
- copy64(M, in);
- mdfour64(state, M);
- in += 64;
- n -= 64;
- }
-
- for (i=0;i<128;i++)
- buf[i] = 0;
- memcpy(buf, in, n);
- buf[n] = 0x80;
-
- if (n <= 55) {
- copy4(buf+56, b);
- copy64(M, buf);
- mdfour64(state, M);
- } else {
- copy4(buf+120, b);
- copy64(M, buf);
- mdfour64(state, M);
- copy64(M, buf+64);
- mdfour64(state, M);
- }
-
- for (i=0;i<128;i++)
- buf[i] = 0;
- copy64(M, buf);
-
- copy4(out, A);
- copy4(out+4, B);
- copy4(out+8, C);
- copy4(out+12, D);
-}
-
-
diff --git a/source3/lib/md5.c b/source3/lib/md5.c
deleted file mode 100644
index 2121b17047..0000000000
--- a/source3/lib/md5.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to MD5Init, call MD5Update as
- * needed on buffers full of bytes, and then call MD5Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-/* This code slightly modified to fit into Samba by
- abartlet@samba.org Jun 2001 */
-
-#include "includes.h"
-
-#include "md5.h"
-
-static void MD5Transform(uint32 buf[4], uint32 const in[16]);
-
-/*
- * Note: this code is harmless on little-endian machines.
- */
-static void byteReverse(unsigned char *buf, unsigned longs)
-{
- uint32 t;
- do {
- t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
- ((unsigned) buf[1] << 8 | buf[0]);
- *(uint32 *) buf = t;
- buf += 4;
- } while (--longs);
-}
-
-/*
- * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
- * initialization constants.
- */
-void MD5Init(struct MD5Context *ctx)
-{
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
-
- ctx->bits[0] = 0;
- ctx->bits[1] = 0;
-}
-
-/*
- * Update context to reflect the concatenation of another buffer full
- * of bytes.
- */
-void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
-{
- register uint32 t;
-
- /* Update bitcount */
-
- t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
- ctx->bits[1]++; /* Carry from low to high */
- ctx->bits[1] += len >> 29;
-
- t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-
- /* Handle any leading odd-sized chunks */
-
- if (t) {
- unsigned char *p = (unsigned char *) ctx->in + t;
-
- t = 64 - t;
- if (len < t) {
- memmove(p, buf, len);
- return;
- }
- memmove(p, buf, t);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- buf += t;
- len -= t;
- }
- /* Process data in 64-byte chunks */
-
- while (len >= 64) {
- memmove(ctx->in, buf, 64);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- buf += 64;
- len -= 64;
- }
-
- /* Handle any remaining bytes of data. */
-
- memmove(ctx->in, buf, len);
-}
-
-/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
- * 1 0* (64-bit count of bits processed, MSB-first)
- */
-void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
-{
- unsigned int count;
- unsigned char *p;
-
- /* Compute number of bytes mod 64 */
- count = (ctx->bits[0] >> 3) & 0x3F;
-
- /* Set the first char of padding to 0x80. This is safe since there is
- always at least one byte free */
- p = ctx->in + count;
- *p++ = 0x80;
-
- /* Bytes of padding needed to make 64 bytes */
- count = 64 - 1 - count;
-
- /* Pad out to 56 mod 64 */
- if (count < 8) {
- /* Two lots of padding: Pad the first block to 64 bytes */
- memset(p, 0, count);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
-
- /* Now fill the next block with 56 bytes */
- memset(ctx->in, 0, 56);
- } else {
- /* Pad block to 56 bytes */
- memset(p, 0, count - 8);
- }
- byteReverse(ctx->in, 14);
-
- /* Append length in bits and transform */
- ((uint32 *) ctx->in)[14] = ctx->bits[0];
- ((uint32 *) ctx->in)[15] = ctx->bits[1];
-
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- byteReverse((unsigned char *) ctx->buf, 4);
- memmove(digest, ctx->buf, 16);
- memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
-}
-
-/* The four core functions - F1 is optimized somewhat */
-
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
-
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data. MD5Update blocks
- * the data and converts bytes into longwords for this routine.
- */
-static void MD5Transform(uint32 buf[4], uint32 const in[16])
-{
- register uint32 a, b, c, d;
-
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
-}
diff --git a/source4/Makefile b/source4/Makefile
index 11057ae5f3..813f0cedd4 100644
--- a/source4/Makefile
+++ b/source4/Makefile
@@ -77,7 +77,7 @@ libstreamsrcdir := lib/stream
libutilsrcdir := lib/util
libtdrsrcdir := lib/tdr
libdbwrapsrcdir := lib/dbwrap
-libcryptosrcdir := lib/crypto
+libcryptosrcdir := ../lib/crypto
libtorturesrcdir := lib/torture
smb_serversrcdir := smb_server
libcompressionsrcdir := ../lib/compression
@@ -132,6 +132,9 @@ else
include $(srcdir)/static_deps.mk
endif
+clean::
+ @find ../lib ../libcli -name '*.o' -o -name '*.hd' | xargs rm -f
+
DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \
$(srcdir)/version.h
diff --git a/source4/auth/credentials/credentials_ntlm.c b/source4/auth/credentials/credentials_ntlm.c
index 22e273c35a..ef41971462 100644
--- a/source4/auth/credentials/credentials_ntlm.c
+++ b/source4/auth/credentials/credentials_ntlm.c
@@ -23,7 +23,7 @@
#include "includes.h"
#include "librpc/gen_ndr/samr.h" /* for struct samrPassword */
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#include "auth/credentials/credentials.h"
diff --git a/source4/auth/gensec/schannel_sign.c b/source4/auth/gensec/schannel_sign.c
index 1e57beba08..9862a029a4 100644
--- a/source4/auth/gensec/schannel_sign.c
+++ b/source4/auth/gensec/schannel_sign.c
@@ -21,7 +21,7 @@
*/
#include "includes.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "auth/auth.h"
#include "auth/gensec/schannel.h"
#include "auth/credentials/credentials.h"
diff --git a/source4/auth/ntlm/ntlm_check.c b/source4/auth/ntlm/ntlm_check.c
index 0dbbce0edc..62dec84f1d 100644
--- a/source4/auth/ntlm/ntlm_check.c
+++ b/source4/auth/ntlm/ntlm_check.c
@@ -20,7 +20,7 @@
*/
#include "includes.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "librpc/gen_ndr/netlogon.h"
#include "libcli/auth/libcli_auth.h"
#include "param/param.h"
diff --git a/source4/auth/ntlmssp/ntlmssp_client.c b/source4/auth/ntlmssp/ntlmssp_client.c
index 891761860c..eb990dee9c 100644
--- a/source4/auth/ntlmssp/ntlmssp_client.c
+++ b/source4/auth/ntlmssp/ntlmssp_client.c
@@ -24,7 +24,7 @@
#include "includes.h"
#include "auth/ntlmssp/ntlmssp.h"
#include "auth/ntlmssp/msrpc_parse.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#include "auth/credentials/credentials.h"
#include "auth/gensec/gensec.h"
diff --git a/source4/auth/ntlmssp/ntlmssp_server.c b/source4/auth/ntlmssp/ntlmssp_server.c
index bf91be3e24..ad1ee8e871 100644
--- a/source4/auth/ntlmssp/ntlmssp_server.c
+++ b/source4/auth/ntlmssp/ntlmssp_server.c
@@ -24,7 +24,7 @@
#include "includes.h"
#include "auth/ntlmssp/ntlmssp.h"
#include "auth/ntlmssp/msrpc_parse.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#include "auth/credentials/credentials.h"
#include "auth/gensec/gensec.h"
diff --git a/source4/auth/ntlmssp/ntlmssp_sign.c b/source4/auth/ntlmssp/ntlmssp_sign.c
index 063b16f539..49ed48df98 100644
--- a/source4/auth/ntlmssp/ntlmssp_sign.c
+++ b/source4/auth/ntlmssp/ntlmssp_sign.c
@@ -23,7 +23,7 @@
#include "auth/auth.h"
#include "auth/ntlmssp/ntlmssp.h"
#include "auth/ntlmssp/msrpc_parse.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "auth/credentials/credentials.h"
#include "auth/gensec/gensec.h"
#include "param/param.h"
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 552d83f411..2be01bac56 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -26,7 +26,7 @@
#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/gen_ndr/ndr_drsuapi.h"
#include "librpc/gen_ndr/ndr_drsblobs.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#include "param/param.h"
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 69783aefa8..6faef63c3d 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -48,7 +48,7 @@
#include "dsdb/samdb/ldb_modules/password_modules.h"
#include "librpc/ndr/libndr.h"
#include "librpc/gen_ndr/ndr_drsblobs.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "param/param.h"
/* If we have decided there is reason to work on this request, then
diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c
index cfd72c25ac..c5466f1acd 100644
--- a/source4/kdc/hdb-ldb.c
+++ b/source4/kdc/hdb-ldb.c
@@ -50,7 +50,7 @@
#include "param/param.h"
#include "events/events.h"
#include "kdc/kdc.h"
-#include "lib/crypto/md4.h"
+#include "../lib/crypto/md4.h"
enum hdb_ldb_ent_type
{ HDB_LDB_ENT_TYPE_CLIENT, HDB_LDB_ENT_TYPE_SERVER,
diff --git a/source4/lib/util/genrand.c b/source4/lib/util/genrand.c
index 7df4ec4e20..cd1823a9a0 100644
--- a/source4/lib/util/genrand.c
+++ b/source4/lib/util/genrand.c
@@ -21,7 +21,7 @@
#include "includes.h"
#include "system/filesys.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "system/locale.h"
/**
diff --git a/source4/libcli/auth/credentials.c b/source4/libcli/auth/credentials.c
index a6cb17c12e..3c77b0836d 100644
--- a/source4/libcli/auth/credentials.c
+++ b/source4/libcli/auth/credentials.c
@@ -23,7 +23,7 @@
#include "includes.h"
#include "system/time.h"
#include "auth/auth.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
/*
diff --git a/source4/libcli/auth/smbencrypt.c b/source4/libcli/auth/smbencrypt.c
index b50f003b91..3af7e45002 100644
--- a/source4/libcli/auth/smbencrypt.c
+++ b/source4/libcli/auth/smbencrypt.c
@@ -25,7 +25,7 @@
#include "system/time.h"
#include "auth/ntlmssp/ntlmssp.h"
#include "auth/ntlmssp/msrpc_parse.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#include "pstring.h"
#include "param/param.h"
diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c
index 826d7dd56b..e798f052ba 100644
--- a/source4/libcli/raw/smb_signing.c
+++ b/source4/libcli/raw/smb_signing.c
@@ -23,7 +23,7 @@
#include "smb.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/raw/raw_proto.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "param/param.h"
/***********************************************************
diff --git a/source4/libcli/smb2/signing.c b/source4/libcli/smb2/signing.c
index de9e1e9d29..101fb00c12 100644
--- a/source4/libcli/smb2/signing.c
+++ b/source4/libcli/smb2/signing.c
@@ -23,7 +23,7 @@
#include "libcli/raw/libcliraw.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
/*
sign an outgoing message
diff --git a/source4/libnet/libnet_passwd.c b/source4/libnet/libnet_passwd.c
index 28d9ae8cbe..de2ed01abd 100644
--- a/source4/libnet/libnet_passwd.c
+++ b/source4/libnet/libnet_passwd.c
@@ -20,7 +20,7 @@
#include "includes.h"
#include "libnet/libnet.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#include "librpc/gen_ndr/ndr_samr_c.h"
diff --git a/source4/main.mk b/source4/main.mk
index 0edfa1c144..368dce9f59 100644
--- a/source4/main.mk
+++ b/source4/main.mk
@@ -22,7 +22,7 @@ mkinclude lib/stream/config.mk
mkinclude lib/util/config.mk
mkinclude lib/tdr/config.mk
mkinclude lib/dbwrap/config.mk
-mkinclude lib/crypto/config.mk
+mkinclude ../lib/crypto/config.mk
mkinclude lib/torture/config.mk
mkinclude lib/basic.mk
mkinclude lib/com/config.mk
diff --git a/source4/ntp_signd/ntp_signd.c b/source4/ntp_signd/ntp_signd.c
index c3a9a1c792..575be1e97e 100644
--- a/source4/ntp_signd/ntp_signd.c
+++ b/source4/ntp_signd/ntp_signd.c
@@ -34,7 +34,7 @@
#include "libcli/security/security.h"
#include "lib/ldb/include/ldb.h"
#include "lib/ldb/include/ldb_errors.h"
-#include "lib/crypto/md5.h"
+#include "../lib/crypto/md5.h"
#include "system/passwd.h"
/*
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index a1ca3b4a46..3b70f3e934 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -27,7 +27,7 @@
#include "auth/kerberos/kerberos.h"
#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "librpc/gen_ndr/ndr_lsa.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
/*
this type allows us to distinguish handle types
diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c
index 5b8e92583b..98d998acc3 100644
--- a/source4/rpc_server/samr/samr_password.c
+++ b/source4/rpc_server/samr/samr_password.c
@@ -25,7 +25,7 @@
#include "rpc_server/common/common.h"
#include "rpc_server/samr/dcesrv_samr.h"
#include "system/time.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "dsdb/common/flags.h"
#include "libcli/ldap/ldap.h"
#include "dsdb/samdb/samdb.h"
diff --git a/source4/torture/local/local.c b/source4/torture/local/local.c
index bf53df4a11..fdefbbe131 100644
--- a/source4/torture/local/local.c
+++ b/source4/torture/local/local.c
@@ -23,7 +23,7 @@
#include "torture/ndr/ndr.h"
#include "torture/ndr/proto.h"
#include "torture/auth/proto.h"
-#include "lib/crypto/test_proto.h"
+#include "../lib/crypto/test_proto.h"
#include "lib/registry/tests/proto.h"
/* ignore me */ static struct torture_suite *
diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c
index e9346f9605..df16c860cb 100644
--- a/source4/torture/rpc/dssync.c
+++ b/source4/torture/rpc/dssync.c
@@ -29,7 +29,7 @@
#include "torture/torture.h"
#include "torture/ldap/proto.h"
#include "libcli/auth/libcli_auth.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "auth/credentials/credentials.h"
#include "libcli/auth/libcli_auth.h"
#include "auth/gensec/gensec.h"
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index a13a8d8818..69bf33352b 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -29,7 +29,7 @@
#include "libcli/auth/libcli_auth.h"
#include "torture/rpc/rpc.h"
#include "param/param.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#define TEST_MACHINENAME "lsatestmach"
static void init_lsa_String(struct lsa_String *name, const char *s)
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 17342f9b86..3bbf6cf223 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -47,7 +47,7 @@
#include "libcli/composite/composite.h"
#include "libcli/smb_composite/smb_composite.h"
#include "libcli/auth/libcli_auth.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "auth/ntlmssp/ntlmssp.h"
#include "libcli/security/proto.h"
#include "param/param.h"
diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c
index e2558ff0a9..4fbffee41e 100644
--- a/source4/torture/rpc/samlogon.c
+++ b/source4/torture/rpc/samlogon.c
@@ -26,7 +26,7 @@
#include "librpc/gen_ndr/ndr_netlogon_c.h"
#include "librpc/gen_ndr/ndr_samr_c.h"
#include "auth/auth.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "lib/cmdline/popt_common.h"
#include "torture/rpc/rpc.h"
#include "auth/gensec/schannel_proto.h"
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 6afda6e9b5..d0aee057d3 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -24,7 +24,7 @@
#include "system/time.h"
#include "librpc/gen_ndr/lsa.h"
#include "librpc/gen_ndr/ndr_samr_c.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#include "libcli/security/security.h"
#include "torture/rpc/rpc.h"
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 1e76de1dd2..6a02af5bb5 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -25,7 +25,7 @@
#include "torture/torture.h"
#include "auth/auth.h"
#include "lib/util/dlinklist.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "system/time.h"
#include "torture/rpc/rpc.h"
#include "auth/gensec/schannel_proto.h"
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index 2af8c4f872..21542e9b16 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -27,7 +27,7 @@
#include "includes.h"
#include "torture/torture.h"
#include "system/time.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "libnet/libnet.h"
#include "lib/cmdline/popt_common.h"
#include "lib/ldb/include/ldb.h"
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
index b212a44b33..6e9937086e 100644
--- a/source4/torture/rpc/wkssvc.c
+++ b/source4/torture/rpc/wkssvc.c
@@ -25,7 +25,7 @@
#include "torture/rpc/rpc.h"
#include "lib/cmdline/popt_common.h"
#include "param/param.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#define SMBTORTURE_MACHINE_NAME "smbtrt_name"