mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Recorded merge of revisions 417677 from http://svn.asterisk.org/svn/asterisk/branches/11
........ res_rtp_asterisk: Add SHA-256 support for DTLS and perform DTLS negotiation on RTCP. This change fixes up DTLS support in res_rtp_asterisk so it can accept and provide a SHA-256 fingerprint, so it occurs on RTCP, and so it occurs after ICE negotiation completes. Configuration options to chan_sip and chan_pjsip have also been added to allow behavior to be tweaked (such as forcing the AVP type media transports in SDP). ASTERISK-22961 #close Reported by: Jay Jideliov Review: https://reviewboard.asterisk.org/r/3679/ Review: https://reviewboard.asterisk.org/r/3686/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@417678 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -476,6 +476,10 @@ struct ast_sip_media_rtp_configuration {
|
||||
unsigned int use_ptime;
|
||||
/*! Do we use AVPF exclusively for this endpoint? */
|
||||
unsigned int use_avpf;
|
||||
/*! Do we force AVP, AVPF, SAVP, or SAVPF even for DTLS media streams? */
|
||||
unsigned int force_avp;
|
||||
/*! Do we use the received media transport in our answer SDP */
|
||||
unsigned int use_received_transport;
|
||||
/*! \brief DTLS-SRTP configuration information */
|
||||
struct ast_rtp_dtls_cfg dtls_cfg;
|
||||
/*! Should SRTP use a 32 byte tag instead of an 80 byte tag? */
|
||||
|
@@ -73,6 +73,8 @@ struct ast_sip_session_media {
|
||||
struct ast_sip_session_sdp_handler *handler;
|
||||
/*! \brief Holds SRTP information */
|
||||
struct ast_sdp_srtp *srtp;
|
||||
/*! \brief The media transport in use for this stream */
|
||||
pj_str_t transport;
|
||||
/*! \brief Stream is on hold */
|
||||
unsigned int held:1;
|
||||
/*! \brief Stream type this session media handles */
|
||||
|
@@ -390,6 +390,12 @@ enum ast_rtp_ice_component_type {
|
||||
AST_RTP_ICE_COMPONENT_RTCP = 2,
|
||||
};
|
||||
|
||||
/*! \brief ICE role during negotiation */
|
||||
enum ast_rtp_ice_role {
|
||||
AST_RTP_ICE_ROLE_CONTROLLED,
|
||||
AST_RTP_ICE_ROLE_CONTROLLING,
|
||||
};
|
||||
|
||||
/*! \brief Structure for an ICE candidate */
|
||||
struct ast_rtp_engine_ice_candidate {
|
||||
char *foundation; /*!< Foundation identifier */
|
||||
@@ -419,6 +425,8 @@ struct ast_rtp_engine_ice {
|
||||
struct ao2_container *(*get_local_candidates)(struct ast_rtp_instance *instance);
|
||||
/*! Callback for telling the ICE support that it is talking to an ice-lite implementation */
|
||||
void (*ice_lite)(struct ast_rtp_instance *instance);
|
||||
/*! Callback for changing our role in negotiation */
|
||||
void (*set_role)(struct ast_rtp_instance *instance, enum ast_rtp_ice_role role);
|
||||
};
|
||||
|
||||
/*! \brief DTLS setup types */
|
||||
@@ -431,22 +439,31 @@ enum ast_rtp_dtls_setup {
|
||||
|
||||
/*! \brief DTLS connection states */
|
||||
enum ast_rtp_dtls_connection {
|
||||
AST_RTP_DTLS_CONNECTION_NEW, /*!< Endpoint wants to use a new connection */
|
||||
AST_RTP_DTLS_CONNECTION_NEW, /*!< Endpoint wants to use a new connection */
|
||||
AST_RTP_DTLS_CONNECTION_EXISTING, /*!< Endpoint wishes to use existing connection */
|
||||
};
|
||||
|
||||
/*! \brief DTLS fingerprint hashes */
|
||||
enum ast_rtp_dtls_hash {
|
||||
AST_RTP_DTLS_HASH_SHA1, /*!< SHA-1 fingerprint hash */
|
||||
AST_RTP_DTLS_HASH_SHA256, /*!< SHA-256 fingerprint hash */
|
||||
AST_RTP_DTLS_HASH_SHA1, /*!< SHA-1 fingerprint hash */
|
||||
};
|
||||
|
||||
/*! \brief DTLS verification settings */
|
||||
enum ast_rtp_dtls_verify {
|
||||
AST_RTP_DTLS_VERIFY_NONE = 0, /*!< Don't verify anything */
|
||||
AST_RTP_DTLS_VERIFY_FINGERPRINT = (1 << 0), /*!< Verify the fingerprint */
|
||||
AST_RTP_DTLS_VERIFY_CERTIFICATE = (1 << 1), /*!< Verify the certificate */
|
||||
};
|
||||
|
||||
/*! \brief DTLS configuration structure */
|
||||
struct ast_rtp_dtls_cfg {
|
||||
unsigned int enabled:1; /*!< Whether DTLS support is enabled or not */
|
||||
unsigned int verify:1; /*!< Whether to request and verify a client certificate when acting as server */
|
||||
unsigned int rekey; /*!< Interval at which to renegotiate and rekey - defaults to 0 (off) */
|
||||
enum ast_rtp_dtls_setup default_setup; /*!< Default setup type to use for outgoing */
|
||||
enum ast_srtp_suite suite; /*!< Crypto suite in use */
|
||||
enum ast_rtp_dtls_hash hash; /*!< Hash to use for fingerprint */
|
||||
enum ast_rtp_dtls_verify verify; /*!< What should be verified */
|
||||
char *certfile; /*!< Certificate file */
|
||||
char *pvtfile; /*!< Private key file */
|
||||
char *cipher; /*!< Cipher to use */
|
||||
@@ -472,8 +489,10 @@ struct ast_rtp_engine_dtls {
|
||||
void (*set_setup)(struct ast_rtp_instance *instance, enum ast_rtp_dtls_setup setup);
|
||||
/*! Set the remote fingerprint */
|
||||
void (*set_fingerprint)(struct ast_rtp_instance *instance, enum ast_rtp_dtls_hash hash, const char *fingerprint);
|
||||
/*! Get the local fingerprint hash type */
|
||||
enum ast_rtp_dtls_hash (*get_fingerprint_hash)(struct ast_rtp_instance *instance);
|
||||
/*! Get the local fingerprint */
|
||||
const char *(*get_fingerprint)(struct ast_rtp_instance *instance, enum ast_rtp_dtls_hash hash);
|
||||
const char *(*get_fingerprint)(struct ast_rtp_instance *instance);
|
||||
};
|
||||
|
||||
/*! Structure that represents an RTP stack (engine) */
|
||||
|
@@ -118,8 +118,10 @@ const char *ast_sdp_srtp_get_attrib(struct ast_sdp_srtp *srtp, int dtls_enabled,
|
||||
* \param sdes_active Whether the media session is using SDES-SRTP
|
||||
* \param instance The RTP instance associated with this media session
|
||||
* \param using_avpf Whether the media session is using early feedback (AVPF)
|
||||
* \param force_avp Force SAVP or SAVPF profile when DTLS is in use
|
||||
*
|
||||
* \retval A non-allocated string describing the profile in use (does not need to be freed)
|
||||
*/
|
||||
char *ast_sdp_get_rtp_profile(unsigned int sdes_active, struct ast_rtp_instance *instance, unsigned int using_avpf);
|
||||
char *ast_sdp_get_rtp_profile(unsigned int sdes_active, struct ast_rtp_instance *instance, unsigned int using_avpf,
|
||||
unsigned int force_avp);
|
||||
#endif /* _SDP_CRYPTO_H */
|
||||
|
Reference in New Issue
Block a user