50
50
client_pull (gnutls_transport_ptr_t tr, void *data, size_t len)
52
success ("client_pull len %d has %d\n", len, to_client_len);
53
success ("client_pull len %d has %d\n", (int) len, (int) to_client_len);
54
55
if (to_client_len < len)
71
72
size_t newlen = to_server_len + len;
74
success ("client_push len %d has %d\n", len, to_server_len);
77
success ("client_push len %d has %d\n", (int) len, (int) to_server_len);
77
81
tmp = realloc (to_server, newlen);
92
96
server_pull (gnutls_transport_ptr_t tr, void *data, size_t len)
94
success ("server_pull len %d has %d\n", len, to_server_len);
99
success ("server_pull len %d has %d\n", (int) len, (int) to_server_len);
96
101
if (to_server_len < len)
113
118
size_t newlen = to_client_len + len;
116
success ("server_push len %d has %d\n", len, to_client_len);
118
hexprint (data, len);
123
success ("server_push len %d has %d\n", (int) len, (int) to_client_len);
124
hexprint (data, len);
120
127
tmp = realloc (to_client, newlen);
135
142
client_finished_callback (gnutls_session_t session,
136
143
const void *finished, size_t len)
138
success ("client finished (length %d)\n", len);
139
hexprint (finished, len);
147
success ("client finished (length %d)\n", (int) len);
148
hexprint (finished, len);
143
153
server_finished_callback (gnutls_session_t session,
144
154
const void *finished, size_t len)
146
success ("server finished (length %d)\n", len);
147
hexprint (finished, len);
158
success ("server finished (length %d)\n", (int) len);
159
hexprint (finished, len);
150
163
#define MAX_BUF 1024
204
217
if (cret == GNUTLS_E_AGAIN)
206
success ("loop invoking client:\n");
220
success ("loop invoking client:\n");
207
221
cret = gnutls_handshake (client);
208
success ("client %d: %s\n", cret, gnutls_strerror (cret));
223
success ("client %d: %s\n", cret, gnutls_strerror (cret));
211
226
if (sret == GNUTLS_E_AGAIN)
213
success ("loop invoking server:\n");
229
success ("loop invoking server:\n");
214
230
sret = gnutls_handshake (server);
215
success ("server %d: %s\n", sret, gnutls_strerror (sret));
232
success ("server %d: %s\n", sret, gnutls_strerror (sret));
218
235
while (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN);
220
success ("Handshake established\n");
238
success ("Handshake established\n");
222
240
ns = gnutls_record_send (client, MSG, strlen (MSG));
223
success ("client: sent %d\n", ns);
242
success ("client: sent %d\n", (int) ns);
225
244
ret = gnutls_record_recv (server, buffer, MAX_BUF);
227
246
fail ("server: didn't receive any data\n");
228
247
else if (ret < 0)
229
248
fail ("server: error: %s\n", gnutls_strerror (ret));
232
251
printf ("server: received %d: ", ret);
233
252
for (n = 0; n < ret; n++)
238
257
ns = gnutls_record_send (server, MSG, strlen (MSG));
239
success ("server: sent %d\n", ns);
259
success ("server: sent %d\n", (int) ns);
241
261
ret = gnutls_record_recv (client, buffer, MAX_BUF);