aboutsummaryrefslogtreecommitdiff
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2024-02-15 12:43:51 +0000
committerMichael Brown <mcb30@ipxe.org>2024-02-15 12:45:58 +0000
commit943d75b557a8bf857d651e8116a7368b9d284e41 (patch)
tree36fae45ff882568d85857f5331eaae41e02267d3 /src/include/ipxe
parent3e721e0c0836588b64deb6e1c1befd08f0f02e71 (diff)
downloadipxe-943d75b557a8bf857d651e8116a7368b9d284e41.zip
ipxe-943d75b557a8bf857d651e8116a7368b9d284e41.tar.gz
ipxe-943d75b557a8bf857d651e8116a7368b9d284e41.tar.bz2
[crypto] Add x509_is_self_signed() helper function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/x509.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/include/ipxe/x509.h b/src/include/ipxe/x509.h
index 5cad459..d2ba49f 100644
--- a/src/include/ipxe/x509.h
+++ b/src/include/ipxe/x509.h
@@ -374,6 +374,16 @@ x509_root_put ( struct x509_root *root ) {
ref_put ( &root->refcnt );
}
+/**
+ * Check if X.509 certificate is self-signed
+ *
+ * @v cert X.509 certificate
+ * @ret is_self_signed X.509 certificate is self-signed
+ */
+static inline int x509_is_self_signed ( struct x509_certificate *cert ) {
+ return ( asn1_compare ( &cert->issuer.raw, &cert->subject.raw ) == 0 );
+}
+
extern const char * x509_name ( struct x509_certificate *cert );
extern int x509_parse ( struct x509_certificate *cert,
const struct asn1_cursor *raw );