Re: help in edsa functions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: help in edsa functions

neorom
I resolved my previous problem, the error came in the name of the
variable "key" which has to be named "eckey". So there is a mistake in
the code in the documentation.

Now my problem is more difficult, because after :

Initialization of the structure :
EC_KEY    *eckey =  EC_KEY_new()
link with an elliptic curve :
eckey = EC_GROUP_new_by_curve_name(NID_secp192k1);
finally, the creation of this key :
if (!EC_KEY_generate_key(eckey))
       {
        printf("error key generation\n");
       }

when I execute my code, I get a Semgentation Fault and gdb tell me
that the problem comes with the  function :  BN_copy()

Program received signal SIGSEGV, Segmentation fault.
0x0805fee8 in BN_copy ()

I am working with ubuntu and the libssl0.9.8g-10

Thanks in advance for your help,

Romain Hinfray


On Mon, Mar 2, 2009 at 2:57 PM, neorom <[hidden email]> wrote:

> Hello every body,
>
> I'm new on this mailing list. I actually have to do a small program
> which have to generate signature with the ecdsa algorithm and I have
> never did it before.
> For this I saw the documentation and the example on the openssl web
> site (http://www.openssl.org/docs/crypto/ecdsa.html).
>
> But on line 8 of this program : key->group = EC_GROUP_new_by_nid(NID_secp192k1);
> , I don't understood why the "key" structure isn't initialized before
> and with struture defines it. Gcc tells me that :  error: ‘key’
> undeclared.
>
> Can you help me please.
>
> Thanks in advance
>
> Romain Hinfray
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: help in edsa functions

Billy Brumley
I think you want a key, not the group.

EC_GROUP_new_by_curve_name => EC_KEY_new_by_curve_name

Billy

On Mon, Mar 2, 2009 at 6:15 PM, neorom <[hidden email]> wrote:

> I resolved my previous problem, the error came in the name of the
> variable "key" which has to be named "eckey". So there is a mistake in
> the code in the documentation.
>
> Now my problem is more difficult, because after :
>
> Initialization of the structure :
> EC_KEY    *eckey =  EC_KEY_new()
> link with an elliptic curve :
> eckey = EC_GROUP_new_by_curve_name(NID_secp192k1);
> finally, the creation of this key :
> if (!EC_KEY_generate_key(eckey))
>       {
>        printf("error key generation\n");
>       }
>
> when I execute my code, I get a Semgentation Fault and gdb tell me
> that the problem comes with the  function :  BN_copy()
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0805fee8 in BN_copy ()
>
> I am working with ubuntu and the libssl0.9.8g-10
>
> Thanks in advance for your help,
>
> Romain Hinfray
>
>
> On Mon, Mar 2, 2009 at 2:57 PM, neorom <[hidden email]> wrote:
>> Hello every body,
>>
>> I'm new on this mailing list. I actually have to do a small program
>> which have to generate signature with the ecdsa algorithm and I have
>> never did it before.
>> For this I saw the documentation and the example on the openssl web
>> site (http://www.openssl.org/docs/crypto/ecdsa.html).
>>
>> But on line 8 of this program : key->group = EC_GROUP_new_by_nid(NID_secp192k1);
>> , I don't understood why the "key" structure isn't initialized before
>> and with struture defines it. Gcc tells me that :  error: ‘key’
>> undeclared.
>>
>> Can you help me please.
>>
>> Thanks in advance
>>
>> Romain Hinfray
>>
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       [hidden email]
> Automated List Manager                           [hidden email]
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: help in edsa functions

neorom
I've solved my problem :
 EC_KEY *key;
 EC_GROUP *group;
//creation de la clef
if ((key = EC_KEY_new()) == NULL)
        {
        ret_ecdsa_check = -6;
        return (ret_ecdsa_check);
        }
group = EC_GROUP_new_by_curve_name(NID_secp192k1);
if (group == NULL)
        {
        ret_ecdsa_check = -5;
        return (ret_ecdsa_check);
        }
if (EC_KEY_set_group(key, group) == 0)
        {
        ret_ecdsa_check = -4;
        return (ret_ecdsa_check);
        }
EC_GROUP_free(group);
if (EC_GROUP_get_degree(EC_KEY_get0_group(key)) < 16

Peviously, I didn't use the link function between the key and the
curve : EC_KEY_set_group(key, group)

So now it works with the source code upper.

Romain Hinfray

On Thu, Mar 5, 2009 at 2:43 PM, Billy Brumley <[hidden email]> wrote:

> I think you want a key, not the group.
>
> EC_GROUP_new_by_curve_name => EC_KEY_new_by_curve_name
>
> Billy
>
> On Mon, Mar 2, 2009 at 6:15 PM, neorom <[hidden email]> wrote:
>> I resolved my previous problem, the error came in the name of the
>> variable "key" which has to be named "eckey". So there is a mistake in
>> the code in the documentation.
>>
>> Now my problem is more difficult, because after :
>>
>> Initialization of the structure :
>> EC_KEY    *eckey =  EC_KEY_new()
>> link with an elliptic curve :
>> eckey = EC_GROUP_new_by_curve_name(NID_secp192k1);
>> finally, the creation of this key :
>> if (!EC_KEY_generate_key(eckey))
>>       {
>>        printf("error key generation\n");
>>       }
>>
>> when I execute my code, I get a Semgentation Fault and gdb tell me
>> that the problem comes with the  function :  BN_copy()
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0805fee8 in BN_copy ()
>>
>> I am working with ubuntu and the libssl0.9.8g-10
>>
>> Thanks in advance for your help,
>>
>> Romain Hinfray
>>
>>
>> On Mon, Mar 2, 2009 at 2:57 PM, neorom <[hidden email]> wrote:
>>> Hello every body,
>>>
>>> I'm new on this mailing list. I actually have to do a small program
>>> which have to generate signature with the ecdsa algorithm and I have
>>> never did it before.
>>> For this I saw the documentation and the example on the openssl web
>>> site (http://www.openssl.org/docs/crypto/ecdsa.html).
>>>
>>> But on line 8 of this program : key->group = EC_GROUP_new_by_nid(NID_secp192k1);
>>> , I don't understood why the "key" structure isn't initialized before
>>> and with struture defines it. Gcc tells me that :  error: ‘key’
>>> undeclared.
>>>
>>> Can you help me please.
>>>
>>> Thanks in advance
>>>
>>> Romain Hinfray
>>>
>> ______________________________________________________________________
>> OpenSSL Project                                 http://www.openssl.org
>> Development Mailing List                       [hidden email]
>> Automated List Manager                           [hidden email]
>>
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       [hidden email]
> Automated List Manager                           [hidden email]
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]