[x509] Record root of trust used when validating a certificate
Record the root of trust used at the point that a certificate is validated, redefine validation as checking a certificate against a specific root of trust, and pass an explicit root of trust when creating a TLS connection. This allows a custom TLS connection to be used with a custom root of trust, without causing any validated certificates to be treated as valid for normal purposes. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -943,6 +943,10 @@ static void x509_validate_chain_okx ( struct x509_test_chain *chn, time_t time,
|
||||
x509_invalidate_chain ( chn->chain );
|
||||
okx ( x509_validate_chain ( chn->chain, time, store, root ) == 0,
|
||||
file, line );
|
||||
okx ( x509_is_valid ( chn->certs[0]->cert, root ),
|
||||
file, line );
|
||||
okx ( ! x509_is_valid ( chn->certs[0]->cert, &dummy_root ),
|
||||
file, line );
|
||||
}
|
||||
#define x509_validate_chain_ok( chn, time, store, root ) \
|
||||
x509_validate_chain_okx ( chn, time, store, root, __FILE__, __LINE__ )
|
||||
|
||||
Reference in New Issue
Block a user