Skip to content

Commit

Permalink
remove redundant size_t casts
Browse files Browse the repository at this point in the history
  • Loading branch information
pabuhler committed Jan 13, 2024
1 parent 5605f82 commit efad3a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions srtp/srtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@ static srtp_err_status_t srtp_protect_aead(srtp_ctx_t *ctx,
if (!(enc_start <= rtp_hdr + *pkt_octet_len))
return srtp_err_status_parse_err;

enc_octet_len = *pkt_octet_len - (size_t)(enc_start - rtp_hdr);
enc_octet_len = *pkt_octet_len - (enc_start - rtp_hdr);

/*
* estimate the packet index using the start of the replay window
Expand Down Expand Up @@ -1895,7 +1895,7 @@ static srtp_err_status_t srtp_protect_aead(srtp_ctx_t *ctx,
/*
* Set the AAD over the RTP header
*/
aad_len = (size_t)(enc_start - rtp_hdr);
aad_len = enc_start - rtp_hdr;
status = srtp_cipher_set_aad(session_keys->rtp_cipher, rtp_hdr, aad_len);
if (status) {
return (srtp_err_status_cipher_fail);
Expand Down Expand Up @@ -2005,7 +2005,7 @@ static srtp_err_status_t srtp_unprotect_aead(srtp_ctx_t *ctx,
/*
* We pass the tag down to the cipher when doing GCM mode
*/
enc_octet_len = *pkt_octet_len - mki_size - (size_t)(enc_start - srtp_hdr);
enc_octet_len = *pkt_octet_len - mki_size - (enc_start - srtp_hdr);

/*
* Sanity check the encrypted payload length against
Expand Down Expand Up @@ -2037,7 +2037,7 @@ static srtp_err_status_t srtp_unprotect_aead(srtp_ctx_t *ctx,
/*
* Set the AAD for AES-GCM, which is the RTP header
*/
aad_len = (size_t)(enc_start - srtp_hdr);
aad_len = enc_start - srtp_hdr;
status = srtp_cipher_set_aad(session_keys->rtp_cipher, srtp_hdr, aad_len);
if (status) {
return (srtp_err_status_cipher_fail);
Expand Down Expand Up @@ -2280,7 +2280,7 @@ srtp_err_status_t srtp_protect_mki(srtp_ctx_t *ctx,
if (!(enc_start <= rtp_hdr + *pkt_octet_len))
return srtp_err_status_parse_err;

enc_octet_len = *pkt_octet_len - (size_t)(enc_start - rtp_hdr);
enc_octet_len = *pkt_octet_len - (enc_start - rtp_hdr);
} else {
enc_start = NULL;
}
Expand Down Expand Up @@ -2649,7 +2649,7 @@ srtp_err_status_t srtp_unprotect_mki(srtp_ctx_t *ctx,
return srtp_err_status_parse_err;

enc_octet_len = *pkt_octet_len - tag_len - mki_size -
(size_t)(enc_start - srtp_hdr);
(enc_start - srtp_hdr);
} else {
enc_start = NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion test/rtp_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ int main(int argc, char *argv[])
expected_len, len);
exit(1);
}
if (strlen(input_key) > (size_t)policy.rtp.cipher_key_len * 2) {
if (strlen(input_key) > policy.rtp.cipher_key_len * 2) {
fprintf(stderr,
"error: too many digits in key/salt "
"(should be %zu hexadecimal digits, found %u)\n",
Expand Down

0 comments on commit efad3a3

Please sign in to comment.