diff --git a/daemon/call.c b/daemon/call.c index e4756b538..3d0356daf 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1595,8 +1595,8 @@ static void __generate_crypto(const struct sdp_ng_flags *flags, struct call_medi skip_sdes: if (flags->opmode == OP_OFFER) { - if (MEDIA_ISSET(this, DTLS) && !this->fingerprint.hash_func && flags->dtls_fingerprint.len) - this->fingerprint.hash_func = dtls_find_hash_func(&flags->dtls_fingerprint); + if (MEDIA_ISSET(this, DTLS) && !this->fp_hash_func && flags->dtls_fingerprint.len) + this->fp_hash_func = dtls_find_hash_func(&flags->dtls_fingerprint); } } // for an answer, uses the incoming received list of SDES crypto suites to prune diff --git a/daemon/sdp.c b/daemon/sdp.c index 29b50a976..cba216af5 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -2288,12 +2288,16 @@ static void insert_dtls(struct call_media *media, struct sdp_chopper *chop) { if (!call->dtls_cert || !MEDIA_ISSET(media, DTLS) || MEDIA_ISSET(media, PASSTHRU)) return; + hf = media->fp_hash_func; + if (!hf) + hf = media->fingerprint.hash_func; + struct dtls_fingerprint *fp = NULL; for (GList *l = call->dtls_cert->fingerprints.head; l; l = l->next) { fp = l->data; - if (!media->fingerprint.hash_func) + if (!hf) break; - if (!strcasecmp(media->fingerprint.hash_func->name, fp->hash_func->name)) + if (!strcasecmp(hf->name, fp->hash_func->name)) break; fp = NULL; } @@ -2301,6 +2305,7 @@ static void insert_dtls(struct call_media *media, struct sdp_chopper *chop) { fp = call->dtls_cert->fingerprints.head->data; hf = fp->hash_func; + media->fp_hash_func = hf; assert(hf->num_bytes > 0); diff --git a/include/call.h b/include/call.h index 8534e4f85..32cd82062 100644 --- a/include/call.h +++ b/include/call.h @@ -312,6 +312,7 @@ struct call_media { str media_id; GQueue sdes_in, sdes_out; struct dtls_fingerprint fingerprint; /* as received */ + const struct dtls_hash_func *fp_hash_func; // outgoing GQueue streams; /* normally RTP + RTCP */ GQueue endpoint_maps;