Skip to content
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

Subsequent additions in ECn2 #25

Closed
baz1 opened this issue Jul 3, 2016 · 1 comment
Closed

Subsequent additions in ECn2 #25

baz1 opened this issue Jul 3, 2016 · 1 comment

Comments

@baz1
Copy link

baz1 commented Jul 3, 2016

Hello,

After investigating the "Illegal parameter usage [in ecn2_add]" error that I received in my program, I reduced the code to the "simplest" version below that still produces that error:

#define MR_PAIRING_BN
#include "pairing_3.h"
int main() {
    PFC pfc(128);
    G2 t1, t2, t3;
    pfc.random(t1);
    t2 = t1 + t1;
    t3 = t1 + t2;
    return 0;
}

I figured that the bug came from mrecn2.c, function ecn2_add3 lines 578-580:

    if (Q!=P && Q->marker==MR_EPOINT_GENERAL)
    { /* Sorry, this code is optimized for mixed addition only */
        mr_berror(_MIPP_ MR_ERR_BAD_PARAMETERS);

I understand that this comment and error have been put here on purpose, but I believe that the C++ wrappers provided in pairing_3.h should make the life easier for users and allow, say, multiple additions of elements in G2.
I noticed that adding the line t2.g.norm(); before the faulty line t3 = t1 + t2; solves the problem, which means it could easily be solved in bn_pair.cpp too (if not simply bundled in mrecn2.c by default ; it is always better not to get an error message when we can avoid it).
Thank you

Rémi

baz1 added a commit to baz1/GS-NIZK that referenced this issue Jul 3, 2016
Note: See issue 25 of MIRACL ( miracl/MIRACL#25 )
for explanation on the modified addition operation for G2 elements.
@mcarrickscott
Copy link
Contributor

Thanks for spotting that bug.

Will update MIRACL later this week in response to your observations.

Mike

On Sun, Jul 3, 2016 at 4:12 AM, Rémi Bazin notifications@github.com wrote:

Hello,

After investigating the "Illegal parameter usage [in ecn2_add]" error that
I received in my program, I reduced the code to the "simplest" version
below that still produces that error:

#define MR_PAIRING_BN
#include "pairing_3.h"
int main() {
PFC pfc(128);
G2 t1, t2, t3;
pfc.random(t1);
t2 = t1 + t1;
t3 = t1 + t2;
return 0;
}

I figured that the bug came from mrecn2.c, function ecn2_add3 lines
578-580:

if (Q!=P && Q->marker==MR_EPOINT_GENERAL)
{ /* Sorry, this code is optimized for mixed addition only */
    mr_berror(_MIPP_ MR_ERR_BAD_PARAMETERS);

I understand that this comment and error have been put here on purpose,
but I believe that the C++ wrappers provided in pairing_3.h should make the
life easier for users and allow, say, multiple additions of elements in G2.
I noticed that adding the line t2.g.norm(); before the faulty line t3 =
t1 + t2; solves the problem, which means it could easily be solved in
bn_pair.cpp too (if not simply bundled in mrecn2.c by default ; it is
always better not to get an error message when we can avoid it).
Thank you

Rémi


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#25, or mute the thread
https://github.com/notifications/unsubscribe/ACm8jtuYkHEGNjrhOEtJw6QDjW3I_Sdmks5qRyiGgaJpZM4JDywT
.

@baz1 baz1 closed this as completed Jul 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants