]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Rename tls_connection_get_keys() to tls_connection_get_random()
authorJouni Malinen <j@w1.fi>
Sat, 1 Aug 2015 15:17:14 +0000 (18:17 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 2 Aug 2015 13:52:56 +0000 (16:52 +0300)
Commit 94f1fe6f6384a2ef379ef5b8cdc32a2fa01f8d13 ('Remove master key
extraction from tls_connection_get_keys()') left only fetching of
server/client random, but did not rename the function and structure to
minimize code changes. The only name is quite confusing, so rename this
through the repository to match the new purpose.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/crypto/tls.h
src/crypto/tls_gnutls.c
src/crypto/tls_internal.c
src/crypto/tls_none.c
src/crypto/tls_openssl.c
src/eap_peer/eap_tls_common.c
src/eap_server/eap_server_tls_common.c
src/tls/tlsv1_client.c
src/tls/tlsv1_client.h
src/tls/tlsv1_server.c
src/tls/tlsv1_server.h

index dbe9fd1e8cfaf3479888fa0ace48a83fef1e2455..5f1fcf2fb71c2b54f2d4986144fbede12e7ca55b 100644 (file)
@@ -11,7 +11,7 @@
 
 struct tls_connection;
 
-struct tls_keys {
+struct tls_random {
        const u8 *client_random;
        size_t client_random_len;
        const u8 *server_random;
@@ -312,15 +312,15 @@ int __must_check tls_connection_set_verify(void *tls_ctx,
                                           int verify_peer);
 
 /**
- * tls_connection_get_keys - Get random data from TLS connection
+ * tls_connection_get_random - Get random data from TLS connection
  * @tls_ctx: TLS context data from tls_init()
  * @conn: Connection context data from tls_connection_init()
- * @keys: Structure of client/server random data (filled on success)
+ * @data: Structure of client/server random data (filled on success)
  * Returns: 0 on success, -1 on failure
  */
-int __must_check tls_connection_get_keys(void *tls_ctx,
+int __must_check tls_connection_get_random(void *tls_ctx,
                                         struct tls_connection *conn,
-                                        struct tls_keys *keys);
+                                        struct tls_random *data);
 
 /**
  * tls_connection_prf - Use TLS-PRF to derive keying material
@@ -334,14 +334,11 @@ int __must_check tls_connection_get_keys(void *tls_ctx,
  * @out_len: Length of the output buffer
  * Returns: 0 on success, -1 on failure
  *
- * This function is optional to implement if tls_connection_get_keys() provides
- * access to master secret and server/client random values. If these values are
- * not exported from the TLS library, tls_connection_prf() is required so that
- * further keying material can be derived from the master secret. If not
- * implemented, the function will still need to be defined, but it can just
- * return -1. Example implementation of this function is in tls_prf_sha1_md5()
- * when it is called with seed set to client_random|server_random (or
- * server_random|client_random).
+ * tls_connection_prf() is required so that further keying material can be
+ * derived from the master secret. Example implementation of this function is in
+ * tls_prf_sha1_md5() when it is called with seed set to
+ * client_random|server_random (or server_random|client_random). For TLSv1.2 and
+ * newer, a different PRF is needed, though.
  */
 int __must_check  tls_connection_prf(void *tls_ctx,
                                     struct tls_connection *conn,
index 11be4c194e42f28347ceb3b18d519b0d7c52f9cf..b53ec4823a951894295c7e3de7898c33113a544b 100644 (file)
@@ -722,8 +722,8 @@ int tls_connection_set_verify(void *ssl_ctx, struct tls_connection *conn,
 }
 
 
-int tls_connection_get_keys(void *ssl_ctx, struct tls_connection *conn,
-                           struct tls_keys *keys)
+int tls_connection_get_random(void *ssl_ctx, struct tls_connection *conn,
+                           struct tls_random *keys)
 {
 #if GNUTLS_VERSION_NUMBER >= 0x030012
        gnutls_datum_t client, server;
index 9704a14ed25052da134ad53c34f17c6b7c708f48..df44f0a30115ddb03d078ba0d34238819a6ff614 100644 (file)
@@ -338,16 +338,16 @@ int tls_connection_set_verify(void *tls_ctx, struct tls_connection *conn,
 }
 
 
-int tls_connection_get_keys(void *tls_ctx, struct tls_connection *conn,
-                           struct tls_keys *keys)
+int tls_connection_get_random(void *tls_ctx, struct tls_connection *conn,
+                             struct tls_random *data)
 {
 #ifdef CONFIG_TLS_INTERNAL_CLIENT
        if (conn->client)
-               return tlsv1_client_get_keys(conn->client, keys);
+               return tlsv1_client_get_random(conn->client, data);
 #endif /* CONFIG_TLS_INTERNAL_CLIENT */
 #ifdef CONFIG_TLS_INTERNAL_SERVER
        if (conn->server)
-               return tlsv1_server_get_keys(conn->server, keys);
+               return tlsv1_server_get_random(conn->server, data);
 #endif /* CONFIG_TLS_INTERNAL_SERVER */
        return -1;
 }
index 9ca5f1c62da1b8795e7cbdbc1de90f25c49511ae..3474302981a17e82e687ac8914f61423233d476e 100644 (file)
@@ -78,8 +78,8 @@ int tls_connection_set_verify(void *tls_ctx, struct tls_connection *conn,
 }
 
 
-int tls_connection_get_keys(void *tls_ctx, struct tls_connection *conn,
-                           struct tls_keys *keys)
+int tls_connection_get_random(void *tls_ctx, struct tls_connection *conn,
+                             struct tls_random *data)
 {
        return -1;
 }
index 7dc41a5326383d770869c840e767d9a3d2a9d708..de163965e4726b5f2a229b8ccd327d700d55cf48 100644 (file)
@@ -2639,8 +2639,8 @@ static int tls_global_dh(SSL_CTX *ssl_ctx, const char *dh_file)
 }
 
 
-int tls_connection_get_keys(void *ssl_ctx, struct tls_connection *conn,
-                           struct tls_keys *keys)
+int tls_connection_get_random(void *ssl_ctx, struct tls_connection *conn,
+                             struct tls_random *keys)
 {
        SSL *ssl;
 
index 8e147196c75d5a6d5966d75f8ceca00c3e9dae8d..af2b7541d70168d909cc43b654fde4d3fd6d2a77 100644 (file)
@@ -347,10 +347,10 @@ u8 * eap_peer_tls_derive_session_id(struct eap_sm *sm,
                                    struct eap_ssl_data *data, u8 eap_type,
                                    size_t *len)
 {
-       struct tls_keys keys;
+       struct tls_random keys;
        u8 *out;
 
-       if (tls_connection_get_keys(sm->ssl_ctx, data->conn, &keys))
+       if (tls_connection_get_random(sm->ssl_ctx, data->conn, &keys))
                return NULL;
 
        if (keys.client_random == NULL || keys.server_random == NULL)
index 23498c99865044abe72bdfd0fa6693cd41f0edb9..3fc7cdc4215e33b7655412f207583ccd4466272e 100644 (file)
@@ -133,10 +133,10 @@ u8 * eap_server_tls_derive_session_id(struct eap_sm *sm,
                                      struct eap_ssl_data *data, u8 eap_type,
                                      size_t *len)
 {
-       struct tls_keys keys;
+       struct tls_random keys;
        u8 *out;
 
-       if (tls_connection_get_keys(sm->ssl_ctx, data->conn, &keys))
+       if (tls_connection_get_random(sm->ssl_ctx, data->conn, &keys))
                return NULL;
 
        if (keys.client_random == NULL || keys.server_random == NULL)
index 533286c12b9465d045bff92d12d1da94e38f0936..a6f0587e34c57854693d3bf093dcea518bc48837 100644 (file)
@@ -714,12 +714,12 @@ int tlsv1_client_hello_ext(struct tlsv1_client *conn, int ext_type,
 
 
 /**
- * tlsv1_client_get_keys - Get master key and random data from TLS connection
+ * tlsv1_client_get_random - Get random data from TLS connection
  * @conn: TLSv1 client connection data from tlsv1_client_init()
- * @keys: Structure of key/random data (filled on success)
+ * @keys: Structure of random data (filled on success)
  * Returns: 0 on success, -1 on failure
  */
-int tlsv1_client_get_keys(struct tlsv1_client *conn, struct tls_keys *keys)
+int tlsv1_client_get_random(struct tlsv1_client *conn, struct tls_random *keys)
 {
        os_memset(keys, 0, sizeof(*keys));
        if (conn->state == CLIENT_HELLO)
index 8ec85f1a9193601cdd1a8b3d0fbc6bac5f7879d0..a4e25e969937c6e3c2c578099ea2d2c98254ad48 100644 (file)
@@ -36,7 +36,7 @@ int tlsv1_client_shutdown(struct tlsv1_client *conn);
 int tlsv1_client_resumed(struct tlsv1_client *conn);
 int tlsv1_client_hello_ext(struct tlsv1_client *conn, int ext_type,
                           const u8 *data, size_t data_len);
-int tlsv1_client_get_keys(struct tlsv1_client *conn, struct tls_keys *keys);
+int tlsv1_client_get_random(struct tlsv1_client *conn, struct tls_random *data);
 int tlsv1_client_get_keyblock_size(struct tlsv1_client *conn);
 int tlsv1_client_set_cipher_list(struct tlsv1_client *conn, u8 *ciphers);
 int tlsv1_client_set_cred(struct tlsv1_client *conn,
index 4df756f7d79e4a7630578b759e956c036dbc902b..ba47337bcbb1187f6e44791609e39fb5c4811106 100644 (file)
@@ -610,12 +610,12 @@ int tlsv1_server_resumed(struct tlsv1_server *conn)
 
 
 /**
- * tlsv1_server_get_keys - Get master key and random data from TLS connection
+ * tlsv1_server_get_random - Get random data from TLS connection
  * @conn: TLSv1 server connection data from tlsv1_server_init()
- * @keys: Structure of key/random data (filled on success)
+ * @keys: Structure of random data (filled on success)
  * Returns: 0 on success, -1 on failure
  */
-int tlsv1_server_get_keys(struct tlsv1_server *conn, struct tls_keys *keys)
+int tlsv1_server_get_random(struct tlsv1_server *conn, struct tls_random *keys)
 {
        os_memset(keys, 0, sizeof(*keys));
        if (conn->state == CLIENT_HELLO)
index b2b28d1e1215a00b434a5f75ad8d9a819ad7acf3..10e7699312b06fe80dbcc3b16a87a130af8e1c8a 100644 (file)
@@ -32,7 +32,7 @@ int tlsv1_server_get_cipher(struct tlsv1_server *conn, char *buf,
                            size_t buflen);
 int tlsv1_server_shutdown(struct tlsv1_server *conn);
 int tlsv1_server_resumed(struct tlsv1_server *conn);
-int tlsv1_server_get_keys(struct tlsv1_server *conn, struct tls_keys *keys);
+int tlsv1_server_get_random(struct tlsv1_server *conn, struct tls_random *data);
 int tlsv1_server_get_keyblock_size(struct tlsv1_server *conn);
 int tlsv1_server_set_cipher_list(struct tlsv1_server *conn, u8 *ciphers);
 int tlsv1_server_set_verify(struct tlsv1_server *conn, int verify_peer);