Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nettle
nettle
Commits
0d039117
Commit
0d039117
authored
Apr 04, 2013
by
Niels Möller
Browse files
Use mpn_cnd_add_n and mpn_cnd_sub_n when available. Rearrange inclusions of gmp-glue.h.
parent
2d796c6e
Changes
11
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
0d039117
2013-04-04 Niels Möller <nisse@lysator.liu.se>
* gmp-glue.h (cnd_add_n, cnd_sub_n): Moved here, define in terms
of mpn_cnd_add_n and mpn_sub_n if available, otherwise in terms of
mpn_addmul_1 and mpn_submul_1. This seems to be an improvement for
subtraction, but more questionable for addition.
* ecc-internal.h: Include gmp-glue.h. Deleted corresponding
include in all files using ecc-internal.h.
(cnd_add_n, cnd_sub_n): Moved from here.
2013-04-03 Niels Möller <nisse@lysator.liu.se>
* ecc-point-mul-g.c (ecc_point_mul_g): New file and function.
...
...
ecc-hash.c
View file @
0d039117
...
...
@@ -27,7 +27,6 @@
#endif
#include
"ecc-internal.h"
#include
"gmp-glue.h"
/* Convert hash value to an integer. If the digest is larger than
the ecc bit size, then we must truncate it and use the leftmost
...
...
ecc-internal.h
View file @
0d039117
...
...
@@ -29,6 +29,7 @@
#include
"nettle-types.h"
#include
"ecc-curve.h"
#include
"gmp-glue.h"
/* Name mangling */
#define ecc_generic_modp _nettle_ecc_generic_modp
...
...
@@ -203,12 +204,6 @@ ecc_hash (const struct ecc_curve *ecc,
mp_limb_t
*
hp
,
unsigned
length
,
const
uint8_t
*
digest
);
#define cnd_add_n(cnd, rp, ap, n) \
mpn_addmul_1 ((rp), (ap), (n), (cnd) != 0)
#define cnd_sub_n(cnd, rp, ap, n) \
mpn_submul_1 ((rp), (ap), (n), (cnd) != 0)
void
cnd_copy
(
int
cnd
,
mp_limb_t
*
rp
,
const
mp_limb_t
*
ap
,
mp_size_t
n
);
...
...
ecc-point-mul-g.c
View file @
0d039117
...
...
@@ -30,7 +30,6 @@
#include
"ecc.h"
#include
"ecc-internal.h"
#include
"gmp-glue.h"
#include
"nettle-internal.h"
void
...
...
ecc-point-mul.c
View file @
0d039117
...
...
@@ -30,7 +30,6 @@
#include
"ecc.h"
#include
"ecc-internal.h"
#include
"gmp-glue.h"
void
ecc_point_mul
(
struct
ecc_point
*
r
,
const
struct
ecc_scalar
*
n
,
...
...
ecc-point.c
View file @
0d039117
...
...
@@ -28,7 +28,6 @@
#include
"ecc.h"
#include
"ecc-internal.h"
#include
"gmp-glue.h"
void
ecc_point_init
(
struct
ecc_point
*
p
,
const
struct
ecc_curve
*
ecc
)
...
...
ecc-random.c
View file @
0d039117
...
...
@@ -30,7 +30,6 @@
#include
"ecc.h"
#include
"ecc-internal.h"
#include
"gmp-glue.h"
#include
"nettle-internal.h"
static
int
...
...
ecc-scalar.c
View file @
0d039117
...
...
@@ -28,7 +28,6 @@
#include
"ecc.h"
#include
"ecc-internal.h"
#include
"gmp-glue.h"
void
ecc_scalar_init
(
struct
ecc_scalar
*
s
,
const
struct
ecc_curve
*
ecc
)
...
...
ecdsa-sign.c
View file @
0d039117
...
...
@@ -31,7 +31,6 @@
#include
"ecdsa.h"
#include
"ecc-internal.h"
#include
"gmp-glue.h"
#include
"nettle-internal.h"
void
...
...
ecdsa-verify.c
View file @
0d039117
...
...
@@ -31,7 +31,6 @@
#include
"ecdsa.h"
#include
"ecc-internal.h"
#include
"gmp-glue.h"
int
ecdsa_verify
(
const
struct
ecc_point
*
pub
,
...
...
gmp-glue.h
View file @
0d039117
...
...
@@ -50,6 +50,15 @@
#define gmp_alloc_limbs _nettle_gmp_alloc_limbs
#define gmp_free_limbs _nettle_gmp_free_limbs
/* Use only in-place operations, so we can fall back to addmul_1/submul_1 */
#ifdef mpn_cnd_add_n
# define cnd_add_n(cnd, rp, ap, n) mpn_cnd_add_n ((cnd), (rp), (rp), (ap), (n))
# define cnd_sub_n(cnd, rp, ap, n) mpn_cnd_sub_n ((cnd), (rp), (rp), (ap), (n))
#else
# define cnd_add_n(cnd, rp, ap, n) mpn_addmul_1 ((rp), (ap), (n), (cnd) != 0)
# define cnd_sub_n(cnd, rp, ap, n) mpn_submul_1 ((rp), (ap), (n), (cnd) != 0)
#endif
/* Some functions for interfacing between mpz and mpn code. Signs of
the mpz numbers are generally ignored. */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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