tinydtls  0.8.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Typedefs | Enumerations | Functions
global.h File Reference
#include <stdlib.h>
#include <sys/types.h>
#include "tinydtls.h"

Go to the source code of this file.

Macros

#define DTLSv12   1
 
#define WITH_SHA256   1
 
#define DTLS_MAX_BUF   1400
 
#define DTLS_DEFAULT_MAX_RETRANSMIT   7
 
#define TLS_EXT_ELLIPTIC_CURVES   10 /* see RFC 4492 */
 
#define TLS_EXT_EC_POINT_FORMATS   11 /* see RFC 4492 */
 
#define TLS_EXT_SIG_HASH_ALGO   13 /* see RFC 5246 */
 
#define TLS_EXT_CLIENT_CERTIFICATE_TYPE   19 /* see RFC 7250 */
 
#define TLS_EXT_SERVER_CERTIFICATE_TYPE   20 /* see RFC 7250 */
 
#define TLS_EXT_ENCRYPT_THEN_MAC   22 /* see RFC 7366 */
 
#define TLS_CERT_TYPE_RAW_PUBLIC_KEY   2 /* see RFC 7250 */
 
#define TLS_EXT_ELLIPTIC_CURVES_SECP256R1   23 /* see RFC 4492 */
 
#define TLS_EXT_EC_POINT_FORMATS_UNCOMPRESSED   0 /* see RFC 4492 */
 
#define TLS_EC_CURVE_TYPE_NAMED_CURVE   3 /* see RFC 4492 */
 
#define TLS_CLIENT_CERTIFICATE_TYPE_ECDSA_SIGN   64 /* see RFC 4492 */
 
#define TLS_EXT_SIG_HASH_ALGO_SHA256   4 /* see RFC 5246 */
 
#define TLS_EXT_SIG_HASH_ALGO_ECDSA   3 /* see RFC 5246 */
 

Typedefs

typedef unsigned char uint8
 
typedef unsigned char uint16 [2]
 
typedef unsigned char uint24 [3]
 
typedef unsigned char uint32 [4]
 
typedef unsigned char uint48 [6]
 

Enumerations

enum  dtls_cipher_t { TLS_NULL_WITH_NULL_NULL = 0x0000, TLS_PSK_WITH_AES_128_CCM_8 = 0xC0A8, TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 = 0xC0AE }
 
enum  dtls_compression_t { TLS_COMPRESSION_NULL = 0x0000 }
 

Functions

static void memxor (unsigned char *x, const unsigned char *y, size_t n)
 
static int equals (unsigned char *a, unsigned char *b, size_t len)
 
static int dtls_fls (unsigned int i)
 

Macro Definition Documentation

#define DTLS_DEFAULT_MAX_RETRANSMIT   7

Number of message retransmissions.

Definition at line 70 of file global.h.

#define DTLS_MAX_BUF   1400

Maximum size of DTLS message. When Peers are sending bigger messages this causes problems. Californium with ECDSA needs at least 220

Definition at line 64 of file global.h.

#define DTLSv12   1

Definition at line 36 of file global.h.

#define TLS_CERT_TYPE_RAW_PUBLIC_KEY   2 /* see RFC 7250 */

Definition at line 92 of file global.h.

#define TLS_CLIENT_CERTIFICATE_TYPE_ECDSA_SIGN   64 /* see RFC 4492 */

Definition at line 100 of file global.h.

#define TLS_EC_CURVE_TYPE_NAMED_CURVE   3 /* see RFC 4492 */

Definition at line 98 of file global.h.

#define TLS_EXT_CLIENT_CERTIFICATE_TYPE   19 /* see RFC 7250 */

Definition at line 88 of file global.h.

#define TLS_EXT_EC_POINT_FORMATS   11 /* see RFC 4492 */

Definition at line 86 of file global.h.

#define TLS_EXT_EC_POINT_FORMATS_UNCOMPRESSED   0 /* see RFC 4492 */

Definition at line 96 of file global.h.

#define TLS_EXT_ELLIPTIC_CURVES   10 /* see RFC 4492 */

Definition at line 85 of file global.h.

#define TLS_EXT_ELLIPTIC_CURVES_SECP256R1   23 /* see RFC 4492 */

Definition at line 94 of file global.h.

#define TLS_EXT_ENCRYPT_THEN_MAC   22 /* see RFC 7366 */

Definition at line 90 of file global.h.

#define TLS_EXT_SERVER_CERTIFICATE_TYPE   20 /* see RFC 7250 */

Definition at line 89 of file global.h.

#define TLS_EXT_SIG_HASH_ALGO   13 /* see RFC 5246 */

Definition at line 87 of file global.h.

#define TLS_EXT_SIG_HASH_ALGO_ECDSA   3 /* see RFC 5246 */

Definition at line 103 of file global.h.

#define TLS_EXT_SIG_HASH_ALGO_SHA256   4 /* see RFC 5246 */

Definition at line 102 of file global.h.

#define WITH_SHA256   1

Definition at line 42 of file global.h.

Typedef Documentation

typedef unsigned char uint16[2]

Definition at line 48 of file global.h.

typedef unsigned char uint24[3]

Definition at line 49 of file global.h.

typedef unsigned char uint32[4]

Definition at line 50 of file global.h.

typedef unsigned char uint48[6]

Definition at line 51 of file global.h.

typedef unsigned char uint8

Definition at line 47 of file global.h.

Enumeration Type Documentation

Known cipher suites.

Enumerator
TLS_NULL_WITH_NULL_NULL 

NULL cipher

TLS_PSK_WITH_AES_128_CCM_8 

see RFC 6655

TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 

see RFC 7251

Definition at line 74 of file global.h.

Known compression suites.

Enumerator
TLS_COMPRESSION_NULL 

Definition at line 81 of file global.h.

Function Documentation

static int dtls_fls ( unsigned int  i)
inlinestatic

Definition at line 139 of file global.h.

static int equals ( unsigned char *  a,
unsigned char *  b,
size_t  len 
)
inlinestatic

Compares len bytes from a with b in constant time. This functions always traverses the entire length to prevent timing attacks.

Parameters
aByte sequence to compare
bByte sequence to compare
lenNumber of bytes to compare.
Returns
1 if a and b are equal, 0 otherwise.

Definition at line 127 of file global.h.

static void memxor ( unsigned char *  x,
const unsigned char *  y,
size_t  n 
)
inlinestatic

XORs n bytes byte-by-byte starting at y to the memory area starting at x.

Definition at line 109 of file global.h.