Merge pull request #199 from dgarske/spell

pull/201/head
elms 2021-12-08 09:22:25 -08:00 committed by GitHub
commit 4523d9bce1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 79 additions and 79 deletions

View File

@ -147,7 +147,7 @@ int TPM2_MakeCredential_Example(void* userCtx, int argc, char *argv[])
if (fp != XBADFILE) {
size_t nameReadSz = XFREAD((BYTE*)&name, 1, sizeof(name), fp);
printf("Read AK Name digest %s\n",
nameReadSz == sizeof(name) ? "success" : "failed");
nameReadSz == sizeof(name) ? "success" : "failed");
XFCLOSE(fp);
}
#endif

View File

@ -24,8 +24,8 @@
#include <wolftpm/tpm2_wrap.h>
#if !defined(WOLFTPM2_NO_WRAPPER) && !defined(WOLFTPM2_NO_WOLFCRYPT) && \
defined(WOLFSSL_CERT_REQ) && \
(defined(WOLF_CRYPTO_DEV) || defined(WOLF_CRYPTO_CB))
defined(WOLFSSL_CERT_REQ) && \
(defined(WOLF_CRYPTO_DEV) || defined(WOLF_CRYPTO_CB))
#include <examples/tpm_io.h>
#include <examples/tpm_test.h>

View File

@ -105,7 +105,7 @@ int TPM2_GPIO_Config_Example(void* userCtx, int argc, char *argv[])
goto exit_badargs;
}
/* Check if mode is for GPIO Input to perform extra config step */
if (gpioMode >= TPM_GPIO_MODE_INPUT_MIN &&
if (gpioMode >= TPM_GPIO_MODE_INPUT_MIN &&
gpioMode <= TPM_GPIO_MODE_INPUT_MAX) {
/* GPIO Input mode */
gpioInput = 1;

View File

@ -47,7 +47,7 @@ static void usage(void)
{
printf("Expected usage:\n");
printf("./examples/keygen/keygen [keyblob.bin] [-ecc/-rsa/-sym] [-t] [-aes/xor] [-eh] [-pem]\n");
printf("* -pem: Store the primary and child public keys as PEM formated files\n");
printf("* -pem: Store the primary and child public keys as PEM formatted files\n");
printf("\t child public key filename: ak.pem or key.pem\n");
printf("\t primary public key filename: ek.pem or srk.pem\n");
printf("* -eh: Create keys under the Endorsement Hierarchy (EK)\n");

View File

@ -2,7 +2,7 @@
# All paths should be given relative to the root
if BUILD_EXAMPLES
noinst_HEADERS += examples/nvram/store.h
noinst_HEADERS += examples/nvram/nvram.h
noinst_PROGRAMS += examples/nvram/store
examples_nvram_store_SOURCES = examples/nvram/store.c \

View File

@ -1,4 +1,4 @@
/* store.h
/* nvram.h
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _STORE_H_
#define _STORE_H_
#ifndef _NVRAM_EXAMPLE_H_
#define _NVRAM_EXAMPLE_H_
#ifdef __cplusplus
extern "C" {
@ -33,4 +33,4 @@ int TPM2_NVRAM_Read_Example(void* userCtx, int argc, char *argv[]);
} /* extern "C" */
#endif
#endif /* _Store_H_ */
#endif /* _NVRAM_EXAMPLE_H_ */

View File

@ -28,7 +28,7 @@
#include <wolftpm/tpm2_wrap.h>
#include <examples/nvram/store.h>
#include <examples/nvram/nvram.h>
#include <examples/tpm_io.h>
#include <examples/tpm_test.h>
#include <examples/tpm_test_keys.h>

View File

@ -28,7 +28,7 @@
#include <wolftpm/tpm2_wrap.h>
#include <examples/nvram/store.h>
#include <examples/nvram/nvram.h>
#include <examples/tpm_io.h>
#include <examples/tpm_test.h>
#include <examples/tpm_test_keys.h>

View File

@ -24,8 +24,8 @@
#include <wolftpm/tpm2_wrap.h>
#if !defined(WOLFTPM2_NO_WRAPPER) && !defined(WOLFTPM2_NO_WOLFCRYPT) && \
!defined(NO_WOLFSSL_CLIENT) && \
(defined(WOLF_CRYPTO_DEV) || defined(WOLF_CRYPTO_CB))
!defined(NO_WOLFSSL_CLIENT) && \
(defined(WOLF_CRYPTO_DEV) || defined(WOLF_CRYPTO_CB))
#include <examples/tpm_io.h>
#include <examples/tpm_test.h>

View File

@ -122,21 +122,21 @@ int TLS_ClientArgs(int argc, char *argv[])
wolfSSL_CTX_set_verify(ctx, WOLFSSL_VERIFY_PEER, myVerify);
/* Load CA Certificates from Buffer */
#if !defined(NO_RSA) && !defined(TLS_USE_ECC)
if (wolfSSL_CTX_load_verify_buffer(ctx,
#if !defined(NO_RSA) && !defined(TLS_USE_ECC)
if (wolfSSL_CTX_load_verify_buffer(ctx,
ca_cert_der_2048, sizeof_ca_cert_der_2048,
WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
printf("Error loading ca_cert_der_2048 DER cert\n");
goto exit;
}
#elif defined(HAVE_ECC)
if (wolfSSL_CTX_load_verify_buffer(ctx,
printf("Error loading ca_cert_der_2048 DER cert\n");
goto exit;
}
#elif defined(HAVE_ECC)
if (wolfSSL_CTX_load_verify_buffer(ctx,
ca_ecc_cert_der_256, sizeof_ca_ecc_cert_der_256,
WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
printf("Error loading ca_ecc_cert_der_256 DER cert\n");
goto exit;
}
#endif
printf("Error loading ca_ecc_cert_der_256 DER cert\n");
goto exit;
}
#endif
#endif
#ifndef NO_TLS_MUTUAL_AUTH

View File

@ -321,15 +321,15 @@ static inline void CloseAndCleanupSocket(SockIoCbCtx* sockIoCtx)
}
}
#else
/* Provide you own socket implementation code */
int SockIORecv(WOLFSSL* ssl, char* buff, int sz, void* ctx);
int SockIOSend(WOLFSSL* ssl, char* buff, int sz, void* ctx);
int SetupSocketAndConnect(SockIoCbCtx* sockIoCtx, const char* host,
word32 port);
void CloseAndCleanupSocket(SockIoCbCtx* sockIoCtx);
/* Provide you own socket implementation code */
int SockIORecv(WOLFSSL* ssl, char* buff, int sz, void* ctx);
int SockIOSend(WOLFSSL* ssl, char* buff, int sz, void* ctx);
int SetupSocketAndConnect(SockIoCbCtx* sockIoCtx, const char* host,
word32 port);
void CloseAndCleanupSocket(SockIoCbCtx* sockIoCtx);
int SetupSocketAndListen(SockIoCbCtx* sockIoCtx, word32 port);
int SocketWaitClient(SockIoCbCtx* sockIoCtx);
int SetupSocketAndListen(SockIoCbCtx* sockIoCtx, word32 port);
int SocketWaitClient(SockIoCbCtx* sockIoCtx);
#endif /* !WOLFSSL_USER_IO */
/******************************************************************************/

View File

@ -24,8 +24,8 @@
#include <wolftpm/tpm2_wrap.h>
#if !defined(WOLFTPM2_NO_WRAPPER) && !defined(WOLFTPM2_NO_WOLFCRYPT) && \
!defined(NO_WOLFSSL_SERVER) && \
(defined(WOLF_CRYPTO_DEV) || defined(WOLF_CRYPTO_CB))
!defined(NO_WOLFSSL_SERVER) && \
(defined(WOLF_CRYPTO_DEV) || defined(WOLF_CRYPTO_CB))
#include <examples/tpm_io.h>
#include <examples/tpm_test.h>

View File

@ -206,7 +206,7 @@ int createAndLoadKey(WOLFTPM2_DEV* pDev,
return rc;
}
/* read failed, so let's create a new key */
/* if a public template was not provided we cannot create */
if (publicTemplate == NULL) {
return BUFFER_E;

View File

@ -6056,7 +6056,7 @@ void TPM2_PrintPublicArea(const TPM2B_PUBLIC* pub)
printf(" RSA: sym algorithm: %s (0x%X), sym keyBits: %d, sym mode: %s (0x%X)\n",
TPM2_GetAlgName(pub->publicArea.parameters.rsaDetail.symmetric.algorithm),
pub->publicArea.parameters.rsaDetail.symmetric.algorithm,
pub->publicArea.parameters.rsaDetail.symmetric.keyBits.sym,
pub->publicArea.parameters.rsaDetail.symmetric.keyBits.sym,
TPM2_GetAlgName(pub->publicArea.parameters.rsaDetail.symmetric.mode.sym),
pub->publicArea.parameters.rsaDetail.symmetric.mode.sym);
printf(" scheme: %s (0x%X), scheme hash: %s (0x%X)\n",

View File

@ -583,7 +583,7 @@ TPM_RC TPM2_ParamDec_CmdResponse(TPM2_AUTH_SESSION *session,
}
else if (session->symmetric.algorithm == TPM_ALG_AES &&
session->symmetric.mode.aes == TPM_ALG_CFB) {
#if !defined(WOLFTPM2_NO_WOLFCRYPT) && defined(WOLFSSL_AES_CFB)
#if !defined(WOLFTPM2_NO_WOLFCRYPT) && defined(WOLFSSL_AES_CFB)
rc = TPM2_ParamDec_AESCFB(session, &session->auth, &session->nonceCaller,
&session->nonceTPM, paramData, paramSz);
#else

View File

@ -543,7 +543,7 @@ int wolfTPM2_Cleanup_ex(WOLFTPM2_DEV* dev, int doShutdown)
/* make sure crypto dev callback is unregistered */
rc = wolfTPM2_ClearCryptoDevCb(dev, INVALID_DEVID);
if (rc != 0)
return rc;
return rc;
#endif
if (doShutdown) {
@ -3465,7 +3465,7 @@ int wolfTPM2_LoadSymmetricKey(WOLFTPM2_DEV* dev, WOLFTPM2_KEY* key, int alg,
LoadExternal_Out loadExtOut;
int hashAlg, hashAlgDigSz;
if (dev == NULL || key == NULL || keyBuf == NULL ||
if (dev == NULL || key == NULL || keyBuf == NULL ||
(keySz != 16 && keySz != 32)) {
return BAD_FUNC_ARG;
}
@ -4395,25 +4395,25 @@ static void wolfTPM2_CopyPubT(TPMT_PUBLIC* out, const TPMT_PUBLIC* in)
out->objectAttributes = in->objectAttributes;
out->authPolicy.size = in->authPolicy.size;
if (out->authPolicy.size > 0) {
if (out->authPolicy.size >
if (out->authPolicy.size >
(UINT16)sizeof(out->authPolicy.buffer))
out->authPolicy.size =
out->authPolicy.size =
(UINT16)sizeof(out->authPolicy.buffer);
XMEMCPY(out->authPolicy.buffer,
in->authPolicy.buffer,
out->authPolicy.size);
}
switch (out->type) {
case TPM_ALG_KEYEDHASH:
out->parameters.keyedHashDetail.scheme =
out->parameters.keyedHashDetail.scheme =
in->parameters.keyedHashDetail.scheme;
out->unique.keyedHash.size =
out->unique.keyedHash.size =
in->unique.keyedHash.size;
if (out->unique.keyedHash.size >
if (out->unique.keyedHash.size >
(UINT16)sizeof(out->unique.keyedHash.buffer)) {
out->unique.keyedHash.size =
out->unique.keyedHash.size =
(UINT16)sizeof(out->unique.keyedHash.buffer);
}
XMEMCPY(out->unique.keyedHash.buffer,
@ -4421,16 +4421,16 @@ static void wolfTPM2_CopyPubT(TPMT_PUBLIC* out, const TPMT_PUBLIC* in)
out->unique.keyedHash.size);
break;
case TPM_ALG_SYMCIPHER:
out->parameters.symDetail.sym.algorithm =
out->parameters.symDetail.sym.algorithm =
in->parameters.symDetail.sym.algorithm;
out->parameters.symDetail.sym.keyBits.sym =
out->parameters.symDetail.sym.keyBits.sym =
in->parameters.symDetail.sym.keyBits.sym;
out->parameters.symDetail.sym.mode.sym =
out->parameters.symDetail.sym.mode.sym =
in->parameters.symDetail.sym.mode.sym;
out->unique.sym.size =
out->unique.sym.size =
in->unique.sym.size;
if (out->unique.sym.size >
if (out->unique.sym.size >
(UINT16)sizeof(out->unique.sym.buffer)) {
out->unique.sym.size =
(UINT16)sizeof(out->unique.sym.buffer);
@ -4442,21 +4442,21 @@ static void wolfTPM2_CopyPubT(TPMT_PUBLIC* out, const TPMT_PUBLIC* in)
case TPM_ALG_RSA:
wolfTPM2_CopySymmetric(&out->parameters.rsaDetail.symmetric,
&in->parameters.rsaDetail.symmetric);
out->parameters.rsaDetail.scheme.scheme =
out->parameters.rsaDetail.scheme.scheme =
in->parameters.rsaDetail.scheme.scheme;
if (out->parameters.rsaDetail.scheme.scheme != TPM_ALG_NULL)
out->parameters.rsaDetail.scheme.details.anySig.hashAlg =
out->parameters.rsaDetail.scheme.details.anySig.hashAlg =
in->parameters.rsaDetail.scheme.details.anySig.hashAlg;
out->parameters.rsaDetail.keyBits =
out->parameters.rsaDetail.keyBits =
in->parameters.rsaDetail.keyBits;
out->parameters.rsaDetail.exponent =
out->parameters.rsaDetail.exponent =
in->parameters.rsaDetail.exponent;
out->unique.rsa.size =
out->unique.rsa.size =
in->unique.rsa.size;
if (out->unique.rsa.size >
if (out->unique.rsa.size >
(UINT16)sizeof(out->unique.rsa.buffer)) {
out->unique.rsa.size =
out->unique.rsa.size =
(UINT16)sizeof(out->unique.rsa.buffer);
}
XMEMCPY(out->unique.rsa.buffer,
@ -4466,14 +4466,14 @@ static void wolfTPM2_CopyPubT(TPMT_PUBLIC* out, const TPMT_PUBLIC* in)
case TPM_ALG_ECC:
wolfTPM2_CopySymmetric(&out->parameters.eccDetail.symmetric,
&in->parameters.eccDetail.symmetric);
out->parameters.eccDetail.scheme.scheme =
out->parameters.eccDetail.scheme.scheme =
in->parameters.eccDetail.scheme.scheme;
if (out->parameters.eccDetail.scheme.scheme != TPM_ALG_NULL)
out->parameters.eccDetail.scheme.details.any.hashAlg =
out->parameters.eccDetail.scheme.details.any.hashAlg =
in->parameters.eccDetail.scheme.details.any.hashAlg;
out->parameters.eccDetail.curveID =
out->parameters.eccDetail.curveID =
in->parameters.eccDetail.curveID;
out->parameters.eccDetail.kdf =
out->parameters.eccDetail.kdf =
in->parameters.eccDetail.kdf;
wolfTPM2_CopyEccParam(&out->unique.ecc.x,
@ -4484,10 +4484,10 @@ static void wolfTPM2_CopyPubT(TPMT_PUBLIC* out, const TPMT_PUBLIC* in)
default:
wolfTPM2_CopySymmetric(&out->parameters.asymDetail.symmetric,
&in->parameters.asymDetail.symmetric);
out->parameters.asymDetail.scheme.scheme =
out->parameters.asymDetail.scheme.scheme =
in->parameters.asymDetail.scheme.scheme;
if (out->parameters.asymDetail.scheme.scheme != TPM_ALG_NULL)
out->parameters.asymDetail.scheme.details.anySig.hashAlg =
out->parameters.asymDetail.scheme.details.anySig.hashAlg =
in->parameters.asymDetail.scheme.details.anySig.hashAlg;
break;
}
@ -4819,7 +4819,7 @@ int wolfTPM2_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
/* Make sure an ECDH key has been set */
if (tlsCtx->ecdhKey == NULL || tlsCtx->eccKey == NULL ||
tlsCtx->ecdhKey->handle.hndl == TPM_RH_NULL) {
tlsCtx->ecdhKey->handle.hndl == TPM_RH_NULL) {
return exit_rc;
}

View File

@ -263,7 +263,7 @@ static void test_TPM2_KDFa(void)
TPM2B_DATA keyIn = {
.size = TEST_KDFA_KEYSZ,
.buffer = {0x27, 0x1F, 0xA0, 0x8B, 0xBD, 0xC5, 0x06, 0x0E, 0xC3, 0xDF,
0xA9, 0x28, 0xFF, 0x9B, 0x73, 0x12, 0x3A, 0x12, 0xDA, 0x0C}
0xA9, 0x28, 0xFF, 0x9B, 0x73, 0x12, 0x3A, 0x12, 0xDA, 0x0C}
};
const char label[] = "KDFSELFTESTLABEL";
TPM2B_NONCE contextU = {

View File

@ -3209,7 +3209,7 @@ WOLFTPM_API int TPM2_GetHashDigestSize(TPMI_ALG_HASH hashAlg);
/*!
\ingroup TPM2_Proprietary
\brief Translate a TPM2 hash type to its coresponding wolfcrypt hash type
\brief Translate a TPM2 hash type to its corresponding wolfcrypt hash type
\return a value specifying a hash type to use with wolfcrypt
\return 0 if hash type is invalid
@ -3341,7 +3341,7 @@ WOLFTPM_API int TPM2_GetCurveSize(TPM_ECC_CURVE curveID);
/*!
\ingroup TPM2_Proprietary
\brief Translate a wolfcrypt curve type to its coresponding TPM curve type
\brief Translate a wolfcrypt curve type to its corresponding TPM curve type
\return integer value representing a wolfcrypt curve type
\return ECC_CURVE_OID_E in case of invalid curve type
@ -3366,7 +3366,7 @@ WOLFTPM_API int TPM2_GetTpmCurve(int curveID);
/*!
\ingroup TPM2_Proprietary
\brief Translate a TPM curve type to its coresponding wolfcrypt curve type
\brief Translate a TPM curve type to its corresponding wolfcrypt curve type
\return integer value representing a TPM curve type
\return -1 or ECC_CURVE_OID_E in case of invalid curve type
@ -3570,7 +3570,7 @@ WOLFTPM_API UINT16 TPM2_GetVendorID(void);
#ifdef DEBUG_WOLFTPM
/*!
\ingroup TPM2_Proprietary
\brief Helper function to print a binary buffer in a formated way
\brief Helper function to print a binary buffer in a formatted way
\note Requires DEBUG_WOLFTPM to be defined
\param buffer pointer to a buffer of BYTE type

View File

@ -84,6 +84,6 @@
#define SOCKET_ECONNABORTED ECONNABORTED
#endif /* USE_WINDOWS_API */
#endif /* ! USE_WOLFSSL_IO */
#endif /* !USE_WOLFSSL_IO */
#endif /* _TPM2_SOCKET_H_ */

View File

@ -78,7 +78,7 @@ typedef int64_t INT64;
#ifndef WOLFSSL_USER_SETTINGS
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfssl/wolfcrypt/logging.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
@ -100,9 +100,9 @@ typedef int64_t INT64;
#include <wolfssl/ssl.h> /* for wolfSSL_ERR_reason_error_string */
#endif
#ifdef DEBUG_WOLFTPM
#include <stdio.h>
#endif
#ifdef DEBUG_WOLFTPM
#include <stdio.h>
#endif
#include <wolfssl/version.h>
#if defined(LIBWOLFSSL_VERSION_HEX) && LIBWOLFSSL_VERSION_HEX < 0x03015004

View File

@ -642,7 +642,7 @@ WOLFTPM_API int wolfTPM2_CreateLoadedKey(WOLFTPM2_DEV* dev, WOLFTPM2_KEYBLOB* ke
/*!
\ingroup wolfTPM2_Wrappers
\brief Wrapper to load the public part of an external key
\note The key must be formated to the format expected by the TPM, see the 'pub' argument and the alternative wrappers.
\note The key must be formatted to the format expected by the TPM, see the 'pub' argument and the alternative wrappers.
\return TPM_RC_SUCCESS: successful
\return TPM_RC_FAILURE: generic failure (check TPM IO and TPM return code)
@ -1097,7 +1097,7 @@ WOLFTPM_API int wolfTPM2_RsaKey_WolfToTpm_ex(WOLFTPM2_DEV* dev,
\param dev pointer to a TPM2_DEV struct
\param tpmKey pointer to an empty struct of WOLFTPM2_KEY type, to hold the imported TPM key
\param pem pointer to an array of byte type, containing a PEM formated public key material
\param pem pointer to an array of byte type, containing a PEM formatted public key material
\param pemSz pointer to integer variable, specifying the size of PEM key data
\sa wolfTPM2_RsaKey_WolfToTpm