SCTC
the soundcloud.com terminal client
Data Structures | Macros | Functions | Variables
tls.c File Reference
#include "../_hard_config.h"
#include "polarssl/oid.h"
#include "polarssl/net.h"
#include "polarssl/debug.h"
#include "polarssl/ssl.h"
#include "polarssl/entropy.h"
#include "polarssl/ctr_drbg.h"
#include "polarssl/error.h"
#include "polarssl/certs.h"
#include "../log.h"
#include "../helper.h"
#include "tls.h"
#include "network.h"
Include dependency graph for tls.c:

Data Structures

struct  tls_conn
 

Macros

#define TLS_CONN_MAGIC   0x42434445
 Magic used to validate the type of network_conn. More...
 
#define SHA512_LEN   64
 

Functions

bool tls_send (struct network_conn *nwc, char *buffer, size_t buffer_len)
 
bool tls_send_fmt (struct network_conn *nwc, char *fmt,...)
 
int tls_recv (struct network_conn *nwc, char *buffer, size_t buffer_len)
 
int tls_recv_byte (struct network_conn *nwc)
 
void tls_disconnect (struct network_conn *nwc)
 
bool tls_init ()
 Global initialization of TLS. More...
 
struct network_conntls_connect (char *server, int port)
 Connect an encrypted TCP/IP socket to server:port. More...
 
bool tls_finalize ()
 Free previous global initialization of TLS. More...
 

Variables

static x509_crt cacerts
 

Macro Definition Documentation

#define SHA512_LEN   64
#define TLS_CONN_MAGIC   0x42434445

Magic used to validate the type of network_conn.

Function Documentation

struct network_conn* tls_connect ( char *  server,
int  port 
)

Connect an encrypted TCP/IP socket to server:port.

Parameters
serverThe server to connect to, either an IP or a hostname.
portThe servers port (0 <= port <= 65536)
Returns
Pointer to a network_conn struct, or NULL in case of an error

Here is the call graph for this function:

Here is the caller graph for this function:

void tls_disconnect ( struct network_conn nwc)

Here is the caller graph for this function:

bool tls_finalize ( )

Free previous global initialization of TLS.

Returns
true in case of success, false otherwise

Here is the caller graph for this function:

bool tls_init ( )

Global initialization of TLS.

This function is required to be called prior to the first call tls_connect(). Global initialization, such as loading the list of trusted CAs is performed here.

Returns
true in case of success, false otherwise

Here is the caller graph for this function:

int tls_recv ( struct network_conn nwc,
char *  buffer,
size_t  buffer_len 
)

Here is the caller graph for this function:

int tls_recv_byte ( struct network_conn nwc)

Here is the caller graph for this function:

bool tls_send ( struct network_conn nwc,
char *  buffer,
size_t  buffer_len 
)

Here is the caller graph for this function:

bool tls_send_fmt ( struct network_conn nwc,
char *  fmt,
  ... 
)

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

x509_crt cacerts
static