From a72ff97e1ccc4a1494159e8e31428c875f8ff601 Mon Sep 17 00:00:00 2001 From: toddouska Date: Wed, 23 Nov 2011 13:15:29 -0800 Subject: [PATCH] ecc extensions fix for ca --- ctaocrypt/src/asn.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ctaocrypt/src/asn.c b/ctaocrypt/src/asn.c index 3f617f86b..78137295b 100644 --- a/ctaocrypt/src/asn.c +++ b/ctaocrypt/src/asn.c @@ -1207,14 +1207,16 @@ static int GetKey(DecodedCert* cert) if (b != 0x00) return ASN_EXPECT_0_E; - /* actual key, use length - 1 since preceding 0 */ - cert->publicKey = (byte*) XMALLOC(length - 1, cert->heap, + /* actual key, use length - 1 since ate preceding 0 */ + length -= 1; + + cert->publicKey = (byte*) XMALLOC(length, cert->heap, DYNAMIC_TYPE_PUBLIC_KEY); if (cert->publicKey == NULL) return MEMORY_E; - XMEMCPY(cert->publicKey, &cert->source[cert->srcIdx], length - 1); + XMEMCPY(cert->publicKey, &cert->source[cert->srcIdx], length); cert->pubKeyStored = 1; - cert->pubKeySize = length - 1; + cert->pubKeySize = length; cert->srcIdx += length; }