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/net/tls.c | |
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/net/tls.c')
-rw-r--r-- | src/net/tls.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/net/tls.c b/src/net/tls.c index 3a8a0e05..6cb63be5 100644 --- a/src/net/tls.c +++ b/src/net/tls.c @@ -1312,37 +1312,24 @@ static int tls_parse_chain ( struct tls_session *tls, goto err_overlength; } - /* Parse certificate */ - if ( ( rc = x509_certificate ( certificate->data, - certificate_len, - &cert ) ) != 0 ) { - DBGC ( tls, "TLS %p could not parse certificate: %s\n", + /* Add certificate to chain */ + if ( ( rc = x509_append_raw ( tls->chain, certificate->data, + certificate_len ) ) != 0 ) { + DBGC ( tls, "TLS %p could not append certificate: %s\n", tls, strerror ( rc ) ); DBGC_HDA ( tls, 0, data, ( end - data ) ); goto err_parse; } + cert = x509_last ( tls->chain ); DBGC ( tls, "TLS %p found certificate %s\n", tls, cert->subject.name ); - /* Append certificate to chain */ - if ( ( rc = x509_append ( tls->chain, cert ) ) != 0 ) { - DBGC ( tls, "TLS %p could not append certificate: %s\n", - tls, strerror ( rc ) ); - goto err_append; - } - - /* Drop reference to certificate */ - x509_put ( cert ); - cert = NULL; - /* Move to next certificate in list */ data = next; } return 0; - err_append: - x509_put ( cert ); err_parse: err_overlength: x509_chain_put ( tls->chain ); |