Index: testing/libfuzzer/fuzzers/libsrtp_fuzzer.cc |
diff --git a/testing/libfuzzer/fuzzers/libsrtp_fuzzer.cc b/testing/libfuzzer/fuzzers/libsrtp_fuzzer.cc |
index 963f7be8358f7bcac1c66b561b21297b9e422198..2d79e06f0baf39bffc9226ee7c2f827df3d5829a 100644 |
--- a/testing/libfuzzer/fuzzers/libsrtp_fuzzer.cc |
+++ b/testing/libfuzzer/fuzzers/libsrtp_fuzzer.cc |
@@ -3,15 +3,16 @@ |
// found in the LICENSE file. |
#include <assert.h> |
+#include <netinet/in.h> |
mmoroz
2016/10/21 09:40:41
Is it needed?
mattdr-at-chromium
2016/10/21 16:25:48
Hm. No, it doesn't seem like this is needed and I
|
#include <stddef.h> |
#include <stdint.h> |
#include <algorithm> |
#include <vector> |
-#include "third_party/libsrtp/srtp/include/rtp.h" |
-#include "third_party/libsrtp/srtp/include/rtp_priv.h" |
-#include "third_party/libsrtp/srtp/include/srtp.h" |
+#include "third_party/libsrtp/include/rtp.h" |
+#include "third_party/libsrtp/include/rtp_priv.h" |
+#include "third_party/libsrtp/include/srtp.h" |
// TODO(katrielc) Also test the authenticated path, which is what |
// WebRTC uses. This is nontrivial because you need to bypass the MAC |
@@ -35,21 +36,21 @@ struct Environment { |
switch (crypto_policy) { |
case LibSrtpFuzzer::NUMBER_OF_POLICIES: |
case LibSrtpFuzzer::NONE: |
- crypto_policy_set_null_cipher_null_auth(&policy.rtp); |
- crypto_policy_set_null_cipher_null_auth(&policy.rtcp); |
+ srtp_crypto_policy_set_null_cipher_null_auth(&policy.rtp); |
+ srtp_crypto_policy_set_null_cipher_null_auth(&policy.rtcp); |
break; |
case LibSrtpFuzzer::LIKE_WEBRTC: |
- crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp); |
- crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); |
+ srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp); |
+ srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); |
break; |
case LibSrtpFuzzer::LIKE_WEBRTC_WITHOUT_AUTH: |
- crypto_policy_set_aes_cm_128_null_auth(&policy.rtp); |
- crypto_policy_set_aes_cm_128_null_auth(&policy.rtcp); |
+ srtp_crypto_policy_set_aes_cm_128_null_auth(&policy.rtp); |
+ srtp_crypto_policy_set_aes_cm_128_null_auth(&policy.rtcp); |
break; |
case LibSrtpFuzzer::AES_GCM: |
// There was a security bug in the GCM mode in libsrtp 1.5.2. |
- crypto_policy_set_aes_gcm_128_8_auth(&policy.rtp); |
- crypto_policy_set_aes_gcm_128_8_auth(&policy.rtcp); |
+ srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtp); |
+ srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtcp); |
break; |
} |
@@ -74,10 +75,11 @@ struct Environment { |
srtp_policy_t policy; |
unsigned char key[SRTP_MASTER_KEY_LEN] = {0}; |
- static void crypto_policy_set_null_cipher_null_auth(crypto_policy_t* p) { |
- p->cipher_type = NULL_CIPHER; |
+ static void srtp_crypto_policy_set_null_cipher_null_auth( |
+ srtp_crypto_policy_t* p) { |
+ p->cipher_type = SRTP_NULL_CIPHER; |
p->cipher_key_len = 0; |
- p->auth_type = NULL_AUTH; |
+ p->auth_type = SRTP_NULL_AUTH; |
p->auth_key_len = 0; |
p->auth_tag_len = 0; |
p->sec_serv = sec_serv_none; |
@@ -110,8 +112,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
size -= SRTP_MASTER_KEY_LEN; |
srtp_t session; |
- err_status_t error = srtp_create(&session, &srtp_policy); |
- if (error != err_status_ok) { |
+ srtp_err_status_t error = srtp_create(&session, &srtp_policy); |
+ if (error != srtp_err_status_ok) { |
assert(false); |
return 0; |
} |