DF-2407 / tpm0.c
/* DF-2407 full production path: write(fd, buf, 0) on a tpm_ops cdev */ #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <string.h> #include <errno.h> int main(int argc, char **argv) { int fd = open(argv[1], O_WRONLY); char b[16]; memset(b, 0xAA, sizeof(b)); if (fd < 0) { perror("open"); return 1; } errno = 0; ssize_t r = write(fd, b, 0); /* len == 0 -> tpmwrite -> sc_write(buf,0) */ printf("write(fd, buf, 0) = %zd errno=%d (%s)\n", r, errno, strerror(errno)); return 0; } |