mirror of
https://github.com/ipxe/ipxe
synced 2026-02-05 08:53:52 +03:00
[x509] Make root of trust a reference-counted structure
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -380,6 +380,7 @@ static void free_tls ( struct refcnt *refcnt ) {
|
||||
}
|
||||
x509_chain_put ( tls->certs );
|
||||
x509_chain_put ( tls->chain );
|
||||
x509_root_put ( tls->root );
|
||||
|
||||
/* Drop reference to session */
|
||||
assert ( list_empty ( &tls->list ) );
|
||||
@@ -3163,7 +3164,7 @@ int add_tls ( struct interface *xfer, const char *name,
|
||||
intf_init ( &tls->validator, &tls_validator_desc, &tls->refcnt );
|
||||
process_init_stopped ( &tls->process, &tls_process_desc,
|
||||
&tls->refcnt );
|
||||
tls->root = root;
|
||||
tls->root = x509_root_get ( root );
|
||||
tls->version = TLS_VERSION_TLS_1_2;
|
||||
tls_clear_cipher ( tls, &tls->tx_cipherspec );
|
||||
tls_clear_cipher ( tls, &tls->tx_cipherspec_pending );
|
||||
|
||||
@@ -116,6 +116,7 @@ static void validator_free ( struct refcnt *refcnt ) {
|
||||
|
||||
DBGC2 ( validator, "VALIDATOR %p \"%s\" freed\n",
|
||||
validator, validator_name ( validator ) );
|
||||
x509_root_put ( validator->root );
|
||||
x509_chain_put ( validator->chain );
|
||||
ocsp_put ( validator->ocsp );
|
||||
xferbuf_free ( &validator->buffer );
|
||||
@@ -650,7 +651,7 @@ int create_validator ( struct interface *job, struct x509_chain *chain,
|
||||
&validator->refcnt );
|
||||
process_init ( &validator->process, &validator_process_desc,
|
||||
&validator->refcnt );
|
||||
validator->root = root;
|
||||
validator->root = x509_root_get ( root );
|
||||
validator->chain = x509_chain_get ( chain );
|
||||
xferbuf_malloc_init ( &validator->buffer );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user