diff options
author | Michael Brown | 2016-08-25 16:41:57 +0200 |
---|---|---|
committer | Michael Brown | 2016-08-25 16:41:57 +0200 |
commit | ff28b22568ebc2cb885beae5d0c95ddcf94dca8a (patch) | |
tree | 56b4698a7e833c37b4ba2bf1feb1dbb9824bd8a0 /src/crypto | |
parent | [crypto] Add image_x509() to extract X.509 certificates from image (diff) | |
download | ipxe-ff28b22568ebc2cb885beae5d0c95ddcf94dca8a.tar.gz ipxe-ff28b22568ebc2cb885beae5d0c95ddcf94dca8a.tar.xz ipxe-ff28b22568ebc2cb885beae5d0c95ddcf94dca8a.zip |
[crypto] Generalise X.509 "valid" field to a "flags" field
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/ocsp.c | 2 | ||||
-rw-r--r-- | src/crypto/x509.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/crypto/ocsp.c b/src/crypto/ocsp.c index e7adcdba..b83f4c03 100644 --- a/src/crypto/ocsp.c +++ b/src/crypto/ocsp.c @@ -282,7 +282,7 @@ int ocsp_check ( struct x509_certificate *cert, /* Sanity checks */ assert ( cert != NULL ); assert ( issuer != NULL ); - assert ( issuer->valid ); + assert ( x509_is_valid ( issuer ) ); /* Allocate and initialise check */ *ocsp = zalloc ( sizeof ( **ocsp ) ); diff --git a/src/crypto/x509.c b/src/crypto/x509.c index 28267191..4d951509 100644 --- a/src/crypto/x509.c +++ b/src/crypto/x509.c @@ -1320,7 +1320,7 @@ int x509_validate ( struct x509_certificate *cert, root = &root_certificates; /* Return success if certificate has already been validated */ - if ( cert->valid ) + if ( x509_is_valid ( cert ) ) return 0; /* Fail if certificate is invalid at specified time */ @@ -1329,7 +1329,7 @@ int x509_validate ( struct x509_certificate *cert, /* Succeed if certificate is a trusted root certificate */ if ( x509_check_root ( cert, root ) == 0 ) { - cert->valid = 1; + cert->flags |= X509_FL_VALIDATED; cert->path_remaining = ( cert->extensions.basic.path_len + 1 ); return 0; } @@ -1342,7 +1342,7 @@ int x509_validate ( struct x509_certificate *cert, } /* Fail unless issuer has already been validated */ - if ( ! issuer->valid ) { + if ( ! x509_is_valid ( issuer ) ) { DBGC ( cert, "X509 %p \"%s\" ", cert, x509_name ( cert ) ); DBGC ( cert, "issuer %p \"%s\" has not yet been validated\n", issuer, x509_name ( issuer ) ); @@ -1376,7 +1376,7 @@ int x509_validate ( struct x509_certificate *cert, cert->path_remaining = max_path_remaining; /* Mark certificate as valid */ - cert->valid = 1; + cert->flags |= X509_FL_VALIDATED; DBGC ( cert, "X509 %p \"%s\" successfully validated using ", cert, x509_name ( cert ) ); |