libsrtp icon indicating copy to clipboard operation
libsrtp copied to clipboard

testsuite violates 32-bit-alignment assumption -

Open fluffy opened this issue 13 years ago • 1 comments

http://sourceforge.net/tracker/?func=detail&aid=1912057&group_id=38894&atid=423799

The testsuite fails on architectures where 32-bit accesses must be 32-bit aligned because test/srtp_driver.c hands unaligned data to srtp_protect() and srtp_unprotect(). This makes the testsuite fail on arm.

There are #ifdef ALIGNMENT_32BIT_REQUIRED macros for word access in crypto/include/integers.h, but these are never used anywhere. Instead the srtp_*protect() routines say they require 32bit-aligned data in the commentary.

As a quick fix for the Debian arm variants, I've made the minimal change (patch attached), simply aligning the test character arrays used in the test program, which solves the problem.

A more robust solution would be to lift the alignment requirement by using the GET_32 and PUT_32 macros and enabling ALIGNMENT_32BIT_REQUIRED in the header #ifdef arm - that way other people's unaligned code using these functions that seems to work for them would not break mysteriously on arm.

fluffy avatar Mar 28 '13 23:03 fluffy

I'm not seeing any alignment issues with the latest on master. See the srtp_driver output below, which is from an Android ARM device. I used the Android NDK to build libsrtp, which is using gcc 4.8. Since this issue has been open for a long time, I'll close the issue for now. Please re-open the issue if a recreate procedure can be provided.

[foleyj@firedragon libsrtp]$ arm-linux-androideabi-gcc --version arm-linux-androideabi-gcc (GCC) 4.8 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

shell@grouper:/data/local/tmp $ ./srtp_driver
usage: ./srtp_driver [ -t ][ -c ][ -v ][-d <debug_module> ]* [ -l ] -t run timing test -r run rejection timing test -c run codec timing test -v run validation tests -d turn on debugging module -l list debugging modules 1|shell@grouper:/data/local/tmp $ ./srtp_driver -v
testing srtp_protect and srtp_unprotect

SSRC: any outbound

rtp cipher: null cipher

rtp auth: hmac sha-1 authentication function

rtp services: authentication

rtcp cipher: null cipher

rtcp auth: hmac sha-1 authentication function

rtcp services: authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect with encrypted extensions headers

SSRC: any outbound

rtp cipher: null cipher

rtp auth: hmac sha-1 authentication function

rtp services: authentication

rtcp cipher: null cipher

rtcp auth: hmac sha-1 authentication function

rtcp services: authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: 1

testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect_rtcp and srtp_unprotect_rtcp

SSRC: any outbound

rtp cipher: null cipher

rtp auth: hmac sha-1 authentication function

rtp services: authentication

rtcp cipher: null cipher

rtcp auth: hmac sha-1 authentication function

rtcp services: authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: null authentication function

rtp services: confidentiality

rtcp cipher: aes integer counter mode

rtcp auth: null authentication function

rtcp services: confidentiality

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing that ciphertext is distinct from plaintext...passed passed

testing srtp_protect and srtp_unprotect with encrypted extensions headers

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: null authentication function

rtp services: confidentiality

rtcp cipher: aes integer counter mode

rtcp auth: null authentication function

rtcp services: confidentiality

window size: 128

tx rtx allowed:false

Encrypted extension headers: 1

testing that ciphertext is distinct from plaintext...passed passed

testing srtp_protect_rtcp and srtp_unprotect_rtcp

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: null authentication function

rtp services: confidentiality

rtcp cipher: aes integer counter mode

rtcp auth: null authentication function

rtcp services: confidentiality

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing that ciphertext is distinct from plaintext...passed passed

testing srtp_protect and srtp_unprotect

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing that ciphertext is distinct from plaintext...passed testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect with encrypted extensions headers

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: 1

testing that ciphertext is distinct from plaintext...passed testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect_rtcp and srtp_unprotect_rtcp

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing that ciphertext is distinct from plaintext...passed testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect

SSRC: any outbound

rtp cipher: null cipher

rtp auth: null authentication function

rtp services: none

rtcp cipher: null cipher

rtcp auth: null authentication function

rtcp services: none

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

passed

testing srtp_protect and srtp_unprotect with encrypted extensions headers

SSRC: any outbound

rtp cipher: null cipher

rtp auth: null authentication function

rtp services: none

rtcp cipher: null cipher

rtcp auth: null authentication function

rtcp services: none

window size: 128

tx rtx allowed:false

Encrypted extension headers: 1

passed

testing srtp_protect_rtcp and srtp_unprotect_rtcp

SSRC: any outbound

rtp cipher: null cipher

rtp auth: null authentication function

rtp services: none

rtcp cipher: null cipher

rtcp auth: null authentication function

rtcp services: none

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

passed

testing srtp_protect and srtp_unprotect

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing that ciphertext is distinct from plaintext...passed testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect with encrypted extensions headers

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: 1

testing that ciphertext is distinct from plaintext...passed testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect_rtcp and srtp_unprotect_rtcp

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing that ciphertext is distinct from plaintext...passed testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect

SSRC: any outbound

rtp cipher: null cipher

rtp auth: hmac sha-1 authentication function

rtp services: authentication

rtcp cipher: null cipher

rtcp auth: hmac sha-1 authentication function

rtcp services: authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect with encrypted extensions headers

SSRC: any outbound

rtp cipher: null cipher

rtp auth: hmac sha-1 authentication function

rtp services: authentication

rtcp cipher: null cipher

rtcp auth: hmac sha-1 authentication function

rtcp services: authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: 1

testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect_rtcp and srtp_unprotect_rtcp

SSRC: any outbound

rtp cipher: null cipher

rtp auth: hmac sha-1 authentication function

rtp services: authentication

rtcp cipher: null cipher

rtcp auth: hmac sha-1 authentication function

rtcp services: authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect with big policy

SSRC: 0x00000000

rtp cipher: null cipher

rtp auth: hmac sha-1 authentication function

rtp services: authentication

rtcp cipher: null cipher

rtcp auth: hmac sha-1 authentication function

rtcp services: authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

SSRC: 0x01000000

rtp cipher: aes integer counter mode

rtp auth: null authentication function

rtp services: confidentiality

rtcp cipher: aes integer counter mode

rtcp auth: null authentication function

rtcp services: confidentiality

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

SSRC: 0x02000000

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

SSRC: 0x03000000

rtp cipher: null cipher

rtp auth: null authentication function

rtp services: none

rtcp cipher: null cipher

rtcp auth: null authentication function

rtcp services: none

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

SSRC: 0x04000000

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

SSRC: 0x05000000

rtp cipher: null cipher

rtp auth: hmac sha-1 authentication function

rtp services: authentication

rtcp cipher: null cipher

rtcp auth: hmac sha-1 authentication function

rtcp services: authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect with big policy and encrypted extensions headers

SSRC: 0x00000000

rtp cipher: null cipher

rtp auth: hmac sha-1 authentication function

rtp services: authentication

rtcp cipher: null cipher

rtcp auth: hmac sha-1 authentication function

rtcp services: authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

SSRC: 0x01000000

rtp cipher: aes integer counter mode

rtp auth: null authentication function

rtp services: confidentiality

rtcp cipher: aes integer counter mode

rtcp auth: null authentication function

rtcp services: confidentiality

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

SSRC: 0x02000000

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

SSRC: 0x03000000

rtp cipher: null cipher

rtp auth: null authentication function

rtp services: none

rtcp cipher: null cipher

rtcp auth: null authentication function

rtcp services: none

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

SSRC: 0x04000000

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

SSRC: 0x05000000

rtp cipher: null cipher

rtp auth: hmac sha-1 authentication function

rtp services: authentication

rtcp cipher: null cipher

rtcp auth: hmac sha-1 authentication function

rtcp services: authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: 1

testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect on wildcard ssrc policy

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: none

testing that ciphertext is distinct from plaintext...passed testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect on wildcard ssrc policy and encrypted extensions headers

SSRC: any outbound

rtp cipher: aes integer counter mode

rtp auth: hmac sha-1 authentication function

rtp services: confidentiality and authentication

rtcp cipher: aes integer counter mode

rtcp auth: hmac sha-1 authentication function

rtcp services: confidentiality and authentication

window size: 128

tx rtx allowed:false

Encrypted extension headers: 1

testing that ciphertext is distinct from plaintext...passed testing for false positives in replay check...passed testing for false positives in auth check...passed passed

testing srtp_protect and srtp_unprotect against reference packets passed

testing srtp_protect and srtp_unprotect against reference packets with encrypted extensions headers passed

testing srtp_protect and srtp_unprotect against reference packets (AES-256) passed

testing srtp_protect and srtp_unprotect against packets with empty payload passed testing srtp_remove_stream()...passed testing srtp_update()...passed

jfigus avatar Dec 15 '15 15:12 jfigus