From 538f70acbca9646e4bce86d6fc8fd7f37ed5a730 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Wed, 29 Apr 2026 21:34:17 +0200 Subject: [PATCH] fix(pkey): use correct value for true ASN1 DER encoding expects the boolean value for true to be 0xFF. Stricter DER decoders will raise an error if the value isn't 0 or 0xFF. Signed-off-by: Erik Larsson --- src/tpm2-provider-pkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tpm2-provider-pkey.c b/src/tpm2-provider-pkey.c index 84a5532..9bf0a53 100644 --- a/src/tpm2-provider-pkey.c +++ b/src/tpm2-provider-pkey.c @@ -76,7 +76,7 @@ tpm2_keydata_write(const TPM2_KEYDATA *keydata, BIO *bout, TPM2_PKEY_FORMAT form if (!tpk->type) goto error; - tpk->emptyAuth = ! !keydata->emptyAuth; + tpk->emptyAuth = keydata->emptyAuth ? 0xFF : 0; // note the ASN1_INTEGER_set is not reliable for uin32_t on 32-bit machines if (!(bn_parent = BN_new()))