diff mbox series

[BlueZ] mesh: Fix app payload decryption for virtual labels

Message ID 20200218193010.12725-1-inga.stotland@intel.com (mailing list archive)
State Accepted
Delegated to: Brian Gix
Headers show
Series [BlueZ] mesh: Fix app payload decryption for virtual labels | expand

Commit Message

Stotland, Inga Feb. 18, 2020, 7:30 p.m. UTC
This fixes a bug when a virtual label and its size hasn't been passed
to a decryption function: instead of always using NULL pointer for
label and 0 for lable size, use actual virtual label info if decrypting
a payload addressed to a virtual destination.
---
 mesh/model.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Brian Gix Feb. 19, 2020, 2:18 a.m. UTC | #1
Applied
On Tue, 2020-02-18 at 11:30 -0800, Inga Stotland wrote:
> This fixes a bug when a virtual label and its size hasn't been passed
> to a decryption function: instead of always using NULL pointer for
> label and 0 for lable size, use actual virtual label info if decrypting
> a payload addressed to a virtual destination.
> ---
>  mesh/model.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/mesh/model.c b/mesh/model.c
> index 072972fda..4e5856292 100644
> --- a/mesh/model.c
> +++ b/mesh/model.c
> @@ -444,8 +444,8 @@ static int app_packet_decrypt(struct mesh_net *net, const uint8_t *data,
>  			continue;
>  
>  		if (old_key && old_key_aid == key_aid) {
> -			decrypted = mesh_crypto_payload_decrypt(NULL, 0, data,
> -						size, szmict, src, dst, key_aid,
> +			decrypted = mesh_crypto_payload_decrypt(virt, virt_size,
> +					data, size, szmict, src, dst, key_aid,
>  						seq, iv_idx, out, old_key);
>  
>  			if (decrypted) {
> @@ -457,8 +457,8 @@ static int app_packet_decrypt(struct mesh_net *net, const uint8_t *data,
>  		}
>  
>  		if (new_key && new_key_aid == key_aid) {
> -			decrypted = mesh_crypto_payload_decrypt(NULL, 0, data,
> -						size, szmict, src, dst, key_aid,
> +			decrypted = mesh_crypto_payload_decrypt(virt, virt_size,
> +					data, size, szmict, src, dst, key_aid,
>  						seq, iv_idx, out, new_key);
>  
>  			if (decrypted) {
diff mbox series

Patch

diff --git a/mesh/model.c b/mesh/model.c
index 072972fda..4e5856292 100644
--- a/mesh/model.c
+++ b/mesh/model.c
@@ -444,8 +444,8 @@  static int app_packet_decrypt(struct mesh_net *net, const uint8_t *data,
 			continue;
 
 		if (old_key && old_key_aid == key_aid) {
-			decrypted = mesh_crypto_payload_decrypt(NULL, 0, data,
-						size, szmict, src, dst, key_aid,
+			decrypted = mesh_crypto_payload_decrypt(virt, virt_size,
+					data, size, szmict, src, dst, key_aid,
 						seq, iv_idx, out, old_key);
 
 			if (decrypted) {
@@ -457,8 +457,8 @@  static int app_packet_decrypt(struct mesh_net *net, const uint8_t *data,
 		}
 
 		if (new_key && new_key_aid == key_aid) {
-			decrypted = mesh_crypto_payload_decrypt(NULL, 0, data,
-						size, szmict, src, dst, key_aid,
+			decrypted = mesh_crypto_payload_decrypt(virt, virt_size,
+					data, size, szmict, src, dst, key_aid,
 						seq, iv_idx, out, new_key);
 
 			if (decrypted) {