EAP-TLS and EAP-TTLS use different constant MSK PRF label

This commit is contained in:
Andreas Steffen
2010-08-07 11:26:04 +02:00
parent b4d30a425e
commit a6444fcdd4
6 changed files with 20 additions and 9 deletions
+2 -1
View File
@@ -424,7 +424,8 @@ static eap_tls_t *eap_tls_create(identification_t *server,
},
.is_server = is_server,
);
this->tls = tls_create(is_server, server, peer);
/* MSK PRF ASCII constant label according to EAP-TLS RFC 5216 */
this->tls = tls_create(is_server, server, peer, "client EAP encryption");
return &this->public;
}
+2 -1
View File
@@ -424,7 +424,8 @@ static eap_ttls_t *eap_ttls_create(identification_t *server,
},
.is_server = is_server,
);
this->tls = tls_create(is_server, server, peer);
/* MSK PRF ASCII constant label according to EAP-TTLS RFC 5281 */
this->tls = tls_create(is_server, server, peer, "ttls keying material");
return &this->public;
}
+2 -2
View File
@@ -172,7 +172,7 @@ METHOD(tls_t, destroy, void,
* See header
*/
tls_t *tls_create(bool is_server, identification_t *server,
identification_t *peer)
identification_t *peer, char *msk_label)
{
private_tls_t *this;
@@ -193,7 +193,7 @@ tls_t *tls_create(bool is_server, identification_t *server,
.peer = peer->clone(peer),
);
this->crypto = tls_crypto_create(&this->public);
this->crypto = tls_crypto_create(&this->public, msk_label);
if (is_server)
{
this->handshake = &tls_server_create(&this->public, this->crypto,
+2 -1
View File
@@ -162,9 +162,10 @@ struct tls_t {
* @param is_server TRUE to act as server, FALSE for client
* @param server server identity
* @param peer peer identity
* @param msk_label ASCII string constant used as seed for MSK PRF
* @return TLS stack
*/
tls_t *tls_create(bool is_server, identification_t *server,
identification_t *peer);
identification_t *peer, char *msk_label);
#endif /** TLS_H_ @}*/
+9 -3
View File
@@ -316,9 +316,14 @@ struct private_tls_crypto_t {
chunk_t iv_out;
/**
* EAP-TLS MSK
* EAP-[T]TLS MSK
*/
chunk_t msk;
/**
* ASCII string constant used as seed for EAP-[T]TLS MSK PRF
*/
char *msk_label;
};
typedef struct {
@@ -855,7 +860,7 @@ METHOD(tls_crypto_t, derive_eap_msk, void,
seed = chunk_cata("cc", client_random, server_random);
free(this->msk.ptr);
this->msk = chunk_alloc(64);
this->prf->get_bytes(this->prf, "client EAP encryption", seed,
this->prf->get_bytes(this->prf, this->msk_label, seed,
this->msk.len, this->msk.ptr);
}
@@ -884,7 +889,7 @@ METHOD(tls_crypto_t, destroy, void,
/**
* See header
*/
tls_crypto_t *tls_crypto_create(tls_t *tls)
tls_crypto_t *tls_crypto_create(tls_t *tls, char *msk_label)
{
private_tls_crypto_t *this;
@@ -904,6 +909,7 @@ tls_crypto_t *tls_crypto_create(tls_t *tls)
.destroy = _destroy,
},
.tls = tls,
.msk_label = msk_label
);
build_cipher_suite_list(this);
+3 -1
View File
@@ -359,7 +359,9 @@ struct tls_crypto_t {
/**
* Create a tls_crypto instance.
*
* @param msk_label ASCII string constant used as seed for MSK PRF
*/
tls_crypto_t *tls_crypto_create(tls_t *tls);
tls_crypto_t *tls_crypto_create(tls_t *tls, char *msk_label);
#endif /** TLS_CRYPTO_H_ @}*/