miracl / MIRACL

MIRACL Cryptographic SDK: Multiprecision Integer and Rational Arithmetic Cryptographic Library is a C software library that is widely regarded by developers as the gold standard open source SDK for elliptic curve cryptography (ECC).
https://miracl.com
654 stars 242 forks source link

Attempt to write to read-only object #65

Open iesiyok opened 6 years ago

iesiyok commented 6 years ago

Thanks for this great tool,

I am wondering why it is not allowed to copy G1, G2 or GT objects. For example, if I attempt to copy one G1 object to another G1 object and they have the precomputed values (mtable), It will give me "Attempt to write to read-only object" error. When, I try to put a G1 in a c++ struct, that's the same error I get.

Thanks for your helps in advance,

mcarrickscott commented 6 years ago

Its a while since I wrote this. But I guess that if a value is precomputed on, then any change in that value means that the precomputed table is no longer correct.

So don't precompute on it unless it is to remain fixed thereafter.

But it should be possible to copy an element if it has not been precomputed on. From pairing_3.h

G1& operator=(const G1& w) { if (mtable==NULL) g=w.g; else read_only_error(); return *this; }

Mike

On Wed, Aug 8, 2018 at 12:07 PM Ilkan Esiyok notifications@github.com wrote:

Thanks for this great tool,

I am wondering why it is not allowed to copy G1, G2 or GT objects. For example, if I attempt to copy one G1 object to another G1 object and they have the precomputed values (mtable), It will give me "Attempt to write to read-only object" error. When, I try to put a G1 in a c++ struct, that's the same error I get.

Thanks for your helps in advance,

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/miracl/MIRACL/issues/65, or mute the thread https://github.com/notifications/unsubscribe-auth/ACm8jkboaBLsBorQphKs0P6FnBTnIY3Cks5uOsaLgaJpZM4Vzuq- .