Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6181806ybv; Tue, 18 Feb 2020 11:30:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzfaxGd4HRyRvW8v8JnoSqz7Em8siAx1JcP8T5V8//rnNYVPBlLm6UrbncS3SjmIMWpMk9v X-Received: by 2002:aca:3354:: with SMTP id z81mr2323698oiz.129.1582054250106; Tue, 18 Feb 2020 11:30:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582054250; cv=none; d=google.com; s=arc-20160816; b=qIhb5H/YxbVbZIDLszTIAXsgYOcx6uMAnYFKPd+czh+u+5LAQdP4A1VMh5p6KwTDpp Yzf3CxOl3FI4IgJ89+JB3COpBwYV+2avffL5ULW+h2se8LVgsU3AdM7ttSLY02I6353P OT2i93maR5A9LO0zvB0v5t7RRSDZuRF70YOzoF1iVqs6t/d4Y8ZIKwVsYc3stoI7DvSQ wY36IgsqctLQ38n5bPjMZ2nkxz7UGVfvMIpp09THPRhQjc24jXIDdl+65dLxm9Ll3aQR HG73skfEFnlYQ05ksKv0AqlhcvLMJq0M2UdNE4aQuN8plQpP54kYgADzvDcdNnkVTONp gY3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=RiMVcjDwqIbIwrfrj4ZdzvuE9LTr9WlKL75DuT8gKHk=; b=wILKeox18zhXWkQZQuqc767eNyqHa5xEiudNw4phKJt9n6LNuYqC1TjKq64f5EhvM3 V1c6ThQ2c+U5UqH8UAocvBUjZwVe1Yu3sh5BfMGP3CBj5kMq8BYq+BiCNpEsAyBj+cGX AlJQD9S0DrZ6C1JkXgq+RYeWJafblESIC+ux4FYlfoWauBWDroFlzsj7wV3LtzqGVVd0 EKHi3OsyyUCP2+GCRg2CreQBcmldGRZD+mfHvqazMwsDUXMcyTgRzwp6JKas9t+51kEb yjDbcEr1Fs7x/2UEMrhpFsei2XqiKS9mfihPqmCewqKVjkQXSS/ZpDIkLcgbCt2mhhUa 6DYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si7857540oiv.267.2020.02.18.11.30.24; Tue, 18 Feb 2020 11:30:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726318AbgBRTaU (ORCPT + 99 others); Tue, 18 Feb 2020 14:30:20 -0500 Received: from mga18.intel.com ([134.134.136.126]:63223 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726283AbgBRTaU (ORCPT ); Tue, 18 Feb 2020 14:30:20 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2020 11:30:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,457,1574150400"; d="scan'208";a="268881413" Received: from ingas-nuc1.sea.intel.com ([10.254.190.110]) by fmsmga002.fm.intel.com with ESMTP; 18 Feb 2020 11:30:18 -0800 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ] mesh: Fix app payload decryption for virtual labels Date: Tue, 18 Feb 2020 11:30:10 -0800 Message-Id: <20200218193010.12725-1-inga.stotland@intel.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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) { -- 2.21.1