* [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages
@ 2019-05-23 17:53 Brian Gix
2019-05-23 17:58 ` Gix, Brian
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Brian Gix @ 2019-05-23 17:53 UTC (permalink / raw)
To: linux-bluetooth
Cc: inga.stotland, brian.gix, jakub.witowski, michal.lowas-rzechonek
From: Jakub Witowski <jakub.witowski@silvair.com>
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages
2019-05-23 17:53 [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages Brian Gix
@ 2019-05-23 17:58 ` Gix, Brian
2019-05-24 15:06 ` Gix, Brian
2019-05-27 18:14 ` Gix, Brian
2 siblings, 0 replies; 6+ messages in thread
From: Gix, Brian @ 2019-05-23 17:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Stotland, Inga, jakub.witowski, michal.lowas-rzechonek
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 <inga.stotland@intel.com>; Gix, Brian
> <brian.gix@intel.com>; jakub.witowski@silvair.com; michal.lowas-
> rzechonek@silvair.com
> Subject: [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages
>
> From: Jakub Witowski <jakub.witowski@silvair.com>
>
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages
2019-05-23 17:53 [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages Brian Gix
2019-05-23 17:58 ` Gix, Brian
@ 2019-05-24 15:06 ` Gix, Brian
2019-05-27 6:54 ` michal.lowas-rzechonek
2019-05-27 18:14 ` Gix, Brian
2 siblings, 1 reply; 6+ messages in thread
From: Gix, Brian @ 2019-05-24 15:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: jakub.witowski, michal.lowas-rzechonek, Stotland, Inga
Patch Applied
On Thu, 2019-05-23 at 10:53 -0700, Brian Gix wrote:
> From: Jakub Witowski <jakub.witowski@silvair.com>
>
> 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);
> }
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages
2019-05-24 15:06 ` Gix, Brian
@ 2019-05-27 6:54 ` michal.lowas-rzechonek
0 siblings, 0 replies; 6+ messages in thread
From: michal.lowas-rzechonek @ 2019-05-27 6:54 UTC (permalink / raw)
To: Gix, Brian; +Cc: linux-bluetooth, jakub.witowski, Stotland, Inga
Hi Brian,
On 05/24, Gix, Brian wrote:
> Patch Applied
Sorry for radio silence, I was away for last two weeks.
Thank you!
--
Michał Lowas-Rzechonek <michal.lowas-rzechonek@silvair.com>
Silvair http://silvair.com
Jasnogórska 44, 31-358 Krakow, POLAND
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages
2019-05-23 17:53 [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages Brian Gix
2019-05-23 17:58 ` Gix, Brian
2019-05-24 15:06 ` Gix, Brian
@ 2019-05-27 18:14 ` Gix, Brian
2019-05-28 7:28 ` Michał Lowas-Rzechonek
2 siblings, 1 reply; 6+ messages in thread
From: Gix, Brian @ 2019-05-27 18:14 UTC (permalink / raw)
To: linux-bluetooth; +Cc: jakub.witowski, michal.lowas-rzechonek, Stotland, Inga
Hi Jakub and Michal,
If you guys are OK with this, this is the version of the patch on long MICs and segment count I will be
applying.
On Thu, 2019-05-23 at 10:53 -0700, Brian Gix wrote:
> From: Jakub Witowski <jakub.witowski@silvair.com>
>
> 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);
> }
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages
2019-05-27 18:14 ` Gix, Brian
@ 2019-05-28 7:28 ` Michał Lowas-Rzechonek
0 siblings, 0 replies; 6+ messages in thread
From: Michał Lowas-Rzechonek @ 2019-05-28 7:28 UTC (permalink / raw)
To: Gix, Brian; +Cc: linux-bluetooth, jakub.witowski, Stotland, Inga
Yes, it's fine.
--
Michał Lowas-Rzechonek
Lambda Team Leader
Silvair
Jasnogórska 44
31-358 Krakow
POLAND
http://www.silvair.com
pon., 27 maj 2019 o 20:14 Gix, Brian <brian.gix@intel.com> napisał(a):
>
> Hi Jakub and Michal,
>
> If you guys are OK with this, this is the version of the patch on long MICs and segment count I will be
> applying.
>
> On Thu, 2019-05-23 at 10:53 -0700, Brian Gix wrote:
> > From: Jakub Witowski <jakub.witowski@silvair.com>
> >
> > 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);
> > }
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-05-28 7:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-23 17:53 [PATCH BlueZ] mesh: Fix long MIC usage in segmented messages Brian Gix
2019-05-23 17:58 ` Gix, Brian
2019-05-24 15:06 ` Gix, Brian
2019-05-27 6:54 ` michal.lowas-rzechonek
2019-05-27 18:14 ` Gix, Brian
2019-05-28 7:28 ` Michał Lowas-Rzechonek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.