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

Unified Diff: webrtc/pc/externalhmac.h

Issue 2407743002: Fix externalhmac.h/.cc to compile with libsrtp 1 and 2 (Closed)
Patch Set: 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 | « no previous file | webrtc/pc/externalhmac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/externalhmac.h
diff --git a/webrtc/pc/externalhmac.h b/webrtc/pc/externalhmac.h
index 18d46811451c1537e84fcc1edeed8b56b92e33db..091412e6a9e710d2aa108daccf227b35e1afacc1 100644
--- a/webrtc/pc/externalhmac.h
+++ b/webrtc/pc/externalhmac.h
@@ -20,8 +20,8 @@
// How will libsrtp select this module?
// Libsrtp defines authentication function types identified by an unsigned
-// integer, e.g. HMAC_SHA1 is 3. Using authentication ids, the application
-// can plug any desired authentication modules into libsrtp.
+// integer, e.g. SRTP_HMAC_SHA1 is 3. Using authentication ids, the
+// application can plug any desired authentication modules into libsrtp.
// libsrtp also provides a mechanism to select different auth functions for
// individual streams. This can be done by setting the right value in
// the auth_type of srtp_policy_t. The application must first register auth
@@ -39,9 +39,20 @@ extern "C" {
}
#endif // HAVE_SRTP
+#if defined(HAVE_SRTP) && !defined(SRTP_HMAC_SHA1)
+// Include compatibility shims to compile against libsrtp 1.x.
+// TODO(mattdr): Remove once Chromium uses libsrtp 2.
+
+// Remember that the definition of SRTP_HMAC_SHA1 is synthetic.
+#define COMPILING_AGAINST_LIBSRTP1 1
+
+#define SRTP_HMAC_SHA1 HMAC_SHA1
+#define srtp_auth_t auth_t
+#endif
+
#if defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH)
-#define EXTERNAL_HMAC_SHA1 HMAC_SHA1 + 1
+#define EXTERNAL_HMAC_SHA1 SRTP_HMAC_SHA1 + 1
#define HMAC_KEY_LENGTH 20
// The HMAC context structure used to store authentication keys.
@@ -52,27 +63,29 @@ typedef struct {
int key_length;
} ExternalHmacContext;
-err_status_t external_hmac_alloc(auth_t** a, int key_len, int out_len);
+srtp_err_status_t external_hmac_alloc(srtp_auth_t** a,
+ int key_len,
+ int out_len);
-err_status_t external_hmac_dealloc(auth_t* a);
+srtp_err_status_t external_hmac_dealloc(srtp_auth_t* a);
-err_status_t external_hmac_init(ExternalHmacContext* state,
- const uint8_t* key,
- int key_len);
+srtp_err_status_t external_hmac_init(ExternalHmacContext* state,
+ const uint8_t* key,
+ int key_len);
-err_status_t external_hmac_start(ExternalHmacContext* state);
+srtp_err_status_t external_hmac_start(ExternalHmacContext* state);
-err_status_t external_hmac_update(ExternalHmacContext* state,
- const uint8_t* message,
- int msg_octets);
+srtp_err_status_t external_hmac_update(ExternalHmacContext* state,
+ const uint8_t* message,
+ int msg_octets);
-err_status_t external_hmac_compute(ExternalHmacContext* state,
- const void* message,
- int msg_octets,
- int tag_len,
- uint8_t* result);
+srtp_err_status_t external_hmac_compute(ExternalHmacContext* state,
+ const void* message,
+ int msg_octets,
+ int tag_len,
+ uint8_t* result);
-err_status_t external_crypto_init();
+srtp_err_status_t external_crypto_init();
#endif // defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH)
#endif // WEBRTC_PC_EXTERNALHMAC_H_
« no previous file with comments | « no previous file | webrtc/pc/externalhmac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698