Re: EC_POINT_get_affine_coordinates replacement in 3.0

2022-05-04 Thread Matt Caswell




On 03/05/2022 23:29, Kory Hamzeh wrote:
You would have to use EVP_PKEY key type. You can use EVP_PKEY_get* to 
get key params.


Yes this is probably the best way to do this.

Specifically you can use the function EVP_PKEY_get_bn_param() documented 
here:


https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_get_bn_param.html

The params you want are called OSSL_PKEY_PARAM_EC_PUB_X and 
OSSL_PKEY_PARAM_EC_PUB_Y as documented on this page:


https://www.openssl.org/docs/man3.0/man7/EVP_PKEY-EC.html

Matt






On May 3, 2022, at 1:56 PM, Chris Bare > wrote:


Thanks, I'll check those out.

On Tue, May 3, 2022 at 4:53 PM William Roberts 
mailto:bill.c.robe...@gmail.com>> wrote:


On Tue, May 3, 2022 at 3:18 PM Chris Bare mailto:chris.b...@gmail.com>> wrote:
>
>
> On Tue, May 3, 2022 at 3:10 PM William Roberts
mailto:bill.c.robe...@gmail.com>> wrote:
>>
>> On Tue, May 3, 2022 at 1:14 PM Chris Bare mailto:chris.b...@gmail.com>> wrote:
>> >
>> > I'm converting some openssl 1.0 code to 3.0 and I don't know
how to get the coordinates
>> > in a 3.0 way.
>> > The old code is:
>> > BN_CTX *ctx = BN_CTX_new ();
>> > BIGNUM *X = NULL, *Y = NULL;
>> > const EC_POINT *pubkey;
>> > const EC_GROUP *group;
>> > BN_CTX_start (ctx);
>> > X = BN_CTX_get (ctx);
>> > Y = BN_CTX_get (ctx);
>> > pubkey = EC_KEY_get0_public_key ((EC_KEY *) EVP_PKEY_get0
(pkey));
>> > group = EC_KEY_get0_group ((EC_KEY *) EVP_PKEY_get0
(cvr->sm_pkey));
>> > EC_POINT_get_affine_coordinates_GFp (group, pubkey, X, Y, ctx)
>> >
>> > What would be the 3.0 way to get X and Y without using
deprecated functions?
>>
>> For EC_POINT_get_affine_coordinates_GFp it goes to
>> EC_POINT_get_affine_coordinates, see:
>>   -

https://www.openssl.org/docs/man3.0/man3/EC_POINT_get_affine_coordinates.html


>>
>> Offhand I don't see any other deprecated functions, was that
the only one?
>>
>> Thanks,
>> Bill
>
>
> all the EC_KEY_get0_ functions are deprecated. Is there a new
way to access the internals of
> the opaque structures, or am I stuck with the deprecated ones
for this?

I think you want the from and to data routines that provide the
components from an EVP PKEY or produce an EVP_PKEY
from the components:
  - https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_todata.html

  -
https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_fromdata.html




--
Chris Bare




Re: EC_POINT_get_affine_coordinates replacement in 3.0

2022-05-03 Thread Kory Hamzeh
You would have to use EVP_PKEY key type. You can use EVP_PKEY_get* to get key 
params.




> On May 3, 2022, at 1:56 PM, Chris Bare  wrote:
> 
> Thanks, I'll check those out.
> 
> On Tue, May 3, 2022 at 4:53 PM William Roberts  > wrote:
> On Tue, May 3, 2022 at 3:18 PM Chris Bare  > wrote:
> >
> >
> > On Tue, May 3, 2022 at 3:10 PM William Roberts  > > wrote:
> >>
> >> On Tue, May 3, 2022 at 1:14 PM Chris Bare  >> > wrote:
> >> >
> >> > I'm converting some openssl 1.0 code to 3.0 and I don't know how to get 
> >> > the coordinates
> >> > in a 3.0 way.
> >> > The old code is:
> >> > BN_CTX *ctx = BN_CTX_new ();
> >> > BIGNUM *X = NULL, *Y = NULL;
> >> > const EC_POINT *pubkey;
> >> > const EC_GROUP *group;
> >> > BN_CTX_start (ctx);
> >> > X = BN_CTX_get (ctx);
> >> > Y = BN_CTX_get (ctx);
> >> > pubkey = EC_KEY_get0_public_key ((EC_KEY *) EVP_PKEY_get0 (pkey));
> >> > group = EC_KEY_get0_group ((EC_KEY *) EVP_PKEY_get0 (cvr->sm_pkey));
> >> > EC_POINT_get_affine_coordinates_GFp (group, pubkey, X, Y, ctx)
> >> >
> >> > What would be the 3.0 way to get X and Y without using deprecated 
> >> > functions?
> >>
> >> For EC_POINT_get_affine_coordinates_GFp it goes to
> >> EC_POINT_get_affine_coordinates, see:
> >>   - 
> >> https://www.openssl.org/docs/man3.0/man3/EC_POINT_get_affine_coordinates.html
> >>  
> >> 
> >>
> >> Offhand I don't see any other deprecated functions, was that the only one?
> >>
> >> Thanks,
> >> Bill
> >
> >
> > all the EC_KEY_get0_ functions are deprecated. Is there a new way to access 
> > the internals of
> > the opaque structures, or am I stuck with the deprecated ones for this?
> 
> I think you want the from and to data routines that provide the
> components from an EVP PKEY or produce an EVP_PKEY
> from the components:
>   - https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_todata.html 
> 
>   - https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_fromdata.html 
> 
> 
> 
> -- 
> Chris Bare



Re: EC_POINT_get_affine_coordinates replacement in 3.0

2022-05-03 Thread Chris Bare
Thanks, I'll check those out.

On Tue, May 3, 2022 at 4:53 PM William Roberts 
wrote:

> On Tue, May 3, 2022 at 3:18 PM Chris Bare  wrote:
> >
> >
> > On Tue, May 3, 2022 at 3:10 PM William Roberts 
> wrote:
> >>
> >> On Tue, May 3, 2022 at 1:14 PM Chris Bare  wrote:
> >> >
> >> > I'm converting some openssl 1.0 code to 3.0 and I don't know how to
> get the coordinates
> >> > in a 3.0 way.
> >> > The old code is:
> >> > BN_CTX *ctx = BN_CTX_new ();
> >> > BIGNUM *X = NULL, *Y = NULL;
> >> > const EC_POINT *pubkey;
> >> > const EC_GROUP *group;
> >> > BN_CTX_start (ctx);
> >> > X = BN_CTX_get (ctx);
> >> > Y = BN_CTX_get (ctx);
> >> > pubkey = EC_KEY_get0_public_key ((EC_KEY *) EVP_PKEY_get0 (pkey));
> >> > group = EC_KEY_get0_group ((EC_KEY *) EVP_PKEY_get0 (cvr->sm_pkey));
> >> > EC_POINT_get_affine_coordinates_GFp (group, pubkey, X, Y, ctx)
> >> >
> >> > What would be the 3.0 way to get X and Y without using deprecated
> functions?
> >>
> >> For EC_POINT_get_affine_coordinates_GFp it goes to
> >> EC_POINT_get_affine_coordinates, see:
> >>   -
> https://www.openssl.org/docs/man3.0/man3/EC_POINT_get_affine_coordinates.html
> >>
> >> Offhand I don't see any other deprecated functions, was that the only
> one?
> >>
> >> Thanks,
> >> Bill
> >
> >
> > all the EC_KEY_get0_ functions are deprecated. Is there a new way to
> access the internals of
> > the opaque structures, or am I stuck with the deprecated ones for this?
>
> I think you want the from and to data routines that provide the
> components from an EVP PKEY or produce an EVP_PKEY
> from the components:
>   - https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_todata.html
>   - https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_fromdata.html
>


-- 
Chris Bare


Re: EC_POINT_get_affine_coordinates replacement in 3.0

2022-05-03 Thread William Roberts
On Tue, May 3, 2022 at 3:18 PM Chris Bare  wrote:
>
>
> On Tue, May 3, 2022 at 3:10 PM William Roberts  
> wrote:
>>
>> On Tue, May 3, 2022 at 1:14 PM Chris Bare  wrote:
>> >
>> > I'm converting some openssl 1.0 code to 3.0 and I don't know how to get 
>> > the coordinates
>> > in a 3.0 way.
>> > The old code is:
>> > BN_CTX *ctx = BN_CTX_new ();
>> > BIGNUM *X = NULL, *Y = NULL;
>> > const EC_POINT *pubkey;
>> > const EC_GROUP *group;
>> > BN_CTX_start (ctx);
>> > X = BN_CTX_get (ctx);
>> > Y = BN_CTX_get (ctx);
>> > pubkey = EC_KEY_get0_public_key ((EC_KEY *) EVP_PKEY_get0 (pkey));
>> > group = EC_KEY_get0_group ((EC_KEY *) EVP_PKEY_get0 (cvr->sm_pkey));
>> > EC_POINT_get_affine_coordinates_GFp (group, pubkey, X, Y, ctx)
>> >
>> > What would be the 3.0 way to get X and Y without using deprecated 
>> > functions?
>>
>> For EC_POINT_get_affine_coordinates_GFp it goes to
>> EC_POINT_get_affine_coordinates, see:
>>   - 
>> https://www.openssl.org/docs/man3.0/man3/EC_POINT_get_affine_coordinates.html
>>
>> Offhand I don't see any other deprecated functions, was that the only one?
>>
>> Thanks,
>> Bill
>
>
> all the EC_KEY_get0_ functions are deprecated. Is there a new way to access 
> the internals of
> the opaque structures, or am I stuck with the deprecated ones for this?

I think you want the from and to data routines that provide the
components from an EVP PKEY or produce an EVP_PKEY
from the components:
  - https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_todata.html
  - https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_fromdata.html


Re: EC_POINT_get_affine_coordinates replacement in 3.0

2022-05-03 Thread Chris Bare
On Tue, May 3, 2022 at 3:10 PM William Roberts 
wrote:

> On Tue, May 3, 2022 at 1:14 PM Chris Bare  wrote:
> >
> > I'm converting some openssl 1.0 code to 3.0 and I don't know how to get
> the coordinates
> > in a 3.0 way.
> > The old code is:
> > BN_CTX *ctx = BN_CTX_new ();
> > BIGNUM *X = NULL, *Y = NULL;
> > const EC_POINT *pubkey;
> > const EC_GROUP *group;
> > BN_CTX_start (ctx);
> > X = BN_CTX_get (ctx);
> > Y = BN_CTX_get (ctx);
> > pubkey = EC_KEY_get0_public_key ((EC_KEY *) EVP_PKEY_get0 (pkey));
> > group = EC_KEY_get0_group ((EC_KEY *) EVP_PKEY_get0 (cvr->sm_pkey));
> > EC_POINT_get_affine_coordinates_GFp (group, pubkey, X, Y, ctx)
> >
> > What would be the 3.0 way to get X and Y without using deprecated
> functions?
>
> For EC_POINT_get_affine_coordinates_GFp it goes to
> EC_POINT_get_affine_coordinates, see:
>   -
> https://www.openssl.org/docs/man3.0/man3/EC_POINT_get_affine_coordinates.html
>
> Offhand I don't see any other deprecated functions, was that the only one?
>
> Thanks,
> Bill
>

all the EC_KEY_get0_ functions are deprecated. Is there a new way to access
the internals of
the opaque structures, or am I stuck with the deprecated ones for this?

-- 
Chris Bare


Re: EC_POINT_get_affine_coordinates replacement in 3.0

2022-05-03 Thread William Roberts
On Tue, May 3, 2022 at 1:14 PM Chris Bare  wrote:
>
> I'm converting some openssl 1.0 code to 3.0 and I don't know how to get the 
> coordinates
> in a 3.0 way.
> The old code is:
> BN_CTX *ctx = BN_CTX_new ();
> BIGNUM *X = NULL, *Y = NULL;
> const EC_POINT *pubkey;
> const EC_GROUP *group;
> BN_CTX_start (ctx);
> X = BN_CTX_get (ctx);
> Y = BN_CTX_get (ctx);
> pubkey = EC_KEY_get0_public_key ((EC_KEY *) EVP_PKEY_get0 (pkey));
> group = EC_KEY_get0_group ((EC_KEY *) EVP_PKEY_get0 (cvr->sm_pkey));
> EC_POINT_get_affine_coordinates_GFp (group, pubkey, X, Y, ctx)
>
> What would be the 3.0 way to get X and Y without using deprecated functions?

For EC_POINT_get_affine_coordinates_GFp it goes to
EC_POINT_get_affine_coordinates, see:
  - 
https://www.openssl.org/docs/man3.0/man3/EC_POINT_get_affine_coordinates.html

Offhand I don't see any other deprecated functions, was that the only one?

Thanks,
Bill


EC_POINT_get_affine_coordinates replacement in 3.0

2022-05-03 Thread Chris Bare
I'm converting some openssl 1.0 code to 3.0 and I don't know how to get the
coordinates
in a 3.0 way.
The old code is:
BN_CTX *ctx = BN_CTX_new ();
BIGNUM *X = NULL, *Y = NULL;
const EC_POINT *pubkey;
const EC_GROUP *group;
BN_CTX_start (ctx);
X = BN_CTX_get (ctx);
Y = BN_CTX_get (ctx);
pubkey = EC_KEY_get0_public_key ((EC_KEY *) EVP_PKEY_get0 (pkey));
group = EC_KEY_get0_group ((EC_KEY *) EVP_PKEY_get0 (cvr->sm_pkey));
EC_POINT_get_affine_coordinates_GFp (group, pubkey, X, Y, ctx)

What would be the 3.0 way to get X and Y without using deprecated functions?
-- 
Chris Bare