|
|
|
@ -23,11 +23,6 @@ namespace crypto
@@ -23,11 +23,6 @@ namespace crypto
|
|
|
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static const uint8_t A_[32] = |
|
|
|
|
{ |
|
|
|
|
0x06, 0x6d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static const uint8_t u_[32] = |
|
|
|
|
{ |
|
|
|
@ -35,17 +30,18 @@ namespace crypto
@@ -35,17 +30,18 @@ namespace crypto
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#define decode_bytes(x) { x = BN_new (); BN_bin2bn (x##_, 32, x); } |
|
|
|
|
#define decode_bytes(x) { x = BN_new (); BN_bin2bn (x##_, 32, x); } // TODO: endianess
|
|
|
|
|
Elligator2::Elligator2 () |
|
|
|
|
{ |
|
|
|
|
decode_bytes (p); |
|
|
|
|
decode_bytes (n1); |
|
|
|
|
decode_bytes (n2); |
|
|
|
|
decode_bytes (A); |
|
|
|
|
decode_bytes (u); |
|
|
|
|
|
|
|
|
|
A = BN_new (); BN_set_word (A, 486662); |
|
|
|
|
|
|
|
|
|
BN_CTX * ctx = BN_CTX_new (); |
|
|
|
|
BN_mod_inverse (iu, u, p, ctx); |
|
|
|
|
iu = BN_new (); BN_mod_inverse (iu, u, p, ctx); |
|
|
|
|
BN_CTX_free (ctx); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|