* -C cancel an ongoing TPM command
*/
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
numbytes = write(file_fd, pgs.u.resp.data,
devtoh32(is_chardev, pgs.u.resp.length));
- if (numbytes != devtoh32(is_chardev, pgs.u.resp.length)) {
+ if ((uint32_t)numbytes != devtoh32(is_chardev, pgs.u.resp.length)) {
fprintf(stderr,
"Could not write to file '%s': %s\n",
filename, strerror(errno));
had_error = true;
break;
}
- pss.u.req.length = htodev32(is_chardev, numbytes);
+ pss.u.req.length = htodev32(is_chardev, (uint32_t)numbytes);
/* the returnsize is zero on all intermediate packets */
returnsize = ((size_t)numbytes < sizeof(pss.u.req.data))
return EXIT_FAILURE;
}
/* no tpm_result here */
- printf("ptm capability is 0x%lx\n", (uint64_t)devtoh64(is_chardev, cap));
+ printf("ptm capability is 0x%" PRIx64 "\n",
+ (uint64_t)devtoh64(is_chardev, cap));
} else if (!strcmp(command, "-i")) {
init.u.req.init_flags = htodev32(is_chardev, PTM_INIT_FLAG_DELETE_VOLATILE);