Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2074614ybm; Thu, 23 May 2019 10:59:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5bJ4VpPNyA4gtdB8x0XyWziKEU+SeWRL8penbaBY6TJs8TPr9gg+Uv273j9f44tOaFfy0 X-Received: by 2002:a63:eb01:: with SMTP id t1mr14870057pgh.385.1558634379141; Thu, 23 May 2019 10:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558634379; cv=none; d=google.com; s=arc-20160816; b=Q4M7Hh6DhEyiOBEtqhfLFrtF9bY5bjLeZMtrb3we5hxdrRTm2wZxLnnNmckesUgA8U 0yd+ngF49WX+kVWhbdNGqJIQ4Vz5TeWkwCGjo4VeUpAsV+m0URsVv5xb6C7ugTbAWdzY ehBISFn/LF5xTf3RxvUR4cfShuv7QhrkFR7B5mwn6mtjkYshJxQEeZ8esreO1W02q/JJ gMNzHXrUi8r1oLlMxv1B1VkwembF8scfYqJ7KYYWuMg7b8926fWJUc+CJJUNL7Dbihce bmXAKrs9UqJHCHKDSBDQdLJCADq2o7yKeD/WYVnUFEsq1PiDRhKdRrsleRWFVHyajluw UX7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=F41tPQK5FISh4ozFjaH6y6p65O0QmpLkg9A35FwL6Ds=; b=Z4KBfAVV65YKhZllj0a0e9VR5t7Hno23zPB5xQ/ecixz5F0OkwHhirlcJLbSfJkONt 3JTsY5fyYkG7U1HnO+ck7K7Qw+3PJnYIDhsgiOtLwEuu70tcumrSo6og4+WUFOc21LVw oPmTu/uqVhQPR5MY16+SQ1tPDS/fYqOW0697eAeGR7tcMqslv/7yoCP3vAxCV/FLkBRe HdchHFcEgvGZlkk4xVeHssf+BlQQkm3IuJDGyFPCOniAWAYbl5i7Njsh0VRKaN1SGxqo l/x6OiF0WNO8SKsoofWK/+9n3vTE8ip40Se9IB9WV45SSRq5yUHNZ0hQmPLJMyj91xR3 uMfw== 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 h4si195509pgq.456.2019.05.23.10.59.23; Thu, 23 May 2019 10:59:39 -0700 (PDT) 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 S1731311AbfEWR6P convert rfc822-to-8bit (ORCPT + 99 others); Thu, 23 May 2019 13:58:15 -0400 Received: from mga04.intel.com ([192.55.52.120]:58153 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731239AbfEWR6P (ORCPT ); Thu, 23 May 2019 13:58:15 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 10:58:15 -0700 X-ExtLoop1: 1 Received: from orsmsx104.amr.corp.intel.com ([10.22.225.131]) by orsmga002.jf.intel.com with ESMTP; 23 May 2019 10:58:14 -0700 Received: from orsmsx163.amr.corp.intel.com (10.22.240.88) by ORSMSX104.amr.corp.intel.com (10.22.225.131) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 23 May 2019 10:58:14 -0700 Received: from orsmsx103.amr.corp.intel.com ([169.254.5.182]) by ORSMSX163.amr.corp.intel.com ([169.254.9.150]) with mapi id 14.03.0415.000; Thu, 23 May 2019 10:58:14 -0700 From: "Gix, Brian" To: "linux-bluetooth@vger.kernel.org" CC: "Stotland, Inga" , "jakub.witowski@silvair.com" , "michal.lowas-rzechonek@silvair.com" Subject: RE: [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages Thread-Topic: [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages Thread-Index: AQHVEZBzEH3OQE0cFU+dUfs5UeuEwaZ4/rtw Date: Thu, 23 May 2019 17:58:13 +0000 Message-ID: References: <20190523175321.13094-1-brian.gix@intel.com> In-Reply-To: <20190523175321.13094-1-brian.gix@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzcwZTUxZTItMzQ5NS00MjQxLTgwNTYtZTBhYzgwNDZlYzAxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaG8zYVRpTlwvZnRSWitqRXJ4N3BpXC9cL3djU2xSZm5pOUFJMkdoaXpjUTFodnFqZmdFZ01TRmNtU0VHTjc0eTQ3ayJ9 dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.22.254.139] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Jakub and Michal, If you have no objections, this will be the version of the Long MIC patch I will be applying. > -----Original Message----- > From: Gix, Brian > Sent: Thursday, May 23, 2019 10:53 AM > To: linux-bluetooth@vger.kernel.org > Cc: Stotland, Inga ; Gix, Brian > ; jakub.witowski@silvair.com; michal.lowas- > rzechonek@silvair.com > Subject: [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages > > From: Jakub Witowski > > Contrary to the comment, implementation used a 8-byte MIC even if this > generated an additional segment. > --- > mesh/model.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/mesh/model.c b/mesh/model.c index 034d54496..90bb62db8 > 100644 > --- a/mesh/model.c > +++ b/mesh/model.c > @@ -40,6 +40,9 @@ > #include "mesh/util.h" > #include "mesh/model.h" > > +/* Divide and round to ceiling (up) to calculate segment count */ > +#define CEILDIV(val, div) (((val) + (div) - 1) / (div)) > + > struct mesh_model { > const struct mesh_model_ops *cbs; > void *user_data; > @@ -451,7 +454,7 @@ static bool msg_send(struct mesh_node *node, bool > credential, uint16_t src, > > /* Use large MIC if it doesn't affect segmentation */ > if (msg_len > 11 && msg_len <= 376) { > - if ((out_len / 12) == ((out_len + 4) / 12)) { > + if (CEILDIV(out_len, 12) == CEILDIV(out_len + 4, 12)) { > szmic = true; > out_len = msg_len + sizeof(uint64_t); > } > -- > 2.14.5