Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wim Lewis
nettle
Commits
0b5a9b2a
Commit
0b5a9b2a
authored
May 2, 2013
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Use GMP's mpz_combit if available.
parent
9deeaa4f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChangeLog
+4
-0
4 additions, 0 deletions
ChangeLog
testsuite/testutils.c
+12
-12
12 additions, 12 deletions
testsuite/testutils.c
with
16 additions
and
12 deletions
ChangeLog
+
4
−
0
View file @
0b5a9b2a
2013-05-02 Niels Möller <nisse@lysator.liu.se>
2013-05-02 Niels Möller <nisse@lysator.liu.se>
* testsuite/testutils.c (mpz_combit): Renamed. Define only if not
provided GMP. Updated all uses.
(mpz_togglebit): ... old name.
* sexp-format.c (sexp_vformat): Use type mpz_srcptr rather
* sexp-format.c (sexp_vformat): Use type mpz_srcptr rather
than the old MP_INT *.
than the old MP_INT *.
...
...
This diff is collapsed.
Click to expand it.
testsuite/testutils.c
+
12
−
12
View file @
0b5a9b2a
...
@@ -647,19 +647,19 @@ test_armor(const struct nettle_armor *armor,
...
@@ -647,19 +647,19 @@ test_armor(const struct nettle_armor *armor,
free
(
decode
);
free
(
decode
);
}
}
#if HAVE_LIBGMP
#if WITH_HOGWEED
/* Missing in current gmp */
#ifndef mpz_combit
/* Missing in older gmp */
static
void
static
void
mpz_
toggle
bit
(
mpz_t
x
,
unsigned
long
int
bit
)
mpz_
com
bit
(
mpz_t
x
,
unsigned
long
int
bit
)
{
{
if
(
mpz_tstbit
(
x
,
bit
))
if
(
mpz_tstbit
(
x
,
bit
))
mpz_clrbit
(
x
,
bit
);
mpz_clrbit
(
x
,
bit
);
else
else
mpz_setbit
(
x
,
bit
);
mpz_setbit
(
x
,
bit
);
}
}
#endif
/* HAVE_LIBGMP */
#endif
#if WITH_HOGWEED
mp_limb_t
*
mp_limb_t
*
xalloc_limbs
(
mp_size_t
n
)
xalloc_limbs
(
mp_size_t
n
)
...
@@ -799,7 +799,7 @@ test_rsa_md5(struct rsa_public_key *pub,
...
@@ -799,7 +799,7 @@ test_rsa_md5(struct rsa_public_key *pub,
"The magic words are squeamish ossifrage"
,
signature
));
"The magic words are squeamish ossifrage"
,
signature
));
/* Try bad signature */
/* Try bad signature */
mpz_
toggle
bit
(
signature
,
17
);
mpz_
com
bit
(
signature
,
17
);
ASSERT
(
!
VERIFY
(
pub
,
md5
,
ASSERT
(
!
VERIFY
(
pub
,
md5
,
"The magic words are squeamish ossifrage"
,
signature
));
"The magic words are squeamish ossifrage"
,
signature
));
...
@@ -837,7 +837,7 @@ test_rsa_sha1(struct rsa_public_key *pub,
...
@@ -837,7 +837,7 @@ test_rsa_sha1(struct rsa_public_key *pub,
"The magic words are squeamish ossifrage"
,
signature
));
"The magic words are squeamish ossifrage"
,
signature
));
/* Try bad signature */
/* Try bad signature */
mpz_
toggle
bit
(
signature
,
17
);
mpz_
com
bit
(
signature
,
17
);
ASSERT
(
!
VERIFY
(
pub
,
sha1
,
ASSERT
(
!
VERIFY
(
pub
,
sha1
,
"The magic words are squeamish ossifrage"
,
signature
));
"The magic words are squeamish ossifrage"
,
signature
));
...
@@ -875,7 +875,7 @@ test_rsa_sha256(struct rsa_public_key *pub,
...
@@ -875,7 +875,7 @@ test_rsa_sha256(struct rsa_public_key *pub,
"The magic words are squeamish ossifrage"
,
signature
));
"The magic words are squeamish ossifrage"
,
signature
));
/* Try bad signature */
/* Try bad signature */
mpz_
toggle
bit
(
signature
,
17
);
mpz_
com
bit
(
signature
,
17
);
ASSERT
(
!
VERIFY
(
pub
,
sha256
,
ASSERT
(
!
VERIFY
(
pub
,
sha256
,
"The magic words are squeamish ossifrage"
,
signature
));
"The magic words are squeamish ossifrage"
,
signature
));
...
@@ -913,7 +913,7 @@ test_rsa_sha512(struct rsa_public_key *pub,
...
@@ -913,7 +913,7 @@ test_rsa_sha512(struct rsa_public_key *pub,
"The magic words are squeamish ossifrage"
,
signature
));
"The magic words are squeamish ossifrage"
,
signature
));
/* Try bad signature */
/* Try bad signature */
mpz_
toggle
bit
(
signature
,
17
);
mpz_
com
bit
(
signature
,
17
);
ASSERT
(
!
VERIFY
(
pub
,
sha512
,
ASSERT
(
!
VERIFY
(
pub
,
sha512
,
"The magic words are squeamish ossifrage"
,
signature
));
"The magic words are squeamish ossifrage"
,
signature
));
...
@@ -1036,7 +1036,7 @@ test_dsa160(const struct dsa_public_key *pub,
...
@@ -1036,7 +1036,7 @@ test_dsa160(const struct dsa_public_key *pub,
&
signature
));
&
signature
));
/* Try bad signature */
/* Try bad signature */
mpz_
toggle
bit
(
signature
.
r
,
17
);
mpz_
com
bit
(
signature
.
r
,
17
);
ASSERT
(
!
DSA_VERIFY
(
pub
,
sha1
,
ASSERT
(
!
DSA_VERIFY
(
pub
,
sha1
,
"The magic words are squeamish ossifrage"
,
"The magic words are squeamish ossifrage"
,
&
signature
));
&
signature
));
...
@@ -1086,7 +1086,7 @@ test_dsa256(const struct dsa_public_key *pub,
...
@@ -1086,7 +1086,7 @@ test_dsa256(const struct dsa_public_key *pub,
&
signature
));
&
signature
));
/* Try bad signature */
/* Try bad signature */
mpz_
toggle
bit
(
signature
.
r
,
17
);
mpz_
com
bit
(
signature
.
r
,
17
);
ASSERT
(
!
DSA_VERIFY
(
pub
,
sha256
,
ASSERT
(
!
DSA_VERIFY
(
pub
,
sha256
,
"The magic words are squeamish ossifrage"
,
"The magic words are squeamish ossifrage"
,
&
signature
));
&
signature
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment