-
Notifications
You must be signed in to change notification settings - Fork 180
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
Resolving name clashes with OpenSSL and others #30
Conversation
From my experience a project name prefix is more common than adding the project name as a suffix to public symbols. Would it be much work to change this? Other than that the change looks okay. Will try to fix our travis later and test this PR. |
I would prefer a prefix, but inserting RELIC_ before everything would require rethinking some symbols. It's simply too long and verbose. |
@dfaranha It is verbose, but the only way to avoid symbol conflicts. Is this mainly a usability concern of yours about the RELIC_? nacl for example uses a crypto_ prefix which is even longer. |
We could try RLC_ and shorten some other symbols to reduce impact. Configuration is still a problem, RLC_NONE makes no sense. |
Fine with that as long as we document it in our README that this is the library prefix of RELIC. It might not be obvious. |
IMHO verbosity is a sad requirement of coding in C. It seems to me that the readability of RELIC is better than 2 characters saved by RLC... |
Thanks, Conrado! That makes more sense. This library needs a major refactoring any way to stay relevant, so this is the right time to make such decisions. Should we also consider prefixing library functions or is the current situation good enough? |
Well, consistency would be nice. So I'd suggest prefixing all symbols that are part of the public API. This does not mean it all has to happen at once. |
I am asking because we already support prefixes fox functions with the LABEL config variable. |
Yes, I think prefixing everything would be better (or the "public API", but the problem is that almost everything is public...). The problem with LABEL is that the un-prefixed symbols are still defined as macros and could still clash with other stuff. |
This would be quite some work, right? Especially with potential pre-computation tables, etc. |
Yes. It will become slightly easier after we remove the memory allocators and some other slow functions. |
So what's the requirement to get this merged into the current git master, omitting the idea to refactor other things like supported curves? |
I think so yes. For starters it should be enough to prefix just the conflicting symbols with RELIC_ and then merge this PR. |
I have changed the suffix to a prefix, so now it's RELIC_ instead of _RELIC. Is it acceptable like this? |
@@ -153,13 +153,13 @@ static void util(void) { | |||
} | |||
|
|||
static void arith(void) { | |||
eb_t p, q, r, t[EB_TABLE_MAX]; | |||
eb_t p, q, r, t[EB_RELIC_TABLE_MAX]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was RELIC_ added in between instead of at the beginning, i.e. RELIC_EB_TABLE_MAX?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to have RELIC_ with the context of TABLE, but if it's better as a proper prefix I can change it again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would seem more consistent I think. Just less to think about, if all RELIC symbols start with RELIC_. RELIC_EB_TABLE_MAX looks sensible to me. With that adjustment and the squashing mentioned by @dschuermann , this PR should be ready to merge. :)
@sruesch Better squash all commits to have only one commit, see http://blog.ona.io/general/2016/02/02/squashing-with-git-interactive-rebase.html |
@dschuermann Thanks, I'll do that! |
I have now changed all conflicting symbols so that they have the prefix RELIC_ as suggested and squashed the commits to only one commit. Is it acceptable like this? |
From the changes made it sounds good. However, I'm seeing errors trying to build the default configuration (i.e.
|
@tfar Oh! Sorry, I'll take another look! |
This should be simple to address using the CAT macros to build RELIC_EP_TABLE_MAX. |
@sruesch Any news on this PR? |
@tfar Sorry for my late reponse! I'm currently working on another project, but as soon as I have some free time I'll fix the errors. I hope to get to this during this weekend. |
@tfar I'm terribly sorry that it took me so long to come back to this! I have, as proposed, used the CAT macros to build RELIC_EP_TABLE_MAX. The current changed version compiles for me, please check again if this works for you, too, or if there are any more errors that I didn't catch. :) |
Looks good to me, other than
From my side I'm okay with merging this and fixing the broken unit tests later. What do you think @dfaranha ? |
Merged it. Will try to debug the unrelated failing unit tests this or next week. @sruesch Thanks again for this PR. |
As stated in issue #16, there are some name clashes between Relic and OpenSSL, especially regarding BN_BITS, BN_BYTES and rsa_st, which are resolved here.