1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "tss2_sys.h"
- #define LOGMODULE test
- #include "util/log.h"
- #include "test.h"
- int
- test_invoke (TSS2_SYS_CONTEXT *sys_context)
- {
- TSS2_RC rc;
- TPM2B_SENSITIVE_DATA inData = {
- .size = 20,
- .buffer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
- };
- LOG_INFO("StirRandom tests started.");
-
- rc = Tss2_Sys_StirRandom(NULL, 0, NULL, 0);
- if (rc != TSS2_SYS_RC_BAD_REFERENCE) {
- LOG_ERROR("StirRandom (ctx) FAILED! Response Code : %x", rc);
- exit(1);
- }
-
- rc = Tss2_Sys_StirRandom(sys_context, 0, NULL, 0);
- if (rc != TSS2_RC_SUCCESS) {
- LOG_ERROR("StirRandom (empty) FAILED! Response Code : %x", rc);
- exit(1);
- }
-
- rc = Tss2_Sys_StirRandom(sys_context, 0, &inData, 0);
- if (rc != TSS2_RC_SUCCESS) {
- LOG_ERROR("StirRandom (indata) FAILED! Response Code : %x", rc);
- exit(1);
- }
- LOG_INFO("StirRandom Test Passed!");
- return 0;
- }
|