recent EC_PRE_COMP changes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

recent EC_PRE_COMP changes

Billy Brumley
https://github.com/openssl/openssl/commit/3aef36ffef89849348049296892327e6fdf9d705

That commit caused EC_PRE_COMP to lose a lot of generality. Was a
function pointer approach like below considered? I'm not trying to
resurrect EC_EXTRA_DATA, but a *little* flexibility would be nice.

BBB

diff --git a/crypto/ec/ec_lcl.h b/crypto/ec/ec_lcl.h
index 2c5e1d9..9f5d4ec 100644
--- a/crypto/ec/ec_lcl.h
+++ b/crypto/ec/ec_lcl.h
@@ -256,24 +256,11 @@ struct ec_group_st {
     BN_MONT_CTX *mont_data;

     /* precomputed values for speed. */
-    enum {
-        pct_none,
-        pct_nistp224, pct_nistp256, pct_nistp521, pct_nistz256,
-        pct_ec } pre_comp_type;
-    union {
-        NISTP224_PRE_COMP *nistp224;
-        NISTP256_PRE_COMP *nistp256;
-        NISTP521_PRE_COMP *nistp521;
-        NISTZ256_PRE_COMP *nistz256;
-        EC_PRE_COMP *ec;
-    } pre_comp;
+    void (*pre_comp_free) (EC_PRE_COMP *);
+    EC_PRE_COMP *(*pre_comp_dup) (EC_PRE_COMP *);
+    EC_PRE_COMP *pre_comp;
 } /* EC_GROUP */ ;
_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: recent EC_PRE_COMP changes

Salz, Rich
> That commit caused EC_PRE_COMP to lose a lot of generality. Was a function
> pointer approach like below considered? I'm not trying to resurrect
> EC_EXTRA_DATA, but a *little* flexibility would be nice.

What functionality was lost that isn't available in the public and standard EX_DATA model?

_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: recent EC_PRE_COMP changes

Billy Brumley
>> That commit caused EC_PRE_COMP to lose a lot of generality. Was a function
>> pointer approach like below considered? I'm not trying to resurrect
>> EC_EXTRA_DATA, but a *little* flexibility would be nice.
>
> What functionality was lost that isn't available in the public and standard EX_DATA model?

Well I don't see an ex_data attached to EC_GROUP or EC_METHOD. I must
be missing something? I guess I can hijack one of the spare void
pointers in EC_GROUP. I was somewhat familiar with the old point
precomp flow for an EC_METHOD, so I'm having a bit of trouble wrapping
my head around it.

When I look at ec_lib.c, pre_comp_type is only being checked in switch
statements in _free and _dup style wrappers. Seems out of place and
oddly specific. Just one dude's opinion :)

Thanks!

BBB
_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: recent EC_PRE_COMP changes

Salz, Rich
> Well I don't see an ex_data attached to EC_GROUP or EC_METHOD.

No, do you need those?  We can add them.

> When I look at ec_lib.c, pre_comp_type is only being checked in switch
> statements in _free and _dup style wrappers. Seems out of place and oddly
> specific. Just one dude's opinion :)

The precomp stuff is internal to openssl, so I think it's reasonable to put there.
_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: recent EC_PRE_COMP changes

Billy Brumley
>> Well I don't see an ex_data attached to EC_GROUP or EC_METHOD.
>
> No, do you need those?  We can add them.
>
>> When I look at ec_lib.c, pre_comp_type is only being checked in switch
>> statements in _free and _dup style wrappers. Seems out of place and oddly
>> specific. Just one dude's opinion :)
>
> The precomp stuff is internal to openssl, so I think it's reasonable to put there.

So when I see original comments like this in the EC structures:

/* The following members are handled by the method functions, even if
they appear generic */

What I expect, and was the behavior at least into 2014, is that e.g.
in ec_lib.c group->foo can happen for members "foo" above that
comment, but not below that comment. Am I interpreting this wrong?

BBB
_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: recent EC_PRE_COMP changes

Salz, Rich

> What I expect, and was the behavior at least into 2014, is that e.g.
> in ec_lib.c group->foo can happen for members "foo" above that comment,
> but not below that comment. Am I interpreting this wrong?

Not really.  But in 1.1 we are doing a great deal of work to make all structures opaque.  So it was right before, but it's wrong now. :)  How's that for an answer?

If you need EX_DATA on other EC structures, please open a ticket.  
_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev