[openssl-users] How to implement custom engine EC_KEY_set_group method

Shiva shankar shiva4a4 at gmail.com
Wed Oct 31 12:18:12 UTC 2018


Hi All,

I have few queries on how to implement custom engine ECDH ec set_group
method and it's return value. Any inputs are highly appreciated.


While setting engine group,currently always default group is set.


int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group)
 {
     if (key->meth->set_group != NULL && key->meth->set_group(key, group)
== 0) *  #Const object & pass by value,whatever the value set by
custom engine is not reflected in the group object *
         return 0;
     EC_GROUP_free(key->group);*#Freeing the key->group.*
     key->group = EC_GROUP_dup(group); *#Assigning the same **group object*
     return (key->group == NULL) ? 0 : 1;
 }

Below is my engine set_group code.

int my_engine_set_group(EC_KEY *key, const EC_GROUP *grp)

{

      if(grp->curve_name==P256)

          key->group = get_custom_group();

    #*What should be the  return value for supported and non supported
curves ?*

        return 1;

       else #Other curves such as P384,P521

         return 0;

}


Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20181031/5a780a5e/attachment.html>


More information about the openssl-users mailing list