summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/auth/ntlm_check.c1
-rw-r--r--source4/include/includes.h5
-rw-r--r--source4/include/nameserv.h7
-rw-r--r--source4/include/rewrite.h8
-rw-r--r--source4/include/structs.h1
-rw-r--r--source4/lib/basic.m42
-rw-r--r--source4/lib/basic.mk19
-rw-r--r--source4/lib/crypto/crc32.h2
-rw-r--r--source4/lib/crypto/crypto.h24
-rw-r--r--source4/lib/crypto/hmacmd5.c1
-rw-r--r--source4/lib/crypto/hmacmd5.h (renamed from source4/include/hmacmd5.h)7
-rw-r--r--source4/lib/crypto/md4.h1
-rw-r--r--source4/lib/crypto/md5.h (renamed from source4/include/md5.h)0
-rw-r--r--source4/lib/genrand.c1
-rw-r--r--source4/libcli/auth/credentials.c1
-rw-r--r--source4/libcli/auth/ntlmssp.c1
-rw-r--r--source4/libcli/auth/ntlmssp_sign.c1
-rw-r--r--source4/libcli/auth/schannel.c1
-rw-r--r--source4/libcli/raw/smb_signing.c1
-rw-r--r--source4/libcli/util/smbencrypt.c1
-rw-r--r--source4/libnet/libnet_passwd.c1
-rw-r--r--source4/passdb/secrets.c1
-rw-r--r--source4/rpc_server/samr/samr_password.c1
-rw-r--r--source4/torture/rpc/samr.c1
24 files changed, 71 insertions, 18 deletions
diff --git a/source4/auth/ntlm_check.c b/source4/auth/ntlm_check.c
index eda06a1ddd..e31424d808 100644
--- a/source4/auth/ntlm_check.c
+++ b/source4/auth/ntlm_check.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "lib/crypto/crypto.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_AUTH
diff --git a/source4/include/includes.h b/source4/include/includes.h
index cda7f976c3..58f8e80803 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -216,14 +216,9 @@ extern int errno;
#include "lib/socket/socket.h"
#include "libcli/ldap/ldap.h"
#include "nameserv.h"
-#include "secrets.h"
#include "byteorder.h"
-#include "md5.h"
-#include "hmacmd5.h"
-
-
#include "module.h"
#include "asn_1.h"
diff --git a/source4/include/nameserv.h b/source4/include/nameserv.h
index 9efee46466..67eaf9dcc2 100644
--- a/source4/include/nameserv.h
+++ b/source4/include/nameserv.h
@@ -36,6 +36,13 @@
#define MAX_DGRAM_SIZE (576) /* tcp/ip datagram limit is 576 bytes */
#define MIN_DGRAM_SIZE 12
+/* A netbios name structure. */
+struct nmb_name {
+ char name[17];
+ char scope[64];
+ uint_t name_type;
+};
+
/*********************************************************
Types of reply packet.
**********************************************************/
diff --git a/source4/include/rewrite.h b/source4/include/rewrite.h
index 8b5e00fdd2..432be56095 100644
--- a/source4/include/rewrite.h
+++ b/source4/include/rewrite.h
@@ -86,14 +86,6 @@ typedef int BOOL;
#include "smb_macros.h"
-/* A netbios name structure. */
-struct nmb_name {
- char name[17];
- char scope[64];
- uint_t name_type;
-};
-
-
#include "rpc_secdes.h"
#include "client.h"
diff --git a/source4/include/structs.h b/source4/include/structs.h
index 6bc19b1127..609f7df8fd 100644
--- a/source4/include/structs.h
+++ b/source4/include/structs.h
@@ -62,5 +62,6 @@ struct ntlmssp_state;
struct auth_methods;
struct schannel_state;
struct spnego_data;
+struct gensec_security;
typedef NTSTATUS (*gensec_password_callback)(struct gensec_security *gensec_security, TALLOC_CTX *mem_ctx,
char **password);
diff --git a/source4/lib/basic.m4 b/source4/lib/basic.m4
index 1640ef2b9d..b3327b6dcc 100644
--- a/source4/lib/basic.m4
+++ b/source4/lib/basic.m4
@@ -2,4 +2,6 @@ dnl # LIB BASIC subsystem
SMB_SUBSYSTEM_MK(LIBREPLACE,lib/basic.mk)
SMB_SUBSYSTEM_MK(LIBNETIF,lib/basic.mk)
+SMB_SUBSYSTEM_NOPROTO(LIBCRYPTO)
+SMB_SUBSYSTEM_MK(LIBCRYPTO,lib/basic.mk)
SMB_SUBSYSTEM_MK(LIBBASIC,lib/basic.mk)
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index 55e654ec74..e7d710eec6 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -20,6 +20,19 @@ ADD_OBJ_FILES = \
##############################
##############################
+# Start SUBSYSTEM LIBCRYPTO
+[SUBSYSTEM::LIBCRYPTO]
+INIT_OBJ_FILES = \
+ lib/crypto/crc32.o
+ADD_OBJ_FILES = \
+ lib/crypto/md5.o \
+ lib/crypto/hmacmd5.o \
+ lib/crypto/md4.o
+# End SUBSYSTEM LIBCRYPTO
+##############################
+
+
+##############################
# Start SUBSYSTEM LIBBASIC
[SUBSYSTEM::LIBBASIC]
INIT_OBJ_FILES = lib/version.o
@@ -57,14 +70,10 @@ ADD_OBJ_FILES = \
lib/module.o \
lib/mutex.o \
lib/events.o \
- lib/crypto/crc32.o \
- lib/crypto/md5.o \
- lib/crypto/hmacmd5.o \
- lib/crypto/md4.o \
lib/db_wrap.o \
lib/server_mutex.o \
lib/idtree.o
REQUIRED_SUBSYSTEMS = \
- LIBTDB CHARSET LIBREPLACE LIBNETIF
+ LIBTDB CHARSET LIBREPLACE LIBNETIF LIBCRYPTO
# End SUBSYSTEM LIBBASIC
##############################
diff --git a/source4/lib/crypto/crc32.h b/source4/lib/crypto/crc32.h
new file mode 100644
index 0000000000..a1030c14df
--- /dev/null
+++ b/source4/lib/crypto/crc32.h
@@ -0,0 +1,2 @@
+uint32_t crc32_calc_buffer( const char *buffer, uint32_t count);
+
diff --git a/source4/lib/crypto/crypto.h b/source4/lib/crypto/crypto.h
new file mode 100644
index 0000000000..e7a0c290a5
--- /dev/null
+++ b/source4/lib/crypto/crypto.h
@@ -0,0 +1,24 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Copyright (C) Andrew Tridgell 2004
+
+ 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 2 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, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "lib/crypto/md5.h"
+#include "lib/crypto/md4.h"
+#include "lib/crypto/hmacmd5.h"
+#include "lib/crypto/crc32.h"
diff --git a/source4/lib/crypto/hmacmd5.c b/source4/lib/crypto/hmacmd5.c
index 9b24279f71..2045f9a9d7 100644
--- a/source4/lib/crypto/hmacmd5.c
+++ b/source4/lib/crypto/hmacmd5.c
@@ -24,6 +24,7 @@
*/
#include "includes.h"
+#include "lib/crypto/crypto.h"
/***********************************************************************
the rfc 2104 version of hmac_md5 initialisation.
diff --git a/source4/include/hmacmd5.h b/source4/lib/crypto/hmacmd5.h
index aea4da30f8..fb6692a05f 100644
--- a/source4/include/hmacmd5.h
+++ b/source4/lib/crypto/hmacmd5.h
@@ -29,4 +29,11 @@ typedef struct
} HMACMD5Context;
+void hmac_md5_init_limK_to_64(const uint8_t *key, int key_len,
+ HMACMD5Context *ctx);
+void hmac_md5_update(const uint8_t *text, int text_len, HMACMD5Context *ctx);
+void hmac_md5_final(uint8_t *digest, HMACMD5Context *ctx);
+void hmac_md5(const uint8_t key[16], const uint8_t *data, int data_len, uint8_t *digest);
+void hmac_md5_init_rfc2104(const uint8_t *key, int key_len, HMACMD5Context *ctx);
+
#endif /* _HMAC_MD5_H */
diff --git a/source4/lib/crypto/md4.h b/source4/lib/crypto/md4.h
new file mode 100644
index 0000000000..234e488e4f
--- /dev/null
+++ b/source4/lib/crypto/md4.h
@@ -0,0 +1 @@
+void mdfour(uint8_t *out, const uint8_t *in, int n);
diff --git a/source4/include/md5.h b/source4/lib/crypto/md5.h
index cd23979f8a..cd23979f8a 100644
--- a/source4/include/md5.h
+++ b/source4/lib/crypto/md5.h
diff --git a/source4/lib/genrand.c b/source4/lib/genrand.c
index 7289719791..46a73e6d2e 100644
--- a/source4/lib/genrand.c
+++ b/source4/lib/genrand.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "system/iconv.h"
+#include "lib/crypto/crypto.h"
static unsigned char hash[258];
static uint32 counter;
diff --git a/source4/libcli/auth/credentials.c b/source4/libcli/auth/credentials.c
index 4a17b13910..a09d767e89 100644
--- a/source4/libcli/auth/credentials.c
+++ b/source4/libcli/auth/credentials.c
@@ -24,6 +24,7 @@
#include "includes.h"
#include "system/time.h"
#include "auth/auth.h"
+#include "lib/crypto/crypto.h"
/*
initialise the credentials state for old-style 64 bit session keys
diff --git a/source4/libcli/auth/ntlmssp.c b/source4/libcli/auth/ntlmssp.c
index 96c733e3b0..55a80d0d5e 100644
--- a/source4/libcli/auth/ntlmssp.c
+++ b/source4/libcli/auth/ntlmssp.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "auth/auth.h"
+#include "lib/crypto/crypto.h"
static NTSTATUS ntlmssp_client_initial(struct ntlmssp_state *ntlmssp_state,
TALLOC_CTX *out_mem_ctx,
diff --git a/source4/libcli/auth/ntlmssp_sign.c b/source4/libcli/auth/ntlmssp_sign.c
index 689a2d353e..7d193c850c 100644
--- a/source4/libcli/auth/ntlmssp_sign.c
+++ b/source4/libcli/auth/ntlmssp_sign.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "auth/auth.h"
+#include "lib/crypto/crypto.h"
#define CLI_SIGN "session key to client-to-server signing key magic constant"
#define CLI_SEAL "session key to client-to-server sealing key magic constant"
diff --git a/source4/libcli/auth/schannel.c b/source4/libcli/auth/schannel.c
index 2f20a3e906..51b8690c97 100644
--- a/source4/libcli/auth/schannel.c
+++ b/source4/libcli/auth/schannel.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "lib/crypto/crypto.h"
struct schannel_state {
uint8_t session_key[16];
diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c
index d348c202f5..c0c1337312 100644
--- a/source4/libcli/raw/smb_signing.c
+++ b/source4/libcli/raw/smb_signing.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "lib/crypto/crypto.h"
/***********************************************************
SMB signing - Common code before we set a new signing implementation
diff --git a/source4/libcli/util/smbencrypt.c b/source4/libcli/util/smbencrypt.c
index 1e911f094b..6034c0e327 100644
--- a/source4/libcli/util/smbencrypt.c
+++ b/source4/libcli/util/smbencrypt.c
@@ -25,6 +25,7 @@
#include "includes.h"
#include "system/time.h"
#include "auth/auth.h"
+#include "lib/crypto/crypto.h"
/*
This implements the X/Open SMB password encryption
diff --git a/source4/libnet/libnet_passwd.c b/source4/libnet/libnet_passwd.c
index 877dacfd04..8082c3c9b0 100644
--- a/source4/libnet/libnet_passwd.c
+++ b/source4/libnet/libnet_passwd.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_samr.h"
+#include "lib/crypto/crypto.h"
/*
* do a password change using DCERPC/SAMR calls
diff --git a/source4/passdb/secrets.c b/source4/passdb/secrets.c
index 74f174efe6..01ccf493ba 100644
--- a/source4/passdb/secrets.c
+++ b/source4/passdb/secrets.c
@@ -23,6 +23,7 @@
such as the local SID and machine trust password */
#include "includes.h"
+#include "secrets.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c
index cce412dfb7..97da3d72e1 100644
--- a/source4/rpc_server/samr/samr_password.c
+++ b/source4/rpc_server/samr/samr_password.c
@@ -25,6 +25,7 @@
#include "rpc_server/common/common.h"
#include "rpc_server/samr/dcesrv_samr.h"
#include "system/time.h"
+#include "lib/crypto/crypto.h"
/*
samr_ChangePasswordUser
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index b19c3e2993..db2a6180a8 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_lsa.h"
#include "librpc/gen_ndr/ndr_samr.h"
+#include "lib/crypto/crypto.h"
#define TEST_ACCOUNT_NAME "samrtorturetest"
#define TEST_ALIASNAME "samrtorturetestalias"