Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libsrtp2 for openSUSE:Factory checked in at 2026-11-23 12:19:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libsrtp2 (Old) and /work/SRC/openSUSE:Factory/.libsrtp2.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libsrtp2" Mon Nov 23 12:19:27 2026 rev:16 rq:1399454 version:2.8.2 Changes: -------- --- /work/SRC/openSUSE:Factory/libsrtp2/libsrtp2.changes 2026-09-23 14:35:41.156170564 +0200 +++ /work/SRC/openSUSE:Factory/.libsrtp2.new.1340718/libsrtp2.changes 2026-11-23 12:19:38.592221350 +0100 @@ -1,0 +2,7 @@ +Fri Nov 20 15:27:29 UTC 2026 - Jan Engelhardt <[email protected]> + +- Update to release 2.8.2 + * Check tag and MKI length before RTP unprotect bounds + * Add missing public cryptex functions to def file + +------------------------------------------------------------------- Old: ---- v2.8.1.tar.gz New: ---- v2.8.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libsrtp2.spec ++++++ --- /var/tmp/diff_new_pack.6xtfme/_old 2026-11-23 12:19:39.859274611 +0100 +++ /var/tmp/diff_new_pack.6xtfme/_new 2026-11-23 12:19:39.860274653 +0100 @@ -18,7 +18,7 @@ Name: libsrtp2 %define lname libsrtp2-1 -Version: 2.8.1 +Version: 2.8.2 Release: 0 Summary: Secure Real-Time Transport Protocol (SRTP) library v2 License: BSD-3-Clause ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.6xtfme/_old 2026-11-23 12:19:39.894276083 +0100 +++ /var/tmp/diff_new_pack.6xtfme/_new 2026-11-23 12:19:39.897276209 +0100 @@ -1,5 +1,5 @@ -mtime: 1789983033 -commit: 4cc0fc3f9f861119cd5428468b3d42dc318f3258745c38a7322d9fab5e091acc +mtime: 1795188474 +commit: 1e1372e6f0899340b8c3e16a9f6aedc68a4f6ec7728bae9bf5990fe85cfeb80a url: https://src.opensuse.org/jengelh/libsrtp2 revision: master ++++++ build.specials.obscpio ++++++ ++++++ build.specials.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 2026-11-20 16:27:54.000000000 +0100 @@ -0,0 +1 @@ +.osc ++++++ v2.8.1.tar.gz -> v2.8.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/.github/workflows/android.yml new/libsrtp-2.8.2/.github/workflows/android.yml --- old/libsrtp-2.8.1/.github/workflows/android.yml 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/.github/workflows/android.yml 2026-11-17 11:34:49.000000000 +0100 @@ -2,16 +2,16 @@ on: push: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] pull_request: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] jobs: build: strategy: fail-fast: false - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/.github/workflows/autotools.yml new/libsrtp-2.8.2/.github/workflows/autotools.yml --- old/libsrtp-2.8.1/.github/workflows/autotools.yml 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/.github/workflows/autotools.yml 2026-11-17 11:34:49.000000000 +0100 @@ -2,16 +2,16 @@ on: push: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] pull_request: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] jobs: build: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-24.04, macos-latest] crypto: [internal, openssl, nss] include: - crypto: internal @@ -25,13 +25,13 @@ steps: - name: Setup Ubuntu - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-24.04' run: | sudo apt-get update sudo apt-get install valgrind - name: Setup Ubuntu NSS - if: matrix.os == 'ubuntu-latest' && matrix.crypto == 'nss' + if: matrix.os == 'ubuntu-24.04' && matrix.crypto == 'nss' run: sudo apt-get install libnss3-dev - name: Setup macOS OpenSSL @@ -54,5 +54,5 @@ run: make runtest - name: Test Valgrind - if: matrix.os == 'ubuntu-latest' && matrix.crypto != 'nss' + if: matrix.os == 'ubuntu-24.04' && matrix.crypto != 'nss' run: make runtest-valgrind diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/.github/workflows/cifuzz.yml new/libsrtp-2.8.2/.github/workflows/cifuzz.yml --- old/libsrtp-2.8.1/.github/workflows/cifuzz.yml 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/.github/workflows/cifuzz.yml 2026-11-17 11:34:49.000000000 +0100 @@ -2,13 +2,13 @@ on: push: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] pull_request: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] jobs: Fuzzing: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Build Fuzzers id: build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/.github/workflows/cmake.yml new/libsrtp-2.8.2/.github/workflows/cmake.yml --- old/libsrtp-2.8.1/.github/workflows/cmake.yml 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/.github/workflows/cmake.yml 2026-11-17 11:34:49.000000000 +0100 @@ -2,9 +2,9 @@ on: push: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] pull_request: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] schedule: - cron: '20 4 * * 1' @@ -13,7 +13,7 @@ strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-24.04, macos-latest, windows-latest] crypto: [internal, openssl, openssl3, nss, mbedtls] exclude: - os: windows-latest @@ -24,7 +24,7 @@ crypto: nss - os: windows-latest crypto: mbedtls - - os: ubuntu-latest + - os: ubuntu-24.04 crypto: openssl3 include: - crypto: internal @@ -45,13 +45,13 @@ steps: - name: Setup Ubuntu NSS - if: matrix.os == 'ubuntu-latest' && matrix.crypto == 'nss' + if: matrix.os == 'ubuntu-24.04' && matrix.crypto == 'nss' run: | sudo apt-get update sudo apt-get install libnss3-dev - name: Setup Ubuntu MbedTLS - if: matrix.os == 'ubuntu-latest' && matrix.crypto == 'mbedtls' + if: matrix.os == 'ubuntu-24.04' && matrix.crypto == 'mbedtls' run: sudo apt-get install libmbedtls-dev - name: Setup macOS OpenSSL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/.github/workflows/coverity_scan.yml new/libsrtp-2.8.2/.github/workflows/coverity_scan.yml --- old/libsrtp-2.8.1/.github/workflows/coverity_scan.yml 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/.github/workflows/coverity_scan.yml 2026-11-17 11:34:49.000000000 +0100 @@ -6,7 +6,7 @@ jobs: coverity: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/.github/workflows/cygwin.yml new/libsrtp-2.8.2/.github/workflows/cygwin.yml --- old/libsrtp-2.8.1/.github/workflows/cygwin.yml 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/.github/workflows/cygwin.yml 2026-11-17 11:34:49.000000000 +0100 @@ -2,9 +2,9 @@ on: push: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] pull_request: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] jobs: build: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/.github/workflows/format_check.yml new/libsrtp-2.8.2/.github/workflows/format_check.yml --- old/libsrtp-2.8.1/.github/workflows/format_check.yml 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/.github/workflows/format_check.yml 2026-11-17 11:34:49.000000000 +0100 @@ -2,13 +2,13 @@ on: push: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] pull_request: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] jobs: format-check: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 - name: Install Clang Format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/.github/workflows/fuzzer_build.yml new/libsrtp-2.8.2/.github/workflows/fuzzer_build.yml --- old/libsrtp-2.8.1/.github/workflows/fuzzer_build.yml 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/.github/workflows/fuzzer_build.yml 2026-11-17 11:34:49.000000000 +0100 @@ -3,14 +3,14 @@ on: push: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] pull_request: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] workflow_dispatch: jobs: fuzz: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/.github/workflows/meson.yml new/libsrtp-2.8.2/.github/workflows/meson.yml --- old/libsrtp-2.8.1/.github/workflows/meson.yml 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/.github/workflows/meson.yml 2026-11-17 11:34:49.000000000 +0100 @@ -2,9 +2,9 @@ on: push: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] pull_request: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] schedule: - cron: '20 4 * * 1' @@ -13,7 +13,7 @@ strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-24.04, macos-latest, windows-latest] crypto: [internal, openssl, openssl3, nss, mbedtls] exclude: - os: windows-latest @@ -24,7 +24,7 @@ crypto: nss - os: windows-latest crypto: mbedtls - - os: ubuntu-latest + - os: ubuntu-24.04 crypto: openssl3 include: - crypto: internal @@ -45,7 +45,7 @@ steps: - name: Setup Ubuntu Meson - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-24.04' run: | sudo apt-get update sudo apt-get install meson @@ -62,13 +62,13 @@ pip3 install meson - name: Setup Ubuntu NSS - if: matrix.os == 'ubuntu-latest' && matrix.crypto == 'nss' + if: matrix.os == 'ubuntu-24.04' && matrix.crypto == 'nss' run: | sudo apt-get update sudo apt-get install libnss3-dev - name: Setup Ubuntu MbedTLS - if: matrix.os == 'ubuntu-latest' && matrix.crypto == 'mbedtls' + if: matrix.os == 'ubuntu-24.04' && matrix.crypto == 'mbedtls' run: sudo apt-get install libmbedtls-dev - name: Setup macOS OpenSSL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/.github/workflows/stream_list.yml new/libsrtp-2.8.2/.github/workflows/stream_list.yml --- old/libsrtp-2.8.1/.github/workflows/stream_list.yml 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/.github/workflows/stream_list.yml 2026-11-17 11:34:49.000000000 +0100 @@ -2,16 +2,16 @@ on: push: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] pull_request: - branches: [ 2_x_dev ] + branches: [ 2_x_dev, '2_*_x_throttle' ] jobs: build: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-24.04, macos-latest, windows-latest] runs-on: ${{ matrix.os }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/CHANGES new/libsrtp-2.8.2/CHANGES --- old/libsrtp-2.8.1/CHANGES 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/CHANGES 2026-11-17 11:34:49.000000000 +0100 @@ -1,5 +1,11 @@ Changelog +2.8.2 + +#845 - Check tag and MKI length before RTP unprotect bounds (backport of #827) + +#829 - Add missing public cryptex functions to def file + 2.8.1 #811 - cryptex and enc xtn hdr is not a valid combination diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/CMakeLists.txt new/libsrtp-2.8.2/CMakeLists.txt --- old/libsrtp-2.8.1/CMakeLists.txt 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/CMakeLists.txt 2026-11-17 11:34:49.000000000 +0100 @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.21) -project(libsrtp2 VERSION 2.8.1 LANGUAGES C) +project(libsrtp2 VERSION 2.8.2 LANGUAGES C) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/configure new/libsrtp-2.8.2/configure --- old/libsrtp-2.8.1/configure 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/configure 2026-11-17 11:34:49.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64 for libsrtp2 2.8.1. +# Generated by GNU Autoconf 2.64 for libsrtp2 2.8.2. # # Report bugs to <https://github.com/cisco/libsrtp/issues>. # @@ -549,8 +549,8 @@ # Identity of this package. PACKAGE_NAME='libsrtp2' PACKAGE_TARNAME='libsrtp2' -PACKAGE_VERSION='2.8.1' -PACKAGE_STRING='libsrtp2 2.8.1' +PACKAGE_VERSION='2.8.2' +PACKAGE_STRING='libsrtp2 2.8.2' PACKAGE_BUGREPORT='https://github.com/cisco/libsrtp/issues' PACKAGE_URL='' @@ -1247,7 +1247,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libsrtp2 2.8.1 to adapt to many kinds of systems. +\`configure' configures libsrtp2 2.8.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1312,7 +1312,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libsrtp2 2.8.1:";; + short | recursive ) echo "Configuration of libsrtp2 2.8.2:";; esac cat <<\_ACEOF @@ -1425,7 +1425,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libsrtp2 configure 2.8.1 +libsrtp2 configure 2.8.2 generated by GNU Autoconf 2.64 Copyright (C) 2009 Free Software Foundation, Inc. @@ -1973,7 +1973,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libsrtp2 $as_me 2.8.1, which was +It was created by libsrtp2 $as_me 2.8.2, which was generated by GNU Autoconf 2.64. Invocation command line was $ $0 $@ @@ -6926,7 +6926,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libsrtp2 $as_me 2.8.1, which was +This file was extended by libsrtp2 $as_me 2.8.2, which was generated by GNU Autoconf 2.64. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6986,7 +6986,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -libsrtp2 config.status 2.8.1 +libsrtp2 config.status 2.8.2 configured by $0, generated by GNU Autoconf 2.64, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/configure.ac new/libsrtp-2.8.2/configure.ac --- old/libsrtp-2.8.1/configure.ac 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/configure.ac 2026-11-17 11:34:49.000000000 +0100 @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([libsrtp2],[2.8.1],[https://github.com/cisco/libsrtp/issues]) +AC_INIT([libsrtp2],[2.8.2],[https://github.com/cisco/libsrtp/issues]) dnl Must come before AC_PROG_CC EMPTY_CFLAGS="no" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/meson.build new/libsrtp-2.8.2/meson.build --- old/libsrtp-2.8.1/meson.build 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/meson.build 2026-11-17 11:34:49.000000000 +0100 @@ -1,4 +1,4 @@ -project('libsrtp2', 'c', version: '2.8.1', +project('libsrtp2', 'c', version: '2.8.2', meson_version: '>= 0.52.0', default_options: ['buildtype=debugoptimized']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/srtp/srtp.c new/libsrtp-2.8.2/srtp/srtp.c --- old/libsrtp-2.8.1/srtp/srtp.c 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/srtp/srtp.c 2026-11-17 11:34:49.000000000 +0100 @@ -2242,7 +2242,12 @@ return status; } - if (!(enc_start <= (uint8_t *)hdr + (*pkt_octet_len - tag_len - mki_size))) + /* + * the lengths are unsigned, so make sure the packet is large enough to + * hold the tag and the MKI before subtracting them from its length + */ + if ((unsigned int)tag_len + mki_size > *pkt_octet_len || + !(enc_start <= (uint8_t *)hdr + (*pkt_octet_len - tag_len - mki_size))) return srtp_err_status_parse_err; /* * We pass the tag down to the cipher when doing GCM mode @@ -2910,6 +2915,13 @@ #endif /* + * the lengths are unsigned, so make sure the packet is large enough to + * hold the tag and the MKI before subtracting them from its length + */ + if (tag_len + mki_size > (unsigned int)*pkt_octet_len) + return srtp_err_status_parse_err; + + /* * find starting point for decryption and length of data to be * decrypted - the encrypted portion starts after the rtp header * extension, if present; otherwise, it starts after the last csrc, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/srtp.def new/libsrtp-2.8.2/srtp.def --- old/libsrtp-2.8.1/srtp.def 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/srtp.def 2026-11-17 11:34:49.000000000 +0100 @@ -42,8 +42,10 @@ srtp_unprotect_rtcp srtp_unprotect_rtcp_mki srtp_set_stream_roc -srtp_set_user_data srtp_get_stream_roc +srtp_set_stream_use_cryptex +srtp_set_stream_require_cryptex +srtp_set_user_data srtp_get_user_data srtp_install_event_handler srtp_get_version_string diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsrtp-2.8.1/test/srtp_driver.c new/libsrtp-2.8.2/test/srtp_driver.c --- old/libsrtp-2.8.1/test/srtp_driver.c 2026-09-21 08:50:45.000000000 +0200 +++ new/libsrtp-2.8.2/test/srtp_driver.c 2026-11-17 11:34:49.000000000 +0100 @@ -91,8 +91,14 @@ srtp_err_status_t srtp_test_empty_payload(void); +srtp_err_status_t srtp_test_unprotect_short_packet_auth_only(void); + #ifdef GCM srtp_err_status_t srtp_test_empty_payload_gcm(void); + +srtp_err_status_t srtp_test_unprotect_short_packet_gcm_mki(void); + +srtp_err_status_t srtp_test_unprotect_short_packet_gcm_mki_sweep(void); #endif srtp_err_status_t srtp_test_remove_stream(void); @@ -587,6 +593,15 @@ printf("failed\n"); exit(1); } + + printf("testing srtp_unprotect on short packet with auth only\n"); + if (srtp_test_unprotect_short_packet_auth_only() == + srtp_err_status_ok) { + printf("passed\n"); + } else { + printf("failed\n"); + exit(1); + } #ifdef GCM printf("testing srtp_protect and srtp_unprotect against " "packet with empty payload (GCM)\n"); @@ -596,6 +611,24 @@ printf("failed\n"); exit(1); } + + printf("testing srtp_unprotect_mki on short packet with GCM and MKI\n"); + if (srtp_test_unprotect_short_packet_gcm_mki() == srtp_err_status_ok) { + printf("passed\n"); + } else { + printf("failed\n"); + exit(1); + } + + printf("testing srtp_unprotect_mki on all short packet lengths with " + "GCM and MKI\n"); + if (srtp_test_unprotect_short_packet_gcm_mki_sweep() == + srtp_err_status_ok) { + printf("passed\n"); + } else { + printf("failed\n"); + exit(1); + } #endif /* @@ -3861,6 +3894,49 @@ return srtp_err_status_ok; } +srtp_err_status_t srtp_test_unprotect_short_packet_auth_only(void) +{ + srtp_t srtp_recv; + srtp_err_status_t status; + int len; + srtp_policy_t policy; + srtp_hdr_t *mesg; + + memset(&policy, 0, sizeof(policy)); + srtp_crypto_policy_set_null_cipher_hmac_sha1_80(&policy.rtp); + srtp_crypto_policy_set_null_cipher_hmac_sha1_80(&policy.rtcp); + policy.rtp.auth_tag_len = 20; + policy.ssrc.type = ssrc_any_inbound; + policy.key = test_key; + policy.window_size = 128; + policy.allow_repeat_tx = 0; + policy.next = NULL; + + status = srtp_create(&srtp_recv, &policy); + if (status) { + return status; + } + + mesg = srtp_create_test_packet(0, 0xcafebabe, &len); + if (mesg == NULL) { + return srtp_err_status_fail; + } + + status = srtp_unprotect(srtp_recv, mesg, &len); + if (status != srtp_err_status_parse_err) { + return srtp_err_status_fail; + } + + status = srtp_dealloc(srtp_recv); + if (status) { + return status; + } + + free(mesg); + + return srtp_err_status_ok; +} + #ifdef GCM srtp_err_status_t srtp_test_empty_payload_gcm(void) { @@ -3936,6 +4012,171 @@ return srtp_err_status_ok; } + +srtp_err_status_t srtp_test_unprotect_short_packet_gcm_mki(void) +{ + srtp_t srtp_recv; + srtp_err_status_t status; + int len; + srtp_policy_t policy; + srtp_hdr_t *mesg; + + memset(&policy, 0, sizeof(policy)); + srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp); + srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtcp); + policy.ssrc.type = ssrc_any_inbound; + policy.key = NULL; + policy.keys = test_keys; + policy.num_master_keys = 2; + policy.window_size = 128; + policy.allow_repeat_tx = 0; + policy.next = NULL; + + status = srtp_create(&srtp_recv, &policy); + if (status) { + return status; + } + + mesg = srtp_create_test_packet(0, 0xcafebabe, &len); + if (mesg == NULL) { + return srtp_err_status_fail; + } + memcpy((uint8_t *)mesg + len - TEST_MKI_ID_SIZE, test_mki_id, + TEST_MKI_ID_SIZE); + + status = srtp_unprotect_mki(srtp_recv, mesg, &len, 1); + if (status != srtp_err_status_parse_err) { + return srtp_err_status_fail; + } + + status = srtp_dealloc(srtp_recv); + if (status) { + return status; + } + + free(mesg); + + return srtp_err_status_ok; +} + +/* + * Sweep over every packet length from the smallest valid RTP header up to + * one header plus tag plus MKI, for GCM with 16 and 8 octet tags, several MKI + * sizes, 0 to 2 CSRCs and with and without a header extension. Each packet + * is allocated with exactly the length given so an out of bounds read is + * detected by a sanitizer. A packet shorter than tag + MKI must be rejected, + * no packet may be accepted since none carries a valid tag. + */ +srtp_err_status_t srtp_test_unprotect_short_packet_gcm_mki_sweep(void) +{ + static const int tag_lens[] = { 16, 8 }; + static const unsigned int mki_sizes[] = { 2, 4, 8, 16 }; + uint8_t mki_id_1[SRTP_MAX_MKI_LEN]; + uint8_t mki_id_2[SRTP_MAX_MKI_LEN]; + size_t t, m; + int cc, x; + + /* + * an all zero MKI is used for the first key so a short packet whose MKI + * overlaps the header (for example the length field of a header extension) + * is still a well formed RTP packet + */ + memset(mki_id_1, 0x00, sizeof(mki_id_1)); + memset(mki_id_2, 0xff, sizeof(mki_id_2)); + + for (t = 0; t < sizeof(tag_lens) / sizeof(tag_lens[0]); t++) { + for (m = 0; m < sizeof(mki_sizes) / sizeof(mki_sizes[0]); m++) { + srtp_t srtp_recv; + srtp_policy_t policy; + srtp_master_key_t key_1; + srtp_master_key_t key_2; + srtp_master_key_t *keys[2]; + srtp_err_status_t status; + unsigned int mki_size = mki_sizes[m]; + + memset(&policy, 0, sizeof(policy)); + if (tag_lens[t] == 16) { + srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp); + srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtcp); + } else { + srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtp); + srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtcp); + } + + key_1.key = test_key; + key_1.mki_id = mki_id_1; + key_1.mki_size = mki_size; + key_2.key = test_key_2; + key_2.mki_id = mki_id_2; + key_2.mki_size = mki_size; + keys[0] = &key_1; + keys[1] = &key_2; + + policy.ssrc.type = ssrc_any_inbound; + policy.keys = keys; + policy.num_master_keys = 2; + policy.window_size = 128; + policy.allow_repeat_tx = 0; + policy.next = NULL; + + status = srtp_create(&srtp_recv, &policy); + if (status) { + return status; + } + + for (cc = 0; cc <= 2; cc++) { + for (x = 0; x <= 1; x++) { + int hdr_len = 12 + 4 * cc + (x ? 4 : 0); + int trailer_len = tag_lens[t] + (int)mki_size; + int len; + + for (len = hdr_len; len <= hdr_len + trailer_len; len++) { + uint8_t *pkt = (uint8_t *)calloc(1, len); + int pkt_len = len; + + if (pkt == NULL) { + return srtp_err_status_alloc_fail; + } + + pkt[0] = (uint8_t)(0x80 | (x ? 0x10 : 0) | cc); + pkt[1] = 0x0f; + pkt[2] = 0x12; + pkt[3] = 0x34; + if (x) { + /* extension header with no extension words */ + pkt[12 + 4 * cc] = 0xbe; + pkt[12 + 4 * cc + 1] = 0xde; + } + if (len >= (int)mki_size) { + memcpy(pkt + len - mki_size, mki_id_1, mki_size); + } + + status = + srtp_unprotect_mki(srtp_recv, pkt, &pkt_len, 1); + free(pkt); + + if (status == srtp_err_status_ok) { + return srtp_err_status_fail; + } + if (len < trailer_len && + status != srtp_err_status_parse_err && + status != srtp_err_status_bad_mki && + status != srtp_err_status_bad_param) { + return srtp_err_status_fail; + } + } + } + } + + status = srtp_dealloc(srtp_recv); + if (status) { + return status; + } + } + } + + return srtp_err_status_ok; +} #endif // GCM srtp_err_status_t srtp_test_remove_stream(void)
