diff options
| author | Michael Brown | 2012-05-08 11:57:50 +0200 |
|---|---|---|
| committer | Michael Brown | 2012-05-08 13:49:01 +0200 |
| commit | 99c798d87a94838be62976cb1632e7d0a9550df3 (patch) | |
| tree | 1284efc5b8a511f820dc72f4dbfa0f14a114048b /src/include | |
| parent | [crypto] Check that common name contains no NUL characters (diff) | |
| download | ipxe-99c798d87a94838be62976cb1632e7d0a9550df3.tar.gz ipxe-99c798d87a94838be62976cb1632e7d0a9550df3.tar.xz ipxe-99c798d87a94838be62976cb1632e7d0a9550df3.zip | |
[crypto] Add x509_append_raw()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/ipxe/x509.h | 16 |
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 ); |
