Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wim Lewis
nettle
Commits
b1773940
Commit
b1773940
authored
Mar 19, 2015
by
Niels Möller
Browse files
Rename nettle_curve25519 to _nettle_curve25519, and remove declaration from ecc-curve.h.
parent
5d4859c0
Changes
18
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
b1773940
2015-03-19 Niels Möller <nisse@diamant.hack.org>
* ecc-curve.h (nettle_curve25519): Removed public declaration.
* ecc-internal.h (_nettle_curve25519): New location, new name.
Updated all users.
* nettle.texinfo: Updated EdDSA documentation.
* Makefile.in (DISTFILES): Added version.h.in, libnettle.map.in,
...
...
curve25519-eh-to-x.c
View file @
b1773940
...
...
@@ -52,7 +52,7 @@ curve25519_eh_to_x (mp_limb_t *xp, const mp_limb_t *p,
#define t1 (scratch + ecc->p.size)
#define t2 (scratch + 2*ecc->p.size)
const
struct
ecc_curve
*
ecc
=
&
nettle_curve25519
;
const
struct
ecc_curve
*
ecc
=
&
_
nettle_curve25519
;
mp_limb_t
cy
;
/* If u = U/W and v = V/W are the coordiantes of the point on the
...
...
curve25519-mul-g.c
View file @
b1773940
...
...
@@ -44,7 +44,7 @@
void
curve25519_mul_g
(
uint8_t
*
r
,
const
uint8_t
*
n
)
{
const
struct
ecc_curve
*
ecc
=
&
nettle_curve25519
;
const
struct
ecc_curve
*
ecc
=
&
_
nettle_curve25519
;
uint8_t
t
[
CURVE25519_SIZE
];
mp_limb_t
*
scratch
;
mp_size_t
itch
;
...
...
curve25519-mul.c
View file @
b1773940
...
...
@@ -44,7 +44,7 @@
void
curve25519_mul
(
uint8_t
*
q
,
const
uint8_t
*
n
,
const
uint8_t
*
p
)
{
const
struct
ecc_curve
*
ecc
=
&
nettle_curve25519
;
const
struct
ecc_curve
*
ecc
=
&
_
nettle_curve25519
;
mp_size_t
itch
;
mp_limb_t
*
scratch
;
int
i
;
...
...
ecc-25519.c
View file @
b1773940
...
...
@@ -290,7 +290,7 @@ ecc_25519_sqrt(const struct ecc_modulo *p, mp_limb_t *rp,
#undef t0
}
const
struct
ecc_curve
nettle_curve25519
=
const
struct
ecc_curve
_
nettle_curve25519
=
{
{
255
,
...
...
ecc-curve.h
View file @
b1773940
...
...
@@ -46,7 +46,6 @@ extern const struct ecc_curve nettle_secp_224r1;
extern
const
struct
ecc_curve
nettle_secp_256r1
;
extern
const
struct
ecc_curve
nettle_secp_384r1
;
extern
const
struct
ecc_curve
nettle_secp_521r1
;
extern
const
struct
ecc_curve
nettle_curve25519
;
#ifdef __cplusplus
}
...
...
ecc-internal.h
View file @
b1773940
...
...
@@ -73,6 +73,12 @@
#define sec_modinv _nettle_sec_modinv
#define curve25519_eh_to_x _nettle_curve25519_eh_to_x
/* Keep this structure internal for now. It's misnamed (since it's
really implementing the equivalent twisted Edwards curve, with
different coordinates). And we're not quite ready to provide
general ecc operations over an arbitrary type of curve. */
extern
const
struct
ecc_curve
_nettle_curve25519
;
#define ECC_MAX_SIZE ((521 + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS)
/* Window size for ecc_mul_a. Using 4 bits seems like a good choice,
...
...
ed25519-sha512-pubkey.c
View file @
b1773940
...
...
@@ -41,7 +41,7 @@
void
ed25519_sha512_public_key
(
uint8_t
*
pub
,
const
uint8_t
*
priv
)
{
const
struct
ecc_curve
*
ecc
=
&
nettle_curve25519
;
const
struct
ecc_curve
*
ecc
=
&
_
nettle_curve25519
;
struct
sha512_ctx
ctx
;
uint8_t
digest
[
ED25519_KEY_SIZE
];
mp_size_t
itch
=
ecc
->
q
.
size
+
_eddsa_public_key_itch
(
ecc
);
...
...
ed25519-sha512-sign.c
View file @
b1773940
...
...
@@ -44,8 +44,8 @@ ed25519_sha512_sign (const uint8_t *pub,
size_t
length
,
const
uint8_t
*
msg
,
uint8_t
*
signature
)
{
const
struct
ecc_curve
*
ecc
=
&
nettle_curve25519
;
mp_size_t
itch
=
ecc
->
q
.
size
+
_eddsa_sign_itch
(
&
nettle_curve25519
);
const
struct
ecc_curve
*
ecc
=
&
_
nettle_curve25519
;
mp_size_t
itch
=
ecc
->
q
.
size
+
_eddsa_sign_itch
(
ecc
);
mp_limb_t
*
scratch
=
gmp_alloc_limbs
(
itch
);
#define k2 scratch
#define scratch_out (scratch + ecc->q.size)
...
...
@@ -56,7 +56,7 @@ ed25519_sha512_sign (const uint8_t *pub,
_eddsa_expand_key
(
ecc
,
&
nettle_sha512
,
&
ctx
,
priv
,
digest
,
k2
);
sha512_update
(
&
ctx
,
ED25519_KEY_SIZE
,
k1
);
_eddsa_sign
(
&
nettle_curve25519
,
&
nettle_sha512
,
pub
,
_eddsa_sign
(
ecc
,
&
nettle_sha512
,
pub
,
&
ctx
,
k2
,
length
,
msg
,
signature
,
scratch_out
);
...
...
ed25519-sha512-verify.c
View file @
b1773940
...
...
@@ -45,14 +45,14 @@ ed25519_sha512_verify (const uint8_t *pub,
size_t
length
,
const
uint8_t
*
msg
,
const
uint8_t
*
signature
)
{
const
struct
ecc_curve
*
ecc
=
&
nettle_curve25519
;
mp_size_t
itch
=
3
*
ecc
->
p
.
size
+
_eddsa_verify_itch
(
&
nettle_curve25519
);
const
struct
ecc_curve
*
ecc
=
&
_
nettle_curve25519
;
mp_size_t
itch
=
3
*
ecc
->
p
.
size
+
_eddsa_verify_itch
(
ecc
);
mp_limb_t
*
scratch
=
gmp_alloc_limbs
(
itch
);
struct
sha512_ctx
ctx
;
int
res
;
#define A scratch
#define scratch_out (scratch + 3*ecc->p.size)
res
=
(
_eddsa_decompress
(
&
nettle_curve25519
,
res
=
(
_eddsa_decompress
(
ecc
,
A
,
pub
,
scratch_out
)
&&
_eddsa_verify
(
ecc
,
&
nettle_sha512
,
pub
,
A
,
&
ctx
,
...
...
examples/ecc-benchmark.c
View file @
b1773940
...
...
@@ -343,7 +343,7 @@ bench_curve (const struct ecc_curve *ecc)
const
struct
ecc_curve
*
const
curves
[]
=
{
&
nettle_secp_192r1
,
&
nettle_secp_224r1
,
&
nettle_curve25519
,
&
_
nettle_curve25519
,
&
nettle_secp_256r1
,
&
nettle_secp_384r1
,
&
nettle_secp_521r1
,
...
...
testsuite/ecdh-test.c
View file @
b1773940
...
...
@@ -191,7 +191,7 @@ test_main(void)
/* NOTE: This isn't the standard way to do curve25519
diffie-hellman, but it tests that the ecc_point interface works
also with curve25519. */
test_dh
(
"curve25519"
,
&
nettle_curve25519
,
test_dh
(
"curve25519"
,
&
_
nettle_curve25519
,
"238301186166219052901200372289459967515481170332211409964804596991365959539"
,
"14283836751943535877833976277675258994717521964638468784408792140505262281235"
,
"43912344711849354965202408139054167824861850336739416536288592824181793690574"
,
...
...
testsuite/ecdsa-sign-test.c
View file @
b1773940
...
...
@@ -159,7 +159,7 @@ test_main (void)
/* Non-standard ecdsa using curve25519. Not interop-tested with
anything else. */
test_ecdsa
(
&
nettle_curve25519
,
test_ecdsa
(
&
_
nettle_curve25519
,
"1db511101b8fd16f e0212c5679ef53f3"
"323bde77f9efa442 617314d576d1dbcb"
,
/* z */
"aa2fa8facfdc3a99 ec466d41a2c9211c"
...
...
testsuite/ecdsa-verify-test.c
View file @
b1773940
...
...
@@ -146,7 +146,7 @@ test_main (void)
"FA509E70 AAC851AE 01AAC68D 62F86647"
"2660"
);
/* s */
test_ecdsa
(
&
nettle_curve25519
,
test_ecdsa
(
&
_
nettle_curve25519
,
/* Public key corresponding to the key in ecdsa-sign-test */
"59f8f317fd5f4e82 c02f8d4dec665fe1"
"230f83b8572638e1 b2ac34a30028e24d"
,
/* x */
...
...
testsuite/eddsa-compress-test.c
View file @
b1773940
...
...
@@ -37,7 +37,7 @@
void
test_main
(
void
)
{
const
struct
ecc_curve
*
ecc
=
&
nettle_curve25519
;
const
struct
ecc_curve
*
ecc
=
&
_
nettle_curve25519
;
gmp_randstate_t
rands
;
mp_size_t
size
,
itch
;
mpz_t
zp
,
t
;
...
...
testsuite/eddsa-sign-test.c
View file @
b1773940
...
...
@@ -104,7 +104,7 @@ void test_main (void)
{
/* Based on a few of the test vectors at
http://ed25519.cr.yp.to/python/sign.input */
test_eddsa_sign
(
&
nettle_curve25519
,
&
nettle_sha512
,
test_eddsa_sign
(
&
_
nettle_curve25519
,
&
nettle_sha512
,
SHEX
(
"d75a980182b10ab7 d54bfed3c964073a"
"0ee172f3daa62325 af021a68f707511a"
),
SHEX
(
"9d61b19deffd5a60 ba844af492ec2cc4"
...
...
@@ -114,7 +114,7 @@ void test_main (void)
"84877f1eb8e5d974 d873e06522490155"
"5fb8821590a33bac c61e39701cf9b46b"
"d25bf5f0595bbe24 655141438e7a100b"
));
test_eddsa_sign
(
&
nettle_curve25519
,
&
nettle_sha512
,
test_eddsa_sign
(
&
_
nettle_curve25519
,
&
nettle_sha512
,
SHEX
(
"3d4017c3e843895a 92b70aa74d1b7ebc"
"9c982ccf2ec4968c c0cd55f12af4660c"
),
SHEX
(
"4ccd089b28ff96da 9db6c346ec114e0f"
...
...
@@ -124,7 +124,7 @@ void test_main (void)
"a2b27b5416503f8f b3762223ebdb69da"
"085ac1e43e15996e 458f3613d0f11d8c"
"387b2eaeb4302aee b00d291612bb0c00"
));
test_eddsa_sign
(
&
nettle_curve25519
,
&
nettle_sha512
,
test_eddsa_sign
(
&
_
nettle_curve25519
,
&
nettle_sha512
,
SHEX
(
"1ed506485b09a645 0be7c9337d9fe87e"
"f99c96f8bd11cd63 1ca160d0fd73067e"
),
SHEX
(
"f215d34fe2d757cf f9cf5c05430994de"
...
...
testsuite/eddsa-verify-test.c
View file @
b1773940
...
...
@@ -127,7 +127,7 @@ test_eddsa (const struct ecc_curve *ecc,
void
test_main
(
void
)
{
test_eddsa
(
&
nettle_curve25519
,
&
nettle_sha512
,
test_eddsa
(
&
_
nettle_curve25519
,
&
nettle_sha512
,
H
(
"d75a980182b10ab7 d54bfed3c964073a"
"0ee172f3daa62325 af021a68f707511a"
),
SHEX
(
""
),
...
...
@@ -135,7 +135,7 @@ test_main (void)
"84877f1eb8e5d974 d873e06522490155"
"5fb8821590a33bac c61e39701cf9b46b"
"d25bf5f0595bbe24 655141438e7a100b"
));
test_eddsa
(
&
nettle_curve25519
,
&
nettle_sha512
,
test_eddsa
(
&
_
nettle_curve25519
,
&
nettle_sha512
,
H
(
"3d4017c3e843895a 92b70aa74d1b7ebc"
"9c982ccf2ec4968c c0cd55f12af4660c"
),
SHEX
(
"72"
),
...
...
@@ -143,7 +143,7 @@ test_main (void)
"a2b27b5416503f8f b3762223ebdb69da"
"085ac1e43e15996e 458f3613d0f11d8c"
"387b2eaeb4302aee b00d291612bb0c00"
));
test_eddsa
(
&
nettle_curve25519
,
&
nettle_sha512
,
test_eddsa
(
&
_
nettle_curve25519
,
&
nettle_sha512
,
H
(
"1ed506485b09a645 0be7c9337d9fe87e"
"f99c96f8bd11cd63 1ca160d0fd73067e"
),
SHEX
(
"fbed2a7df418ec0e 8036312ec239fcee"
...
...
testsuite/testutils.c
View file @
b1773940
...
...
@@ -1229,7 +1229,7 @@ const struct ecc_curve * const ecc_curves[] = {
&
nettle_secp_256r1
,
&
nettle_secp_384r1
,
&
nettle_secp_521r1
,
&
nettle_curve25519
,
&
_
nettle_curve25519
,
NULL
};
...
...
Write
Preview
Supports
Markdown
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