Home | History | Annotate | Download | only in crypto

Lines Matching full:conn

75 	struct tls_connection *conn = (struct tls_connection *) fd->secret;
80 if (conn->pull_buf == NULL) {
85 end = conn->pull_buf + conn->pull_buf_len;
86 if (end - conn->pull_buf_offset < amount)
87 amount = end - conn->pull_buf_offset;
88 os_memcpy(buf, conn->pull_buf_offset, amount);
89 conn->pull_buf_offset += amount;
90 if (conn->pull_buf_offset == end) {
92 os_free(conn->pull_buf);
93 conn->pull_buf = conn->pull_buf_offset = NULL;
94 conn->pull_buf_len = 0;
98 (unsigned long) (end - conn->pull_buf_offset));
107 struct tls_connection *conn = (struct tls_connection *) fd->secret;
113 nbuf = os_realloc(conn->push_buf, conn->push_buf_len + amount);
119 os_memcpy(nbuf + conn->push_buf_len, buf, amount);
120 conn->push_buf = nbuf;
121 conn->push_buf_len += amount;
288 struct tls_connection *conn = arg;
309 if (conn->verify_peer)
318 struct tls_connection *conn = client_data;
320 conn->established = 1;
326 struct tls_connection *conn;
328 conn = os_zalloc(sizeof(*conn));
329 if (conn == NULL)
332 conn->fd = PR_CreateIOLayerStub(nss_layer_id, &nss_io);
333 if (conn->fd == NULL) {
334 os_free(conn);
337 conn->fd->secret = (void *) conn;
339 conn->fd = SSL_ImportFD(NULL, conn->fd);
340 if (conn->fd == NULL) {
341 os_free(conn);
345 if (SSL_OptionSet(conn->fd, SSL_SECURITY, PR_TRUE) != SECSuccess ||
346 SSL_OptionSet(conn->fd, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE) !=
348 SSL_OptionSet(conn->fd, SSL_HANDSHAKE_AS_SERVER, PR_FALSE) !=
350 SSL_OptionSet(conn->fd, SSL_ENABLE_TLS, PR_TRUE) != SECSuccess ||
351 SSL_BadCertHook(conn->fd, nss_bad_cert_cb, conn) != SECSuccess ||
352 SSL_HandshakeCallback(conn->fd, nss_handshake_cb, conn) !=
355 PR_Close(conn->fd);
356 os_free(conn);
360 SSL_ResetHandshake(conn->fd, PR_FALSE);
362 return conn;
366 void tls_connection_deinit(void *tls_ctx, struct tls_connection *conn)
368 PR_Close(conn->fd);
369 os_free(conn->push_buf);
370 os_free(conn->pull_buf);
371 os_free(conn);
375 int tls_connection_established(void *tls_ctx, struct tls_connection *conn)
377 return conn->established;
381 int tls_connection_shutdown(void *tls_ctx, struct tls_connection *conn)
387 int tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
408 int tls_connection_set_verify(void *tls_ctx, struct tls_connection *conn,
411 conn->verify_peer = verify_peer;
416 int tls_connection_get_keys(void *tls_ctx, struct tls_connection *conn,
424 int tls_connection_prf(void *tls_ctx, struct tls_connection *conn,
428 if (conn == NULL || server_random_first) {
435 if (SSL_ExportKeyingMaterial(conn->fd, label, NULL, 0, out, out_len) !=
447 struct tls_connection *conn,
460 if (conn->pull_buf) {
463 (unsigned long) conn->pull_buf_len);
464 os_free(conn->pull_buf);
466 conn->pull_buf = os_malloc(wpabuf_len(in_data));
467 if (conn->pull_buf == NULL)
469 os_memcpy(conn->pull_buf, wpabuf_head(in_data),
471 conn->pull_buf_offset = conn->pull_buf;
472 conn->pull_buf_len = wpabuf_len(in_data);
475 SSL_ForceHandshake(conn->fd);
477 if (conn->established && conn->push_buf == NULL) {
479 conn->push_buf = os_malloc(1);
482 if (conn->push_buf == NULL)
484 out_data = wpabuf_alloc_ext_data(conn->push_buf, conn->push_buf_len);
486 os_free(conn->push_buf);
487 conn->push_buf = NULL;
488 conn->push_buf_len = 0;
494 struct tls_connection *conn,
503 struct tls_connection *conn,
511 res = PR_Send(conn->fd, wpabuf_head(in_data), wpabuf_len(in_data), 0,
517 if (conn->push_buf == NULL)
519 buf = wpabuf_alloc_ext_data(conn->push_buf, conn->push_buf_len);
521 os_free(conn->push_buf);
522 conn->push_buf = NULL;
523 conn->push_buf_len = 0;
529 struct tls_connection *conn,
537 if (conn->pull_buf) {
540 (unsigned long) conn->pull_buf_len);
541 os_free(conn->pull_buf);
543 conn->pull_buf = os_malloc(wpabuf_len(in_data));
544 if (conn->pull_buf == NULL)
546 os_memcpy(conn->pull_buf, wpabuf_head(in_data), wpabuf_len(in_data));
547 conn->pull_buf_offset = conn->pull_buf;
548 conn->pull_buf_len = wpabuf_len(in_data);
560 res = PR_Recv(conn->fd, wpabuf_mhead(out), wpabuf_size(out), 0, 0);
572 int tls_connection_resumed(void *tls_ctx, struct tls_connection *conn)
578 int tls_connection_set_cipher_list(void *tls_ctx, struct tls_connection *conn,
585 int tls_get_cipher(void *tls_ctx, struct tls_connection *conn,
593 struct tls_connection *conn)
599 int tls_connection_client_hello_ext(void *tls_ctx, struct tls_connection *conn,
607 int tls_connection_get_failed(void *tls_ctx, struct tls_connection *conn)
613 int tls_connection_get_read_alerts(void *tls_ctx, struct tls_connection *conn)
620 struct tls_connection *conn)
627 struct tls_connection *conn)
640 struct tls_connection *conn,