fixed build_cipher_suite_list()
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 21 Aug 2010 10:51:54 +0000 (12:51 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 21 Aug 2010 10:52:55 +0000 (12:52 +0200)
src/libtls/tls_crypto.c

index 801a127..f3df497 100644 (file)
@@ -486,16 +486,16 @@ static void build_cipher_suite_list(private_tls_crypto_t *this,
        filter_suite(this, suites, &count, offsetof(suite_algs_t, hash),
                                 lib->crypto->create_hasher_enumerator);
 
+       free(this->suites);
+       this->suite_count = count;
+       this->suites = malloc(sizeof(tls_cipher_suite_t) * count);
+
        DBG2(DBG_CFG, "%d supported TLS cipher suites:", count);
        for (i = 0; i < count; i++)
        {
-               DBG2(DBG_CFG, "  %N", tls_cipher_suite_names, suites[i]);
+               DBG2(DBG_CFG, "  %N", tls_cipher_suite_names, suites[i].suite);
+               this->suites[i] = suites[i].suite;
        }
-
-       free(this->suites);
-       this->suite_count = count;
-       this->suites = malloc(sizeof(tls_cipher_suite_t) * count);
-       memcpy(this->suites, suites, sizeof(tls_cipher_suite_t) * this->suite_count);
 }
 
 METHOD(tls_crypto_t, get_cipher_suites, int,