From af410f4ae0ba2cbae99e0491ee3ff072e1441c07 Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 20 Oct 2023 16:01:37 -0700 Subject: [PATCH] Fixes for building wolfCrypt with no RSA (--disable-rsa / NO_RSA). --- examples/pcr/policy_sign.c | 1 + wolftpm/tpm2_wrap.h | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/pcr/policy_sign.c b/examples/pcr/policy_sign.c index d00d96d8..41a1515f 100644 --- a/examples/pcr/policy_sign.c +++ b/examples/pcr/policy_sign.c @@ -165,6 +165,7 @@ static int PolicySign(TPM_ALG_ID alg, const char* keyFile, const char* password, wc_FreeRsaKey(&key.rsa); } #else + (void)hashAlg; rc = NOT_COMPILED_IN; #endif } diff --git a/wolftpm/tpm2_wrap.h b/wolftpm/tpm2_wrap.h index b291a157..65aec9c9 100644 --- a/wolftpm/tpm2_wrap.h +++ b/wolftpm/tpm2_wrap.h @@ -1326,10 +1326,9 @@ WOLFTPM_API int wolfTPM2_RsaKey_WolfToTpm_ex(WOLFTPM2_DEV* dev, WOLFTPM_API int wolfTPM2_RsaKey_PubPemToTpm(WOLFTPM2_DEV* dev, WOLFTPM2_KEY* tpmKey, const byte* pem, word32 pemSz); - /*! \ingroup wolfTPM2_Wrappers - \brief Import DER ECC private or public key into TPM public and sensitive structures. This does not make any calls to TPM hardware. + \brief Import DER RSA private or public key into TPM public and sensitive structures. This does not make any calls to TPM hardware. \return TPM_RC_SUCCESS: successful \return TPM_RC_FAILURE: generic failure (check TPM IO and TPM return code) @@ -1343,9 +1342,9 @@ WOLFTPM_API int wolfTPM2_RsaKey_PubPemToTpm(WOLFTPM2_DEV* dev, \sa wolfTPM2_ImportPublicKeyBuffer \sa wolfTPM2_ImportPrivateKeyBuffer - \sa wolfTPM2_DecodeRsaDer + \sa wolfTPM2_DecodeEccDer */ -WOLFTPM_API int wolfTPM2_DecodeEccDer(const byte* der, word32 derSz, +WOLFTPM_API int wolfTPM2_DecodeRsaDer(const byte* der, word32 derSz, TPM2B_PUBLIC* pub, TPM2B_SENSITIVE* sens, TPMA_OBJECT attributes); #endif /* !NO_RSA */ @@ -1426,7 +1425,7 @@ WOLFTPM_API int wolfTPM2_EccKey_WolfToPubPoint(WOLFTPM2_DEV* dev, ecc_key* wolfK /*! \ingroup wolfTPM2_Wrappers - \brief Import DER RSA private or public key into TPM public and sensitive structures. This does not make any calls to TPM hardware. + \brief Import DER ECC private or public key into TPM public and sensitive structures. This does not make any calls to TPM hardware. \return TPM_RC_SUCCESS: successful \return TPM_RC_FAILURE: generic failure (check TPM IO and TPM return code) @@ -1440,9 +1439,9 @@ WOLFTPM_API int wolfTPM2_EccKey_WolfToPubPoint(WOLFTPM2_DEV* dev, ecc_key* wolfK \sa wolfTPM2_ImportPublicKeyBuffer \sa wolfTPM2_ImportPrivateKeyBuffer - \sa wolfTPM2_DecodeEccDer + \sa wolfTPM2_DecodeRsaDer */ -WOLFTPM_API int wolfTPM2_DecodeRsaDer(const byte* der, word32 derSz, +WOLFTPM_API int wolfTPM2_DecodeEccDer(const byte* der, word32 derSz, TPM2B_PUBLIC* pub, TPM2B_SENSITIVE* sens, TPMA_OBJECT attributes); #endif /* HAVE_ECC */ #endif /* !WOLFTPM2_NO_WOLFCRYPT */