[riot-notifications] [RIOT-OS/RIOT] FIDO2 support in RIOT (#16489)

benpicco notifications at github.com
Mon Aug 23 23:50:22 CEST 2021


@benpicco commented on this pull request.



> +    return index;
+}
+
+/**
+ * overwrite existing key if equal, else find free space.
+ *
+ * The current official CTAP spec does not have credential management yet
+ * so rk's can't be deleted, only overwritten => we can be sure that there are
+ * no holes when reading keys from flash memory
+ */
+static int _save_rk(ctap_resident_key_t *rk)
+{
+    bool equal = false;
+    int ret;
+    uint16_t page_num = 0, offset_into_page = 0;
+    uint8_t page[FLASHPAGE_SIZE] = { 0 };

`FLASHPAGE_SIZE` can be pretty big (8k on SAM D5x/E5x), it's risky putting that on the stack.

You could have saved yourself a lot of hassle by using the [MTD API](https://doc.riot-os.org/group__drivers__mtd.html) that abstracts away the low-level flash handling and comes with it's own flashpage sized work buffer.

-- 
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/16489#pullrequestreview-736597871
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210823/d7491543/attachment.htm>


More information about the notifications mailing list