diff --git a/crypto/evp/evp_tests.txt b/crypto/evp/evp_tests.txt index f0601b21..7c316d81 100644 --- a/crypto/evp/evp_tests.txt +++ b/crypto/evp/evp_tests.txt @@ -54,6 +54,11 @@ PublicKey = P-256-SPKI Input = 3082014b3082010306072a8648ce3d02013081f7020101302c06072a8648ce3d0101022100ffffffff00000001000000000000000000000000ffffffffffffffffffffffff305b0420ffffffff00000001000000000000000000000000fffffffffffffffffffffffc04205ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b031500c49d360886e704936a6678e1139d26b7819f7e900441046b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2964fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5022100ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551020101034200042c150f429ce70f216c252cf5e062ce1f639cd5d165c7f89424072c27197d78b33b920e95cdb664e990dcf0cfea0d94e2a8e6af9d0e58056e653104925b9fe6c9 Error = DECODE_ERROR +# The same as above, but with trailing data after the curve name. +PublicKey = P-256-SPKI +Input = 305b301506072a8648ce3d020106082a8648ce3d0301070500034200042c150f429ce70f216c252cf5e062ce1f639cd5d165c7f89424072c27197d78b33b920e95cdb664e990dcf0cfea0d94e2a8e6af9d0e58056e653104925b9fe6c9 +Error = DECODE_ERROR + # A DSA private key. PrivateKey = DSA-1024 Type = DSA diff --git a/crypto/evp/p_ec_asn1.c b/crypto/evp/p_ec_asn1.c index b723ad72..8d44dcdc 100644 --- a/crypto/evp/p_ec_asn1.c +++ b/crypto/evp/p_ec_asn1.c @@ -93,14 +93,15 @@ static int eckey_pub_decode(EVP_PKEY *out, CBS *params, CBS *key) { /* See RFC 5480, section 2. */ /* The parameters are a named curve. */ + EC_POINT *point = NULL; + EC_KEY *eckey = NULL; EC_GROUP *group = EC_KEY_parse_curve_name(params); if (group == NULL || CBS_len(params) != 0) { OPENSSL_PUT_ERROR(EVP, EVP_R_DECODE_ERROR); - return 0; + goto err; } - EC_POINT *point = NULL; - EC_KEY *eckey = EC_KEY_new(); + eckey = EC_KEY_new(); if (eckey == NULL || !EC_KEY_set_group(eckey, group)) { goto err; }