[PATCH BlueZ v2 7/9] mesh: crypto: mesh_crypto_aes_ccm_encrypt(): remove unused parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 'out_mic' pointer isn't written by this function and all callers
pass a NULL pointer for this. It's obviously not required (and would not
work), so lets remove it.
---
 mesh/crypto.c           | 10 ++++------
 mesh/crypto.h           |  3 +--
 mesh/net-keys.c         |  2 +-
 mesh/prov-initiator.c   |  2 +-
 unit/test-mesh-crypto.c |  2 +-
 5 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/mesh/crypto.c b/mesh/crypto.c
index 31001d283a04..3200d1231f1f 100644
--- a/mesh/crypto.c
+++ b/mesh/crypto.c
@@ -84,8 +84,7 @@ bool mesh_crypto_aes_cmac(const uint8_t key[16], const uint8_t *msg,
 bool mesh_crypto_aes_ccm_encrypt(const uint8_t nonce[13], const uint8_t key[16],
 					const uint8_t *aad, uint16_t aad_len,
 					const void *msg, uint16_t msg_len,
-					void *out_msg,
-					void *out_mic, size_t mic_size)
+					void *out_msg, size_t mic_size)
 {
 	void *cipher;
 	bool result;
@@ -733,8 +732,7 @@ bool mesh_crypto_payload_encrypt(uint8_t *aad, const uint8_t *payload,
 	if (!mesh_crypto_aes_ccm_encrypt(nonce, app_key,
 							aad, aad ? 16 : 0,
 							payload, payload_len,
-							out, NULL,
-							aszmic ? 8 : 4))
+							out, aszmic ? 8 : 4))
 		return false;
 
 	return true;
@@ -812,13 +810,13 @@ static bool mesh_crypto_packet_encrypt(uint8_t *packet, uint8_t packet_len,
 		if (!mesh_crypto_aes_ccm_encrypt(nonce, network_key,
 					NULL, 0,
 					packet + 7, packet_len - 7 - 8,
-					packet + 7, NULL, 8))
+					packet + 7, 8))
 			return false;
 	} else {
 		if (!mesh_crypto_aes_ccm_encrypt(nonce, network_key,
 					NULL, 0,
 					packet + 7, packet_len - 7 - 4,
-					packet + 7, NULL, 4))
+					packet + 7, 4))
 			return false;
 	}
 
diff --git a/mesh/crypto.h b/mesh/crypto.h
index 5e4d1d229c19..e4bbe4343223 100644
--- a/mesh/crypto.h
+++ b/mesh/crypto.h
@@ -15,8 +15,7 @@
 bool mesh_crypto_aes_ccm_encrypt(const uint8_t nonce[13], const uint8_t key[16],
 					const uint8_t *aad, uint16_t aad_len,
 					const void *msg, uint16_t msg_len,
-					void *out_msg,
-					void *out_mic, size_t mic_size);
+					void *out_msg, size_t mic_size);
 bool mesh_crypto_aes_ccm_decrypt(const uint8_t nonce[13], const uint8_t key[16],
 				const uint8_t *aad, uint16_t aad_len,
 				const void *enc_msg, uint16_t enc_msg_len,
diff --git a/mesh/net-keys.c b/mesh/net-keys.c
index 338d287a7ef7..0daeb9209b86 100644
--- a/mesh/net-keys.c
+++ b/mesh/net-keys.c
@@ -396,7 +396,7 @@ static bool mpb_compose(struct net_key *key, uint32_t ivi, bool kr, bool ivu)
 
 	l_getrandom(random, sizeof(random));
 	if (!mesh_crypto_aes_ccm_encrypt(random, key->pvt_key, NULL, 0,
-						b_data, 5, b_data, NULL, 8))
+						b_data, 5, b_data, 8))
 		return false;
 
 	key->mpb[0] = BT_AD_MESH_BEACON;
diff --git a/mesh/prov-initiator.c b/mesh/prov-initiator.c
index c0d2de443ac1..d46081c7ae19 100644
--- a/mesh/prov-initiator.c
+++ b/mesh/prov-initiator.c
@@ -466,7 +466,7 @@ void initiator_prov_data(uint16_t net_idx, uint16_t primary, void *caller_data)
 			&prov_data.data,
 			sizeof(prov_data.data),
 			&prov_data.data,
-			NULL, sizeof(prov_data.mic));
+			sizeof(prov_data.mic));
 	print_packet("EncdData", &prov_data.data, sizeof(prov_data) - 1);
 	prov->trans_tx(prov->trans_data, &prov_data, sizeof(prov_data));
 	prov->state = INT_PROV_DATA_SENT;
diff --git a/unit/test-mesh-crypto.c b/unit/test-mesh-crypto.c
index 81f0724fe540..36cae70a68a4 100644
--- a/unit/test-mesh-crypto.c
+++ b/unit/test-mesh-crypto.c
@@ -1864,7 +1864,7 @@ static void check_beacon(const struct mesh_crypto_test *keys)
 		l_put_be32(keys->iv_index, beacon + 15);
 		mesh_crypto_aes_ccm_encrypt(random, enc_key, NULL, 0,
 							beacon + 14, 5,
-							beacon + 14, NULL, 8);
+							beacon + 14, 8);
 		verify_data("BeaconMIC", 0, keys->beacon_cmac, beacon + 19, 8);
 		verify_data("PrivBeacon", 0, keys->beacon, beacon, 27);
 	}
-- 
2.43.0





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux