Skip to content
Merged
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
2 changes: 1 addition & 1 deletion apps/wolfsshd/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ static int DoCheckUser(const char* usr, WOLFSSHD_AUTH* auth)
wolfSSH_Log(WS_LOG_INFO, "[SSHD] User ok.");
ret = WOLFSSH_USERAUTH_SUCCESS;
}
else if (ret == WSSHD_AUTH_FAILURE) {
else if (rc == WSSHD_AUTH_FAILURE) {
wolfSSH_Log(WS_LOG_INFO, "[SSHD] User %s doesn't exist.", usr);
ret = WOLFSSH_USERAUTH_INVALID_USER;
}
Expand Down
6 changes: 3 additions & 3 deletions src/agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,15 +590,15 @@ static int PostRemoveId(WOLFSSH_AGENT_CTX* agent,
int match;

match = WMEMCMP(id, cur->id, WC_SHA256_DIGEST_SIZE);
if (!match) {
if (match) {
prev = cur;
cur = cur->next;
}
else {
if (prev != NULL)
prev->next = cur->next;
else
agent->idList = NULL;
agent->idList = cur->next;

wolfSSH_AGENT_ID_free(cur, agent->heap);
cur = NULL;
Expand Down Expand Up @@ -660,7 +660,7 @@ static WOLFSSH_AGENT_ID* FindKeyId(WOLFSSH_AGENT_ID* id,

if (ret == WS_SUCCESS) {
while (id != NULL &&
WMEMCMP(digest, id, WC_SHA256_DIGEST_SIZE) != 0 &&
WMEMCMP(digest, id->id, WC_SHA256_DIGEST_SIZE) != 0 &&
WMEMCMP(keyBlob, id->keyBlob, keyBlobSz)) {
id = id->next;
}
Expand Down
24 changes: 14 additions & 10 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -7210,8 +7210,9 @@ static int DoUserAuthRequestRsaCert(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk,
}

if (ret == WS_SUCCESS) {
if (publicKeyTypeSz != pk->publicKeyTypeSz &&
WMEMCMP(publicKeyType, pk->publicKeyType, publicKeyTypeSz) != 0) {
if (publicKeyTypeSz != pk->publicKeyTypeSz
|| WMEMCMP(publicKeyType, pk->publicKeyType,
publicKeyTypeSz) != 0) {

WLOG(WS_LOG_DEBUG,
"Signature's type does not match public key type");
Expand Down Expand Up @@ -7309,8 +7310,9 @@ static int DoUserAuthRequestEcc(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk,
if (ret == WS_SUCCESS) {
publicKeyType = pk->publicKey + i;
i += publicKeyTypeSz;
if (publicKeyTypeSz != pk->publicKeyTypeSz &&
WMEMCMP(publicKeyType, pk->publicKeyType, publicKeyTypeSz) != 0) {
if (publicKeyTypeSz != pk->publicKeyTypeSz
|| WMEMCMP(publicKeyType, pk->publicKeyType,
publicKeyTypeSz) != 0) {

WLOG(WS_LOG_DEBUG,
"Public Key's type does not match public key type");
Expand Down Expand Up @@ -7351,8 +7353,9 @@ static int DoUserAuthRequestEcc(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk,
publicKeyType = pk->signature + i;
i += publicKeyTypeSz;

if (publicKeyTypeSz != pk->publicKeyTypeSz &&
WMEMCMP(publicKeyType, pk->publicKeyType, publicKeyTypeSz) != 0) {
if (publicKeyTypeSz != pk->publicKeyTypeSz
|| WMEMCMP(publicKeyType, pk->publicKeyType,
publicKeyTypeSz) != 0) {

WLOG(WS_LOG_DEBUG,
"Signature's type does not match public key type");
Expand Down Expand Up @@ -7620,7 +7623,7 @@ static int DoUserAuthRequestEd25519(WOLFSSH* ssh,
publicKeyType = pk->publicKey + i;
i += publicKeyTypeSz;
if (publicKeyTypeSz != pk->publicKeyTypeSz
&& WMEMCMP(publicKeyType,
|| WMEMCMP(publicKeyType,
pk->publicKeyType, publicKeyTypeSz) != 0) {
WLOG(WS_LOG_DEBUG,
"Public Key's type does not match public key type");
Expand Down Expand Up @@ -7651,8 +7654,9 @@ static int DoUserAuthRequestEd25519(WOLFSSH* ssh,
publicKeyType = pk->signature + i;
i += publicKeyTypeSz;

if (publicKeyTypeSz != pk->publicKeyTypeSz &&
WMEMCMP(publicKeyType, pk->publicKeyType, publicKeyTypeSz) != 0) {
if (publicKeyTypeSz != pk->publicKeyTypeSz
|| WMEMCMP(publicKeyType, pk->publicKeyType,
publicKeyTypeSz) != 0) {

WLOG(WS_LOG_DEBUG,
"Signature's type does not match public key type");
Expand Down Expand Up @@ -8940,7 +8944,7 @@ int wolfSSH_DoModes(const byte* modes, word32 modesSz, int fd)

tcgetattr(fd, &term);

while (idx < modesSz && modes[idx] != WOLFSSH_TTY_OP_END
while (idx + TERMINAL_MODE_SZ <= modesSz && modes[idx] != WOLFSSH_TTY_OP_END
&& modes[idx] < WOLFSSH_TTY_INVALID) {

ato32(modes + idx + 1, &arg);
Expand Down
14 changes: 8 additions & 6 deletions src/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,12 @@ void wolfSSH_SetTpmDev(WOLFSSH* ssh, WOLFTPM2_DEV* dev)
{
WLOG(WS_LOG_DEBUG, "Entering wolfSSH_SetTpmDev()");

if (ssh && ssh->ctx)
if (ssh && ssh->ctx) {
ssh->ctx->tpmDev = dev;

if (ssh->ctx->tpmDev == NULL) {
WLOG(WS_LOG_DEBUG, "wolfSSH_SetTpmDev: Set tpm dev failed");
if (ssh->ctx->tpmDev == NULL) {
WLOG(WS_LOG_DEBUG, "wolfSSH_SetTpmDev: Set tpm dev failed");
}
}
}

Expand All @@ -418,11 +419,12 @@ void wolfSSH_SetTpmKey(WOLFSSH* ssh, WOLFTPM2_KEY* key)
{
WLOG(WS_LOG_DEBUG, "Entering wolfSSH_SetTpmKey()");

if (ssh && ssh->ctx)
if (ssh && ssh->ctx) {
ssh->ctx->tpmKey = key;

if (ssh->ctx->tpmDev == NULL) {
WLOG(WS_LOG_DEBUG, "wolfSSH_SetTpmKey: Set tpm key failed");
if (ssh->ctx->tpmKey == NULL) {
WLOG(WS_LOG_DEBUG, "wolfSSH_SetTpmKey: Set tpm key failed");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/wolfscp.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ static int GetScpFileMode(WOLFSSH* ssh, byte* buf, word32 bufSz,

for (i = 0; i < SCP_MODE_OCTET_LEN; i++)
{
if (modeOctet[i] < '0' || modeOctet[0] > '7') {
if (modeOctet[i] < '0' || modeOctet[i] > '7') {
ret = WS_BAD_ARGUMENT;
break;
}
Expand Down