r3462: separate out the crypto includes
authorAndrew Tridgell <tridge@samba.org>
Tue, 2 Nov 2004 06:14:15 +0000 (06:14 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:05:16 +0000 (13:05 -0500)
(This used to be commit 3f75117db921e493bb77a5dc14b8ce91a6288f30)

24 files changed:
source4/auth/ntlm_check.c
source4/include/includes.h
source4/include/nameserv.h
source4/include/rewrite.h
source4/include/structs.h
source4/lib/basic.m4
source4/lib/basic.mk
source4/lib/crypto/crc32.h [new file with mode: 0644]
source4/lib/crypto/crypto.h [new file with mode: 0644]
source4/lib/crypto/hmacmd5.c
source4/lib/crypto/hmacmd5.h [moved from source4/include/hmacmd5.h with 72% similarity]
source4/lib/crypto/md4.h [new file with mode: 0644]
source4/lib/crypto/md5.h [moved from source4/include/md5.h with 100% similarity]
source4/lib/genrand.c
source4/libcli/auth/credentials.c
source4/libcli/auth/ntlmssp.c
source4/libcli/auth/ntlmssp_sign.c
source4/libcli/auth/schannel.c
source4/libcli/raw/smb_signing.c
source4/libcli/util/smbencrypt.c
source4/libnet/libnet_passwd.c
source4/passdb/secrets.c
source4/rpc_server/samr/samr_password.c
source4/torture/rpc/samr.c

index eda06a1ddd154fd077ed9f317efd0f53d35ba049..e31424d8085c1668c16aaa522611d111a3290f2d 100644 (file)
@@ -21,6 +21,7 @@
 */
 
 #include "includes.h"
+#include "lib/crypto/crypto.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
index cda7f976c33e41a05f4340c8645e856cdb61695f..58f8e80803fb17a82e38665ed79092700c6241b1 100644 (file)
@@ -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"
index 9efee46466e12ecc7ab6c84a4fd7f28ff991e4f6..67eaf9dcc2a8b1ac9f891bea4bf6f5cc29469050 100644 (file)
 #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.
 **********************************************************/
index 8b5e00fdd2ecfc654123bae11ffea69d443b1b6c..432be5609563b88dbae125d8a4a6dfeeb923355e 100644 (file)
@@ -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"
index 6bc19b112743c3d0a7a3104f8ebb7b97301388e9..609f7df8fd23fab58ff334743c78a1f69a30515b 100644 (file)
@@ -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);
index 1640ef2b9daa0f45c8ef46d36c7826fca52cde40..b3327b6dccf9d68b03b6bca867af854fa0bede1b 100644 (file)
@@ -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)
index 55e654ec74e94961ef47b3054fb2512734cbbe18..e7d710eec6b72c086c11e3b92fbafb0d9c01e121 100644 (file)
@@ -19,6 +19,19 @@ ADD_OBJ_FILES = \
 # End SUBSYSTEM LIBNETIF
 ##############################
 
+##############################
+# 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]
@@ -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 (file)
index 0000000..a1030c1
--- /dev/null
@@ -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 (file)
index 0000000..e7a0c29
--- /dev/null
@@ -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"
index 9b24279f717bd1dddf4cc0cf1901ee60c5602ce0..2045f9a9d73a1a49329b0892ce71f877c2ae4422 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include "includes.h"
+#include "lib/crypto/crypto.h"
 
 /***********************************************************************
  the rfc 2104 version of hmac_md5 initialisation.
similarity index 72%
rename from source4/include/hmacmd5.h
rename to source4/lib/crypto/hmacmd5.h
index aea4da30f8dfa11700eca38323e0996325ca927f..fb6692a05f00c6b304c3ab8c1879effdb258643a 100644 (file)
@@ -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 (file)
index 0000000..234e488
--- /dev/null
@@ -0,0 +1 @@
+void mdfour(uint8_t *out, const uint8_t *in, int n);
index 72897197918ed48c914061ec37b60d6115f01050..46a73e6d2ee05223620a173ef83e535d3938d973 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "includes.h"
 #include "system/iconv.h"
+#include "lib/crypto/crypto.h"
 
 static unsigned char hash[258];
 static uint32 counter;
index 4a17b13910931e6e1ad5187eb79d448daa977ebc..a09d767e891e8c847d14fe86703577231e483145 100644 (file)
@@ -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
index 96c733e3b05542787b10a09c00b53f9afbd3e4e3..55a80d0d5eb3506a6a777402d69f730ebba2c97f 100644 (file)
@@ -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, 
index 689a2d353ebf73e87c0f842f177a1e626e1756bb..7d193c850cbaa75e59248a694f36a56cfb84d5a0 100644 (file)
@@ -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"
index 2f20a3e906f4f01b49c624f6491417ec4507c732..51b8690c97aed46412e0953003f6cd700766da52 100644 (file)
@@ -21,6 +21,7 @@
 */
 
 #include "includes.h"
+#include "lib/crypto/crypto.h"
 
 struct schannel_state {
        uint8_t session_key[16];
index d348c202f5fd79c7c6771e996b4c1d84d6e31a30..c0c1337312b2f1ae5b936f57b2abed2eea859c4b 100644 (file)
@@ -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
index 1e911f094b7756fc2e291105102301f522a2b858..6034c0e327643a74dbee9a32b6ddb3d0dd2426c4 100644 (file)
@@ -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
index 877dacfd04dcc32e17388492444a671295d3733f..8082c3c9b022a58bc0db615fc704d78625f20b29 100644 (file)
@@ -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
index 74f174efe6c3f92f5c7566e8735152183c8bff56..01ccf493baab611a3b4ee67486100665bf4f07c0 100644 (file)
@@ -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
index cce412dfb7b5257828b9f3a8317f160fd0a90a93..97da3d72e12ff9d01a394537959454a54e6f0938 100644 (file)
@@ -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 
index b19c3e2993704cd44887f385f9e85e4b17374f9b..db2a6180a8c666626ed2b292637aab2737c88f1d 100644 (file)
@@ -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"