Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion apps/wolfssh/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,13 @@ static int FingerprintKey(const byte* pubKey, word32 pubKeySz, char* out)
wc_Sha256Free(&sha);
}

if (ret == 0)
if (ret == 0) {
#ifdef WOLFSSL_BASE64_ENCODE
ret = Base64_Encode_NoNl(digest, sizeof(digest), (byte*)fp, &fpSz);
#else
ret = WS_NOT_COMPILED;
#endif
}

if (ret == 0) {
if (fpSz > 0 && fp[fpSz - 1] == '=') {
Expand Down Expand Up @@ -409,7 +414,11 @@ int ClientPublicKeyCheck(const byte* pubKey, word32 pubKeySz, void* ctx)
pubKeyType[sz] = 0;

sz = WOLFSSH_CLIENT_ENCKEY_SIZE_ESTIMATE;
#ifdef WOLFSSL_BASE64_ENCODE
ret = Base64_Encode_NoNl(pubKey, pubKeySz, (byte*)encodedKey, &sz);
#else
ret = WS_NOT_COMPILED;
#endif
}

if (ret == 0)
Expand Down
16 changes: 15 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,22 @@ AS_IF([test "x$ENABLED_SMALLSTACK" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SMALL_STACK"])
AS_IF([test "x$ENABLED_NONE_CIPHER" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_ALLOW_NONE_CIPHER"])
dnl The client app shows host key fingerprints and writes known_hosts
dnl entries, both base64. wolfSSL only enables its encoder by default on
dnl x86_64, so check for it rather than fail later on a hidden prototype.
AS_IF([test "x$ENABLED_SSHCLIENT" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SSHCLIENT"])
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SSHCLIENT"
AC_MSG_CHECKING([for Base64_Encode_NoNl])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <wolfssl/options.h>
#include <wolfssl/wolfcrypt/coding.h>]],
[[byte out[8];
word32 outSz = sizeof(out);
(void)Base64_Encode_NoNl((const byte*)"x", 1,
out, &outSz);]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([the SSH client app needs base64 encoding for host key fingerprints and known_hosts entries. Rebuild wolfSSL with --enable-base64encode, or leave out --enable-sshclient.])])])
AS_IF([test "x$ENABLED_TPM" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_TPM"
AC_CHECK_LIB([wolftpm],[wolfTPM2_Init],,[AC_MSG_ERROR([libwolftpm is required for ${PACKAGE}. It can be obtained from https://www.wolfssl.com/download.html/ .])])])
Expand Down
3 changes: 2 additions & 1 deletion src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -16248,11 +16248,12 @@ int SendServiceAccept(WOLFSSH* ssh, byte serviceId)
}


#ifndef NO_WOLFSSH_SERVER

#define WS_EXTINFO_EXTENSION_COUNT 1
static const char serverSigAlgsName[] = "server-sig-algs";


#ifndef NO_WOLFSSH_SERVER
static int SendExtInfoServer(WOLFSSH* ssh)
{
byte* output;
Expand Down
18 changes: 12 additions & 6 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ static const char serverKeyEccDer[] =
"7bb87f38c66dd5a00a06082a8648ce3d030107a144034200048113ffa42bb79c"
"45747a834c61f33fad26cf22cda9a3bca561b47ce662d4c2f755439a31fb8011"
"20b5124b24f578d7fd22ef4635f005586b5f63c8da1bc4f569";
#ifndef NO_WOLFSSH_SERVER
static const byte serverKeyEccCurveId = ID_ECDSA_SHA2_NISTP256;
#endif
#elif !defined(WOLFSSH_NO_ECDSA_SHA2_NISTP384)
static const char serverKeyEccDer[] =
"3081a402010104303eadd2bbbf05a7be3a3f7c28151289de5bb3644d7011761d"
Expand All @@ -414,7 +416,9 @@ static const char serverKeyEccDer[] =
"7724316d46a23105873f2986d5c712803a6f471ab86850eb063e108961349cf8"
"b4c6a4cf5e97bd7e51e975e3e9217261506eb9cf3c493d3eb88d467b5f27ebab"
"2161c00066febd";
#ifndef NO_WOLFSSH_SERVER
static const byte serverKeyEccCurveId = ID_ECDSA_SHA2_NISTP384;
#endif
#elif !defined(WOLFSSH_NO_ECDSA_SHA2_NISTP521)
static const char serverKeyEccDer[] =
"3081dc0201010442004ca4d86428d9400e7b2df3912eb996c195895043af92e8"
Expand All @@ -424,8 +428,10 @@ static const char serverKeyEccDer[] =
"d18046a9717f2c6f59519c827095b29a6313306218c235769400d0f96d000a19"
"3ba346652beb409a9a45c597a3ed932dd5aaae96bf2f317e5a7ac7458b3c6cdb"
"aa90c355382cdfcdca7377d92eb20a5e8c74237ca5a345b19e3f1a2290b154";
#ifndef NO_WOLFSSH_SERVER
static const byte serverKeyEccCurveId = ID_ECDSA_SHA2_NISTP521;
#endif
#endif

#ifndef WOLFSSH_NO_RSA
static const char serverKeyRsaDer[] =
Expand Down Expand Up @@ -472,7 +478,7 @@ static const char serverKeyRsaDer[] =

static void test_wolfSSH_CTX_UsePrivateKey_buffer(void)
{
#ifndef WOLFSSH_NO_SERVER
#ifndef NO_WOLFSSH_SERVER
WOLFSSH_CTX* ctx;
#ifndef WOLFSSH_NO_ECDSA
byte* eccKey;
Expand Down Expand Up @@ -607,7 +613,7 @@ static void test_wolfSSH_CTX_UsePrivateKey_buffer(void)
#ifndef WOLFSSH_NO_RSA
FreeBins(rsaKey, NULL, NULL, NULL);
#endif
#endif /* WOLFSSH_NO_SERVER */
#endif /* NO_WOLFSSH_SERVER */
}


Expand Down Expand Up @@ -985,7 +991,7 @@ static void test_wolfSSH_ReadCert_file(void)
static void test_wolfSSH_CTX_UseCert_file(void)
{
#if defined(WOLFSSH_CERTS) && !defined(NO_FILESYSTEM) && \
!defined(WOLFSSH_USER_FILESYSTEM) && !defined(WOLFSSH_NO_SERVER)
!defined(WOLFSSH_USER_FILESYSTEM) && !defined(NO_WOLFSSH_SERVER)
WOLFSSH_CTX* ctx = NULL;
#ifndef WOLFSSH_NO_ED25519
int ret;
Expand Down Expand Up @@ -1034,7 +1040,7 @@ static void test_wolfSSH_CTX_UseCert_file(void)
static void test_wolfSSH_CTX_AddRootCert_file(void)
{
#if defined(WOLFSSH_CERTS) && !defined(NO_FILESYSTEM) && \
!defined(WOLFSSH_USER_FILESYSTEM) && !defined(WOLFSSH_NO_SERVER)
!defined(WOLFSSH_USER_FILESYSTEM) && !defined(NO_WOLFSSH_SERVER)
WOLFSSH_CTX* ctx = NULL;

ctx = wolfSSH_CTX_new(WOLFSSH_ENDPOINT_SERVER, NULL);
Expand Down Expand Up @@ -1082,7 +1088,7 @@ static void test_wolfSSH_CTX_AddRootCert_file(void) { ; }

static void test_wolfSSH_CTX_UsePrivateKey_buffer_pem(void)
{
#if defined(WOLFSSH_CERTS) && !defined(WOLFSSH_NO_SERVER)
#if defined(WOLFSSH_CERTS) && !defined(NO_WOLFSSH_SERVER)
WOLFSSH_CTX* ctx = NULL;
byte* key = NULL;
word32 keySz = 0;
Expand Down Expand Up @@ -1119,7 +1125,7 @@ static void test_wolfSSH_CTX_UsePrivateKey_buffer_pem(void)
#endif /* WOLFSSH_NO_ECDSA */

wolfSSH_CTX_free(ctx);
#endif /* WOLFSSH_CERTS && !WOLFSSH_NO_SERVER */
#endif /* WOLFSSH_CERTS && !NO_WOLFSSH_SERVER */
}


Expand Down
3 changes: 2 additions & 1 deletion tests/regress.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ static word32 AppendUint32(byte* buf, word32 bufSz, word32 idx, word32 value)
return idx;
}

static word32 ReadUint32(const byte* buf)
/* Callers sit in separate conditional blocks; some builds have none. */
static WS_MAYBE_UNUSED word32 ReadUint32(const byte* buf)
{
return ((word32)buf[0] << 24) | ((word32)buf[1] << 16) |
((word32)buf[2] << 8) | (word32)buf[3];
Expand Down
Loading