From efad3a3cc1fa995058eaafb5435f693647c23571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20B=C3=BChler?= Date: Fri, 12 Jan 2024 21:47:36 +0100 Subject: [PATCH] remove redundant size_t casts --- srtp/srtp.c | 12 ++++++------ test/rtp_decoder.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/srtp/srtp.c b/srtp/srtp.c index 84dbd24b9..81782135e 100644 --- a/srtp/srtp.c +++ b/srtp/srtp.c @@ -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 @@ -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); @@ -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 @@ -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); @@ -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; } @@ -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; } diff --git a/test/rtp_decoder.c b/test/rtp_decoder.c index 869512dcf..f9ab24d24 100644 --- a/test/rtp_decoder.c +++ b/test/rtp_decoder.c @@ -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",