Skip to content

Commit

Permalink
Echoserver Rekey Fix
Browse files Browse the repository at this point in the history
1. wolfSSH_worker() should return WS_REKEYING if receiving a packet.
2. The echoserver's ssh_worker  should wait for another packet when it
   is rekeying.
  • Loading branch information
ejohnstown committed Sep 12, 2024
1 parent bbba8ae commit bb1ba69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/echoserver/echoserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,9 @@ static int ssh_worker(thread_ctx_t* threadCtx)
#endif
continue;
}
else if (rc == WS_REKEYING) {
continue;
}
else if (rc != WS_WANT_READ) {
#ifdef SHELL_DEBUG
printf("Break:read sshFd returns %d: errno =%x\n",
Expand Down
5 changes: 5 additions & 0 deletions src/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -2423,6 +2423,11 @@ int wolfSSH_worker(WOLFSSH* ssh, word32* channelId)
}

if (ret == WS_CHAN_RXD) {
if (ssh->isKeying) {
ssh->error = WS_REKEYING;
return WS_REKEYING;
}

WLOG(WS_LOG_DEBUG, "Leaving wolfSSH_worker(), "
"data received on channel %u", ssh->lastRxId);
}
Expand Down

0 comments on commit bb1ba69

Please sign in to comment.