Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4684893ybi; Tue, 28 May 2019 00:29:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3Z7pFjn1Y/OyJGX7IH9wPKX38xzUOr+pwA1528Eh5j1C8G2MZXynWN1Mdx3rryeiSYEYN X-Received: by 2002:a17:902:e311:: with SMTP id cg17mr65179919plb.202.1559028578768; Tue, 28 May 2019 00:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559028578; cv=none; d=google.com; s=arc-20160816; b=G/I2RFP5JEmamQap8aEGy2I07t4Dv5LY6O+xLU8ZakVbeCJkfN8ZI1OB/z1+XJ6Txl +XodK43ODRYndJxgTPfnA7trOnlPZdaq7UsxJP1g9S3SKn9wqgr63boZ/seDXC08n7th IByRII/vJVsUv87Kmp/6hMuWrhsbaINKbI1gKv9vCpSixf69RcPa5pEFl6iqOsftB1T/ SXfSu4hI5wXJD4eZGscB2TtiNul7jgr3yffrYfY0ojWyANjEzmkcIAwA6z6NG3tBsWtD Ij0ka9290rBLbDPRXArqzJXkDJAoKq35YfhmEPU8tjXsz04OpRDSlWReSLxcUKGuxviJ 6jpQ== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=FZj8oWyFq3CoJbFnxhmHQl5Z1o9Vs+qjAi2PsBJzKX8=; b=ipfsZuRLimgn1N8wUlOFhKVAXmXq8jnnL40CUk2Rb41ehbwGEQXFtSBwv4HavKApd9 Yu+xzUuNdNVB6Hx42NK8aU4S+EM0jIDAGNfU+vIME9U04B863Hbc42l95JVCjGrkM7k5 QJp1udHZmtagFtNuNzGYmKF0PJDHTN0AMHOWrt3Lq0Ewusr2MOh2ttghKpDVBNN0YWxv LxLVrMr+R49rT+9c4+IMh2DGxK+jhFK3uDoN6cZLjAHO6ZHG7frfYzIjRhhwFNap6vNb oDeVPpv7kyrZixv8PInJvzP5aA9WLKM5DQuNYlNcGc+XSPO3Hlve9bjQXZoX/44xyD3w PvFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=Um4OlysC; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g73si13078889pfb.282.2019.05.28.00.29.11; Tue, 28 May 2019 00:29:38 -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; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=Um4OlysC; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726879AbfE1H3C (ORCPT + 99 others); Tue, 28 May 2019 03:29:02 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:41514 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726816AbfE1H3C (ORCPT ); Tue, 28 May 2019 03:29:02 -0400 Received: by mail-io1-f65.google.com with SMTP id w25so3462853ioc.8 for ; Tue, 28 May 2019 00:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silvair-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=FZj8oWyFq3CoJbFnxhmHQl5Z1o9Vs+qjAi2PsBJzKX8=; b=Um4OlysCGBHGA44CeY55xcHo861uo0c+FB5zM5s8Qnqn8P6QSmVoPuAMS9X2g+QoND L2hKkop2CfC/5H/BLntyqiaENDlcJoxPSyUxHBtm5NPUZUK/JzTi6RXGTmVZmxb0n7P+ 6jHA85NqhcYJC5VXcAQHDq802kneWZD/Z6G+qQ2NjGaDJKIdgv8AmzqFWX+s9ZGEJnXk CDqH0FOGRjubh1XCLJyVAtiJhL4FdUkMBvCaTiM3ohohXkV45aOGGrln7zSFOeao9Jp5 QmYKnAus6zrh6nJIHAGNalDdaJ/gzKto/+H758RArtTQ6OF+YSsSPGUtplQQz/PZMK3O 3Jfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=FZj8oWyFq3CoJbFnxhmHQl5Z1o9Vs+qjAi2PsBJzKX8=; b=QNoYrseu1YJpfroRfC2BHkQgsN/ycz7xnExwqBaVGq3hiLtxNFxCbHAEDDtne4+fCz 3ET6iwfyhdrSgmxjg7AJAsNl80wM7sK6GU/g2D3kirGKl6ZP3SG7T3Um7qRbo5+bzJ79 pJjY79bde2AxxMGtfUTDFO82fO3KovJzCjxG2mJBrOaAGAlBNVQ6KRBbhzeNFpvpRZEX xqLPac9Ah/5VH7D8k3v/adBOAWS/k9KnLVk1/lQiVzFbzlx2XUEytCVII3JU+QUF6KmY p+5hMcuxYcxQisasf6SBWL4TAKraBr5SjKrbPfEvEa8vWREr0r2qlLMv8aZWXr9uGuVc ZrMA== X-Gm-Message-State: APjAAAVxzinIjjzDJEvLeQNWsoQiZH0WwOlTQ3rV3qgscR1iOCyrbhf1 ZcpkGtoCrzXlFELKLo/kDcXURWxSy/JDsee71TCY3w== X-Received: by 2002:a5d:9dc7:: with SMTP id 7mr8023315ioo.237.1559028541410; Tue, 28 May 2019 00:29:01 -0700 (PDT) MIME-Version: 1.0 References: <20190523175321.13094-1-brian.gix@intel.com> <1558634183.332.19.camel@intel.com> In-Reply-To: <1558634183.332.19.camel@intel.com> From: =?UTF-8?Q?Micha=C5=82_Lowas=2DRzechonek?= Date: Tue, 28 May 2019 09:28:50 +0200 Message-ID: Subject: Re: [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages To: "Gix, Brian" Cc: "linux-bluetooth@vger.kernel.org" , "jakub.witowski@silvair.com" , "Stotland, Inga" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Yes, it's fine. --=20 Micha=C5=82 Lowas-Rzechonek Lambda Team Leader Silvair Jasnog=C3=B3rska 44 31-358 Krakow POLAND http://www.silvair.com pon., 27 maj 2019 o 20:14 Gix, Brian napisa=C5=82(a): > > Hi Jakub and Michal, > > If you guys are OK with this, this is the version of the patch on long MI= Cs and segment count I will be > applying. > > On Thu, 2019-05-23 at 10:53 -0700, Brian Gix wrote: > > 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 c= redential, uint16_t src, > > > > /* Use large MIC if it doesn't affect segmentation */ > > if (msg_len > 11 && msg_len <=3D 376) { > > - if ((out_len / 12) =3D=3D ((out_len + 4) / 12)) { > > + if (CEILDIV(out_len, 12) =3D=3D CEILDIV(out_len + 4, 12))= { > > szmic =3D true; > > out_len =3D msg_len + sizeof(uint64_t); > > }