~ubuntu-branches/ubuntu/intrepid/wpasupplicant/intrepid

« back to all changes in this revision

Viewing changes to tls_internal.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2007-04-01 10:53:37 UTC
  • Revision ID: james.westby@ubuntu.com-20070401105337-3dd89n3g8ecdhjsl
Tags: 0.5.7-0ubuntu2
Apply patch from upstream after private email discussion:
http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=33673d3f43da6f5ec0f0aa5a8245a1617b6eb2fd#patch1
Fixes LP: #98895, #98925

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
        }
44
44
        tls_ref_count++;
45
45
 
46
 
        global = os_zalloc(sizeof(*global));
 
46
        global = wpa_zalloc(sizeof(*global));
47
47
        if (global == NULL)
48
48
                return NULL;
49
49
 
57
57
        if (tls_ref_count == 0) {
58
58
                tlsv1_client_global_deinit();
59
59
        }
60
 
        os_free(global);
 
60
        free(global);
61
61
}
62
62
 
63
63
 
71
71
{
72
72
        struct tls_connection *conn;
73
73
 
74
 
        conn = os_zalloc(sizeof(*conn));
 
74
        conn = wpa_zalloc(sizeof(*conn));
75
75
        if (conn == NULL)
76
76
                return NULL;
77
77
 
78
78
        conn->client = tlsv1_client_init();
79
79
        if (conn->client == NULL) {
80
 
                os_free(conn);
 
80
                free(conn);
81
81
                return NULL;
82
82
        }
83
83
 
87
87
 
88
88
void tls_connection_deinit(void *tls_ctx, struct tls_connection *conn)
89
89
{
90
 
        if (conn == NULL)
91
 
                return;
92
90
        tlsv1_client_deinit(conn->client);
93
 
        os_free(conn);
 
91
        free(conn);
94
92
}
95
93
 
96
94
 
109
107
int tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
110
108
                              const struct tls_connection_params *params)
111
109
{
112
 
        if (tlsv1_client_set_ca_cert(conn->client, params->ca_cert,
113
 
                                     params->ca_cert_blob,
114
 
                                     params->ca_cert_blob_len,
115
 
                                     params->ca_path)) {
116
 
                wpa_printf(MSG_INFO, "TLS: Failed to configure trusted CA "
117
 
                           "certificates");
118
 
                return -1;
119
 
        }
120
 
 
121
 
        if (tlsv1_client_set_client_cert(conn->client, params->client_cert,
122
 
                                         params->client_cert_blob,
123
 
                                         params->client_cert_blob_len)) {
124
 
                wpa_printf(MSG_INFO, "TLS: Failed to configure client "
125
 
                           "certificate");
126
 
                return -1;
127
 
        }
128
 
 
129
 
        if (tlsv1_client_set_private_key(conn->client,
130
 
                                         params->private_key,
131
 
                                         params->private_key_passwd,
132
 
                                         params->private_key_blob,
133
 
                                         params->private_key_blob_len)) {
134
 
                wpa_printf(MSG_INFO, "TLS: Failed to load private key");
135
 
                return -1;
136
 
        }
137
 
 
 
110
        printf("TLS: not implemented - %s\n", __func__);
138
111
        return 0;
139
112
}
140
113
 
142
115
int tls_global_set_params(void *tls_ctx,
143
116
                          const struct tls_connection_params *params)
144
117
{
145
 
        wpa_printf(MSG_INFO, "TLS: not implemented - %s", __func__);
 
118
        printf("TLS: not implemented - %s\n", __func__);
146
119
        return -1;
147
120
}
148
121
 
149
122
 
150
123
int tls_global_set_verify(void *tls_ctx, int check_crl)
151
124
{
152
 
        wpa_printf(MSG_INFO, "TLS: not implemented - %s", __func__);
 
125
        printf("TLS: not implemented - %s\n", __func__);
153
126
        return -1;
154
127
}
155
128
 
192
165
        if (appl_data)
193
166
                *appl_data = NULL;
194
167
 
195
 
        wpa_printf(MSG_DEBUG, "TLS: %s(in_data=%p in_len=%lu)",
196
 
                   __func__, in_data, (unsigned long) in_len);
 
168
        printf("TLS: %s(in_data=%p in_len=%lu)\n",
 
169
               __func__, in_data, (unsigned long) in_len);
197
170
        return tlsv1_client_handshake(conn->client, in_data, in_len, out_len);
198
171
}
199
172
 
203
176
                                     const u8 *in_data, size_t in_len,
204
177
                                     size_t *out_len)
205
178
{
206
 
        wpa_printf(MSG_INFO, "TLS: not implemented - %s", __func__);
 
179
        printf("TLS: not implemented - %s\n", __func__);
207
180
        return NULL;
208
181
}
209
182