summaryrefslogtreecommitdiffstats
path: root/src/crypto
diff options
context:
space:
mode:
authorMichael Brown2012-03-22 12:01:13 +0100
committerMichael Brown2012-03-22 12:41:21 +0100
commit5c6639593969e6b7b6b4796cbb833c002819857c (patch)
tree36c1b5d29534e26d5f3e2465bc6ec9e27c2fdd38 /src/crypto
parent[crypto] Avoid an error when asn1_shrink() is already at end of object (diff)
downloadipxe-5c6639593969e6b7b6b4796cbb833c002819857c.tar.gz
ipxe-5c6639593969e6b7b6b4796cbb833c002819857c.tar.xz
ipxe-5c6639593969e6b7b6b4796cbb833c002819857c.zip
[crypto] Shrink raw certificate data to fit certificate
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>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/x509.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/crypto/x509.c b/src/crypto/x509.c
index eb485522..145c77ee 100644
--- a/src/crypto/x509.c
+++ b/src/crypto/x509.c
@@ -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 ) );