Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 1 | Secure RTP (SRTP) and UST Reference Implementations |
| 2 | David A. McGrew |
| 3 | Cisco Systems, Inc. |
| 4 | mcgrew@cisco.com |
| 5 | |
| 6 | |
| 7 | This package provides an implementation of the Secure Real-time |
| 8 | Transport Protocol (SRTP), the Universal Security Transform (UST), and |
| 9 | a supporting cryptographic kernel. These mechanisms are documented in |
| 10 | the Internet Drafts in the doc/ subdirectory. The SRTP API is |
| 11 | documented in include/srtp.h, and the library is in libsrtp.a (after |
| 12 | compilation). |
| 13 | |
| 14 | |
| 15 | Installation: |
| 16 | |
| 17 | ./configure [ options ] # GNU autoconf script |
| 18 | make # or gmake if needed; use GNU make |
| 19 | |
| 20 | The configure script accepts the following options: |
| 21 | |
| 22 | --help provides a usage summary |
| 23 | --disable-debug compile without the runtime debugging system |
| 24 | --enable-syslog use syslog for error reporting |
| 25 | --disable-stdout use stdout for error reporting |
| 26 | --enable-console use /dev/console for error reporting |
| 27 | --gdoi use GDOI key management (disabled at present) |
| 28 | |
| 29 | By default, debbuging is enabled and stdout is used for debugging. |
| 30 | You can use the above configure options to have the debugging output |
| 31 | sent to syslog or the system console. Alternatively, you can define |
| 32 | ERR_REPORTING_FILE in include/conf.h to be any other file that can be |
| 33 | opened by libSRTP, and debug messages will be sent to it. |
| 34 | |
| 35 | This package has been tested on Mac OS X (powerpc-apple-darwin1.4), |
| 36 | Cygwin (i686-pc-cygwin), and Sparc (sparc-sun-solaris2.6). Previous |
| 37 | versions have been tested on Linux and OpenBSD on both x86 and sparc |
| 38 | platforms. |
| 39 | |
| 40 | A quick tour of this package: |
| 41 | |
| 42 | Makefile targets: all, clean, ... |
| 43 | README this file |
| 44 | CHANGES change log |
| 45 | VERSION version number of this package |
| 46 | LICENSE legal details (it's a BSD-like license) |
| 47 | crypto/ciphers/ ciphers (null, aes_icm, ...) |
| 48 | crypto/math/ crypto math routines |
| 49 | crypto/hash/ crypto hashing (hmac, tmmhv2, ...) |
| 50 | crypto/replay/ replay protection |
| 51 | doc/ documentation: rfcs, apis, and suchlike |
| 52 | include/ include files for all code in distribution |
| 53 | srtp/ secure real-time transport protocol implementation |
| 54 | tables/ apps for generating tables (useful in porting) |
| 55 | test/ test drivers |
| 56 | |
| 57 | |
| 58 | Applications |
| 59 | |
| 60 | Several test drivers and a simple and portable srtp application |
| 61 | are included in the test/ subdirectory. |
| 62 | |
| 63 | test driver function tested |
| 64 | ------------------------------------------------------------- |
| 65 | kernel_driver crypto kernel (ciphers, auth funcs, rng) |
| 66 | srtp_driver srtp in-memory tests (does not use the network) |
| 67 | rdbx_driver rdbx (extended replay database) |
| 68 | roc_driver extended sequence number functions |
| 69 | replay_driver replay database (n.b. not used in libsrtp) |
| 70 | cipher_driver ciphers |
| 71 | auth_driver hash functions |
| 72 | |
| 73 | The app rtpw is a simple rtp application which reads words from |
| 74 | /usr/dict/words and then sends them out one at a time using [s]rtp. |
| 75 | Manual srtp keying uses the -k option; automated key management |
| 76 | using gdoi will be added later. |
| 77 | |
| 78 | usage: rtpw [-d <debug>]* [-k <key> [-a][-e]] [-s | -r] dest_ip dest_port |
| 79 | or rtpw -l |
| 80 | |
| 81 | Either the -s (sender) or -r (receiver) option must be chosen. |
| 82 | |
| 83 | The values dest_ip, dest_port are the ip address and udp port to |
| 84 | which the dictionary will be sent, respectively. |
| 85 | |
| 86 | options: |
| 87 | |
| 88 | -s (s)rtp sender - causes app to send words |
| 89 | |
| 90 | -r (s)rtp receive - causes app to receve words |
| 91 | |
| 92 | -k <key> use srtp master key <key>, where the |
| 93 | key is a hexadecimal value (without the |
| 94 | leading "0x") |
| 95 | |
| 96 | -e encrypt/decrypt (for data confidentiality) |
| 97 | (requires use of -k option as well) |
| 98 | |
| 99 | -a message authentication |
| 100 | (requires use of -k option as well) |
| 101 | |
| 102 | -l list debug modules |
| 103 | |
| 104 | -d <debug> turn on debugging for module <debug> |
| 105 | |
| 106 | |
| 107 | In order to get random 30-byte values for use as key/salt pairs , you |
| 108 | can use the following bash function to format the output of |
| 109 | /dev/random (where that device is available). |
| 110 | |
| 111 | function randhex() { |
| 112 | cat /dev/random | od --read-bytes=32 --width=32 -x | awk '{ print $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 }' |
| 113 | } |
| 114 | |
| 115 | |
| 116 | An example of an SRTP session using two rtpw programs follows: |
| 117 | |
| 118 | set k=c1eec3717da76195bb878578790af71c4ee9f859e197a414a78d5abc7451 |
| 119 | |
| 120 | [sh1]$ test/rtpw -s -k $k -ea 0.0.0.0 9999 |
| 121 | Security services: confidentiality message authentication |
| 122 | set master key/salt to C1EEC3717DA76195BB878578790AF71C/4EE9F859E197A414A78D5ABC7451 |
| 123 | setting SSRC to 2078917053 |
| 124 | sending word: A |
| 125 | sending word: a |
| 126 | sending word: aa |
| 127 | sending word: aal |
| 128 | ... |
| 129 | |
| 130 | [sh2]$ test/rtpw -r -k $k -ea 0.0.0.0 9999 |
| 131 | security services: confidentiality message authentication |
| 132 | set master key/salt to C1EEC3717DA76195BB878578790AF71C/4EE9F859E197A414A78D5ABC7451 |
| 133 | 19 octets received from SSRC 2078917053 word: A |
| 134 | 19 octets received from SSRC 2078917053 word: a |
| 135 | 20 octets received from SSRC 2078917053 word: aa |
| 136 | 21 octets received from SSRC 2078917053 word: aal |
| 137 | ... |
| 138 | |
| 139 | Implementation Notes |
| 140 | |
| 141 | * The srtp_protect() function assumes that the buffer holding the |
| 142 | rtp packet has enough storage allocated that the authentication |
| 143 | tag can be written to the end of that packet. If this assumption |
| 144 | is not valid, memory corruption will ensue. |
| 145 | |
| 146 | * Automated tests for the crypto functions are provided through |
| 147 | the cipher_type_self_test() and auth_type_self_test() functions. |
| 148 | These functions should be used to test each port of this code |
| 149 | to a new platform. |
| 150 | |
| 151 | * Replay protection is contained in the crypto engine, and |
| 152 | tests for it are provided. |
| 153 | |
| 154 | * This implementation provides calls to initialize, protect, and |
| 155 | unprotect RTP packets, and makes as few as possible assumptions |
| 156 | about how these functions will be called. For example, the |
| 157 | caller is not expected to provide packets in order (though if |
| 158 | they're called more than 65k out of sequence, synchronization |
| 159 | will be lost). |
| 160 | |
| 161 | * The sequence number in the rtp packet is used as the low 16 bits |
| 162 | of the sender's local packet index. Note that RTP will start its |
| 163 | sequence number in a random place, and the SRTP layer just jumps |
| 164 | forward to that number at its first invocation. An earlier |
| 165 | version of this library used initial sequence numbers that are |
| 166 | less than 32,768; this trick is no longer required as the |
| 167 | rdbx_estimate_index(...) function has been made smarter. |
| 168 | |
| 169 | * The replay window is 128 bits in length, and is hard-coded to this |
| 170 | value for now. |
Cullen Jennings | d778c79 | 2005-10-02 12:04:37 +0000 | [diff] [blame^] | 171 | |
| 172 | |