aboutsummaryrefslogtreecommitdiff
path: root/src/common/tortls.c
diff options
context:
space:
mode:
authorGladys Shufflebottom <>2011-02-19 22:01:42 -0500
committerNick Mathewson <nickm@torproject.org>2011-03-01 18:11:25 -0500
commit49de5431d53b4515d48a0f1c76fc53f3306f5d11 (patch)
tree21e2e00097341ff04c7d54da0816b05e62bd5fac /src/common/tortls.c
parentd60a7c2f8d139d2b2dfd71780dae8a86489cec49 (diff)
downloadtor-49de5431d53b4515d48a0f1c76fc53f3306f5d11.tar
tor-49de5431d53b4515d48a0f1c76fc53f3306f5d11.tar.gz
remove tls related hash table code
Diffstat (limited to 'src/common/tortls.c')
-rw-r--r--src/common/tortls.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index ca9e92c8e..20a0e77b6 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -58,7 +58,6 @@
#include "util.h"
#include "torlog.h"
#include "container.h"
-#include "ht.h"
#include <string.h>
/* Enable the "v2" TLS handshake.
@@ -108,7 +107,6 @@ typedef struct tor_tls_context_t {
* accessed from within tortls.c.
*/
struct tor_tls_t {
- HT_ENTRY(tor_tls_t) node;
tor_tls_context_t *context; /** A link to the context object for this tls. */
SSL *ssl; /**< An OpenSSL SSL object. */
int socket; /**< The underlying file descriptor for this TLS connection. */
@@ -171,25 +169,12 @@ tor_tls_entry_hash(const tor_tls_t *a)
#endif
}
-/** Map from SSL* pointers to tor_tls_t objects using those pointers.
- */
-static HT_HEAD(tlsmap, tor_tls_t) tlsmap_root = HT_INITIALIZER();
-
-HT_PROTOTYPE(tlsmap, tor_tls_t, node, tor_tls_entry_hash,
- tor_tls_entries_eq)
-HT_GENERATE(tlsmap, tor_tls_t, node, tor_tls_entry_hash,
- tor_tls_entries_eq, 0.6, malloc, realloc, free)
-
/** Helper: given a SSL* pointer, return the tor_tls_t object using that
* pointer. */
static INLINE tor_tls_t *
tor_tls_get_by_ssl(const SSL *ssl)
{
- tor_tls_t search, *result;
- memset(&search, 0, sizeof(search));
- search.ssl = (SSL*)ssl;
- result = HT_FIND(tlsmap, &tlsmap_root, &search);
- return result;
+ return SSL_get_app_data(ssl);
}
static void tor_tls_context_decref(tor_tls_context_t *ctx);
@@ -466,10 +451,6 @@ tor_tls_free_all(void)
client_tls_context = NULL;
tor_tls_context_decref(ctx);
}
- if (!HT_EMPTY(&tlsmap_root)) {
- log_warn(LD_MM, "Still have entries in the tlsmap at shutdown.");
- }
- HT_CLEAR(tlsmap, &tlsmap_root);
#ifdef V2_HANDSHAKE_CLIENT
if (CLIENT_CIPHER_DUMMIES)
tor_free(CLIENT_CIPHER_DUMMIES);
@@ -1085,7 +1066,7 @@ tor_tls_new(int sock, int isServer)
tor_free(result);
return NULL;
}
- HT_INSERT(tlsmap, &tlsmap_root, result);
+ SSL_set_app_data(result->ssl, result);
SSL_set_bio(result->ssl, bio, bio);
tor_tls_context_incref(context);
result->context = context;
@@ -1196,14 +1177,9 @@ tor_tls_is_server(tor_tls_t *tls)
void
tor_tls_free(tor_tls_t *tls)
{
- tor_tls_t *removed;
if (!tls)
return;
tor_assert(tls->ssl);
- removed = HT_REMOVE(tlsmap, &tlsmap_root, tls);
- if (!removed) {
- log_warn(LD_BUG, "Freeing a TLS that was not in the ssl->tls map.");
- }
#ifdef SSL_set_tlsext_host_name
SSL_set_tlsext_host_name(tls->ssl, NULL);
#endif