diff --git a/src/internal.c b/src/internal.c index 7e9727cf6..987e670b0 100644 --- a/src/internal.c +++ b/src/internal.c @@ -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. @@ -1073,7 +1074,6 @@ static INLINE int CalcRsaInverses(RsaKey* key) return ret; } - /* * Utility for GetOpenSshKey() to read in RSA keys. */ @@ -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. */ @@ -1134,7 +1136,7 @@ static int GetOpenSshKeyEcc(ecc_key* key, return ret; } - +#endif /* * Decodes an OpenSSH format key. @@ -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); diff --git a/src/ssh.c b/src/ssh.c index 4e3758d72..fcee2726b 100644 --- a/src/ssh.c +++ b/src/ssh.c @@ -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, @@ -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);