aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan 't Hart <johan.thart@peterconnects.com>2019-06-13 10:55:13 +0200
committerJohan 't Hart <johan.thart@peterconnects.com>2019-06-13 15:24:43 +0200
commitc4bd93de6c69c0f6d130b4ad0f0cff9fcef6b0d0 (patch)
tree77840d603f554535b0c2bc46f27dd704a4af2aa4
parent23a3ce1b5b0391368df110610398f5489652652d (diff)
downloadlibsrtp2-c4bd93de6c69c0f6d130b4ad0f0cff9fcef6b0d0.tar.gz
Make compilable in C89
So it also compiles in Visual Studio 2012 which uses C89.
-rw-r--r--crypto/kernel/err.c2
-rw-r--r--srtp/srtp.c14
2 files changed, 9 insertions, 7 deletions
diff --git a/crypto/kernel/err.c b/crypto/kernel/err.c
index f443549..9db5bfb 100644
--- a/crypto/kernel/err.c
+++ b/crypto/kernel/err.c
@@ -80,6 +80,7 @@ srtp_err_status_t srtp_install_err_report_handler(
void srtp_err_report(srtp_err_reporting_level_t level, const char *format, ...)
{
+ char msg[512];
va_list args;
if (srtp_err_file != NULL) {
va_start(args, format);
@@ -88,7 +89,6 @@ void srtp_err_report(srtp_err_reporting_level_t level, const char *format, ...)
}
if (srtp_err_report_handler != NULL) {
va_start(args, format);
- char msg[512];
if (vsnprintf(msg, sizeof(msg), format, args) > 0) {
/* strip trailing \n, callback should not have one */
size_t l = strlen(msg);
diff --git a/srtp/srtp.c b/srtp/srtp.c
index 5d9da7b..47ca6b1 100644
--- a/srtp/srtp.c
+++ b/srtp/srtp.c
@@ -82,13 +82,14 @@ srtp_debug_module_t mod_srtp = {
static srtp_err_status_t srtp_validate_rtp_header(void *rtp_hdr,
int *pkt_octet_len)
{
+ srtp_hdr_t *hdr = (srtp_hdr_t *)rtp_hdr;
+ int rtp_header_len;
+
if (*pkt_octet_len < octets_in_rtp_header)
return srtp_err_status_bad_param;
- srtp_hdr_t *hdr = (srtp_hdr_t *)rtp_hdr;
-
/* Check RTP header length */
- int rtp_header_len = octets_in_rtp_header + 4 * hdr->cc;
+ rtp_header_len = octets_in_rtp_header + 4 * hdr->cc;
if (hdr->x == 1)
rtp_header_len += octets_in_rtp_extn_hdr;
@@ -678,6 +679,8 @@ static srtp_err_status_t srtp_kdf_init(srtp_kdf_t *kdf,
int key_len)
{
srtp_cipher_type_id_t cipher_id;
+ srtp_err_status_t stat;
+
switch (key_len) {
case SRTP_AES_ICM_256_KEY_LEN_WSALT:
cipher_id = SRTP_AES_ICM_256;
@@ -693,7 +696,6 @@ static srtp_err_status_t srtp_kdf_init(srtp_kdf_t *kdf,
break;
}
- srtp_err_status_t stat;
stat = srtp_crypto_kernel_alloc_cipher(cipher_id, &kdf->cipher, key_len, 0);
if (stat)
return stat;
@@ -4551,10 +4553,10 @@ srtp_err_status_t stream_get_protect_trailer_length(srtp_stream_ctx_t *stream,
uint32_t mki_index,
uint32_t *length)
{
- *length = 0;
-
srtp_session_keys_t *session_key;
+ *length = 0;
+
if (use_mki) {
if (mki_index >= stream->num_master_keys) {
return srtp_err_status_bad_mki;