]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[crypto] Shrink raw certificate data to fit certificate
authorMichael Brown <mcb30@ipxe.org>
Thu, 22 Mar 2012 11:01:13 +0000 (11:01 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 22 Mar 2012 11:41:21 +0000 (11:41 +0000)
The certificate may be part of an ASN.1-encoded certificate chain, and
so may not be the only object contained within the ASN.1 cursor.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/crypto/x509.c

index eb485522344f80b3aaa2aca56fd93d53d52e8f60..145c77ee1881f22704ddf4133edfa2d57ba0e3d0 100644 (file)
@@ -902,6 +902,7 @@ int x509_parse ( struct x509_certificate *cert, const void *data, size_t len ) {
        memset ( cert, 0, sizeof ( *cert ) );
        cert->raw.data = data;
        cert->raw.len = len;
+       asn1_shrink_any ( &cert->raw );
 
        /* Enter certificate */
        memcpy ( &cursor, &cert->raw, sizeof ( cursor ) );