|
@@ -711,9 +711,14 @@ safe_or_connection_tls_secrets(safe_or_connection_t *safe_or_conn,
|
|
|
tor_assert(safe_or_conn != NULL);
|
|
|
tor_assert(secrets_out != NULL);
|
|
|
tor_mutex_acquire(&TO_SAFE_CONN(safe_or_conn)->lock);
|
|
|
- tor_assert(safe_or_conn->tls != NULL);
|
|
|
|
|
|
- int rv = tor_tls_get_tlssecrets(safe_or_conn->tls, secrets_out);
|
|
|
+ int rv = -1;
|
|
|
+
|
|
|
+ if (safe_or_conn->tls == NULL){
|
|
|
+ log_warn(LD_OR, "safe_or_conn->tls is NULL");
|
|
|
+ } else {
|
|
|
+ rv = tor_tls_get_tlssecrets(safe_or_conn->tls, secrets_out);
|
|
|
+ }
|
|
|
|
|
|
tor_mutex_release(&TO_SAFE_CONN(safe_or_conn)->lock);
|
|
|
return rv;
|
|
@@ -727,10 +732,15 @@ safe_or_connection_key_material(safe_or_connection_t *safe_or_conn,
|
|
|
{
|
|
|
tor_assert(safe_or_conn != NULL);
|
|
|
tor_mutex_acquire(&TO_SAFE_CONN(safe_or_conn)->lock);
|
|
|
- tor_assert(safe_or_conn->tls != NULL);
|
|
|
|
|
|
- int rv = tor_tls_export_key_material(safe_or_conn->tls, secrets_out,
|
|
|
- context, context_len, label);
|
|
|
+ int rv = -1;
|
|
|
+
|
|
|
+ if (safe_or_conn->tls == NULL){
|
|
|
+ log_warn(LD_OR, "safe_or_conn->tls is NULL");
|
|
|
+ } else {
|
|
|
+ rv = tor_tls_export_key_material(safe_or_conn->tls, secrets_out,
|
|
|
+ context, context_len, label);
|
|
|
+ }
|
|
|
|
|
|
tor_mutex_release(&TO_SAFE_CONN(safe_or_conn)->lock);
|
|
|
return rv;
|