@@ -3,17 +3,19 @@ use criterion::{criterion_group, criterion_main, Criterion};
33use util:: Marshal ;
44use webrtc_srtp:: { context:: Context , protection_profile:: ProtectionProfile } ;
55
6+ const MASTER_KEY : & [ u8 ] = & [
7+ 96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
8+ ] ;
9+ const MASTER_SALT : & [ u8 ] = & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ;
610const RAW_RTCP : & [ u8 ] = & [
711 0x81 , 0xc8 , 0x00 , 0x0b , 0xca , 0xfe , 0xba , 0xbe , 0xab , 0xab , 0xab , 0xab , 0xab , 0xab , 0xab , 0xab ,
812 0xab , 0xab , 0xab , 0xab , 0xab , 0xab , 0xab , 0xab ,
913] ;
1014
1115fn benchmark_encrypt_rtp_aes_128_cm_hmac_sha1 ( c : & mut Criterion ) {
1216 let mut ctx = Context :: new (
13- & [
14- 96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
15- ] ,
16- & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
17+ MASTER_KEY ,
18+ MASTER_SALT ,
1719 ProtectionProfile :: Aes128CmHmacSha1_80 ,
1820 None ,
1921 None ,
@@ -55,21 +57,17 @@ fn benchmark_encrypt_rtp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
5557
5658fn benchmark_decrypt_rtp_aes_128_cm_hmac_sha1 ( c : & mut Criterion ) {
5759 let mut setup_ctx = Context :: new (
58- & [
59- 96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
60- ] ,
61- & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
60+ MASTER_KEY ,
61+ MASTER_SALT ,
6262 ProtectionProfile :: Aes128CmHmacSha1_80 ,
6363 None ,
6464 None ,
6565 )
6666 . unwrap ( ) ;
6767
6868 let mut ctx = Context :: new (
69- & [
70- 96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
71- ] ,
72- & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
69+ MASTER_KEY ,
70+ MASTER_SALT ,
7371 ProtectionProfile :: Aes128CmHmacSha1_80 ,
7472 None ,
7573 None ,
@@ -109,10 +107,8 @@ fn benchmark_decrypt_rtp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
109107
110108fn benchmark_encrypt_rtcp_aes_128_cm_hmac_sha1 ( c : & mut Criterion ) {
111109 let mut ctx = Context :: new (
112- & [
113- 96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
114- ] ,
115- & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
110+ MASTER_KEY ,
111+ MASTER_SALT ,
116112 ProtectionProfile :: Aes128CmHmacSha1_80 ,
117113 None ,
118114 None ,
@@ -128,10 +124,8 @@ fn benchmark_encrypt_rtcp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
128124
129125fn benchmark_decrypt_rtcp_aes_128_cm_hmac_sha1 ( c : & mut Criterion ) {
130126 let encrypted = Context :: new (
131- & [
132- 96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
133- ] ,
134- & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
127+ MASTER_KEY ,
128+ MASTER_SALT ,
135129 ProtectionProfile :: Aes128CmHmacSha1_80 ,
136130 None ,
137131 None ,
@@ -141,10 +135,8 @@ fn benchmark_decrypt_rtcp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
141135 . unwrap ( ) ;
142136
143137 let mut ctx = Context :: new (
144- & [
145- 96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
146- ] ,
147- & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
138+ MASTER_KEY ,
139+ MASTER_SALT ,
148140 ProtectionProfile :: Aes128CmHmacSha1_80 ,
149141 None ,
150142 None ,
0 commit comments