]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
botan: Reject EC keys with explicitly encoded parameters
authorTobias Brunner <tobias@strongswan.org>
Thu, 31 Aug 2023 12:27:09 +0000 (14:27 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 13 Oct 2023 07:10:46 +0000 (09:10 +0200)
This requires a function that will be added in the upcoming Botan 3.2
release.

configure.ac
src/libstrongswan/plugins/botan/botan_ec_public_key.c

index e89e702be455cbf00a5dec359f6dd010742c6267..365f5cb967e25eabba5a67686d3d1f01b6b78ed8 100644 (file)
@@ -1215,7 +1215,7 @@ if test x$botan = xtrue; then
        AC_SUBST(botan_LIBS)
        saved_LIBS=$LIBS
        LIBS="$botan_LIBS"
-       AC_CHECK_FUNCS(botan_rng_init_custom)
+       AC_CHECK_FUNCS(botan_rng_init_custom botan_pubkey_ecc_key_used_explicit_encoding)
        LIBS=$saved_LIBS
 fi
 
index 95def4fa7588506c9633a48c96a2e1e66ea767dc..bd23bd0c89f229b8e959d2f382b9e54c6c0bb969 100644 (file)
@@ -235,6 +235,14 @@ botan_ec_public_key_t *botan_ec_public_key_adopt(botan_pubkey_t key)
 {
        private_botan_ec_public_key_t *this;
 
+#ifdef HAVE_BOTAN_PUBKEY_ECC_KEY_USED_EXPLICIT_ENCODING
+       if (botan_pubkey_ecc_key_used_explicit_encoding(key))
+       {
+               botan_pubkey_destroy(key);
+               return NULL;
+       }
+#endif
+
        INIT(this,
                .public = {
                        .key = {