[PATCH] Some header file cleanup

Andreas Schneider asn at samba.org
Wed Feb 27 07:15:28 UTC 2019


Hi,

attached are a few patches to do some header include cleanup.

Review much appreciated.


Thanks,


	Andreas

-- 
Andreas Schneider                      asn at samba.org
Samba Team                             www.samba.org
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
-------------- next part --------------
>From a7b5c539332d6be067c892cb1c4662f725fcf815 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 26 Feb 2019 18:30:22 +0100
Subject: [PATCH 01/10] lib:crypto: Include only the required header files

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/crypto/aes_ccm_128.c       | 3 ++-
 lib/crypto/aes_ccm_128_test.c  | 5 +++--
 lib/crypto/aes_cmac_128.c      | 3 ++-
 lib/crypto/aes_cmac_128_test.c | 3 ++-
 lib/crypto/aes_gcm_128.c       | 3 ++-
 lib/crypto/aes_gcm_128_test.c  | 5 +++--
 lib/crypto/hmacmd5test.c       | 2 +-
 lib/crypto/hmacsha256.c        | 3 ++-
 lib/crypto/md4test.c           | 2 +-
 lib/crypto/md5test.c           | 2 +-
 10 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/lib/crypto/aes_ccm_128.c b/lib/crypto/aes_ccm_128.c
index a821e8d48a8..0cbc05567a8 100644
--- a/lib/crypto/aes_ccm_128.c
+++ b/lib/crypto/aes_ccm_128.c
@@ -18,7 +18,8 @@
 */
 
 #include "replace.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/aes.h"
+#include "lib/crypto/aes_ccm_128.h"
 #include "lib/util/byteorder.h"
 
 #define M_ ((AES_CCM_128_M - 2) / 2)
diff --git a/lib/crypto/aes_ccm_128_test.c b/lib/crypto/aes_ccm_128_test.c
index 1a9fe411359..67745e3e1ae 100644
--- a/lib/crypto/aes_ccm_128_test.c
+++ b/lib/crypto/aes_ccm_128_test.c
@@ -18,8 +18,9 @@
 */
 #include "replace.h"
 #include "../lib/util/samba_util.h"
-#include "../lib/crypto/crypto.h"
-#include "../lib/crypto/aes_test.h"
+#include "lib/crypto/aes.h"
+#include "lib/crypto/aes_ccm_128.h"
+#include "lib/crypto/aes_test.h"
 
 #ifndef AES_CCM_128_ONLY_TESTVECTORS
 struct torture_context;
diff --git a/lib/crypto/aes_cmac_128.c b/lib/crypto/aes_cmac_128.c
index 5d71e82de0d..e5e489ec70d 100644
--- a/lib/crypto/aes_cmac_128.c
+++ b/lib/crypto/aes_cmac_128.c
@@ -19,7 +19,8 @@
 */
 
 #include "replace.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/aes.h"
+#include "lib/crypto/aes_cmac_128.h"
 
 static const uint8_t const_Zero[] = {
 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
diff --git a/lib/crypto/aes_cmac_128_test.c b/lib/crypto/aes_cmac_128_test.c
index 86a2fd73d0a..22f6fd8fe8b 100644
--- a/lib/crypto/aes_cmac_128_test.c
+++ b/lib/crypto/aes_cmac_128_test.c
@@ -17,7 +17,8 @@
 */
 #include "replace.h"
 #include "../lib/util/samba_util.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/aes.h"
+#include "lib/crypto/aes_cmac_128.h"
 
 struct torture_context;
 bool torture_local_crypto_aes_cmac_128(struct torture_context *torture);
diff --git a/lib/crypto/aes_gcm_128.c b/lib/crypto/aes_gcm_128.c
index bfbf176e53d..6b5a385cbd8 100644
--- a/lib/crypto/aes_gcm_128.c
+++ b/lib/crypto/aes_gcm_128.c
@@ -18,7 +18,8 @@
 */
 
 #include "replace.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/aes.h"
+#include "lib/crypto/aes_gcm_128.h"
 #include "lib/util/byteorder.h"
 
 static inline void aes_gcm_128_inc32(uint8_t inout[AES_BLOCK_SIZE])
diff --git a/lib/crypto/aes_gcm_128_test.c b/lib/crypto/aes_gcm_128_test.c
index 6d2cbf2aed8..fdd87ff532d 100644
--- a/lib/crypto/aes_gcm_128_test.c
+++ b/lib/crypto/aes_gcm_128_test.c
@@ -18,8 +18,9 @@
 */
 #include "replace.h"
 #include "../lib/util/samba_util.h"
-#include "../lib/crypto/crypto.h"
-#include "../lib/crypto/aes_test.h"
+#include "lib/crypto/aes.h"
+#include "lib/crypto/aes_gcm_128.h"
+#include "lib/crypto/aes_test.h"
 
 #ifndef AES_GCM_128_ONLY_TESTVECTORS
 struct torture_context;
diff --git a/lib/crypto/hmacmd5test.c b/lib/crypto/hmacmd5test.c
index 6db25269696..0e749dcaf22 100644
--- a/lib/crypto/hmacmd5test.c
+++ b/lib/crypto/hmacmd5test.c
@@ -18,7 +18,7 @@
 */
 #include "replace.h"
 #include "../lib/util/samba_util.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/hmacmd5.h"
 
 struct torture_context;
 bool torture_local_crypto_hmacmd5(struct torture_context *torture);
diff --git a/lib/crypto/hmacsha256.c b/lib/crypto/hmacsha256.c
index 36e321a0940..15a74ef6f5e 100644
--- a/lib/crypto/hmacsha256.c
+++ b/lib/crypto/hmacsha256.c
@@ -27,7 +27,8 @@
  */
 
 #include "replace.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/sha256.h"
+#include "lib/crypto/hmacsha256.h"
 
 /***********************************************************************
  the rfc 2104/2202 version of hmac_sha256 initialisation.
diff --git a/lib/crypto/md4test.c b/lib/crypto/md4test.c
index dfdaef51b00..1899dcd2046 100644
--- a/lib/crypto/md4test.c
+++ b/lib/crypto/md4test.c
@@ -19,7 +19,7 @@
 
 #include "replace.h"
 #include "../lib/util/samba_util.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/md4.h"
 
 struct torture_context;
 bool torture_local_crypto_md4(struct torture_context *torture);
diff --git a/lib/crypto/md5test.c b/lib/crypto/md5test.c
index f58e131b02d..01e5cc0bfcd 100644
--- a/lib/crypto/md5test.c
+++ b/lib/crypto/md5test.c
@@ -19,7 +19,7 @@
 
 #include "replace.h"
 #include "../lib/util/samba_util.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/md5.h"
 
 struct torture_context;
 
-- 
2.20.1


>From bc7538a25e43170e5c36444dbae5755a6651d607 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 27 Feb 2019 07:57:44 +0100
Subject: [PATCH 02/10] krb5_wrap: Only use the required md4 header

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/krb5_wrap/krb5_samba.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/krb5_wrap/krb5_samba.c b/lib/krb5_wrap/krb5_samba.c
index f0dc86b1859..344a26cdb6c 100644
--- a/lib/krb5_wrap/krb5_samba.c
+++ b/lib/krb5_wrap/krb5_samba.c
@@ -23,7 +23,7 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "krb5_samba.h"
-#include "lib/crypto/crypto.h"
+#include "lib/crypto/md4.h"
 #include "../libds/common/flags.h"
 
 #ifdef HAVE_COM_ERR_H
-- 
2.20.1


>From 7420a7797a97df18a9922bf225527a3ba2393779 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 27 Feb 2019 07:59:18 +0100
Subject: [PATCH 03/10] libcli:auth: Only use the required md4 header

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 libcli/auth/netlogon_creds_cli.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcli/auth/netlogon_creds_cli.c b/libcli/auth/netlogon_creds_cli.c
index 817d2cd041a..dd286a281bf 100644
--- a/libcli/auth/netlogon_creds_cli.c
+++ b/libcli/auth/netlogon_creds_cli.c
@@ -37,7 +37,7 @@
 #include "source3/include/messages.h"
 #include "source3/include/g_lock.h"
 #include "libds/common/roles.h"
-#include "lib/crypto/crypto.h"
+#include "lib/crypto/md4.h"
 #include "auth/credentials/credentials.h"
 
 struct netlogon_creds_cli_locked_state;
-- 
2.20.1


>From 3d150d00343066bf579e20f4e2639bb5ae43785f Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 27 Feb 2019 08:02:24 +0100
Subject: [PATCH 04/10] libcli:auth: Only use the required md4 header

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 libcli/auth/ntlm_check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcli/auth/ntlm_check.c b/libcli/auth/ntlm_check.c
index b68e9c87888..3844abde528 100644
--- a/libcli/auth/ntlm_check.c
+++ b/libcli/auth/ntlm_check.c
@@ -20,7 +20,7 @@
 */
 
 #include "includes.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/md4.h"
 #include "librpc/gen_ndr/netlogon.h"
 #include "libcli/auth/libcli_auth.h"
 
-- 
2.20.1


>From 414b07038f213c3e74b7359556af125e7e210a9c Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 27 Feb 2019 08:06:21 +0100
Subject: [PATCH 05/10] s4:dsdb: Only use the required md4 header file

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/dsdb/common/util_trusts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/dsdb/common/util_trusts.c b/source4/dsdb/common/util_trusts.c
index 40777ec14ff..4fe20496ed8 100644
--- a/source4/dsdb/common/util_trusts.c
+++ b/source4/dsdb/common/util_trusts.c
@@ -32,7 +32,7 @@
 #include "dsdb/common/util.h"
 #include "libds/common/flag_mapping.h"
 #include "../lib/util/dlinklist.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/md4.h"
 #include "libcli/ldap/ldap_ndr.h"
 
 NTSTATUS dsdb_trust_forest_info_from_lsa(TALLOC_CTX *mem_ctx,
-- 
2.20.1


>From 449e46c94c7f06ca778d31e6a6a86a9c13941444 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 27 Feb 2019 08:07:37 +0100
Subject: [PATCH 06/10] s4:dsdb: Only use the required md4 and md5 header files

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/dsdb/samdb/ldb_modules/password_hash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 51fd70b7c1d..804be6a4307 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -42,7 +42,8 @@
 #include "dsdb/samdb/ldb_modules/util.h"
 #include "dsdb/samdb/ldb_modules/password_modules.h"
 #include "librpc/gen_ndr/ndr_drsblobs.h"
-#include "../lib/crypto/crypto.h"
+#include "lib/crypto/md4.h"
+#include "lib/crypto/md5.h"
 #include "param/param.h"
 #include "lib/krb5_wrap/krb5_samba.h"
 #include "auth/common_auth.h"
-- 
2.20.1


>From 56cd8bc9a6efa27111e673d633c3cedb748d966f Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 27 Feb 2019 08:03:05 +0100
Subject: [PATCH 07/10] libcli:samsync: Remove unused header file

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 libcli/samsync/decrypt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libcli/samsync/decrypt.c b/libcli/samsync/decrypt.c
index 66cc9158b67..f5ea4cc70fc 100644
--- a/libcli/samsync/decrypt.c
+++ b/libcli/samsync/decrypt.c
@@ -22,7 +22,6 @@
 
 
 #include "includes.h"
-#include "../lib/crypto/crypto.h"
 #include "../libcli/auth/libcli_auth.h"
 #include "../libcli/samsync/samsync.h"
 #include "librpc/gen_ndr/ndr_netlogon.h"
-- 
2.20.1


>From 4d529cfa6aea5e0764f22d8ede92b625b78765e2 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 27 Feb 2019 08:05:05 +0100
Subject: [PATCH 08/10] s4:dsdb: Remove unused header file

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/dsdb/repl/replicated_objects.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 372fb2d6928..5186a362947 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -26,7 +26,6 @@
 #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 "../libcli/drsuapi/drsuapi.h"
 #include "libcli/auth/libcli_auth.h"
 #include "param/param.h"
-- 
2.20.1


>From 4ee2a467b8a6c675aa78178acfa8a5e1e14d1aed Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 27 Feb 2019 08:09:11 +0100
Subject: [PATCH 09/10] s4:torture: Remove unused header file

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/torture/rpc/wkssvc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
index 0dff6036507..c98ac92b39b 100644
--- a/source4/torture/rpc/wkssvc.c
+++ b/source4/torture/rpc/wkssvc.c
@@ -25,7 +25,6 @@
 #include "torture/rpc/torture_rpc.h"
 #include "lib/cmdline/popt_common.h"
 #include "param/param.h"
-#include "../lib/crypto/crypto.h"
 #include "libcli/auth/libcli_auth.h"
 
 #define SMBTORTURE_MACHINE_NAME "smbtrt_name"
-- 
2.20.1


>From 5c86be540f35101ac9169df8ed57d5e9812b0ec7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 27 Feb 2019 08:00:05 +0100
Subject: [PATCH 10/10] libcli:auth: Remove unused header file

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 libcli/auth/tests/ntlm_check.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libcli/auth/tests/ntlm_check.c b/libcli/auth/tests/ntlm_check.c
index 886a1a342f8..79b8ec9e28c 100644
--- a/libcli/auth/tests/ntlm_check.c
+++ b/libcli/auth/tests/ntlm_check.c
@@ -45,7 +45,6 @@
 #include <cmocka.h>
 
 #include "includes.h"
-#include "../lib/crypto/crypto.h"
 #include "librpc/gen_ndr/netlogon.h"
 #include "libcli/auth/libcli_auth.h"
 #include "auth/credentials/credentials.h"
-- 
2.20.1



More information about the samba-technical mailing list