-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current master doesn't allow selecting curves at run-time #77
Comments
Selecting parameters at compile time is the main design decision behind RELIC. :) |
I'd really like you to reconsider. In my use case, being able to process data secured by NIST P384 and P256 is desirable. Having to recompile for each of these is not. Update |
I think it's possible to support curves with different sizes without affecting performance, maybe someday I'll convince @dfaranha 😆 But it would need a complete overhaul of the library, so it would take some time, if it will ever happen. You can take a look at BearSSL if performance is not critical, it's a great library. You can select the curve by calling |
I don't see any speed-wise performance impact of supporting multiple curve sizes. There would be some memory impact - but, say, between P256 and P384 I think it would be negligible.
Unfortunately, performance does matter in my case.
I'm sorry, but I don't fully understand.
Thanks! |
Supporting multiple curve sizes implies function pointers for each field arithmetic function, which are a mess to deal with. Regarding your questions:
You can also build multiple versions of the library for different parameters and link them together. Check the LABEL configuration variable for that. A massive refactor of the library to support this is not in my current plans. I already have a hard enough time to maintain the library somewhat working, and can barely make progress in the current refactoring/cleanup with all my other work-related activities. Anyone is welcome to fork the library and adapt it to their needs. |
I thought that FP_PRIME should be set in CMakeLists.txt, but couldn't find it there. How should I set it? As a define added to CFLAGS? Or...? Since the library is built as a part of another project, ideally I shouldn't need to specify parameters in the invocation command... |
You can pass configuration switches when invocating CMake to build the Makefiles. |
My library provides high-level crypto API and uses RELIC for the actual ECC operations. And it's also built via CMake... So I do not invoke CMake manually in the RELIC directory. |
Could you please give an example of how to pass |
You probably figured this out already after all these years, but it's cmake -DFP_PRIME=384 <path_to_target>. |
As I said in #77 (comment), I am not invoking CMake manually - thus |
I imagine you can then import RELIC's |
I recently learned of ExternalProject support in CMake and figured out I should leave it as a suggestion here. |
FIle
relic_conf.h
sets the default valueF#define FP_PRIME 256
. The following code inrelic_ep_param.c
makes sure that a curve is compiled in only ifFP_PRIME
is set to the corresponding value:That precludes the code that uses this library from choosing curves at the run time, forcing to compile one curve only.
I hope that was not the intention, and urge fixing this. One way to do that would be removing the
&& FP_PRIME == xxx
part from the corresponding#if defined(XXX) ...
The text was updated successfully, but these errors were encountered: