Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Fix some printf formatting codes for size_t/ssize_t. #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/curve.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int curve_decode_point(ec_public_key **public_key, const uint8_t *key_data, size
}

if(key_len != DJB_KEY_LEN + 1) {
signal_log(global_context, SG_LOG_ERROR, "Invalid key length: %d", key_len);
signal_log(global_context, SG_LOG_ERROR, "Invalid key length: %zu", key_len);
return SG_ERR_INVALID_KEY;
}

Expand Down Expand Up @@ -143,7 +143,7 @@ int curve_decode_private_point(ec_private_key **private_key, const uint8_t *key_
ec_private_key *key = 0;

if(key_len != DJB_KEY_LEN) {
signal_log(global_context, SG_LOG_ERROR, "Invalid key length: %d", key_len);
signal_log(global_context, SG_LOG_ERROR, "Invalid key length: %zu", key_len);
return SG_ERR_INVALID_KEY;
}

Expand Down
2 changes: 1 addition & 1 deletion src/hkdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ ssize_t hkdf_derive_secrets(hkdf_context *context,

prk_len = hkdf_extract(context, &prk, salt, salt_len, input_key_material, input_key_material_len);
if(prk_len < 0) {
signal_log(context->global_context, SG_LOG_ERROR, "hkdf_extract error: %d", prk_len);
signal_log(context->global_context, SG_LOG_ERROR, "hkdf_extract error: %zd", prk_len);
return prk_len;
}

Expand Down
4 changes: 2 additions & 2 deletions src/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ int key_exchange_message_deserialize(key_exchange_message **message, const uint8
}

if(message_structure->has_basekeysignature && message_structure->basekeysignature.len != CURVE_SIGNATURE_LEN) {
signal_log(global_context, SG_LOG_WARNING, "Invalid base key signature length: %d", message_structure->basekeysignature.len);
signal_log(global_context, SG_LOG_WARNING, "Invalid base key signature length: %zu", message_structure->basekeysignature.len);
result = SG_ERR_INVALID_MESSAGE;
goto complete;
}
Expand Down Expand Up @@ -770,7 +770,7 @@ int signal_message_verify_mac(signal_message *message,
our_mac_data = signal_buffer_data(our_mac_buffer);
our_mac_len = signal_buffer_len(our_mac_buffer);
if(our_mac_len != their_mac_len) {
signal_log(global_context, SG_LOG_WARNING, "MAC length mismatch: %d != %d", our_mac_len, their_mac_len);
signal_log(global_context, SG_LOG_WARNING, "MAC length mismatch: %zu != %zu", our_mac_len, their_mac_len);
result = SG_ERR_UNKNOWN;
goto complete;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ratchet.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ int ratchet_chain_key_get_message_keys(ratchet_chain_key *chain_key, ratchet_mes

if(key_material_data_len != RATCHET_CIPHER_KEY_LENGTH + RATCHET_MAC_KEY_LENGTH + RATCHET_IV_LENGTH) {
signal_log(chain_key->global_context, SG_LOG_WARNING,
"key_material_data length mismatch: %d != %d",
"key_material_data length mismatch: %zu != %d",
key_material_data_len, (RATCHET_CIPHER_KEY_LENGTH + RATCHET_MAC_KEY_LENGTH + RATCHET_IV_LENGTH));
result = SG_ERR_UNKNOWN;
goto complete;
Expand Down