blob: c2cb1757f83c08109f815c0504cc9880effd4701 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
* Copyright (C) 2010 Martin Willi
* Copyright (C) 2010 revosec AG
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup tls_crypto tls_crypto
* @{ @ingroup tls
*/
#ifndef TLS_CRYPTO_H_
#define TLS_CRYPTO_H_
typedef struct tls_crypto_t tls_crypto_t;
#include "tls.h"
#include "tls_prf.h"
/**
* TLS crypto helper functions.
*/
struct tls_crypto_t {
/**
* Get a list of supported TLS cipher suites.
*
* @param suites list of suites, points to internal data
* @return number of suites returned
*/
int (*get_cipher_suites)(tls_crypto_t *this, tls_cipher_suite_t **suites);
/**
* Select and store a cipher suite from a given list of candidates.
*
* @param suites list of candidates to select from
* @param count number of suites
* @return selected suite, 0 if none acceptable
*/
tls_cipher_suite_t (*select_cipher_suite)(tls_crypto_t *this,
tls_cipher_suite_t *suites, int count);
/**
* Derive the master secret and load it into the PRF.
*
* @param premaster premaster secret
* @param client_random random data from client hello
* @param server_random random data from server hello
*/
void (*derive_master_secret)(tls_crypto_t *this, chunk_t premaster,
chunk_t client_random, chunk_t server_random);
/**
* Get the connection state PRF.
*
* @return PRF, NULL if not supported
*/
tls_prf_t* (*get_prf)(tls_crypto_t *this);
/**
* Destroy a tls_crypto_t.
*/
void (*destroy)(tls_crypto_t *this);
};
/**
* Create a tls_crypto instance.
*/
tls_crypto_t *tls_crypto_create(tls_t *tls);
#endif /** TLS_CRYPTO_H_ @}*/
|