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

Unified Diff: test/rtpw.c

Issue 2344973002: Update libsrtp to version 2.0 (Closed)
Patch Set: Add '.' back to include_dirs 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 | « test/rtp.c ('k') | test/rtpw_test.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/rtpw.c
diff --git a/srtp/test/rtpw.c b/test/rtpw.c
similarity index 90%
rename from srtp/test/rtpw.c
rename to test/rtpw.c
index b4d27726ba10bfd9147742c9e2a70177f658b6b9..763bdeea77961755d30a1162934060f1089e8286 100644
--- a/srtp/test/rtpw.c
+++ b/test/rtpw.c
@@ -55,7 +55,6 @@
#include <config.h>
#endif
-#include "datatypes.h"
#include "getopt_s.h" /* for local getopt() */
#include <stdio.h> /* for printf, fprintf */
@@ -88,7 +87,7 @@
#include "srtp.h"
#include "rtp.h"
-#include "crypto_kernel.h"
+#include "util.h"
#ifdef RTPW_USE_WINSOCK2
# define DICT_FILE "words.txt"
@@ -157,7 +156,7 @@ main (int argc, char *argv[]) {
struct sockaddr_in local;
#endif
program_type prog_type = unknown;
- sec_serv_t sec_servs = sec_serv_none;
+ srtp_sec_serv_t sec_servs = sec_serv_none;
unsigned char ttl = 5;
int c;
int key_size = 128;
@@ -170,7 +169,7 @@ main (int argc, char *argv[]) {
unsigned short port = 0;
rtp_sender_t snd;
srtp_policy_t policy;
- err_status_t status;
+ srtp_err_status_t status;
int len;
int expected_len;
int do_list_mods = 0;
@@ -186,6 +185,8 @@ main (int argc, char *argv[]) {
}
#endif
+ memset(&policy, 0x0, sizeof(srtp_policy_t));
+
printf("Using %s [0x%x]\n", srtp_get_version_string(), srtp_get_version());
if (setup_signal_handler(argv[0]) != 0) {
@@ -241,7 +242,7 @@ main (int argc, char *argv[]) {
prog_type = sender;
break;
case 'd':
- status = crypto_kernel_set_debug_module(optarg_s, 1);
+ status = srtp_set_debug_module(optarg_s, 1);
if (status) {
printf("error: set debug module (%s) failed\n", optarg_s);
exit(1);
@@ -257,7 +258,7 @@ main (int argc, char *argv[]) {
if (prog_type == unknown) {
if (do_list_mods) {
- status = crypto_kernel_list_debug_modules();
+ status = srtp_list_debug_modules();
if (status) {
printf("error: list of debug modules failed\n");
exit(1);
@@ -356,7 +357,6 @@ main (int argc, char *argv[]) {
printf("\n");
/* set up the srtp policy and master key */
- memset(&policy, 0, sizeof(policy));
if (sec_servs) {
/*
* create policy structure, using the default mechanisms but
@@ -369,12 +369,12 @@ main (int argc, char *argv[]) {
#ifdef OPENSSL
switch (key_size) {
case 128:
- 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;
case 256:
- crypto_policy_set_aes_gcm_256_8_auth(&policy.rtp);
- crypto_policy_set_aes_gcm_256_8_auth(&policy.rtcp);
+ srtp_crypto_policy_set_aes_gcm_256_8_auth(&policy.rtp);
+ srtp_crypto_policy_set_aes_gcm_256_8_auth(&policy.rtcp);
break;
}
#else
@@ -384,12 +384,12 @@ main (int argc, char *argv[]) {
} else {
switch (key_size) {
case 128:
- crypto_policy_set_rtp_default(&policy.rtp);
- crypto_policy_set_rtcp_default(&policy.rtcp);
+ srtp_crypto_policy_set_rtp_default(&policy.rtp);
+ srtp_crypto_policy_set_rtcp_default(&policy.rtcp);
break;
case 256:
- crypto_policy_set_aes_cm_256_hmac_sha1_80(&policy.rtp);
- crypto_policy_set_rtcp_default(&policy.rtcp);
+ srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80(&policy.rtp);
+ srtp_crypto_policy_set_rtcp_default(&policy.rtcp);
break;
}
}
@@ -401,12 +401,12 @@ main (int argc, char *argv[]) {
} else {
switch (key_size) {
case 128:
- crypto_policy_set_aes_cm_128_null_auth(&policy.rtp);
- crypto_policy_set_rtcp_default(&policy.rtcp);
+ srtp_crypto_policy_set_aes_cm_128_null_auth(&policy.rtp);
+ srtp_crypto_policy_set_rtcp_default(&policy.rtcp);
break;
case 256:
- crypto_policy_set_aes_cm_256_null_auth(&policy.rtp);
- crypto_policy_set_rtcp_default(&policy.rtcp);
+ srtp_crypto_policy_set_aes_cm_256_null_auth(&policy.rtp);
+ srtp_crypto_policy_set_rtcp_default(&policy.rtcp);
break;
}
}
@@ -416,12 +416,12 @@ main (int argc, char *argv[]) {
#ifdef OPENSSL
switch (key_size) {
case 128:
- crypto_policy_set_aes_gcm_128_8_only_auth(&policy.rtp);
- crypto_policy_set_aes_gcm_128_8_only_auth(&policy.rtcp);
+ srtp_crypto_policy_set_aes_gcm_128_8_only_auth(&policy.rtp);
+ srtp_crypto_policy_set_aes_gcm_128_8_only_auth(&policy.rtcp);
break;
case 256:
- crypto_policy_set_aes_gcm_256_8_only_auth(&policy.rtp);
- crypto_policy_set_aes_gcm_256_8_only_auth(&policy.rtcp);
+ srtp_crypto_policy_set_aes_gcm_256_8_only_auth(&policy.rtp);
+ srtp_crypto_policy_set_aes_gcm_256_8_only_auth(&policy.rtcp);
break;
}
#else
@@ -429,8 +429,8 @@ main (int argc, char *argv[]) {
return 0;
#endif
} else {
- crypto_policy_set_null_cipher_hmac_sha1_80(&policy.rtp);
- crypto_policy_set_rtcp_default(&policy.rtcp);
+ srtp_crypto_policy_set_null_cipher_hmac_sha1_80(&policy.rtp);
+ srtp_crypto_policy_set_rtcp_default(&policy.rtcp);
}
break;
default:
@@ -495,21 +495,11 @@ main (int argc, char *argv[]) {
* the effect of this policy is to turn off SRTP, so that this
* application is now a vanilla-flavored RTP application.
*/
+ srtp_crypto_policy_set_null_cipher_hmac_null(&policy.rtp);
+ srtp_crypto_policy_set_null_cipher_hmac_null(&policy.rtcp);
policy.key = (uint8_t *)key;
policy.ssrc.type = ssrc_specific;
policy.ssrc.value = ssrc;
- policy.rtp.cipher_type = NULL_CIPHER;
- policy.rtp.cipher_key_len = 0;
- policy.rtp.auth_type = NULL_AUTH;
- policy.rtp.auth_key_len = 0;
- policy.rtp.auth_tag_len = 0;
- policy.rtp.sec_serv = sec_serv_none;
- policy.rtcp.cipher_type = NULL_CIPHER;
- policy.rtcp.cipher_key_len = 0;
- policy.rtcp.auth_type = NULL_AUTH;
- policy.rtcp.auth_key_len = 0;
- policy.rtcp.auth_tag_len = 0;
- policy.rtcp.sec_serv = sec_serv_none;
policy.window_size = 0;
policy.allow_repeat_tx = 0;
policy.ekt = NULL;
« no previous file with comments | « test/rtp.c ('k') | test/rtpw_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698