Configure elliptic curves

168 views
Skip to first unread message

Camilo Logreira

unread,
Feb 26, 2014, 11:08:27 PM2/26/14
to relic-...@googlegroups.com
Hello.

I can't found how to configure the elliptic curves in the library to use in the a C-program. For example the NIST curves P256 and P384

How do I configure those elliptic curves?

Thanks for your time and explanation.

Tobias Markmann

unread,
Feb 27, 2014, 6:56:20 AM2/27/14
to relic-...@googlegroups.com
Hi Camilo,

If I understand it correctly, the elliptic curves available at runtime depend on your compile time settings. Have a look at https://code.google.com/p/relic-toolkit/source/browse/trunk/src/ep/relic_ep_param.c .
So I guess both those curves will never be available at runtime, unless you compile the lib two times with different settings under a different prefix. If you set FP_PRIME to 256, then the NIST P256 curve will be available ( https://code.google.com/p/relic-toolkit/source/browse/trunk/src/ep/relic_ep_param.c#185 ). If you set it to 384, the NIST P384 curve will be available.

Finally, with ep_param_set(), https://code.google.com/p/relic-toolkit/source/browse/trunk/src/ep/relic_ep_param.c#453 , you can select the curve to be used.

Cheers,
Tobias

Camilo Logreira

unread,
Feb 27, 2014, 8:42:52 AM2/27/14
to relic-...@googlegroups.com
Hi Tobias

Tks for your time and support.

If I catch the idea, the only way that I can configure the curve parameters is setting the parameters before building the library? If that is wright, how can I diifferenciate, for example, the secg k-256 from the nist p-256 when I set the parameters before building the library? What are the configure procedure to set those parameters?

Tks for your time.

Diego Aranha

unread,
Feb 27, 2014, 8:46:14 AM2/27/14
to relic-...@googlegroups.com
Camilo,

When you compile the library with FP_PRIME=256, you can only use 256-bit primes. The reason for this is that the library can take optimization decisions based on the fixed parameter size. Still, you can switch between the two curves using ep_param_set(), which accepts the curves by name. Yet another possible way is to initialize the library with two contexts (one for each curve) and switch the contexts as appropriate.

We know it's still cumbersome, but we are aiming towards a delicate balance between performance and flexibility and usability is the current trade-off.

Best,

--
Diego de Freitas Aranha
Institute of Computing - University of Campinas
http://www.ic.unicamp.br/~dfaranha



--

---
You received this message because you are subscribed to the Google Groups "relic-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to relic-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Yassine Sbai

unread,
Nov 16, 2017, 5:54:55 AM11/16/17
to relic-discuss
Diego,

I had the same difficulty using NIST curves on Relic. In fact I can set the NIST-P256 curve and it compiles with no problem but when I try to use it in runtime an Error is thrown in "relic_fp_param.c" more especialy in the function "fp_param_get_var" where no curve named "NIST-P256" is included. If you have any hint on where the problem could come from, I would appreciate it.

Thank you,
Yassine.

Diego Aranha

unread,
Nov 17, 2017, 8:07:01 PM11/17/17
to relic-...@googlegroups.com
Yassine,

Thank you for the notification!

Is the function invoked from your code or one of the library tests? This function should only be called when using pairing invocations, which of course makes no sense for curve NIST-P256. Please let me know so I can help you further.

Best,
--
Diego de Freitas Aranha
Institute of Computing - University of Campinas
http://www.ic.unicamp.br/~dfaranha
For more options, visit https://groups.google.com/d/optout.

Yassine Sbai

unread,
Dec 4, 2017, 5:27:20 AM12/4/17
to relic-discuss
Understood. 

Thanks.
Reply all
Reply to author
Forward
0 new messages