[riot-notifications] [RIOT-OS/RIOT] sys/credman: add key load functions (#16263)

Leandro Lanzieri notifications at github.com
Fri Sep 17 08:32:30 CEST 2021


@leandrolanzieri commented on this pull request.



> +    int obj_count = der_object_count((uint8_t *)buf, buf_len);
+    if (obj_count <= 0) {
+        DEBUG("credman: could not calculate the number of elements within the key\n");
+        return CREDMAN_INVALID;
+    }
+
+    if (obj_count > CONFIG_CREDMAN_MAX_ASN1_OBJ) {
+        DEBUG("credman: not enough ASN.1 objects to decode key.\n");
+        DEBUG("credman: current max is %d, and we need %d\n",
+              CONFIG_CREDMAN_MAX_ASN1_OBJ, obj_count);
+        return CREDMAN_INVALID;
+    }
+
+    int32_t res = der_decode((uint8_t *)buf, buf_len, &pub_key, objects, obj_count);
+    if (res < 0) {
+        DEBUG("credman: could not parse the key (%d)\n", res);

Fixed

-- 
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/16263#discussion_r710787399
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210916/2e47010c/attachment.htm>


More information about the notifications mailing list