Browse Source

[tls] Display validator messages only while validation is in progress

Allow the cipherstream to report progress status messages during
connection establishment.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 5 years ago
parent
commit
7b63c1275f
2 changed files with 11 additions and 3 deletions
  1. 2
    0
      src/include/ipxe/tls.h
  2. 9
    3
      src/net/tls.c

+ 2
- 0
src/include/ipxe/tls.h View File

335
 	struct pending_operation client_negotiation;
335
 	struct pending_operation client_negotiation;
336
 	/** Server security negotiation pending operation */
336
 	/** Server security negotiation pending operation */
337
 	struct pending_operation server_negotiation;
337
 	struct pending_operation server_negotiation;
338
+	/** Certificate validation pending operation */
339
+	struct pending_operation validation;
338
 
340
 
339
 	/** TX sequence number */
341
 	/** TX sequence number */
340
 	uint64_t tx_seq;
342
 	uint64_t tx_seq;

+ 9
- 3
src/net/tls.c View File

382
 	/* Remove pending operations, if applicable */
382
 	/* Remove pending operations, if applicable */
383
 	pending_put ( &tls->client_negotiation );
383
 	pending_put ( &tls->client_negotiation );
384
 	pending_put ( &tls->server_negotiation );
384
 	pending_put ( &tls->server_negotiation );
385
+	pending_put ( &tls->validation );
385
 
386
 
386
 	/* Remove process */
387
 	/* Remove process */
387
 	process_del ( &tls->process );
388
 	process_del ( &tls->process );
950
 	assert ( ! tls->tx_pending );
951
 	assert ( ! tls->tx_pending );
951
 	assert ( ! is_pending ( &tls->client_negotiation ) );
952
 	assert ( ! is_pending ( &tls->client_negotiation ) );
952
 	assert ( ! is_pending ( &tls->server_negotiation ) );
953
 	assert ( ! is_pending ( &tls->server_negotiation ) );
954
+	assert ( ! is_pending ( &tls->validation ) );
953
 
955
 
954
 	/* (Re)initialise handshake context */
956
 	/* (Re)initialise handshake context */
955
 	digest_init ( &md5_sha1_algorithm, tls->handshake_md5_sha1_ctx );
957
 	digest_init ( &md5_sha1_algorithm, tls->handshake_md5_sha1_ctx );
1875
 		       "%s\n", tls, strerror ( rc ) );
1877
 		       "%s\n", tls, strerror ( rc ) );
1876
 		return rc;
1878
 		return rc;
1877
 	}
1879
 	}
1880
+	pending_get ( &tls->validation );
1878
 
1881
 
1879
 	return 0;
1882
 	return 0;
1880
 }
1883
 }
2582
 			  struct job_progress *progress ) {
2585
 			  struct job_progress *progress ) {
2583
 
2586
 
2584
 	/* Return cipherstream or validator progress as applicable */
2587
 	/* Return cipherstream or validator progress as applicable */
2585
-	if ( tls_ready ( tls ) ) {
2586
-		return job_progress ( &tls->cipherstream, progress );
2587
-	} else {
2588
+	if ( is_pending ( &tls->validation ) ) {
2588
 		return job_progress ( &tls->validator, progress );
2589
 		return job_progress ( &tls->validator, progress );
2590
+	} else {
2591
+		return job_progress ( &tls->cipherstream, progress );
2589
 	}
2592
 	}
2590
 }
2593
 }
2591
 
2594
 
2820
 	struct pubkey_algorithm *pubkey = cipherspec->suite->pubkey;
2823
 	struct pubkey_algorithm *pubkey = cipherspec->suite->pubkey;
2821
 	struct x509_certificate *cert;
2824
 	struct x509_certificate *cert;
2822
 
2825
 
2826
+	/* Mark validation as complete */
2827
+	pending_put ( &tls->validation );
2828
+
2823
 	/* Close validator interface */
2829
 	/* Close validator interface */
2824
 	intf_restart ( &tls->validator, rc );
2830
 	intf_restart ( &tls->validator, rc );
2825
 
2831
 

Loading…
Cancel
Save