summaryrefslogtreecommitdiffstats
path: root/contrib/libs/curl/lib/vssh/libssh2.c
diff options
context:
space:
mode:
authorthegeorg <[email protected]>2022-04-20 17:40:08 +0300
committerthegeorg <[email protected]>2022-04-20 17:40:08 +0300
commit31ff69685d432e9506ba2cad2e4cb05528021282 (patch)
tree70ed539fcc48dd4d1981fd4785797a11cd7e4006 /contrib/libs/curl/lib/vssh/libssh2.c
parent9abb1ba6ed6c2852738c0f69367b9c0bff668676 (diff)
Update contrib/libs/curl to 7.81.0
ref:47b24ca6f73cd31c101d7e08fb558fb7ddd6b54f
Diffstat (limited to 'contrib/libs/curl/lib/vssh/libssh2.c')
-rw-r--r--contrib/libs/curl/lib/vssh/libssh2.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/contrib/libs/curl/lib/vssh/libssh2.c b/contrib/libs/curl/lib/vssh/libssh2.c
index 74909c460c0..df8c71a3b4c 100644
--- a/contrib/libs/curl/lib/vssh/libssh2.c
+++ b/contrib/libs/curl/lib/vssh/libssh2.c
@@ -645,8 +645,8 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
hostkey = libssh2_session_hostkey(sshc->ssh_session, &len, NULL);
if(hostkey) {
- Curl_sha256it(hash, (const unsigned char *) hostkey, len);
- fingerprint = (char *) hash;
+ if(!Curl_sha256it(hash, (const unsigned char *) hostkey, len))
+ fingerprint = (char *) hash;
}
#endif
@@ -661,16 +661,15 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
/* The length of fingerprint is 32 bytes for SHA256.
* See libssh2_hostkey_hash documentation. */
- if(Curl_base64_encode (data, fingerprint, 32, &fingerprint_b64,
- &fingerprint_b64_len) != CURLE_OK) {
+ if(Curl_base64_encode(data, fingerprint, 32, &fingerprint_b64,
+ &fingerprint_b64_len) != CURLE_OK) {
state(data, SSH_SESSION_FREE);
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode;
}
if(!fingerprint_b64) {
- failf(data,
- "sha256 fingerprint could not be encoded");
+ failf(data, "sha256 fingerprint could not be encoded");
state(data, SSH_SESSION_FREE);
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode;
@@ -698,7 +697,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
failf(data,
"Denied establishing ssh session: mismatch sha256 fingerprint. "
- "Remote %s is not equal to %s", fingerprint, pubkey_sha256);
+ "Remote %s is not equal to %s", fingerprint_b64, pubkey_sha256);
state(data, SSH_SESSION_FREE);
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode;