Skip to content

Commit 991fad6

Browse files
committed
More peer review fixes
1 parent 8a34a17 commit 991fad6

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

.github/workflows/fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: |
4343
./autogen.sh
4444
CC=clang ./configure --enable-wolftpm --enable-pkcallbacks --enable-keygen \
45-
CFLAGS="-fsanitize=fuzzer-no-link,address -fno-omit-frame-pointer -g -O1" \
45+
CFLAGS="-fsanitize=fuzzer-no-link,address -fno-omit-frame-pointer -g -O1 -DWC_RSA_NO_PADDING" \
4646
LDFLAGS="-fsanitize=address"
4747
make -j$(nproc)
4848
sudo make install

examples/run_examples.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ wait_for_port() {
4545
while [ $elapsed -lt $timeout ]; do
4646
if command -v ss >/dev/null 2>&1; then
4747
ss -tln 2>/dev/null | grep -q ":${port} " && return 0
48-
elif netstat -tln 2>/dev/null | grep -q ":${port} "; then
49-
return 0
48+
elif command -v netstat >/dev/null 2>&1; then
49+
netstat -tln 2>/dev/null | grep -q ":${port} " && return 0
5050
fi
5151
sleep 0.01
5252
elapsed=$((elapsed + 1))

src/tpm2_swtpm.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,11 @@ static TPM_RC SwTpmConnect(TPM2_CTX* ctx, const char* host, const char* port)
224224
tty.c_oflag &= ~OPOST;
225225
tty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
226226

227-
/* Blocking read with timeout.
227+
/* Read with overall timeout.
228228
* RSA key generation on embedded targets can take 10+ seconds,
229-
* so use a generous timeout. */
230-
tty.c_cc[VMIN] = 1; /* block until at least 1 byte */
229+
* so use a generous timeout. With VMIN=0 and VTIME>0, read()
230+
* returns after the timeout even if no byte is received. */
231+
tty.c_cc[VMIN] = 0; /* allow timeout without requiring first byte */
231232
tty.c_cc[VTIME] = 200; /* 20 second timeout (tenths of seconds) */
232233

233234
if (tcsetattr(fd, TCSANOW, &tty) != 0) {

0 commit comments

Comments
 (0)