EAP-TLS and EAP-TTLS use different constant MSK PRF label
authorAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 6 Aug 2010 15:33:46 +0000 (17:33 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 7 Aug 2010 09:26:04 +0000 (11:26 +0200)
src/libcharon/plugins/eap_tls/eap_tls.c
src/libcharon/plugins/eap_ttls/eap_ttls.c
src/libtls/tls.c
src/libtls/tls.h
src/libtls/tls_crypto.c
src/libtls/tls_crypto.h

index 453a4cc..03e0d58 100644 (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;
 }
index 96b4cff..fa812a1 100644 (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;
 }
index 4384c07..f8f7e84 100644 (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,
index 67ee742..923c87a 100644 (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_ @}*/
index 0bbfd81..b8eb87b 100644 (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);
index 5fe90d8..09f1a0e 100644 (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_ @}*/