1
- use bytes:: { Bytes , BytesMut } ;
1
+ use bytes:: BytesMut ;
2
2
use criterion:: { criterion_group, criterion_main, Criterion } ;
3
3
use util:: Marshal ;
4
4
use webrtc_srtp:: { context:: Context , protection_profile:: ProtectionProfile } ;
5
5
6
- const RAW_RTCP : Bytes = Bytes :: from_static ( & [
6
+ const RAW_RTCP : & [ u8 ] = & [
7
7
0x81 , 0xc8 , 0x00 , 0x0b , 0xca , 0xfe , 0xba , 0xbe , 0xab , 0xab , 0xab , 0xab , 0xab , 0xab , 0xab , 0xab ,
8
8
0xab , 0xab , 0xab , 0xab , 0xab , 0xab , 0xab , 0xab ,
9
- ] ) ;
9
+ ] ;
10
10
11
11
fn benchmark_encrypt_rtp_aes_128_cm_hmac_sha1 ( c : & mut Criterion ) {
12
12
let mut ctx = Context :: new (
13
- & vec ! [
13
+ & [
14
14
96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
15
15
] ,
16
- & vec ! [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
16
+ & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
17
17
ProtectionProfile :: Aes128CmHmacSha1_80 ,
18
18
None ,
19
19
None ,
@@ -55,21 +55,21 @@ fn benchmark_encrypt_rtp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
55
55
56
56
fn benchmark_decrypt_rtp_aes_128_cm_hmac_sha1 ( c : & mut Criterion ) {
57
57
let mut setup_ctx = Context :: new (
58
- & vec ! [
58
+ & [
59
59
96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
60
60
] ,
61
- & vec ! [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
61
+ & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
62
62
ProtectionProfile :: Aes128CmHmacSha1_80 ,
63
63
None ,
64
64
None ,
65
65
)
66
66
. unwrap ( ) ;
67
67
68
68
let mut ctx = Context :: new (
69
- & vec ! [
69
+ & [
70
70
96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
71
71
] ,
72
- & vec ! [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
72
+ & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
73
73
ProtectionProfile :: Aes128CmHmacSha1_80 ,
74
74
None ,
75
75
None ,
@@ -109,10 +109,10 @@ fn benchmark_decrypt_rtp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
109
109
110
110
fn benchmark_encrypt_rtcp_aes_128_cm_hmac_sha1 ( c : & mut Criterion ) {
111
111
let mut ctx = Context :: new (
112
- & vec ! [
112
+ & [
113
113
96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
114
114
] ,
115
- & vec ! [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
115
+ & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
116
116
ProtectionProfile :: Aes128CmHmacSha1_80 ,
117
117
None ,
118
118
None ,
@@ -121,30 +121,30 @@ fn benchmark_encrypt_rtcp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
121
121
122
122
c. bench_function ( "Benchmark RTCP encrypt" , |b| {
123
123
b. iter ( || {
124
- ctx. encrypt_rtcp ( & RAW_RTCP ) . unwrap ( ) ;
124
+ ctx. encrypt_rtcp ( RAW_RTCP ) . unwrap ( ) ;
125
125
} ) ;
126
126
} ) ;
127
127
}
128
128
129
129
fn benchmark_decrypt_rtcp_aes_128_cm_hmac_sha1 ( c : & mut Criterion ) {
130
130
let encrypted = Context :: new (
131
- & vec ! [
131
+ & [
132
132
96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
133
133
] ,
134
- & vec ! [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
134
+ & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
135
135
ProtectionProfile :: Aes128CmHmacSha1_80 ,
136
136
None ,
137
137
None ,
138
138
)
139
139
. unwrap ( )
140
- . encrypt_rtcp ( & RAW_RTCP )
140
+ . encrypt_rtcp ( RAW_RTCP )
141
141
. unwrap ( ) ;
142
142
143
143
let mut ctx = Context :: new (
144
- & vec ! [
144
+ & [
145
145
96 , 180 , 31 , 4 , 119 , 137 , 128 , 252 , 75 , 194 , 252 , 44 , 63 , 56 , 61 , 55 ,
146
146
] ,
147
- & vec ! [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
147
+ & [ 247 , 26 , 49 , 94 , 99 , 29 , 79 , 94 , 5 , 111 , 252 , 216 , 62 , 195 ] ,
148
148
ProtectionProfile :: Aes128CmHmacSha1_80 ,
149
149
None ,
150
150
None ,
0 commit comments