tlsv1_common.h File Reference

#include "crypto/crypto.h"
Include dependency graph for tlsv1_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tls_cipher_data
struct  tls_cipher_suite
struct  tls_verify_hash

Defines

#define TLS_ALERT_ACCESS_DENIED   49
#define TLS_ALERT_BAD_CERTIFICATE   42
#define TLS_ALERT_BAD_CERTIFICATE_HASH_VALUE   114
#define TLS_ALERT_BAD_CERTIFICATE_STATUS_RESPONSE   113
#define TLS_ALERT_BAD_RECORD_MAC   20
#define TLS_ALERT_CERTIFICATE_EXPIRED   45
#define TLS_ALERT_CERTIFICATE_REVOKED   44
#define TLS_ALERT_CERTIFICATE_UNKNOWN   46
#define TLS_ALERT_CERTIFICATE_UNOBTAINABLE   111
#define TLS_ALERT_CLOSE_NOTIFY   0
#define TLS_ALERT_DECODE_ERROR   50
#define TLS_ALERT_DECOMPRESSION_FAILURE   30
#define TLS_ALERT_DECRYPT_ERROR   51
#define TLS_ALERT_DECRYPTION_FAILED   21
#define TLS_ALERT_EXPORT_RESTRICTION   60
#define TLS_ALERT_HANDSHAKE_FAILURE   40
#define TLS_ALERT_ILLEGAL_PARAMETER   47
#define TLS_ALERT_INSUFFICIENT_SECURITY   71
#define TLS_ALERT_INTERNAL_ERROR   80
#define TLS_ALERT_LEVEL_FATAL   2
#define TLS_ALERT_LEVEL_WARNING   1
#define TLS_ALERT_NO_RENEGOTIATION   100
#define TLS_ALERT_PROTOCOL_VERSION   70
#define TLS_ALERT_RECORD_OVERFLOW   22
#define TLS_ALERT_UNEXPECTED_MESSAGE   10
#define TLS_ALERT_UNKNOWN_CA   48
#define TLS_ALERT_UNRECOGNIZED_NAME   112
#define TLS_ALERT_UNSUPPORTED_CERTIFICATE   43
#define TLS_ALERT_UNSUPPORTED_EXTENSION   110
#define TLS_ALERT_USER_CANCELED   90
#define TLS_COMPRESSION_NULL   0
#define TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA   0x0019
#define TLS_DH_anon_EXPORT_WITH_RC4_40_MD5   0x0017
#define TLS_DH_anon_WITH_3DES_EDE_CBC_SHA   0x001B
#define TLS_DH_anon_WITH_AES_128_CBC_SHA   0x0034
#define TLS_DH_anon_WITH_AES_256_CBC_SHA   0x003A
#define TLS_DH_anon_WITH_DES_CBC_SHA   0x001A
#define TLS_DH_anon_WITH_RC4_128_MD5   0x0018
#define TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA   0x000B
#define TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA   0x000D
#define TLS_DH_DSS_WITH_AES_128_CBC_SHA   0x0030
#define TLS_DH_DSS_WITH_AES_256_CBC_SHA   0x0036
#define TLS_DH_DSS_WITH_DES_CBC_SHA   0x000C
#define TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA   0x000E
#define TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA   0x0010
#define TLS_DH_RSA_WITH_AES_128_CBC_SHA   0x0031
#define TLS_DH_RSA_WITH_AES_256_CBC_SHA   0x0037
#define TLS_DH_RSA_WITH_DES_CBC_SHA   0x000F
#define TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA   0x0011
#define TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA   0x0013
#define TLS_DHE_DSS_WITH_AES_128_CBC_SHA   0x0032
#define TLS_DHE_DSS_WITH_AES_256_CBC_SHA   0x0038
#define TLS_DHE_DSS_WITH_DES_CBC_SHA   0x0012
#define TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA   0x0014
#define TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA   0x0016
#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA   0x0033
#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA   0x0039
#define TLS_DHE_RSA_WITH_DES_CBC_SHA   0x0015
#define TLS_EXT_CLIENT_CERTIFICATE_URL   2
#define TLS_EXT_MAX_FRAGMENT_LENGTH   1
#define TLS_EXT_PAC_OPAQUE   TLS_EXT_SESSION_TICKET
#define TLS_EXT_SERVER_NAME   0
#define TLS_EXT_SESSION_TICKET   35
#define TLS_EXT_STATUS_REQUEST   5
#define TLS_EXT_TRUNCATED_HMAC   4
#define TLS_EXT_TRUSTED_CA_KEYS   3
#define TLS_MASTER_SECRET_LEN   48
#define TLS_NULL_WITH_NULL_NULL   0x0000
#define TLS_PRE_MASTER_SECRET_LEN   48
#define TLS_RANDOM_LEN   32
#define TLS_RSA_EXPORT_WITH_DES40_CBC_SHA   0x0008
#define TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5   0x0006
#define TLS_RSA_EXPORT_WITH_RC4_40_MD5   0x0003
#define TLS_RSA_WITH_3DES_EDE_CBC_SHA   0x000A
#define TLS_RSA_WITH_AES_128_CBC_SHA   0x002F
#define TLS_RSA_WITH_AES_256_CBC_SHA   0x0035
#define TLS_RSA_WITH_DES_CBC_SHA   0x0009
#define TLS_RSA_WITH_IDEA_CBC_SHA   0x0007
#define TLS_RSA_WITH_NULL_MD5   0x0001
#define TLS_RSA_WITH_NULL_SHA   0x0002
#define TLS_RSA_WITH_RC4_128_MD5   0x0004
#define TLS_RSA_WITH_RC4_128_SHA   0x0005
#define TLS_SESSION_ID_MAX_LEN   32
#define TLS_VERIFY_DATA_LEN   12
#define TLS_VERSION   0x0301

Enumerations

enum  {
  TLS_HANDSHAKE_TYPE_HELLO_REQUEST = 0, TLS_HANDSHAKE_TYPE_CLIENT_HELLO = 1, TLS_HANDSHAKE_TYPE_SERVER_HELLO = 2, TLS_HANDSHAKE_TYPE_NEW_SESSION_TICKET = 4,
  TLS_HANDSHAKE_TYPE_CERTIFICATE = 11, TLS_HANDSHAKE_TYPE_SERVER_KEY_EXCHANGE = 12, TLS_HANDSHAKE_TYPE_CERTIFICATE_REQUEST = 13, TLS_HANDSHAKE_TYPE_SERVER_HELLO_DONE = 14,
  TLS_HANDSHAKE_TYPE_CERTIFICATE_VERIFY = 15, TLS_HANDSHAKE_TYPE_CLIENT_KEY_EXCHANGE = 16, TLS_HANDSHAKE_TYPE_FINISHED = 20, TLS_HANDSHAKE_TYPE_CERTIFICATE_URL = 21,
  TLS_HANDSHAKE_TYPE_CERTIFICATE_STATUS = 22
}
enum  { TLS_CHANGE_CIPHER_SPEC = 1 }
enum  tls_cipher {
  TLS_CIPHER_NULL, TLS_CIPHER_RC4_40, TLS_CIPHER_RC4_128, TLS_CIPHER_RC2_CBC_40,
  TLS_CIPHER_IDEA_CBC, TLS_CIPHER_DES40_CBC, TLS_CIPHER_DES_CBC, TLS_CIPHER_3DES_EDE_CBC,
  TLS_CIPHER_AES_128_CBC, TLS_CIPHER_AES_256_CBC
}
enum  tls_cipher_type { TLS_CIPHER_STREAM, TLS_CIPHER_BLOCK }
enum  tls_hash { TLS_HASH_NULL, TLS_HASH_MD5, TLS_HASH_SHA }
enum  tls_key_exchange {
  TLS_KEY_X_NULL, TLS_KEY_X_RSA, TLS_KEY_X_RSA_EXPORT, TLS_KEY_X_DH_DSS_EXPORT,
  TLS_KEY_X_DH_DSS, TLS_KEY_X_DH_RSA_EXPORT, TLS_KEY_X_DH_RSA, TLS_KEY_X_DHE_DSS_EXPORT,
  TLS_KEY_X_DHE_DSS, TLS_KEY_X_DHE_RSA_EXPORT, TLS_KEY_X_DHE_RSA, TLS_KEY_X_DH_anon_EXPORT,
  TLS_KEY_X_DH_anon
}

Functions

struct tls_cipher_datatls_get_cipher_data (tls_cipher cipher)
struct tls_cipher_suitetls_get_cipher_suite (u16 suite)
int tls_parse_cert (const u8 *buf, size_t len, struct crypto_public_key **pk)
int tls_server_key_exchange_allowed (tls_cipher cipher)
void tls_verify_hash_add (struct tls_verify_hash *verify, const u8 *buf, size_t len)
void tls_verify_hash_free (struct tls_verify_hash *verify)
int tls_verify_hash_init (struct tls_verify_hash *verify)

Define Documentation

#define TLS_ALERT_ACCESS_DENIED   49

Definition at line 108 of file tlsv1_common.h.

#define TLS_ALERT_BAD_CERTIFICATE   42

Definition at line 101 of file tlsv1_common.h.

#define TLS_ALERT_BAD_CERTIFICATE_HASH_VALUE   114

Definition at line 121 of file tlsv1_common.h.

#define TLS_ALERT_BAD_CERTIFICATE_STATUS_RESPONSE   113

Definition at line 120 of file tlsv1_common.h.

#define TLS_ALERT_BAD_RECORD_MAC   20

Definition at line 96 of file tlsv1_common.h.

#define TLS_ALERT_CERTIFICATE_EXPIRED   45

Definition at line 104 of file tlsv1_common.h.

#define TLS_ALERT_CERTIFICATE_REVOKED   44

Definition at line 103 of file tlsv1_common.h.

#define TLS_ALERT_CERTIFICATE_UNKNOWN   46

Definition at line 105 of file tlsv1_common.h.

#define TLS_ALERT_CERTIFICATE_UNOBTAINABLE   111

Definition at line 118 of file tlsv1_common.h.

#define TLS_ALERT_CLOSE_NOTIFY   0

Definition at line 94 of file tlsv1_common.h.

#define TLS_ALERT_DECODE_ERROR   50

Definition at line 109 of file tlsv1_common.h.

#define TLS_ALERT_DECOMPRESSION_FAILURE   30

Definition at line 99 of file tlsv1_common.h.

#define TLS_ALERT_DECRYPT_ERROR   51

Definition at line 110 of file tlsv1_common.h.

#define TLS_ALERT_DECRYPTION_FAILED   21

Definition at line 97 of file tlsv1_common.h.

#define TLS_ALERT_EXPORT_RESTRICTION   60

Definition at line 111 of file tlsv1_common.h.

#define TLS_ALERT_HANDSHAKE_FAILURE   40

Definition at line 100 of file tlsv1_common.h.

#define TLS_ALERT_ILLEGAL_PARAMETER   47

Definition at line 106 of file tlsv1_common.h.

#define TLS_ALERT_INSUFFICIENT_SECURITY   71

Definition at line 113 of file tlsv1_common.h.

#define TLS_ALERT_INTERNAL_ERROR   80

Definition at line 114 of file tlsv1_common.h.

#define TLS_ALERT_LEVEL_FATAL   2

Definition at line 91 of file tlsv1_common.h.

#define TLS_ALERT_LEVEL_WARNING   1

Definition at line 90 of file tlsv1_common.h.

#define TLS_ALERT_NO_RENEGOTIATION   100

Definition at line 116 of file tlsv1_common.h.

#define TLS_ALERT_PROTOCOL_VERSION   70

Definition at line 112 of file tlsv1_common.h.

#define TLS_ALERT_RECORD_OVERFLOW   22

Definition at line 98 of file tlsv1_common.h.

#define TLS_ALERT_UNEXPECTED_MESSAGE   10

Definition at line 95 of file tlsv1_common.h.

#define TLS_ALERT_UNKNOWN_CA   48

Definition at line 107 of file tlsv1_common.h.

#define TLS_ALERT_UNRECOGNIZED_NAME   112

Definition at line 119 of file tlsv1_common.h.

#define TLS_ALERT_UNSUPPORTED_CERTIFICATE   43

Definition at line 102 of file tlsv1_common.h.

#define TLS_ALERT_UNSUPPORTED_EXTENSION   110

Definition at line 117 of file tlsv1_common.h.

#define TLS_ALERT_USER_CANCELED   90

Definition at line 115 of file tlsv1_common.h.

#define TLS_COMPRESSION_NULL   0

Definition at line 87 of file tlsv1_common.h.

#define TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA   0x0019

Definition at line 70 of file tlsv1_common.h.

#define TLS_DH_anon_EXPORT_WITH_RC4_40_MD5   0x0017

Definition at line 68 of file tlsv1_common.h.

#define TLS_DH_anon_WITH_3DES_EDE_CBC_SHA   0x001B

Definition at line 72 of file tlsv1_common.h.

#define TLS_DH_anon_WITH_AES_128_CBC_SHA   0x0034

Definition at line 78 of file tlsv1_common.h.

#define TLS_DH_anon_WITH_AES_256_CBC_SHA   0x003A

Definition at line 84 of file tlsv1_common.h.

#define TLS_DH_anon_WITH_DES_CBC_SHA   0x001A

Definition at line 71 of file tlsv1_common.h.

#define TLS_DH_anon_WITH_RC4_128_MD5   0x0018

Definition at line 69 of file tlsv1_common.h.

#define TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA   0x000B

Definition at line 56 of file tlsv1_common.h.

#define TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA   0x000D

Definition at line 58 of file tlsv1_common.h.

#define TLS_DH_DSS_WITH_AES_128_CBC_SHA   0x0030

Definition at line 74 of file tlsv1_common.h.

#define TLS_DH_DSS_WITH_AES_256_CBC_SHA   0x0036

Definition at line 80 of file tlsv1_common.h.

#define TLS_DH_DSS_WITH_DES_CBC_SHA   0x000C

Definition at line 57 of file tlsv1_common.h.

#define TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA   0x000E

Definition at line 59 of file tlsv1_common.h.

#define TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA   0x0010

Definition at line 61 of file tlsv1_common.h.

#define TLS_DH_RSA_WITH_AES_128_CBC_SHA   0x0031

Definition at line 75 of file tlsv1_common.h.

#define TLS_DH_RSA_WITH_AES_256_CBC_SHA   0x0037

Definition at line 81 of file tlsv1_common.h.

#define TLS_DH_RSA_WITH_DES_CBC_SHA   0x000F

Definition at line 60 of file tlsv1_common.h.

#define TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA   0x0011

Definition at line 62 of file tlsv1_common.h.

#define TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA   0x0013

Definition at line 64 of file tlsv1_common.h.

#define TLS_DHE_DSS_WITH_AES_128_CBC_SHA   0x0032

Definition at line 76 of file tlsv1_common.h.

#define TLS_DHE_DSS_WITH_AES_256_CBC_SHA   0x0038

Definition at line 82 of file tlsv1_common.h.

#define TLS_DHE_DSS_WITH_DES_CBC_SHA   0x0012

Definition at line 63 of file tlsv1_common.h.

#define TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA   0x0014

Definition at line 65 of file tlsv1_common.h.

#define TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA   0x0016

Definition at line 67 of file tlsv1_common.h.

#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA   0x0033

Definition at line 77 of file tlsv1_common.h.

#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA   0x0039

Definition at line 83 of file tlsv1_common.h.

#define TLS_DHE_RSA_WITH_DES_CBC_SHA   0x0015

Definition at line 66 of file tlsv1_common.h.

#define TLS_EXT_CLIENT_CERTIFICATE_URL   2

Definition at line 131 of file tlsv1_common.h.

#define TLS_EXT_MAX_FRAGMENT_LENGTH   1

Definition at line 130 of file tlsv1_common.h.

#define TLS_EXT_PAC_OPAQUE   TLS_EXT_SESSION_TICKET

Definition at line 137 of file tlsv1_common.h.

#define TLS_EXT_SERVER_NAME   0

Definition at line 129 of file tlsv1_common.h.

#define TLS_EXT_SESSION_TICKET   35

Definition at line 135 of file tlsv1_common.h.

#define TLS_EXT_STATUS_REQUEST   5

Definition at line 134 of file tlsv1_common.h.

#define TLS_EXT_TRUNCATED_HMAC   4

Definition at line 133 of file tlsv1_common.h.

#define TLS_EXT_TRUSTED_CA_KEYS   3

Definition at line 132 of file tlsv1_common.h.

#define TLS_MASTER_SECRET_LEN   48

Definition at line 23 of file tlsv1_common.h.

#define TLS_NULL_WITH_NULL_NULL   0x0000

Definition at line 45 of file tlsv1_common.h.

#define TLS_PRE_MASTER_SECRET_LEN   48

Definition at line 22 of file tlsv1_common.h.

#define TLS_RANDOM_LEN   32

Definition at line 21 of file tlsv1_common.h.

#define TLS_RSA_EXPORT_WITH_DES40_CBC_SHA   0x0008

Definition at line 53 of file tlsv1_common.h.

#define TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5   0x0006

Definition at line 51 of file tlsv1_common.h.

#define TLS_RSA_EXPORT_WITH_RC4_40_MD5   0x0003

Definition at line 48 of file tlsv1_common.h.

#define TLS_RSA_WITH_3DES_EDE_CBC_SHA   0x000A

Definition at line 55 of file tlsv1_common.h.

#define TLS_RSA_WITH_AES_128_CBC_SHA   0x002F

Definition at line 73 of file tlsv1_common.h.

#define TLS_RSA_WITH_AES_256_CBC_SHA   0x0035

Definition at line 79 of file tlsv1_common.h.

#define TLS_RSA_WITH_DES_CBC_SHA   0x0009

Definition at line 54 of file tlsv1_common.h.

#define TLS_RSA_WITH_IDEA_CBC_SHA   0x0007

Definition at line 52 of file tlsv1_common.h.

#define TLS_RSA_WITH_NULL_MD5   0x0001

Definition at line 46 of file tlsv1_common.h.

#define TLS_RSA_WITH_NULL_SHA   0x0002

Definition at line 47 of file tlsv1_common.h.

#define TLS_RSA_WITH_RC4_128_MD5   0x0004

Definition at line 49 of file tlsv1_common.h.

#define TLS_RSA_WITH_RC4_128_SHA   0x0005

Definition at line 50 of file tlsv1_common.h.

#define TLS_SESSION_ID_MAX_LEN   32

Definition at line 24 of file tlsv1_common.h.

#define TLS_VERIFY_DATA_LEN   12

Definition at line 25 of file tlsv1_common.h.

#define TLS_VERSION   0x0301

Definition at line 20 of file tlsv1_common.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
TLS_HANDSHAKE_TYPE_HELLO_REQUEST 
TLS_HANDSHAKE_TYPE_CLIENT_HELLO 
TLS_HANDSHAKE_TYPE_SERVER_HELLO 
TLS_HANDSHAKE_TYPE_NEW_SESSION_TICKET 
TLS_HANDSHAKE_TYPE_CERTIFICATE 
TLS_HANDSHAKE_TYPE_SERVER_KEY_EXCHANGE 
TLS_HANDSHAKE_TYPE_CERTIFICATE_REQUEST 
TLS_HANDSHAKE_TYPE_SERVER_HELLO_DONE 
TLS_HANDSHAKE_TYPE_CERTIFICATE_VERIFY 
TLS_HANDSHAKE_TYPE_CLIENT_KEY_EXCHANGE 
TLS_HANDSHAKE_TYPE_FINISHED 
TLS_HANDSHAKE_TYPE_CERTIFICATE_URL 
TLS_HANDSHAKE_TYPE_CERTIFICATE_STATUS 

Definition at line 28 of file tlsv1_common.h.

anonymous enum
Enumerator:
TLS_CHANGE_CIPHER_SPEC 

Definition at line 124 of file tlsv1_common.h.

enum tls_cipher
Enumerator:
TLS_CIPHER_NULL 
TLS_CIPHER_RC4_40 
TLS_CIPHER_RC4_128 
TLS_CIPHER_RC2_CBC_40 
TLS_CIPHER_IDEA_CBC 
TLS_CIPHER_DES40_CBC 
TLS_CIPHER_DES_CBC 
TLS_CIPHER_3DES_EDE_CBC 
TLS_CIPHER_AES_128_CBC 
TLS_CIPHER_AES_256_CBC 

Definition at line 156 of file tlsv1_common.h.

Enumerator:
TLS_CIPHER_STREAM 
TLS_CIPHER_BLOCK 

Definition at line 182 of file tlsv1_common.h.

enum tls_hash
Enumerator:
TLS_HASH_NULL 
TLS_HASH_MD5 
TLS_HASH_SHA 

Definition at line 169 of file tlsv1_common.h.

Enumerator:
TLS_KEY_X_NULL 
TLS_KEY_X_RSA 
TLS_KEY_X_RSA_EXPORT 
TLS_KEY_X_DH_DSS_EXPORT 
TLS_KEY_X_DH_DSS 
TLS_KEY_X_DH_RSA_EXPORT 
TLS_KEY_X_DH_RSA 
TLS_KEY_X_DHE_DSS_EXPORT 
TLS_KEY_X_DHE_DSS 
TLS_KEY_X_DHE_RSA_EXPORT 
TLS_KEY_X_DHE_RSA 
TLS_KEY_X_DH_anon_EXPORT 
TLS_KEY_X_DH_anon 

Definition at line 140 of file tlsv1_common.h.


Function Documentation

struct tls_cipher_data* tls_get_cipher_data ( tls_cipher  cipher  )  [read]

Definition at line 101 of file tlsv1_common.c.

struct tls_cipher_suite* tls_get_cipher_suite ( u16  suite  )  [read]

tls_get_cipher_suite - Get TLS cipher suite : Cipher suite identifier Returns: Pointer to the cipher data or NULL if not found

Definition at line 91 of file tlsv1_common.c.

int tls_parse_cert ( const u8 buf,
size_t  len,
struct crypto_public_key **  pk 
)

tls_parse_cert - Parse DER encoded X.509 certificate and get public key : ASN.1 DER encoded certificate : Length of the buffer : Buffer for returning the allocated public key Returns: 0 on success, -1 on failure

This functions parses an ASN.1 DER encoded X.509 certificate and retrieves the public key from it. The caller is responsible for freeing the public key by calling crypto_public_key_free().

Definition at line 147 of file tlsv1_common.c.

int tls_server_key_exchange_allowed ( tls_cipher  cipher  ) 

Definition at line 111 of file tlsv1_common.c.

void tls_verify_hash_add ( struct tls_verify_hash verify,
const u8 buf,
size_t  len 
)

Definition at line 209 of file tlsv1_common.c.

void tls_verify_hash_free ( struct tls_verify_hash verify  ) 

Definition at line 227 of file tlsv1_common.c.

int tls_verify_hash_init ( struct tls_verify_hash verify  ) 

Definition at line 190 of file tlsv1_common.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Fri Jan 11 10:05:01 2013