blob: 02dc1f8eb59d574effe86106bf3b3f8472c9c8bb [file] [log] [blame]
Cullen Jennings235513a2005-09-21 22:51:36 +00001Secure RTP (SRTP) and UST Reference Implementations
2David A. McGrew
3Cisco Systems, Inc.
4mcgrew@cisco.com
5
6
7This package provides an implementation of the Secure Real-time
8Transport Protocol (SRTP), the Universal Security Transform (UST), and
9a supporting cryptographic kernel. These mechanisms are documented in
10the Internet Drafts in the doc/ subdirectory. The SRTP API is
11documented in include/srtp.h, and the library is in libsrtp.a (after
12compilation).
13
14
15Installation:
16
17./configure [ options ] # GNU autoconf script
18make # or gmake if needed; use GNU make
19
20The 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
29By default, debbuging is enabled and stdout is used for debugging.
30You can use the above configure options to have the debugging output
31sent to syslog or the system console. Alternatively, you can define
32ERR_REPORTING_FILE in include/conf.h to be any other file that can be
33opened by libSRTP, and debug messages will be sent to it.
34
35This package has been tested on Mac OS X (powerpc-apple-darwin1.4),
36Cygwin (i686-pc-cygwin), and Sparc (sparc-sun-solaris2.6). Previous
37versions have been tested on Linux and OpenBSD on both x86 and sparc
38platforms.
39
40A quick tour of this package:
41
42Makefile targets: all, clean, ...
43README this file
44CHANGES change log
45VERSION version number of this package
46LICENSE legal details (it's a BSD-like license)
47crypto/ciphers/ ciphers (null, aes_icm, ...)
48crypto/math/ crypto math routines
49crypto/hash/ crypto hashing (hmac, tmmhv2, ...)
50crypto/replay/ replay protection
51doc/ documentation: rfcs, apis, and suchlike
52include/ include files for all code in distribution
53srtp/ secure real-time transport protocol implementation
54tables/ apps for generating tables (useful in porting)
55test/ test drivers
56
57
58Applications
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
78usage: rtpw [-d <debug>]* [-k <key> [-a][-e]] [-s | -r] dest_ip dest_port
79or 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
107In order to get random 30-byte values for use as key/salt pairs , you
108can use the following bash function to format the output of
109/dev/random (where that device is available).
110
111function 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
116An example of an SRTP session using two rtpw programs follows:
117
118set k=c1eec3717da76195bb878578790af71c4ee9f859e197a414a78d5abc7451
119
120[sh1]$ test/rtpw -s -k $k -ea 0.0.0.0 9999
121Security services: confidentiality message authentication
122set master key/salt to C1EEC3717DA76195BB878578790AF71C/4EE9F859E197A414A78D5ABC7451
123setting SSRC to 2078917053
124sending word: A
125sending word: a
126sending word: aa
127sending word: aal
128...
129
130[sh2]$ test/rtpw -r -k $k -ea 0.0.0.0 9999
131security services: confidentiality message authentication
132set master key/salt to C1EEC3717DA76195BB878578790AF71C/4EE9F859E197A414A78D5ABC7451
13319 octets received from SSRC 2078917053 word: A
13419 octets received from SSRC 2078917053 word: a
13520 octets received from SSRC 2078917053 word: aa
13621 octets received from SSRC 2078917053 word: aal
137...
138
139Implementation 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 Jenningsd778c792005-10-02 12:04:37 +0000171
172