mirror of https://github.com/wolfSSL/wolfssh.git
PR review: Update some std-C functions with the proper porting wrappers.
parent
732aba4bc6
commit
9bbfcf1a96
|
@ -891,6 +891,7 @@ static int wolfSSH_KEY_init(WS_KeySignature* key, byte keyId, void* heap)
|
||||||
int ret = WS_SUCCESS;
|
int ret = WS_SUCCESS;
|
||||||
|
|
||||||
if (key != NULL) {
|
if (key != NULL) {
|
||||||
|
WMEMSET(key, 0, sizeof(*key));
|
||||||
key->keySigId = keyId;
|
key->keySigId = keyId;
|
||||||
|
|
||||||
switch (keyId) {
|
switch (keyId) {
|
||||||
|
@ -1104,12 +1105,12 @@ static int GetOpenSshKey(WS_KeySignature *key,
|
||||||
word32 keyCount = 0, strSz = 0, i;
|
word32 keyCount = 0, strSz = 0, i;
|
||||||
int ret = WS_SUCCESS;
|
int ret = WS_SUCCESS;
|
||||||
|
|
||||||
if (strcmp(AuthMagic, (const char*)buf) != 0) {
|
if (WSTRCMP(AuthMagic, (const char*)buf) != 0) {
|
||||||
ret = WS_KEY_AUTH_MAGIC_E;
|
ret = WS_KEY_AUTH_MAGIC_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == WS_SUCCESS) {
|
if (ret == WS_SUCCESS) {
|
||||||
*idx += (word32)strlen(AuthMagic) + 1;
|
*idx += (word32)WSTRLEN(AuthMagic) + 1;
|
||||||
ret = GetSkip(buf, len, idx); /* ciphername */
|
ret = GetSkip(buf, len, idx); /* ciphername */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9138,7 +9139,7 @@ static int SendKexGetSigningKey(WOLFSSH* ssh,
|
||||||
sigKeyBlock_ptr->sk.ecc.primeName =
|
sigKeyBlock_ptr->sk.ecc.primeName =
|
||||||
PrimeNameForId(ssh->handshake->pubKeyId);
|
PrimeNameForId(ssh->handshake->pubKeyId);
|
||||||
sigKeyBlock_ptr->sk.ecc.primeNameSz =
|
sigKeyBlock_ptr->sk.ecc.primeNameSz =
|
||||||
(word32)strlen(sigKeyBlock_ptr->sk.ecc.primeName);
|
(word32)WSTRLEN(sigKeyBlock_ptr->sk.ecc.primeName);
|
||||||
|
|
||||||
/* Decode the user-configured ECDSA private key. */
|
/* Decode the user-configured ECDSA private key. */
|
||||||
sigKeyBlock_ptr->sk.ecc.qSz =
|
sigKeyBlock_ptr->sk.ecc.qSz =
|
||||||
|
@ -9428,7 +9429,7 @@ int SendKexDhReply(WOLFSSH* ssh)
|
||||||
sigKeyBlock_ptr->pubKeyName =
|
sigKeyBlock_ptr->pubKeyName =
|
||||||
IdToName(SigTypeForId(sigKeyBlock_ptr->pubKeyId));
|
IdToName(SigTypeForId(sigKeyBlock_ptr->pubKeyId));
|
||||||
sigKeyBlock_ptr->pubKeyNameSz =
|
sigKeyBlock_ptr->pubKeyNameSz =
|
||||||
(word32)strlen(sigKeyBlock_ptr->pubKeyName);
|
(word32)WSTRLEN(sigKeyBlock_ptr->pubKeyName);
|
||||||
sigKeyBlock_ptr->pubKeyFmtId = sigKeyBlock_ptr->pubKeyId;
|
sigKeyBlock_ptr->pubKeyFmtId = sigKeyBlock_ptr->pubKeyId;
|
||||||
if (sigKeyBlock_ptr->pubKeyId == ID_RSA_SHA2_256
|
if (sigKeyBlock_ptr->pubKeyId == ID_RSA_SHA2_256
|
||||||
|| sigKeyBlock_ptr->pubKeyId == ID_RSA_SHA2_512) {
|
|| sigKeyBlock_ptr->pubKeyId == ID_RSA_SHA2_512) {
|
||||||
|
@ -9437,7 +9438,7 @@ int SendKexDhReply(WOLFSSH* ssh)
|
||||||
sigKeyBlock_ptr->pubKeyFmtName =
|
sigKeyBlock_ptr->pubKeyFmtName =
|
||||||
IdToName(sigKeyBlock_ptr->pubKeyFmtId);
|
IdToName(sigKeyBlock_ptr->pubKeyFmtId);
|
||||||
sigKeyBlock_ptr->pubKeyFmtNameSz =
|
sigKeyBlock_ptr->pubKeyFmtNameSz =
|
||||||
(word32)strlen(sigKeyBlock_ptr->pubKeyFmtName);
|
(word32)WSTRLEN(sigKeyBlock_ptr->pubKeyFmtName);
|
||||||
|
|
||||||
switch (ssh->handshake->kexId) {
|
switch (ssh->handshake->kexId) {
|
||||||
#ifndef WOLFSSH_NO_ECDH_SHA2_NISTP256
|
#ifndef WOLFSSH_NO_ECDH_SHA2_NISTP256
|
||||||
|
|
|
@ -1664,8 +1664,8 @@ static int DoOpenSshKey(const byte* in, word32 inSz, byte** out,
|
||||||
newKey = *out;
|
newKey = *out;
|
||||||
}
|
}
|
||||||
|
|
||||||
in += strlen(PrivBeginOpenSSH);
|
in += WSTRLEN(PrivBeginOpenSSH);
|
||||||
inSz -= (word32)(strlen(PrivBeginOpenSSH) + strlen(PrivEndOpenSSH) + 2);
|
inSz -= (word32)(WSTRLEN(PrivBeginOpenSSH) + WSTRLEN(PrivEndOpenSSH) + 2);
|
||||||
|
|
||||||
ret = Base64_Decode((byte*)in, inSz, newKey, &newKeySz);
|
ret = Base64_Decode((byte*)in, inSz, newKey, &newKeySz);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
|
|
Loading…
Reference in New Issue