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

benpicco notifications at github.com
Thu Sep 16 17:45:27 CEST 2021


@benpicco 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);

either do
```suggestion
        DEBUG("credman: could not parse the key (%" PRId32 ")\n", res);
```

-- 
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#pullrequestreview-756474833
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210916/06b2a99f/attachment-0001.htm>


More information about the notifications mailing list