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