]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
pkcs8: Don't forward NULL parameters when parsing keys
authorTobias Brunner <tobias@strongswan.org>
Mon, 18 Oct 2021 09:22:40 +0000 (11:22 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 18 Oct 2021 09:24:11 +0000 (11:24 +0200)
Other plugins don't expect this build part for RSA keys and will fail
parsing the keys further.

src/libstrongswan/plugins/pkcs8/pkcs8_builder.c

index 22b7829a490e9c41bc2afdebf7a43d4ab0a4afec..1d7a48fb2638e603c842dadc46611a8d2877ffa2 100644 (file)
@@ -97,7 +97,8 @@ static private_key_t *parse_private_key(chunk_t blob)
                        case PKINFO_PRIVATE_KEY:
                        {
                                DBG2(DBG_ASN, "-- > --");
-                               if (params.ptr)
+                               if (params.len &&
+                                       !chunk_equals(params, chunk_from_chars(0x05, 0x00)))
                                {
                                        key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY,
                                                                                         type, BUILD_BLOB_ALGID_PARAMS,