From e6bfa6d933a38e5a1404b7bc321563fb2aea062e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 12 Feb 2023 11:15:23 +0200 Subject: [PATCH] srtp-utils: Reuse existing function to get expected key length This avoids unnecessary and potentially error-prone duplication. --- plugins/provider/sip/calls-srtp-utils.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugins/provider/sip/calls-srtp-utils.c b/plugins/provider/sip/calls-srtp-utils.c index b2ff3c2..842c6b9 100644 --- a/plugins/provider/sip/calls-srtp-utils.c +++ b/plugins/provider/sip/calls-srtp-utils.c @@ -89,14 +89,8 @@ validate_crypto_attribute (calls_srtp_crypto_attribute *attr, return FALSE; } - switch (attr->crypto_suite) { - case CALLS_SRTP_SUITE_AES_128_SHA1_32: - case CALLS_SRTP_SUITE_AES_128_SHA1_80: - expected_key_salt_length = 30; /* 16 byte key + 14 byte salt */ - break; - - case CALLS_SRTP_SUITE_UNKNOWN: - default: + expected_key_salt_length = get_key_size_for_suite (attr->crypto_suite); + if (expected_key_salt_length == 0) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Crypto suite unknown"); return FALSE;