[asterisk-dev] [Code Review] IAX2 retransmit with encryption enabled fix

David Vossel dvossel at digium.com
Wed Mar 11 10:58:23 CDT 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/192/
-----------------------------------------------------------

(Updated 2009-03-11 10:58:23.542825)


Review request for Asterisk Developers and Russell Bryant.


Changes
-------

my previous patch did not take into account that the pvt struct's decryption key corresponds to the other sides encryption key.  A separate key corresponding to our encryption key must be held as well in order to decrypt and re-encrypt frames during update_packet().  Using the other sides decryption key for update_packet is very dangerous due to key rotation. 


Summary
-------

If an iax channel is encrypted, and a retransmit frame is sent, that packet's iseqno is updated while it is encrypted.  This causes the entire frame to be corrupted.  When the corrupted frame is sent, the other side decrypts it and sends a VNAK back because the decrypted frame doesn't make any sense.  When we get the VNAK, we look through the sent queue and send the same corrupted frame causing a loop.  

To fix this, encrypted frames requiring retransmission are decrypted, updated, then re-encrypted.  Since key-rotation may change the key held by the pvt struct, the keys used for encryption/decryption are held within the iax_frame to guarantee they remain correct.


This addresses bug 0014607.
    http://bugs.digium.com/view.php?id=0014607


Diffs (updated)
-----

  /trunk/channels/iax2-parser.h 180714 
  /trunk/channels/chan_iax2.c 180714 

Diff: http://reviewboard.digium.com/r/192/diff


Testing
-------


Thanks,

David




More information about the asterisk-dev mailing list