tls

TLS 1.2 Client (Minimal)

Functions

FunctionDescription
_tls_copy
_tls_socket_tcp
_tls_connect_raw
_tls_send
_tls_recv
_tls_close
_tls_getrandom
tcp_connectConnect to host:port via TCP. Returns socket fd or -1.
_tls_build_client_helloInternal: build TLS ClientHello message.
tls_connectConnect to host:port with TLS 1.2 handshake. Returns TLS context or 0 on fail…
tls_writeWrite data over TLS connection. Returns bytes written. Simplified: sends as T…
tls_readRead data from TLS connection. Returns bytes read.
tls_closeClose TLS connection.

Details

_tls_copy

fn _tls_copy(dst: &i8, doff: i64, src: &i8, soff: i64, n: i64)

_tls_socket_tcp

fn _tls_socket_tcp() -> i64

_tls_connect_raw

fn _tls_connect_raw(fd: i64, addr: &i8, len: i64) -> i64

_tls_send

fn _tls_send(fd: i64, buf: &i8, len: i64) -> i64

_tls_recv

fn _tls_recv(fd: i64, buf: &i8, max: i64) -> i64

_tls_close

fn _tls_close(fd: i64) -> i64

_tls_getrandom

fn _tls_getrandom(buf: &i8, n: i64) -> i64

tcp_connect

fn tcp_connect(host: &i8, hlen: i64, port: i64) -> i64

Connect to host:port via TCP. Returns socket fd or -1.

_tls_build_client_hello

fn _tls_build_client_hello(ctx: &i64, buf: &i8) -> i64

Internal: build TLS ClientHello message.

tls_connect

fn tls_connect(host: &i8, hlen: i64, port: i64) -> &i64

Connect to host:port with TLS 1.2 handshake. Returns TLS context or 0 on failure.

tls_write

fn tls_write(ctx: &i64, data: &i8, len: i64) -> i64

Write data over TLS connection. Returns bytes written. Simplified: sends as TLS application data record (unencrypted for now).

tls_read

fn tls_read(ctx: &i64, buf: &i8, max: i64) -> i64

Read data from TLS connection. Returns bytes read.

tls_close

fn tls_close(ctx: &i64)

Close TLS connection.