[riot-notifications] [RIOT-OS/RIOT] Initial implementation of IEEE 802.15.4 security (#15150)

benpicco notifications at github.com
Sat Nov 28 00:55:26 CET 2020


@benpicco commented on this pull request.

Even works on `native` with `socket_zep`. That would allow for automated testing, but I don't want to block for a lack of unit/integration tests.
Would be good to at least have an application in `tests/` that uses this module, so this is compiled by CI.
(e.g. see `tests/driver_mrf24j40`)

@miri64 want to have another loog at the [latest changes](f03ea0b2ed86dd00e0b88820625ad6e4ea27b8bf) to `gnrc_netif_ieee802154.c`?

> + * Copyright (C) 2020 Otto-von-Guericke-Universität Magdeburg
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @{
+ *
+ * @file
+ * @author Fabian Hüßler <fabian.huessler at ovgu.de>
+ * @}
+ */
+
+#include <stdbool.h>

```suggestion
#include <assert.h>
#include <stdbool.h>
```

> +    uint32_t frame_counter = byteorder_ntohl((be_uint32_t)
+                                byteorder_ltobl((le_uint32_t)aux->fc));

gcc 10 does not like this

```
/home/benpicco/dev/RIOT-BHT/sys/net/link_layer/ieee802154/security.c: In function ‘ieee802154_sec_decrypt_frame’:
/home/benpicco/dev/RIOT-BHT/sys/net/link_layer/ieee802154/security.c:426:49: error: ISO C forbids casts to union type [-Werror=pedantic]
  426 |                                 byteorder_ltobl((le_uint32_t)aux->fc));
      |                                                 ^
/home/benpicco/dev/RIOT-BHT/sys/net/link_layer/ieee802154/security.c:425:46: error: ISO C forbids casting nonscalar to the same type [-Werror=pedantic]
  425 |     uint32_t frame_counter = byteorder_ntohl((be_uint32_t)
      |                                              ^
cc1: all warnings being treated as errors
```
Given that this code will likely never run on a big endian machine, we might as well do
```suggestion
    uint32_t frame_counter = aux->fc;
```

but a 'proper' fix would be 

```suggestion
    uint32_t frame_counter = byteorder_ntohl(byteorder_ltobl((le_uint32_t){aux->fc}));
````

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15150#pullrequestreview-540211542
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201127/f8f35cb8/attachment.htm>


More information about the notifications mailing list