Skip to content

Commit

Permalink
Changes from open PR 641 and 642
Browse files Browse the repository at this point in the history
  • Loading branch information
gojimmypi committed Dec 29, 2023
1 parent 7dee2c5 commit 580db0f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,7 @@ static INLINE int GetMpintToMp(mp_int* mp,
}


#ifndef WOLFSSH_NO_RSA
/*
* For the given RSA key, calculate p^-1 and q^-1. wolfCrypt's RSA
* code expects them, but the OpenSSH format key doesn't store them.
Expand All @@ -1073,7 +1074,6 @@ static INLINE int CalcRsaInverses(RsaKey* key)
return ret;
}


/*
* Utility for GetOpenSshKey() to read in RSA keys.
*/
Expand Down Expand Up @@ -1105,8 +1105,10 @@ static int GetOpenSshKeyRsa(RsaKey* key,

return ret;
}
#endif


#if !defined(WOLFSSH_NO_ECDSA) && !defined(WOLFSSH_NO_ECC)
/*
* Utility for GetOpenSshKey() to read in ECDSA keys.
*/
Expand Down Expand Up @@ -1134,7 +1136,7 @@ static int GetOpenSshKeyEcc(ecc_key* key,

return ret;
}

#endif

/*
* Decodes an OpenSSH format key.
Expand Down Expand Up @@ -1218,7 +1220,7 @@ static int GetOpenSshKey(WS_KeySignature *key,
str, strSz, &subIdx);
break;
#endif
#ifndef WOLFSSH_NO_ECDSA
#if !defined(WOLFSSH_NO_ECDSA) && !defined(WOLFSSH_NO_ECC)
case ID_ECDSA_SHA2_NISTP256:
ret = GetOpenSshKeyEcc(&key->ks.ecc.key,
str, strSz, &subIdx);
Expand Down
11 changes: 7 additions & 4 deletions src/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1488,10 +1488,13 @@ union wolfSSH_key {

static const char* PrivBeginOpenSSH = "-----BEGIN OPENSSH PRIVATE KEY-----";
static const char* PrivEndOpenSSH = "-----END OPENSSH PRIVATE KEY-----";
static const char* PrivBeginPrefix = "-----BEGIN ";
/* static const char* PrivEndPrefix = "-----END "; */
static const char* PrivSuffix = " PRIVATE KEY-----";

#if !defined(NO_FILESYSTEM) && !defined(WOLFSSH_USER_FILESYSTEM)
/* currently only used in wolfSSH_ReadKey_file() */
static const char* PrivBeginPrefix = "-----BEGIN ";
/* static const char* PrivEndPrefix = "-----END "; */
static const char* PrivSuffix = " PRIVATE KEY-----";
#endif

static int DoSshPubKey(const byte* in, word32 inSz, byte** out,
word32* outSz, const byte** outType, word32* outTypeSz,
Expand All @@ -1503,7 +1506,7 @@ static int DoSshPubKey(const byte* in, word32 inSz, byte** out,
char* type = NULL;
char* key = NULL;
int ret = WS_SUCCESS;
word32 newKeySz, typeSz;
word32 newKeySz, typeSz = 0;

WOLFSSH_UNUSED(inSz);
WOLFSSH_UNUSED(heap);
Expand Down

0 comments on commit 580db0f

Please sign in to comment.