Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
OTRv4
little-ed448-Goldilocks
Commits
339c9194
Unverified
Commit
339c9194
authored
Feb 06, 2018
by
Sofia Celi
⛸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change name of functions and variables
parent
940fbb33
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
279 additions
and
279 deletions
+279
-279
src/GENERATED/c/ed448goldilocks/decaf.c
src/GENERATED/c/ed448goldilocks/decaf.c
+5
-5
src/GENERATED/c/ed448goldilocks/decaf_gen_tables.c
src/GENERATED/c/ed448goldilocks/decaf_gen_tables.c
+2
-2
src/GENERATED/c/ed448goldilocks/decaf_tables.c
src/GENERATED/c/ed448goldilocks/decaf_tables.c
+1
-1
src/GENERATED/c/ed448goldilocks/eddsa.c
src/GENERATED/c/ed448goldilocks/eddsa.c
+5
-5
src/GENERATED/c/ed448goldilocks/elligator.c
src/GENERATED/c/ed448goldilocks/elligator.c
+2
-2
src/GENERATED/c/ed448goldilocks/scalar.c
src/GENERATED/c/ed448goldilocks/scalar.c
+4
-4
src/GENERATED/include/decaf/common.h
src/GENERATED/include/decaf/common.h
+1
-1
src/GENERATED/include/decaf/ed448.h
src/GENERATED/include/decaf/ed448.h
+13
-13
src/GENERATED/include/decaf/point_448.h
src/GENERATED/include/decaf/point_448.h
+166
-166
src/GENERATED/include/decaf/point_448.hxx
src/GENERATED/include/decaf/point_448.hxx
+75
-75
src/generator/curve_data.py
src/generator/curve_data.py
+1
-1
src/public_include/decaf/common.h
src/public_include/decaf/common.h
+4
-4
No files found.
src/GENERATED/c/ed448goldilocks/decaf.c
View file @
339c9194
...
...
@@ -19,10 +19,10 @@
#include <decaf/ed448.h>
/* Template stuff */
#define API_NS(_id)
decaf
_448_##_id
#define SCALAR_BITS
DECAF
_448_SCALAR_BITS
#define SCALAR_SER_BYTES
DECAF
_448_SCALAR_BYTES
#define SCALAR_LIMBS
DECAF
_448_SCALAR_LIMBS
#define API_NS(_id)
goldilocks
_448_##_id
#define SCALAR_BITS
GOLDILOCKS
_448_SCALAR_BITS
#define SCALAR_SER_BYTES
GOLDILOCKS
_448_SCALAR_BYTES
#define SCALAR_LIMBS
GOLDILOCKS
_448_SCALAR_LIMBS
#define scalar_t API_NS(scalar_t)
#define point_t API_NS(point_t)
#define precomputed_s API_NS(precomputed_s)
...
...
@@ -48,7 +48,7 @@ static const scalar_t point_scalarmul_adjustment = {{{
const
uint8_t
decaf_x448_base_point
[
DECAF_X448_PUBLIC_BYTES
]
=
{
0x05
};
#define RISTRETTO_FACTOR
DECAF
_448_RISTRETTO_FACTOR
#define RISTRETTO_FACTOR
GOLDILOCKS
_448_RISTRETTO_FACTOR
const
gf
RISTRETTO_FACTOR
=
{
FIELD_LITERAL
(
0x42ef0f45572736
,
0x7bf6aa20ce5296
,
0xf4fd6eded26033
,
0x968c14ba839a66
,
0xb8d54b64a2d780
,
0x6aa0a1f1a7b8a5
,
0x683bf68d722fa2
,
0x22d962fbeb24f7
)};
...
...
src/GENERATED/c/ed448goldilocks/decaf_gen_tables.c
View file @
339c9194
...
...
@@ -19,7 +19,7 @@
#include "f_field.h"
#include "decaf.h"
#define API_NS(_id)
decaf
_448_##_id
#define API_NS(_id)
goldilocks
_448_##_id
static
const
unsigned
char
base_point_ser_for_pregen
[
SER_BYTES
]
=
{
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x66
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
,
0x33
};
...
...
@@ -90,7 +90,7 @@ int main(int argc, char **argv) {
printf
(
"/** @warning: this file was automatically generated. */
\n
"
);
printf
(
"#include
\"
field.h
\"\n\n
"
);
printf
(
"#include <decaf.h>
\n\n
"
);
printf
(
"#define API_NS(_id)
decaf
_448_##_id
\n
"
);
printf
(
"#define API_NS(_id)
goldilocks
_448_##_id
\n
"
);
output
=
(
const
gf_s
*
)
real_point_base
;
printf
(
"const API_NS(point_t) API_NS(point_base) = {{
\n
"
);
...
...
src/GENERATED/c/ed448goldilocks/decaf_tables.c
View file @
339c9194
...
...
@@ -3,7 +3,7 @@
#include <decaf.h>
#define API_NS(_id)
decaf
_448_##_id
#define API_NS(_id)
goldilocks
_448_##_id
const
API_NS
(
point_t
)
API_NS
(
point_base
)
=
{{
{
FIELD_LITERAL
(
0x0000000000000000
,
0x0000000000000000
,
0x0000000000000000
,
0x0080000000000000
,
0x00fffffffffffffe
,
0x00ffffffffffffff
,
0x00ffffffffffffff
,
0x007fffffffffffff
)},
{
FIELD_LITERAL
(
0x006079b4dfdd4a64
,
0x000c1e3ab470a1c8
,
0x0044d73f48e5199b
,
0x0050452714141818
,
0x004c74c393d5242c
,
0x0024080526437050
,
0x00d48d06c13078ca
,
0x008508de14f04286
)},
...
...
src/GENERATED/c/ed448goldilocks/eddsa.c
View file @
339c9194
...
...
@@ -17,8 +17,8 @@
#include <decaf/shake.h>
#include <string.h>
#define API_NAME "
decaf
_448"
#define API_NS(_id)
decaf
_448_##_id
#define API_NAME "
goldilocks
_448"
#define API_NS(_id)
goldilocks
_448_##_id
#define hash_ctx_t decaf_shake256_ctx_t
#define hash_init decaf_shake256_init
...
...
@@ -122,7 +122,7 @@ void decaf_ed448_derive_secret_scalar (
* the decaf base point is on Etwist_d, and when converted it effectively
* picks up a factor of 2 from the isogenies. So we might start at 2 instead of 1.
*/
for
(
unsigned
int
c
=
1
;
c
<
DECAF
_448_EDDSA_ENCODE_RATIO
;
c
<<=
1
)
{
for
(
unsigned
int
c
=
1
;
c
<
GOLDILOCKS
_448_EDDSA_ENCODE_RATIO
;
c
<<=
1
)
{
API_NS
(
scalar_halve
)(
secret
,
secret
);
}
...
...
@@ -194,7 +194,7 @@ void decaf_ed448_sign (
/* Scalarmul to create the nonce-point */
API_NS
(
scalar_t
)
nonce_scalar_2
;
API_NS
(
scalar_halve
)(
nonce_scalar_2
,
nonce_scalar
);
for
(
unsigned
int
c
=
2
;
c
<
DECAF
_448_EDDSA_ENCODE_RATIO
;
c
<<=
1
)
{
for
(
unsigned
int
c
=
2
;
c
<
GOLDILOCKS
_448_EDDSA_ENCODE_RATIO
;
c
<<=
1
)
{
API_NS
(
scalar_halve
)(
nonce_scalar_2
,
nonce_scalar_2
);
}
...
...
@@ -291,7 +291,7 @@ decaf_error_t decaf_ed448_verify (
DECAF_EDDSA_448_PRIVATE_BYTES
);
for
(
unsigned
c
=
1
;
c
<
DECAF
_448_EDDSA_DECODE_RATIO
;
c
<<=
1
)
{
for
(
unsigned
c
=
1
;
c
<
GOLDILOCKS
_448_EDDSA_DECODE_RATIO
;
c
<<=
1
)
{
API_NS
(
scalar_add
)(
response_scalar
,
response_scalar
,
response_scalar
);
}
...
...
src/GENERATED/c/ed448goldilocks/elligator.c
View file @
339c9194
...
...
@@ -16,13 +16,13 @@
#include <decaf.h>
/* Template stuff */
#define API_NS(_id)
decaf
_448_##_id
#define API_NS(_id)
goldilocks
_448_##_id
#define point_t API_NS(point_t)
#define COFACTOR 4
static
const
int
EDWARDS_D
=
-
39081
;
/* This is prob also not needed */
#define RISTRETTO_FACTOR
DECAF
_448_RISTRETTO_FACTOR
#define RISTRETTO_FACTOR
GOLDILOCKS
_448_RISTRETTO_FACTOR
extern
const
gf
RISTRETTO_FACTOR
;
/* End of template stuff */
...
...
src/GENERATED/c/ed448goldilocks/scalar.c
View file @
339c9194
...
...
@@ -16,10 +16,10 @@
#include <decaf.h>
/* Template stuff */
#define API_NS(_id)
decaf
_448_##_id
#define SCALAR_BITS
DECAF
_448_SCALAR_BITS
#define SCALAR_SER_BYTES
DECAF
_448_SCALAR_BYTES
#define SCALAR_LIMBS
DECAF
_448_SCALAR_LIMBS
#define API_NS(_id)
goldilocks
_448_##_id
#define SCALAR_BITS
GOLDILOCKS
_448_SCALAR_BITS
#define SCALAR_SER_BYTES
GOLDILOCKS
_448_SCALAR_BYTES
#define SCALAR_LIMBS
GOLDILOCKS
_448_SCALAR_LIMBS
#define scalar_t API_NS(scalar_t)
static
const
decaf_word_t
MONTGOMERY_FACTOR
=
(
decaf_word_t
)
0x3bd440fae918bc5ull
;
...
...
src/GENERATED/include/decaf/common.h
View file @
339c9194
...
...
@@ -54,7 +54,7 @@ extern "C" {
#define DECAF_WORD_BITS 32
/**< The number of bits in a word */
#endif
#endif
#if DECAF_WORD_BITS == 64
typedef
uint64_t
decaf_word_t
;
/**< Word size for internal computations */
typedef
int64_t
decaf_sword_t
;
/**< Signed word size for internal computations */
...
...
src/GENERATED/include/decaf/ed448.h
View file @
339c9194
...
...
@@ -48,10 +48,10 @@ extern "C" {
#define decaf_ed448_prehash_destroy decaf_shake256_destroy
/** EdDSA encoding ratio. */
#define
DECAF
_448_EDDSA_ENCODE_RATIO 4
#define
GOLDILOCKS
_448_EDDSA_ENCODE_RATIO 4
/** EdDSA decoding ratio. */
#define
DECAF
_448_EDDSA_DECODE_RATIO (4 / 4)
#define
GOLDILOCKS
_448_EDDSA_DECODE_RATIO (4 / 4)
/**
* @brief EdDSA key secret key generation. This function uses a different (non-Decaf)
...
...
@@ -61,7 +61,7 @@ extern "C" {
* @param [in] privkey The private key.
*/
void
decaf_ed448_derive_secret_scalar
(
decaf
_448_scalar_t
secret
,
goldilocks
_448_scalar_t
secret
,
const
uint8_t
privkey
[
DECAF_EDDSA_448_PRIVATE_BYTES
]
)
DECAF_API_VIS
DECAF_NONNULL
DECAF_NOINLINE
;
...
...
@@ -192,7 +192,7 @@ decaf_error_t decaf_ed448_verify_prehash (
/**
* @brief EdDSA point encoding. Used internally, exposed externally.
* Multiplies by
DECAF
_448_EDDSA_ENCODE_RATIO first.
* Multiplies by
GOLDILOCKS
_448_EDDSA_ENCODE_RATIO first.
*
* The multiplication is required because the EdDSA encoding represents
* the cofactor information, but the Decaf encoding ignores it (which
...
...
@@ -201,35 +201,35 @@ decaf_error_t decaf_ed448_verify_prehash (
* representation doesn't track it.
*
* The way libdecaf handles this is to multiply by
*
DECAF
_448_EDDSA_DECODE_RATIO when decoding, and by
*
DECAF
_448_EDDSA_ENCODE_RATIO when encoding. The product of these
*
GOLDILOCKS
_448_EDDSA_DECODE_RATIO when decoding, and by
*
GOLDILOCKS
_448_EDDSA_ENCODE_RATIO when encoding. The product of these
* ratios is always exactly the cofactor 4, so the cofactor
* ends up cleared one way or another. But exactly how that shakes
* out depends on the base points specified in RFC 8032.
*
* The upshot is that if you pass the Decaf/Ristretto base point to
* this function, you will get
DECAF
_448_EDDSA_ENCODE_RATIO times the
* this function, you will get
GOLDILOCKS
_448_EDDSA_ENCODE_RATIO times the
* EdDSA base point.
*
* @param [out] enc The encoded point.
* @param [in] p The point.
*/
void
decaf
_448_point_mul_by_ratio_and_encode_like_eddsa
(
void
goldilocks
_448_point_mul_by_ratio_and_encode_like_eddsa
(
uint8_t
enc
[
DECAF_EDDSA_448_PUBLIC_BYTES
],
const
decaf
_448_point_t
p
const
goldilocks
_448_point_t
p
)
DECAF_API_VIS
DECAF_NONNULL
DECAF_NOINLINE
;
/**
* @brief EdDSA point decoding. Multiplies by
DECAF
_448_EDDSA_DECODE_RATIO,
* @brief EdDSA point decoding. Multiplies by
GOLDILOCKS
_448_EDDSA_DECODE_RATIO,
* and ignores cofactor information.
*
* See notes on
decaf
_448_point_mul_by_ratio_and_encode_like_eddsa
* See notes on
goldilocks
_448_point_mul_by_ratio_and_encode_like_eddsa
*
* @param [out] enc The encoded point.
* @param [in] p The point.
*/
decaf_error_t
decaf
_448_point_decode_like_eddsa_and_mul_by_ratio
(
decaf
_448_point_t
p
,
decaf_error_t
goldilocks
_448_point_decode_like_eddsa_and_mul_by_ratio
(
goldilocks
_448_point_t
p
,
const
uint8_t
enc
[
DECAF_EDDSA_448_PUBLIC_BYTES
]
)
DECAF_API_VIS
DECAF_NONNULL
DECAF_NOINLINE
;
...
...
src/GENERATED/include/decaf/point_448.h
View file @
339c9194
This diff is collapsed.
Click to expand it.
src/GENERATED/include/decaf/point_448.hxx
View file @
339c9194
This diff is collapsed.
Click to expand it.
src/generator/curve_data.py
View file @
339c9194
...
...
@@ -116,7 +116,7 @@ for curve,data in curve_data.items():
data
[
"bits"
]
=
ceil_log2
(
data
[
"modulus"
])
if
"c_ns"
not
in
data
:
data
[
"c_ns"
]
=
"
decaf
_"
+
str
(
data
[
"bits"
])
data
[
"c_ns"
]
=
"
goldilocks
_"
+
str
(
data
[
"bits"
])
data
[
"C_NS"
]
=
data
[
"c_ns"
].
upper
()
src/public_include/decaf/common.h
View file @
339c9194
...
...
@@ -54,7 +54,7 @@ extern "C" {
#define DECAF_WORD_BITS 32
/**< The number of bits in a word */
#endif
#endif
#if DECAF_WORD_BITS == 64
typedef
uint64_t
decaf_word_t
;
/**< Word size for internal computations */
typedef
int64_t
decaf_sword_t
;
/**< Signed word size for internal computations */
...
...
@@ -96,7 +96,7 @@ decaf_successful(decaf_error_t e) {
decaf_dword_t
w
=
((
decaf_word_t
)
e
)
^
((
decaf_word_t
)
DECAF_SUCCESS
);
return
(
w
-
1
)
>>
DECAF_WORD_BITS
;
}
/** Overwrite data with zeros. Uses memset_s if available. */
void
decaf_bzero
(
void
*
data
,
...
...
@@ -109,9 +109,9 @@ decaf_bool_t decaf_memeq (
const
void
*
data2
,
size_t
size
)
DECAF_NONNULL
DECAF_WARN_UNUSED
DECAF_API_VIS
;
#ifdef __cplusplus
}
/* extern "C" */
#endif
#endif
/* __DECAF_COMMON_H__ */
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