pushssl – attach SSL version 2 encryption to a communication channel

#include <u.h>
#include <libc.h>

int pushssl(int fd, char *alg, char *secin, char *secout, int *cfd)

Pushssl opens an ssl(3) device, connects it to the communications channel fd, and starts up encryption and message authentication as specified in alg. The algorithms are separated by a space and either can be first. See ssl(3) for the possible algorithms. Secin and secout contain the encryption keys for the two directions. If either is nil, the other is used in both directions. If cfd is non–nil, the SSL control channel is opened and its fd returned.

Pushssl returns a file descriptor for the SSL data channel. Anything written to this descriptor will get encrypted and authenticated and then written to the file descriptor, fd. Pushssl closes the original file descriptor fd on success.


dial(2), ssl(3),

return –1 on failure.