Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
OTRv4
little-ed448-Goldilocks
Commits
1fbd4a0b
Unverified
Commit
1fbd4a0b
authored
Jan 20, 2018
by
Sofia Celi
⛸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of some p521 things
parent
914840e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
22 deletions
+8
-22
src/GENERATED/c/ed448goldilocks/elligator.c
src/GENERATED/c/ed448goldilocks/elligator.c
+2
-9
src/GENERATED/c/p448/f_generic.c
src/GENERATED/c/p448/f_generic.c
+2
-2
src/per_curve/elligator.tmpl.c
src/per_curve/elligator.tmpl.c
+2
-9
src/per_field/f_generic.tmpl.c
src/per_field/f_generic.tmpl.c
+2
-2
No files found.
src/GENERATED/c/ed448goldilocks/elligator.c
View file @
1fbd4a0b
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#define COFACTOR 4
#define COFACTOR 4
static
const
int
EDWARDS_D
=
-
39081
;
static
const
int
EDWARDS_D
=
-
39081
;
/* This is prob also not needed */
#define RISTRETTO_FACTOR DECAF_448_RISTRETTO_FACTOR
#define RISTRETTO_FACTOR DECAF_448_RISTRETTO_FACTOR
extern
const
gf
RISTRETTO_FACTOR
;
extern
const
gf
RISTRETTO_FACTOR
;
...
@@ -146,15 +147,7 @@ API_NS(invert_elligator_nonuniform) (
...
@@ -146,15 +147,7 @@ API_NS(invert_elligator_nonuniform) (
gf_cond_neg
(
b
,
sgn_r0
^
gf_lobit
(
b
));
gf_cond_neg
(
b
,
sgn_r0
^
gf_lobit
(
b
));
/* Eliminate duplicate values for identity ... */
/* Eliminate duplicate values for identity ... */
succ
&=
~
(
gf_eq
(
b
,
ZERO
)
&
(
sgn_r0
|
sgn_s
));
succ
&=
~
(
gf_eq
(
b
,
ZERO
)
&
(
sgn_r0
|
sgn_s
));
// #if COFACTOR == 8
gf_serialize
(
recovered_hash
,
b
,
1
);
// succ &= ~(is_identity & sgn_ed_T); /* NB: there are no preimages of rotated identity. */
// #endif
#if 448 == 8*SER_BYTES + 1
/* p521 */
gf_serialize
(
recovered_hash
,
b
,
0
);
#else
gf_serialize
(
recovered_hash
,
b
,
1
);
#endif
#if 0
#if 0
recovered_hash[SER_BYTES-1] ^= (hint>>3)<<0;
recovered_hash[SER_BYTES-1] ^= (hint>>3)<<0;
#endif
#endif
...
...
src/GENERATED/c/p448/f_generic.c
View file @
1fbd4a0b
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
static
const
gf
MODULUS
=
{
FIELD_LITERAL
(
static
const
gf
MODULUS
=
{
FIELD_LITERAL
(
0xffffffffffffff
,
0xffffffffffffff
,
0xffffffffffffff
,
0xffffffffffffff
,
0xfffffffffffffe
,
0xffffffffffffff
,
0xffffffffffffff
,
0xffffffffffffff
0xffffffffffffff
,
0xffffffffffffff
,
0xffffffffffffff
,
0xffffffffffffff
,
0xfffffffffffffe
,
0xffffffffffffff
,
0xffffffffffffff
,
0xffffffffffffff
)};
)};
#if P_MOD_8 == 5
#if P_MOD_8 == 5
const
gf
SQRT_MINUS_ONE
=
{
FIELD_LITERAL
(
const
gf
SQRT_MINUS_ONE
=
{
FIELD_LITERAL
(
/* NOPE */
/* NOPE */
...
@@ -29,7 +29,7 @@ void gf_serialize (uint8_t serial[SER_BYTES], const gf x, int with_hibit) {
...
@@ -29,7 +29,7 @@ void gf_serialize (uint8_t serial[SER_BYTES], const gf x, int with_hibit) {
gf_copy
(
red
,
x
);
gf_copy
(
red
,
x
);
gf_strong_reduce
(
red
);
gf_strong_reduce
(
red
);
if
(
!
with_hibit
)
{
assert
(
gf_hibit
(
red
)
==
0
);
}
if
(
!
with_hibit
)
{
assert
(
gf_hibit
(
red
)
==
0
);
}
unsigned
int
j
=
0
,
fill
=
0
;
unsigned
int
j
=
0
,
fill
=
0
;
dword_t
buffer
=
0
;
dword_t
buffer
=
0
;
UNROLL
for
(
unsigned
int
i
=
0
;
i
<
(
with_hibit
?
X_SER_BYTES
:
SER_BYTES
);
i
++
)
{
UNROLL
for
(
unsigned
int
i
=
0
;
i
<
(
with_hibit
?
X_SER_BYTES
:
SER_BYTES
);
i
++
)
{
...
...
src/per_curve/elligator.tmpl.c
View file @
1fbd4a0b
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#define COFACTOR $(cofactor)
#define COFACTOR $(cofactor)
static
const
int
EDWARDS_D
=
$
(
d
);
static
const
int
EDWARDS_D
=
$
(
d
);
/* This is prob also not needed */
#define RISTRETTO_FACTOR $(C_NS)_RISTRETTO_FACTOR
#define RISTRETTO_FACTOR $(C_NS)_RISTRETTO_FACTOR
extern
const
gf
RISTRETTO_FACTOR
;
extern
const
gf
RISTRETTO_FACTOR
;
...
@@ -135,15 +136,7 @@ API_NS(invert_elligator_nonuniform) (
...
@@ -135,15 +136,7 @@ API_NS(invert_elligator_nonuniform) (
gf_cond_neg
(
b
,
sgn_r0
^
gf_lobit
(
b
));
gf_cond_neg
(
b
,
sgn_r0
^
gf_lobit
(
b
));
/* Eliminate duplicate values for identity ... */
/* Eliminate duplicate values for identity ... */
succ
&=
~
(
gf_eq
(
b
,
ZERO
)
&
(
sgn_r0
|
sgn_s
));
succ
&=
~
(
gf_eq
(
b
,
ZERO
)
&
(
sgn_r0
|
sgn_s
));
// #if COFACTOR == 8
gf_serialize
(
recovered_hash
,
b
,
1
);
// succ &= ~(is_identity & sgn_ed_T); /* NB: there are no preimages of rotated identity. */
// #endif
#if $(gf_bits) == 8*SER_BYTES + 1
/* p521 */
gf_serialize
(
recovered_hash
,
b
,
0
);
#else
gf_serialize
(
recovered_hash
,
b
,
1
);
#endif
#if $(gf_bits%8)
#if $(gf_bits%8)
recovered_hash
[
SER_BYTES
-
1
]
^=
(
hint
>>
3
)
<<
$
(
gf_bits
%
8
);
recovered_hash
[
SER_BYTES
-
1
]
^=
(
hint
>>
3
)
<<
$
(
gf_bits
%
8
);
#endif
#endif
...
...
src/per_field/f_generic.tmpl.c
View file @
1fbd4a0b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
static
const
gf
MODULUS
=
{
FIELD_LITERAL
(
static
const
gf
MODULUS
=
{
FIELD_LITERAL
(
$
(
ser
(
modulus
,
gf_lit_limb_bits
))
$
(
ser
(
modulus
,
gf_lit_limb_bits
))
)};
)};
#if P_MOD_8 == 5
#if P_MOD_8 == 5
const
gf
SQRT_MINUS_ONE
=
{
FIELD_LITERAL
(
const
gf
SQRT_MINUS_ONE
=
{
FIELD_LITERAL
(
$
(
ser
(
msqrt
(
-
1
,
modulus
),
gf_lit_limb_bits
)
if
modulus
%
4
==
1
else
"/* NOPE */"
)
$
(
ser
(
msqrt
(
-
1
,
modulus
),
gf_lit_limb_bits
)
if
modulus
%
4
==
1
else
"/* NOPE */"
)
...
@@ -18,7 +18,7 @@ void gf_serialize (uint8_t serial[SER_BYTES], const gf x, int with_hibit) {
...
@@ -18,7 +18,7 @@ void gf_serialize (uint8_t serial[SER_BYTES], const gf x, int with_hibit) {
gf_copy
(
red
,
x
);
gf_copy
(
red
,
x
);
gf_strong_reduce
(
red
);
gf_strong_reduce
(
red
);
if
(
!
with_hibit
)
{
assert
(
gf_hibit
(
red
)
==
0
);
}
if
(
!
with_hibit
)
{
assert
(
gf_hibit
(
red
)
==
0
);
}
unsigned
int
j
=
0
,
fill
=
0
;
unsigned
int
j
=
0
,
fill
=
0
;
dword_t
buffer
=
0
;
dword_t
buffer
=
0
;
UNROLL
for
(
unsigned
int
i
=
0
;
i
<
(
with_hibit
?
X_SER_BYTES
:
SER_BYTES
);
i
++
)
{
UNROLL
for
(
unsigned
int
i
=
0
;
i
<
(
with_hibit
?
X_SER_BYTES
:
SER_BYTES
);
i
++
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment