29 RCSID(
"$Id: 7b7aa96359b1ecf54a963e6b1326ce9ad5aef1a4 $")
32 #define __STDC_WANT_LIB_EXT1__ 1
35 #include <freeradius-devel/util/sha1.h>
36 #include <freeradius-devel/tls/base.h>
37 #include <freeradius-devel/tls/log.h>
43 #include <openssl/hmac.h>
49 char const *keying_prf_label,
size_t keying_prf_label_len)
54 if (eap_tls_session->
tls_session->info.version == TLS1_3_VERSION) {
80 #define EAP_TLS_MPPE_KEY_LEN 32
92 if (SSL_export_keying_material(ssl,
out,
sizeof(
out),
98 fr_tls_log(request,
"Failed generating MPPE keys");
103 uint8_t random[SSL3_RANDOM_SIZE];
105 uint8_t master_key[SSL_MAX_MASTER_KEY_LENGTH];
106 size_t master_key_len;
108 RDEBUG3(
"Key Derivation Function input");
111 master_key_len = SSL_SESSION_get_master_key(SSL_get_session(ssl), master_key,
sizeof(master_key));
113 random_len = SSL_get_client_random(ssl, random, SSL3_RANDOM_SIZE);
115 random_len = SSL_get_server_random(ssl, random, SSL3_RANDOM_SIZE);
120 RDEBUG2(
"Adding session keys");
142 switch (SSL_SESSION_get_protocol_version(SSL_get_session(ssl))) {
150 random_based_session_id:
154 SSL_get_client_random(ssl, p, SSL3_RANDOM_SIZE);
155 p += SSL3_RANDOM_SIZE;
156 SSL_get_server_random(ssl, p, SSL3_RANDOM_SIZE);
168 if (SSL_export_keying_material(ssl, p, 64,
174 fr_tls_log(request,
"Failed generating TLS session ID");
#define USES_APPLE_DEPRECATED_API
void eap_crypto_prf_label_init(eap_tls_prf_label_t *prf_label, eap_session_t *eap_session, char const *keying_prf_label, size_t keying_prf_label_len)
Initialize the PRF label fields.
int eap_crypto_mppe_keys(request_t *request, SSL *ssl, eap_tls_prf_label_t *prf_label)
Generate keys according to RFC 5216 and add to the reply.
#define EAP_TLS_MPPE_KEY_LEN
int eap_crypto_tls_session_id(TALLOC_CTX *ctx, request_t *request, SSL *ssl, eap_tls_prf_label_t *prf_label, uint8_t **out, uint8_t eap_type)
HIDDEN fr_dict_attr_t const * attr_ms_mppe_send_key
HIDDEN fr_dict_attr_t const * attr_ms_mppe_recv_key
HIDDEN fr_dict_attr_t const * attr_eap_msk
HIDDEN fr_dict_attr_t const * attr_eap_emsk
void eap_add_reply(request_t *request, fr_dict_attr_t const *da, uint8_t const *value, int len)
void * opaque
Opaque data used by EAP methods.
eap_type_t type
EAP method number.
Tracks the progress of a single session of any EAP method.
#define REXDENT()
Exdent (unindent) R* messages by one level.
#define RDEBUG_ENABLED3
True if request debug level 1-3 messages are enabled.
#define RINDENT()
Indent R* messages by one level.
static char buff[sizeof("18446744073709551615")+3]
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
Generic EAP over TLS API.
fr_tls_session_t * tls_session
TLS session used to authenticate peer or tunnel sensitive data.
size_t keying_prf_label_len
length of the keying PRF label.
char const * keying_prf_label
PRF label to use for generating keying material.
size_t context_len
length of the context
uint8_t context[1]
for TLS 1.3 context, is the EAP Type code
char const * sessid_prf_label
PRF label to use when generating the session ID.
int use_context
for SSL_export_keying_material().
size_t sessid_prf_label_len
Length of the session ID PRF label.
Tracks the state of an EAP-TLS session.
Master include file to access all functions and structures in the library.
static size_t char ** out
#define fr_box_octets(_val, _len)