]> git.ipfire.org Git - thirdparty/strongswan.git/commit
vici: Delay creation of raw public keys until we know the identity
authorTobias Brunner <tobias@strongswan.org>
Fri, 6 Dec 2024 10:33:37 +0000 (11:33 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 10 Dec 2024 08:08:05 +0000 (09:08 +0100)
commit65e121b49839f5afce2a8b725ffdd5f0a4914512
tree46d3dee93cf12bb78f7412a4f0067a2bc628d2fd
parent24a9c32a435085bd36508e1ccd15e9e611714582
vici: Delay creation of raw public keys until we know the identity

The previous approach had two drawbacks:

First, it caused duplicate public keys because when the `certificate_t`
object was created and added to the credential set it had no subject
assigned yet.  So it defaulted to the key ID.  However, all previously
loaded keys had their subject already changed to an identity, so there
never was a match and new objects were always added whenever a config
with raw public keys was loaded.

Second, the subject was replaced in a way that's not thread-safe on an
object that's already shared in the public credential set.  So other
threads could potentially access the `identification_t` object that's
destroyed during that process.

References strongswan/strongswan#853
Closes strongswan/strongswan#2561
src/libcharon/plugins/vici/vici_config.c