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
Brian Smith
nettle
Commits
a45118aa
Commit
a45118aa
authored
Aug 25, 2014
by
Niels Möller
Browse files
Additional function pointers in struct ecc_curve.
To support curve25519 point operations.
parent
3a64c5a7
Changes
8
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
a45118aa
2014-08-25 Niels Möller <nisse@lysator.liu.se>
* ecc-internal.h (ecc_mul_g_func, ecc_mul_func, ecc_h_to_a_func):
New typedefs.
(struct ecc_curve): New function pointers mul, mul_g, h_to_a, and
constans for their scratch requirements. Updated all instances.
* ecc-point.c (ecc_point_set): Handle curve25519 as a special
case, when checking if the point is on the curve.
...
...
ecc-192.c
View file @
a45118aa
...
...
@@ -39,6 +39,9 @@
#include <assert.h>
/* FIXME: Remove ecc.h include, once prototypes of more internal
functions are moved to ecc-internal.h */
#include "ecc.h"
#include "ecc-internal.h"
#define USE_REDC 0
...
...
@@ -118,11 +121,19 @@ const struct ecc_curve nettle_secp_192r1 =
ECC_PIPPENGER_K
,
ECC_PIPPENGER_C
,
ECC_MUL_A_ITCH
(
ECC_LIMB_SIZE
),
ECC_MUL_G_ITCH
(
ECC_LIMB_SIZE
),
ECC_J_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_192_modp
,
ecc_generic_redc
,
ecc_192_modp
,
ecc_generic_modq
,
ecc_mul_a
,
ecc_mul_g
,
ecc_j_to_a
,
ecc_p
,
ecc_b
,
ecc_q
,
...
...
ecc-224.c
View file @
a45118aa
...
...
@@ -37,6 +37,7 @@
# include "config.h"
#endif
#include "ecc.h"
#include "ecc-internal.h"
#if HAVE_NATIVE_ecc_224_modp
...
...
@@ -64,11 +65,19 @@ const struct ecc_curve nettle_secp_224r1 =
ECC_PIPPENGER_K
,
ECC_PIPPENGER_C
,
ECC_MUL_A_ITCH
(
ECC_LIMB_SIZE
),
ECC_MUL_G_ITCH
(
ECC_LIMB_SIZE
),
ECC_J_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_224_modp
,
ecc_generic_redc
,
USE_REDC
?
ecc_generic_redc
:
ecc_224_modp
,
ecc_generic_modq
,
ecc_mul_a
,
ecc_mul_g
,
ecc_j_to_a
,
ecc_p
,
ecc_b
,
ecc_q
,
...
...
ecc-25519.c
View file @
a45118aa
...
...
@@ -35,6 +35,7 @@
# include "config.h"
#endif
#include "ecc.h"
#include "ecc-internal.h"
#define USE_REDC 0
...
...
@@ -210,11 +211,19 @@ const struct ecc_curve nettle_curve25519 =
ECC_PIPPENGER_K
,
ECC_PIPPENGER_C
,
ECC_MUL_A_EH_ITCH
(
ECC_LIMB_SIZE
),
ECC_MUL_G_EH_ITCH
(
ECC_LIMB_SIZE
),
ECC_EH_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_25519_modp
,
NULL
,
ecc_25519_modp
,
NULL
,
ecc_mul_a_eh
,
ecc_mul_g_eh
,
ecc_eh_to_a
,
ecc_p
,
ecc_d
,
/* Use the Edwards curve constant. */
ecc_q
,
...
...
ecc-256.c
View file @
a45118aa
...
...
@@ -39,6 +39,7 @@
#include <assert.h>
#include "ecc.h"
#include "ecc-internal.h"
#if HAVE_NATIVE_ecc_256_redc
...
...
@@ -229,11 +230,19 @@ const struct ecc_curve nettle_secp_256r1 =
ECC_PIPPENGER_K
,
ECC_PIPPENGER_C
,
ECC_MUL_A_ITCH
(
ECC_LIMB_SIZE
),
ECC_MUL_G_ITCH
(
ECC_LIMB_SIZE
),
ECC_J_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_256_modp
,
ecc_256_redc
,
USE_REDC
?
ecc_256_redc
:
ecc_256_modp
,
ecc_256_modq
,
ecc_mul_a
,
ecc_mul_g
,
ecc_j_to_a
,
ecc_p
,
ecc_b
,
ecc_q
,
...
...
ecc-384.c
View file @
a45118aa
...
...
@@ -39,6 +39,7 @@
#include <assert.h>
#include "ecc.h"
#include "ecc-internal.h"
#define USE_REDC 0
...
...
@@ -157,11 +158,19 @@ const struct ecc_curve nettle_secp_384r1 =
ECC_PIPPENGER_K
,
ECC_PIPPENGER_C
,
ECC_MUL_A_ITCH
(
ECC_LIMB_SIZE
),
ECC_MUL_G_ITCH
(
ECC_LIMB_SIZE
),
ECC_J_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_384_modp
,
ECC_REDC_SIZE
!=
0
?
ecc_generic_redc
:
NULL
,
ecc_384_modp
,
ecc_generic_modq
,
ecc_mul_a
,
ecc_mul_g
,
ecc_j_to_a
,
ecc_p
,
ecc_b
,
ecc_q
,
...
...
ecc-521.c
View file @
a45118aa
...
...
@@ -37,6 +37,7 @@
# include "config.h"
#endif
#include "ecc.h"
#include "ecc-internal.h"
#define USE_REDC 0
...
...
@@ -85,11 +86,19 @@ const struct ecc_curve nettle_secp_521r1 =
ECC_PIPPENGER_K
,
ECC_PIPPENGER_C
,
ECC_MUL_A_ITCH
(
ECC_LIMB_SIZE
),
ECC_MUL_G_ITCH
(
ECC_LIMB_SIZE
),
ECC_J_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_521_modp
,
ecc_generic_redc
,
ecc_521_modp
,
ecc_generic_modq
,
ecc_mul_a
,
ecc_mul_g
,
ecc_j_to_a
,
ecc_p
,
ecc_b
,
ecc_q
,
...
...
ecc-internal.h
View file @
a45118aa
...
...
@@ -82,6 +82,19 @@
modp_mul and modp_add. */
typedef
void
ecc_mod_func
(
const
struct
ecc_curve
*
ecc
,
mp_limb_t
*
rp
);
typedef
void
ecc_mul_g_func
(
const
struct
ecc_curve
*
ecc
,
mp_limb_t
*
r
,
const
mp_limb_t
*
np
,
mp_limb_t
*
scratch
);
typedef
void
ecc_mul_func
(
const
struct
ecc_curve
*
ecc
,
mp_limb_t
*
r
,
const
mp_limb_t
*
np
,
const
mp_limb_t
*
p
,
mp_limb_t
*
scratch
);
typedef
void
ecc_h_to_a_func
(
const
struct
ecc_curve
*
ecc
,
int
flags
,
mp_limb_t
*
r
,
const
mp_limb_t
*
p
,
mp_limb_t
*
scratch
);
/* Represents an elliptic curve of the form
y^2 = x^3 - 3x + b (mod p)
...
...
@@ -102,11 +115,19 @@ struct ecc_curve
unsigned
short
pippenger_k
;
unsigned
short
pippenger_c
;
unsigned
short
mul_itch
;
unsigned
short
mul_g_itch
;
unsigned
short
h_to_a_itch
;
ecc_mod_func
*
modp
;
ecc_mod_func
*
redc
;
ecc_mod_func
*
reduce
;
ecc_mod_func
*
modq
;
ecc_mul_func
*
mul
;
ecc_mul_g_func
*
mul_g
;
ecc_h_to_a_func
*
h_to_a
;
/* The prime p. */
const
mp_limb_t
*
p
;
const
mp_limb_t
*
b
;
...
...
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