wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions
tlsv1_common.c File Reference

TLSv1 common routines. More...

#include "includes.h"
#include "common.h"
#include "crypto/md5.h"
#include "crypto/sha1.h"
#include "crypto/sha256.h"
#include "x509v3.h"
#include "tlsv1_common.h"

Macros

#define NUM_TLS_CIPHER_SUITES   ARRAY_SIZE(tls_cipher_suites)
 
#define NUM_TLS_CIPHER_DATA   ARRAY_SIZE(tls_ciphers)
 

Functions

const struct tls_cipher_suitetls_get_cipher_suite (u16 suite)
 Get TLS cipher suite. More...
 
const 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. More...
 
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)
 
int tls_version_ok (u16 ver)
 
const char * tls_version_str (u16 ver)
 
int tls_prf (u16 ver, const u8 *secret, size_t secret_len, const char *label, const u8 *seed, size_t seed_len, u8 *out, size_t outlen)
 
int tls_key_x_server_params_hash (u16 tls_version, const u8 *client_random, const u8 *server_random, const u8 *server_params, size_t server_params_len, u8 *hash)
 
int tls_verify_signature (u16 tls_version, struct crypto_public_key *pk, const u8 *data, size_t data_len, const u8 *pos, size_t len, u8 *alert)
 

Detailed Description

TLSv1 common routines.

Function Documentation

const struct tls_cipher_suite* tls_get_cipher_suite ( u16  suite)

Get TLS cipher suite.

Parameters
suiteCipher suite identifier
Returns
Pointer to the cipher data or NULL if not found
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
bufASN.1 DER encoded certificate
lenLength of the buffer
pkBuffer 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().