Hi Matt,
By pure chance I talked this week with someone about TPM2 support in
SWUpdate, and I took a deeper look inside the current status.
And yes, there is the issues you found, but even fixing the p11-kit
topic, it is far away to be good. I have found several other issues if I
switch to another implementation than openssl (you can even select
pkcs#11 without selecting wolfssl for example).
In fact, there are several contamination between the supported crypto
libraries (openssl vs wolfssl vs mbedtls vs gpg). The introduction of
new libraries was added, but this was done by fixing build issues and
making the code less maintainable.
This led me to send today a patch as TODO
(
https://groups.google.com/g/swupdate/c/UURURVu5egA) with:
" rework support for crypto engine - let possible to load multiple
libraries at the same time. Currently, there is support for openSSL,
WolfSSL and mbedTLS. There should be a way to select one or more
libraries and independently the algorithms that SWUpdate should support.
Some hacks are currently built to avoid conflicts (pkcs#7 and CMS are
the same thing, but supported by different libraries), and they should
be solved"
IMHO there are the following components to be identified and supported
in some way:
- crypto libraries: currently 4 libraries are supported, and it should
be possible to select one or all of them.
- services: SWUpdate asks for 3 type of services: hashing, decryption
and digest (verification). Each library offers all 3 or just some of
them, depending what is implemented.
- module: a "crypto" module should implement a service using one of the
possible algorithm. For example, openssl modules providing verification
are RSA and CMS. Decrypting will have pkcs#11. A pkcs#11 module can be
implemented with openssl or wolfssl, and the user / integrator should
just pick up what he wants.
If a system has more than one library, SWUpdate should be able to
support more modules at the same time.
So there is work to do - hopefully I will find a customer who is aware
of this or I can well explain, and needs some extensions to be
implemented, allowing me to fix this what it currently looks quite messy.
Best regards,
Stefano