tlsv1_common.h File Reference

TLSv1 common definitions. More...

#include "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.

Data Structures

struct  tls_cipher_suite
struct  tls_cipher_data
struct  tls_verify_hash

Defines

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

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_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
}
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_hash { TLS_HASH_NULL, TLS_HASH_MD5, TLS_HASH_SHA }
enum  tls_cipher_type { TLS_CIPHER_STREAM, TLS_CIPHER_BLOCK }

Functions

struct tls_cipher_suitetls_get_cipher_suite (u16 suite)
 Get TLS cipher suite.
struct tls_cipher_datatls_get_cipher_data (tls_cipher cipher)
int tls_server_key_exchange_allowed (tls_cipher cipher)
int tls_parse_cert (const u8 *buf, size_t len, struct crypto_public_key **pk)
 Parse DER encoded X.509 certificate and get public key.
int tls_verify_hash_init (struct tls_verify_hash *verify)
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)

Detailed Description

TLSv1 common definitions.

Copyright
Copyright (c) 2006-2007, Jouni Malinen <j@w1.fi>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

Alternatively, this software may be distributed under the terms of BSD license.

See README and COPYING for more details.

Definition in file tlsv1_common.h.


Function Documentation

struct tls_cipher_suite* tls_get_cipher_suite ( u16  suite  )  [read]

Get TLS cipher suite.

Parameters:
suite Cipher suite identifier
Returns:
Pointer to the cipher data or NULL if not found

Definition at line 93 of file tlsv1_common.c.

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

Parse DER encoded X.509 certificate and get public key.

Parameters:
buf ASN.1 DER encoded certificate
len Length of the buffer
pk 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 150 of file tlsv1_common.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Sat Nov 21 23:22:58 2009 for hostapd by  doxygen 1.6.1