mirror of https://github.com/wolfSSL/wolfssh.git
Review Fixes
1. Add a wrapper to the key-gen code that checks for wolfCrypt's keygen flag and errors if keygen isn't available. 2. The main loops around wolfSSH_stream_read() for the example client and server needed to check the error register for WANT_READ or WANT_WRITE, not the return code.pull/134/head
parent
3a2da4bb0e
commit
2350ffe00e
|
@ -304,6 +304,7 @@ THREAD_RETURN WOLFSSH_THREAD client_test(void* args)
|
||||||
do {
|
do {
|
||||||
ret = wolfSSH_stream_read(ssh, (byte*)rxBuf, sizeof(rxBuf) - 1);
|
ret = wolfSSH_stream_read(ssh, (byte*)rxBuf, sizeof(rxBuf) - 1);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
|
ret = wolfSSH_get_error(ssh);
|
||||||
if (ret != WS_WANT_READ && ret != WS_WANT_WRITE)
|
if (ret != WS_WANT_READ && ret != WS_WANT_WRITE)
|
||||||
err_sys("Stream read failed.");
|
err_sys("Stream read failed.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,8 @@ static THREAD_RETURN WOLFSSH_THREAD server_worker(void* vArgs)
|
||||||
rxSz = wolfSSH_stream_read(threadCtx->ssh,
|
rxSz = wolfSSH_stream_read(threadCtx->ssh,
|
||||||
buf + backlogSz,
|
buf + backlogSz,
|
||||||
EXAMPLE_BUFFER_SZ);
|
EXAMPLE_BUFFER_SZ);
|
||||||
|
if (rxSz <= 0)
|
||||||
|
rxSz = wolfSSH_get_error(threadCtx->ssh);
|
||||||
} while (rxSz == WS_WANT_READ || rxSz == WS_WANT_WRITE);
|
} while (rxSz == WS_WANT_READ || rxSz == WS_WANT_WRITE);
|
||||||
|
|
||||||
if (rxSz > 0) {
|
if (rxSz > 0) {
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
|
|
||||||
#ifdef WOLFSSH_KEYGEN
|
#ifdef WOLFSSH_KEYGEN
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_KEY_GEN
|
||||||
|
|
||||||
#ifdef NO_INLINE
|
#ifdef NO_INLINE
|
||||||
#include <wolfssh/misc.h>
|
#include <wolfssh/misc.h>
|
||||||
#else
|
#else
|
||||||
|
@ -105,4 +107,9 @@ int wolfSSH_MakeRsaKey(byte* out, word32 outSz,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
#else /* WOLFSSL_KEY_GEN */
|
||||||
|
#error "wolfSSH keygen requires that keygen is enabled in wolfSSL, use --enable-keygen or #define WOLFSSL_KEY_GEN."
|
||||||
|
#endif /* WOLFSSL_KEY_GEN */
|
||||||
|
|
||||||
|
#endif /* WOLFSSH_KEYGEN */
|
||||||
|
|
Loading…
Reference in New Issue