Skip to content

Commit

Permalink
Fix formatting check
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
  • Loading branch information
aggarg committed Jul 11, 2024
1 parent 8c264f2 commit 15c1101
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
36 changes: 17 additions & 19 deletions crypto/include/err.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,42 +126,40 @@ typedef struct {
#ifdef ENABLE_DEBUG_LOGGING

#ifndef debug_print0
#define debug_print0(mod, format) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name)
#define debug_print0(mod, format) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name)
#endif

#ifndef debug_print
#define debug_print(mod, format, arg) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, \
arg)
#define debug_print(mod, format, arg) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, arg)
#endif

#ifndef debug_print2
#define debug_print2(mod, format, arg1, arg2) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, \
arg1, arg2)
#define debug_print2(mod, format, arg1, arg2) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, \
arg1, arg2)
#endif

#else

#ifndef debug_print0
#define debug_print0(mod, format) \
if (mod.on) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name)
#define debug_print0(mod, format) \
if (mod.on) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name)
#endif

#ifndef debug_print
#define debug_print(mod, format, arg) \
if (mod.on) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, \
arg)
#define debug_print(mod, format, arg) \
if (mod.on) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, arg)
#endif

#ifndef debug_print2
#define debug_print2(mod, format, arg1, arg2) \
if (mod.on) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, \
arg1, arg2)
#define debug_print2(mod, format, arg1, arg2) \
if (mod.on) \
srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, \
arg1, arg2)
#endif

#endif
Expand Down
25 changes: 12 additions & 13 deletions srtp/srtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,8 @@ static srtp_err_status_t srtp_stream_clone(
srtp_session_keys_t *session_keys = NULL;
const srtp_session_keys_t *template_session_keys = NULL;

debug_print(mod_srtp,
"cloning stream (SSRC: 0x%08x)", (unsigned int) ntohl(ssrc));
debug_print(mod_srtp, "cloning stream (SSRC: 0x%08x)",
(unsigned int)ntohl(ssrc));

/* allocate srtp stream and set str_ptr */
str = (srtp_stream_ctx_t *)srtp_crypto_alloc(sizeof(srtp_stream_ctx_t));
Expand Down Expand Up @@ -1443,9 +1443,8 @@ static srtp_err_status_t srtp_stream_init(srtp_stream_ctx_t *srtp,
return err;
}

debug_print(mod_srtp,
"initializing stream (SSRC: 0x%08x)",
(unsigned int) p->ssrc.value);
debug_print(mod_srtp, "initializing stream (SSRC: 0x%08x)",
(unsigned int)p->ssrc.value);

/* initialize replay database */
/*
Expand Down Expand Up @@ -1511,15 +1510,15 @@ static srtp_err_status_t srtp_stream_init(srtp_stream_ctx_t *srtp,
void srtp_event_reporter(srtp_event_data_t *data)
{
srtp_err_report(srtp_err_level_warning,
"srtp: in stream 0x%x: ", (unsigned int) data->ssrc);
"srtp: in stream 0x%x: ", (unsigned int)data->ssrc);

switch (data->event) {
case event_ssrc_collision:
srtp_err_report(srtp_err_level_warning, "\tSSRC collision\n");
break;
case event_key_soft_limit:
srtp_err_report(srtp_err_level_warning,
"\tkey usage soft limit reached\n");
"\tkey usage soft limit reached\n");
break;
case event_key_hard_limit:
srtp_err_report(srtp_err_level_warning,
Expand Down Expand Up @@ -2551,7 +2550,7 @@ srtp_err_status_t srtp_unprotect(srtp_t ctx,
if (ctx->stream_template != NULL) {
stream = ctx->stream_template;
debug_print(mod_srtp, "using provisional stream (SSRC: 0x%08x)",
(unsigned int) ntohl(hdr->ssrc));
(unsigned int)ntohl(hdr->ssrc));

/*
* set estimated packet index to sequence number from header,
Expand Down Expand Up @@ -3670,7 +3669,7 @@ static srtp_err_status_t srtp_protect_rtcp_aead(
}
seq_num = srtp_rdb_get_value(&stream->rtcp_rdb);
trailer |= htonl(seq_num);
debug_print(mod_srtp, "srtcp index: %x", (unsigned int) seq_num);
debug_print(mod_srtp, "srtcp index: %x", (unsigned int)seq_num);

memcpy(trailer_p, &trailer, sizeof(trailer));

Expand Down Expand Up @@ -3817,7 +3816,7 @@ static srtp_err_status_t srtp_unprotect_rtcp_aead(
*/
/* this is easier than dealing with bitfield access */
seq_num = ntohl(trailer) & SRTCP_INDEX_MASK;
debug_print(mod_srtp, "srtcp index: %x", (unsigned int) seq_num);
debug_print(mod_srtp, "srtcp index: %x", (unsigned int)seq_num);
status = srtp_rdb_check(&stream->rtcp_rdb, seq_num);
if (status) {
return status;
Expand Down Expand Up @@ -4115,7 +4114,7 @@ srtp_err_status_t srtp_protect_rtcp(srtp_t ctx,
}
seq_num = srtp_rdb_get_value(&stream->rtcp_rdb);
trailer |= htonl(seq_num);
debug_print(mod_srtp, "srtcp index: %x", (unsigned int) seq_num);
debug_print(mod_srtp, "srtcp index: %x", (unsigned int)seq_num);

memcpy(trailer_p, &trailer, sizeof(trailer));

Expand Down Expand Up @@ -4258,7 +4257,7 @@ srtp_err_status_t srtp_unprotect_rtcp(srtp_t ctx,

debug_print(mod_srtp,
"srtcp using provisional stream (SSRC: 0x%08x)",
(unsigned int) ntohl(hdr->ssrc));
(unsigned int)ntohl(hdr->ssrc));
} else {
/* no template stream, so we return an error */
return srtp_err_status_no_ctx;
Expand Down Expand Up @@ -4338,7 +4337,7 @@ srtp_err_status_t srtp_unprotect_rtcp(srtp_t ctx,
*/
/* this is easier than dealing with bitfield access */
seq_num = ntohl(trailer) & SRTCP_INDEX_MASK;
debug_print(mod_srtp, "srtcp index: %x", (unsigned int) seq_num);
debug_print(mod_srtp, "srtcp index: %x", (unsigned int)seq_num);
status = srtp_rdb_check(&stream->rtcp_rdb, seq_num);
if (status) {
return status;
Expand Down

0 comments on commit 15c1101

Please sign in to comment.