group
group__libshare__netesl
The "Encrypted Socket Layer" provides a simple layer over a network connection which incorporates 128bit TEA encryption over data transmitted on a socket.

Encrypted Socket Layer

The encryption key is calculated by an xor operation between a client and server supplied key. The server-side listen socket may optionally require a specific key to be supplied by the client. The libshare encrypted network socket operations.
function
int esl_readb
(int sk, shbuf_t *in_buff)
Fill a buffer from a ESL stream.
function
ssize_t esl_read
(int sk, const void *data, size_t data_len)
Fill a user-supplied data segment from a ESL stream.
function
int esl_writeb
(int sk, shbuf_t *wbuff)
Write the contents of a buffer to a ESL stream.
function
ssize_t esl_write
(int sk, const void *data, size_t data_len)
Write a user-supplied data segment to a ESL stream.
function
int esl_connect
(char *hostname, int port, shkey_t *eslkey)
Initiate a connection to a ESL server socket.
function
int esl_bind
(int port)
Listen for incoming ESL connections on a TCP port.
function
int esl_accept
(int sk)
Accept a new incoming ESL connection.
function
void esl_key_set
(int sk, shkey_t *key)
Require a particular key to be supplied by the client.
Param
sk
The bound listen socket.
define
SHNET_ENCRYPT_PROTO_VERSION
1
The initial version for the encrypted socket protocol.
define
ESL_DATA
0
A secure socket mode indicating a 'data' operation (no-op).
define
ESL_INIT_NULL
1
A secure socket mode indicating a 'null' operation (no-op).
define
ESL_INIT_CERT
2
A secure socket mode indicating public handshake negotiation.
define
ESL_INIT_PRIV
3
A secure socket mode indicating priveleged handshake negotiation.
define
ESL_INIT_CONFIRM
4
A secure socket mode confirming handshake parameters.
define
ESL_CHECKSUM
(htons(shcrc((_data), (_data_len)) & 0xFFFF))