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

Leandro Lanzieri notifications at github.com
Sun Apr 4 19:27:31 CEST 2021


@leandrolanzieri commented on this pull request.



> +#if IS_USED(MODULE_CREDMAN_LOAD)
+int credman_load_public_key(const uint8_t *buf, size_t buf_len, ecdsa_public_key_t *out)
+{
+    assert(buf);
+    assert(out);
+
+    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;
+    }
+
+    asn1_tree objects[obj_count];
+    asn1_tree pub_key;
+
+    if (der_decode((uint8_t *)buf, buf_len, &pub_key, objects, obj_count) < 0) {

I'll add it to the `DEBUG` message.

-- 
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_r606830544
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210404/caf3de72/attachment.htm>


More information about the notifications mailing list