diff --git a/src/channels.c b/src/channels.c index 309a165d..d0c9cd6f 100644 --- a/src/channels.c +++ b/src/channels.c @@ -1622,7 +1622,8 @@ static int channel_write_common(ssh_channel channel, rc = ssh_buffer_pack(session->out_buffer, "dP", effectivelen, - (size_t)effectivelen, data); + (size_t)effectivelen, + data); if (rc != SSH_OK) { ssh_set_error_oom(session); goto error; @@ -1998,7 +1999,8 @@ int ssh_channel_request_pty_size_modes(ssh_channel channel, const char *terminal 0, /* pix */ 0, /* pix */ (uint32_t)modes_len, - modes_len, modes); + (size_t)modes_len, + modes); if (rc != SSH_OK) { ssh_set_error_oom(session); diff --git a/src/kex.c b/src/kex.c index 2c558092..33b21061 100644 --- a/src/kex.c +++ b/src/kex.c @@ -1077,7 +1077,7 @@ int ssh_send_kex(ssh_session session) rc = ssh_buffer_pack(session->out_buffer, "bP", SSH2_MSG_KEXINIT, - 16, + (size_t)16, kex->cookie); /* cookie */ if (rc != SSH_OK) goto error; @@ -1409,10 +1409,10 @@ int ssh_make_sessionid(ssh_session session) rc = ssh_buffer_pack(buf, "dPdPS", ssh_buffer_get_len(client_hash), - ssh_buffer_get_len(client_hash), + (size_t)ssh_buffer_get_len(client_hash), ssh_buffer_get(client_hash), ssh_buffer_get_len(server_hash), - ssh_buffer_get_len(server_hash), + (size_t)ssh_buffer_get_len(server_hash), ssh_buffer_get(server_hash), server_pubkey_blob); SSH_STRING_FREE(server_pubkey_blob); @@ -1514,9 +1514,11 @@ int ssh_make_sessionid(ssh_session session) rc = ssh_buffer_pack(buf, "dPdP", CURVE25519_PUBKEY_SIZE, - (size_t)CURVE25519_PUBKEY_SIZE, session->next_crypto->curve25519_client_pubkey, + (size_t)CURVE25519_PUBKEY_SIZE, + session->next_crypto->curve25519_client_pubkey, CURVE25519_PUBKEY_SIZE, - (size_t)CURVE25519_PUBKEY_SIZE, session->next_crypto->curve25519_server_pubkey); + (size_t)CURVE25519_PUBKEY_SIZE, + session->next_crypto->curve25519_server_pubkey); if (rc != SSH_OK) { ssh_set_error(session, diff --git a/src/messages.c b/src/messages.c index f4e89d4a..db340a5a 100644 --- a/src/messages.c +++ b/src/messages.c @@ -786,7 +786,7 @@ static ssh_buffer ssh_msg_userauth_build_digest(ssh_session session, rc = ssh_buffer_pack(buffer, "dPbsssbsS", - crypto->session_id_len, /* session ID string */ + (uint32_t)crypto->session_id_len, /* session ID string */ crypto->session_id_len, crypto->session_id, SSH2_MSG_USERAUTH_REQUEST, /* type */ diff --git a/src/pki.c b/src/pki.c index d42a6338..2521b32b 100644 --- a/src/pki.c +++ b/src/pki.c @@ -2638,10 +2638,14 @@ int ssh_pki_signature_verify(ssh_session session, return SSH_ERROR; } - rc = ssh_buffer_pack(sk_buffer, "PbdP", - SHA256_DIGEST_LEN, application_hash, - sig->sk_flags, sig->sk_counter, - SHA256_DIGEST_LEN, input_hash); + rc = ssh_buffer_pack(sk_buffer, + "PbdP", + (size_t)SHA256_DIGEST_LEN, + application_hash, + sig->sk_flags, + sig->sk_counter, + (size_t)SHA256_DIGEST_LEN, + input_hash); if (rc != SSH_OK) { SSH_BUFFER_FREE(sk_buffer); explicit_bzero(input_hash, SHA256_DIGEST_LEN); @@ -2735,7 +2739,8 @@ ssh_string ssh_pki_do_sign(ssh_session session, rc = ssh_buffer_pack(sign_input, "SP", session_id, - ssh_buffer_get_len(sigbuf), ssh_buffer_get(sigbuf)); + (size_t)ssh_buffer_get_len(sigbuf), + ssh_buffer_get(sigbuf)); if (rc != SSH_OK) { goto end; } diff --git a/src/pki_container_openssh.c b/src/pki_container_openssh.c index 5b97cfd2..e8cc5c5a 100644 --- a/src/pki_container_openssh.c +++ b/src/pki_container_openssh.c @@ -552,7 +552,8 @@ ssh_string ssh_pki_openssh_privkey_export(const ssh_key privkey, "ddPs", rnd, /* checkint 1 & 2 */ rnd, - ssh_string_len(blob), ssh_string_data(blob), + ssh_string_len(blob), + ssh_string_data(blob), "" /* comment */); if (rc == SSH_ERROR){ goto error; @@ -621,15 +622,17 @@ ssh_string ssh_pki_openssh_privkey_export(const ssh_key privkey, rc = ssh_buffer_pack(buffer, "PssSdSdP", - (size_t)strlen(OPENSSH_AUTH_MAGIC) + 1, OPENSSH_AUTH_MAGIC, + strlen(OPENSSH_AUTH_MAGIC) + 1, + OPENSSH_AUTH_MAGIC, to_encrypt ? "aes128-cbc" : "none", /* ciphername */ - to_encrypt ? "bcrypt" : "none", /* kdfname */ - kdf_options, /* kdfoptions */ - (uint32_t) 1, /* nkeys */ + to_encrypt ? "bcrypt" : "none", /* kdfname */ + kdf_options, /* kdfoptions */ + (uint32_t)1, /* nkeys */ pubkey_s, - (uint32_t)ssh_buffer_get_len(privkey_buffer), + ssh_buffer_get_len(privkey_buffer), /* rest of buffer is a string */ - (size_t)ssh_buffer_get_len(privkey_buffer), ssh_buffer_get(privkey_buffer)); + (size_t)ssh_buffer_get_len(privkey_buffer), + ssh_buffer_get(privkey_buffer)); if (rc != SSH_OK) { goto error; }