Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1291)

Unified Diff: testing/libfuzzer/fuzzers/libsrtp_fuzzer.cc

Issue 2436913003: Upgrade libsrtp to version 2.0 (second attempt) (Closed)
Patch Set: Remove srtp_tests Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698