aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2023-12-04 18:28:16 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2023-12-04 18:28:16 -0500
commitef3de36732ce9ec5299806695f01159435a2ba3d (patch)
treec038d5bc6a0a21ed4fc4ae69ae63f26adb74d150
parent871f37517d53b35432dd076236d12eb451275ed8 (diff)
downloadopenssl_tpm2_engine-ef3de36732ce9ec5299806695f01159435a2ba3d.tar.gz
fix the pkcs12 wrapping test for openssl 3.2
Openssl 3.2 has two problems with this test. The first is that it will no longer use a CA certificate unless it has the CA constraint set and the second is that it seems the pkcs12 required parameters are incompatible with the local openssl.cnf. Fix both by not using the local openssl.cnf when generating non-TPM openssl files and use the v3_ca section of the global openssl.cnf to add the CA constraint. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rwxr-xr-xtests/wrap_pkcs12.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/wrap_pkcs12.sh b/tests/wrap_pkcs12.sh
index 60f04ef..9186155 100755
--- a/tests/wrap_pkcs12.sh
+++ b/tests/wrap_pkcs12.sh
@@ -10,8 +10,13 @@
openssl ecparam -genkey -name prime256v1 > tmp.param || exit 1
openssl genpkey -paramfile tmp.param -out key.priv || exit 1
-openssl req -new -x509 -subj '/CN=test CA/' -key key.priv -out tmp.crt || exit 1
-openssl pkcs12 -out tmp.p12 -passout pass: -export -inkey key.priv -in tmp.crt
+# warning: openssl 3.2 bug; subshell execution with standard openssl.cnf
+# to work around
+(
+ unset OPENSSL_CONF
+ openssl req -new -x509 -subj '/CN=test CA/' -key key.priv --extensions v3_ca -out tmp.crt || exit 1
+ openssl pkcs12 -out tmp.p12 -passout pass: -export -inkey key.priv -in tmp.crt
+)
${bindir}/create_tpm2_key -w tmp.p12 key.tpm || exit 1