From b8fd17fadc588a63905729cc411e7ec271e99114 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Sat, 8 Feb 2014 22:20:42 +0100 Subject: [PATCH] setup the ec pub key properly when doing generate key --- yubico-piv-tool.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/yubico-piv-tool.c b/yubico-piv-tool.c index 41d27cd..8345686 100644 --- a/yubico-piv-tool.c +++ b/yubico-piv-tool.c @@ -361,11 +361,13 @@ static bool generate_key(SCARDHANDLE *card, const char *slot, enum enum_algorith rsa->e = bignum_e; EVP_PKEY_set1_RSA(public_key, rsa); } else if(algorithm == algorithm_arg_ECCP256) { - const EC_GROUP *group; + EC_GROUP *group; unsigned char *data_ptr = data + 3; - eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); - group = EC_KEY_get0_group(eckey); + eckey = EC_KEY_new(); + group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1); + EC_GROUP_set_asn1_flag(group, NID_X9_62_prime256v1); + EC_KEY_set_group(eckey, group); point = EC_POINT_new(group); if(*data_ptr++ != 0x86) { fprintf(stderr, "Failed to parse public key structure.\n");