mirror of https://github.com/wolfSSL/wolfTPM.git
Fixes for native_test with ST33 and `TPM2_GetRandom2`.
parent
f983525f56
commit
626beaf4d7
|
@ -331,7 +331,7 @@ int TPM2_Native_TestArgs(void* userCtx, int argc, char *argv[])
|
||||||
#if defined(WOLFTPM_ST33) || defined(WOLFTPM_AUTODETECT)
|
#if defined(WOLFTPM_ST33) || defined(WOLFTPM_AUTODETECT)
|
||||||
if (TPM2_GetVendorID() == TPM_VENDOR_STM) {
|
if (TPM2_GetVendorID() == TPM_VENDOR_STM) {
|
||||||
XMEMSET(&cmdIn.getRand, 0, sizeof(cmdIn.getRand));
|
XMEMSET(&cmdIn.getRand, 0, sizeof(cmdIn.getRand));
|
||||||
i = (int)sizeof(cmdOut.getRand2.randomBytes);
|
i = (int)sizeof(cmdOut.getRand2.randomBytes.buffer);
|
||||||
if (i > (MAX_RESPONSE_SIZE-(int)sizeof(UINT16))) {
|
if (i > (MAX_RESPONSE_SIZE-(int)sizeof(UINT16))) {
|
||||||
i = (MAX_RESPONSE_SIZE-(int)sizeof(UINT16));
|
i = (MAX_RESPONSE_SIZE-(int)sizeof(UINT16));
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ int TPM2_Native_TestArgs(void* userCtx, int argc, char *argv[])
|
||||||
/* the getRand and getRand2 have same return size header in cmdOut union */
|
/* the getRand and getRand2 have same return size header in cmdOut union */
|
||||||
if (cmdOut.getRand.randomBytes.size != i) {
|
if (cmdOut.getRand.randomBytes.size != i) {
|
||||||
printf("TPM2_GetRandom length mismatch %d != %d\n",
|
printf("TPM2_GetRandom length mismatch %d != %d\n",
|
||||||
cmdOut.getRand.randomBytes.size, MAX_RNG_REQ_SIZE);
|
cmdOut.getRand.randomBytes.size, i);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
printf("TPM2_GetRandom: Got %d bytes\n", cmdOut.getRand.randomBytes.size);
|
printf("TPM2_GetRandom: Got %d bytes\n", cmdOut.getRand.randomBytes.size);
|
||||||
|
@ -371,7 +371,7 @@ int TPM2_Native_TestArgs(void* userCtx, int argc, char *argv[])
|
||||||
|
|
||||||
/* Stir Random */
|
/* Stir Random */
|
||||||
XMEMSET(&cmdIn.stirRand, 0, sizeof(cmdIn.stirRand));
|
XMEMSET(&cmdIn.stirRand, 0, sizeof(cmdIn.stirRand));
|
||||||
cmdIn.stirRand.inData.size = cmdOut.getRand.randomBytes.size;
|
cmdIn.stirRand.inData.size = MAX_RNG_REQ_SIZE;
|
||||||
XMEMCPY(cmdIn.stirRand.inData.buffer,
|
XMEMCPY(cmdIn.stirRand.inData.buffer,
|
||||||
cmdOut.getRand.randomBytes.buffer, cmdIn.stirRand.inData.size);
|
cmdOut.getRand.randomBytes.buffer, cmdIn.stirRand.inData.size);
|
||||||
rc = TPM2_StirRandom(&cmdIn.stirRand);
|
rc = TPM2_StirRandom(&cmdIn.stirRand);
|
||||||
|
|
Loading…
Reference in New Issue