aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/x509.h
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2012-05-08 10:57:50 +0100
committerMichael Brown <mcb30@ipxe.org>2012-05-08 12:49:01 +0100
commit99c798d87a94838be62976cb1632e7d0a9550df3 (patch)
tree1284efc5b8a511f820dc72f4dbfa0f14a114048b /src/include/ipxe/x509.h
parent6c8fcd4bb31d2c4da90e94d78363182d1e92a6c7 (diff)
downloadipxe-99c798d87a94838be62976cb1632e7d0a9550df3.tar.gz
[crypto] Add x509_append_raw()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/x509.h')
-rw-r--r--src/include/ipxe/x509.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/include/ipxe/x509.h b/src/include/ipxe/x509.h
index b9db20479..78b180c99 100644
--- a/src/include/ipxe/x509.h
+++ b/src/include/ipxe/x509.h
@@ -261,6 +261,20 @@ x509_first ( struct x509_chain *chain ) {
return ( link ? link->cert : NULL );
}
+/**
+ * Get last certificate in X.509 certificate chain
+ *
+ * @v chain X.509 certificate chain
+ * @ret cert X.509 certificate, or NULL
+ */
+static inline __attribute__ (( always_inline )) struct x509_certificate *
+x509_last ( struct x509_chain *chain ) {
+ struct x509_link *link;
+
+ link = list_last_entry ( &chain->links, struct x509_link, list );
+ return ( link ? link->cert : NULL );
+}
+
/** An X.509 extension */
struct x509_extension {
/** Name */
@@ -319,6 +333,8 @@ extern int x509_certificate ( const void *data, size_t len,
extern struct x509_chain * x509_alloc_chain ( void );
extern int x509_append ( struct x509_chain *chain,
struct x509_certificate *cert );
+extern int x509_append_raw ( struct x509_chain *chain, const void *data,
+ size_t len );
extern int x509_validate_chain ( struct x509_chain *chain, time_t time,
struct x509_root *root );