How to implement custom engine EC_KEY_set_group method

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to implement custom engine EC_KEY_set_group method

Shiva shankar


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



--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users