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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wim Lewis
nettle
Commits
b2780333
Commit
b2780333
authored
10 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
New function write_mpn, used in the testsuite.
parent
4351c027
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ChangeLog
+3
-0
3 additions, 0 deletions
ChangeLog
testsuite/testutils.c
+17
-7
17 additions, 7 deletions
testsuite/testutils.c
testsuite/testutils.h
+3
-0
3 additions, 0 deletions
testsuite/testutils.h
with
23 additions
and
7 deletions
ChangeLog
+
3
−
0
View file @
b2780333
...
...
@@ -2,6 +2,9 @@
* testsuite/testutils.c (die): Use plain vfprintf, not
gmp_vfprintf.
(write_mpn): New function.
(test_ecc_point): Use it, replacing gmp_fprintf.
* testsuite/testutils.h (write_mpn): Declare it.
* der-iterator.c: Deleted HAVE_LIBGMP conditionals.
...
...
This diff is collapsed.
Click to expand it.
testsuite/testutils.c
+
17
−
7
View file @
b2780333
...
...
@@ -1282,6 +1282,13 @@ struct ecc_ref_point
const
char
*
y
;
};
void
write_mpn
(
FILE
*
f
,
int
base
,
const
mp_limb_t
*
xp
,
mp_size_t
n
)
{
mpz_t
t
;
mpz_out_str
(
f
,
base
,
mpz_roinit_n
(
t
,
xp
,
n
));
}
static
void
test_ecc_point
(
const
struct
ecc_curve
*
ecc
,
const
struct
ecc_ref_point
*
ref
,
...
...
@@ -1290,13 +1297,16 @@ test_ecc_point (const struct ecc_curve *ecc,
if
(
!
(
test_mpn
(
ref
->
x
,
p
,
ecc
->
size
)
&&
test_mpn
(
ref
->
y
,
p
+
ecc
->
size
,
ecc
->
size
)
))
{
gmp_fprintf
(
stderr
,
"Incorrect point!
\n
"
"got: x = %Nx
\n
"
" y = %Nx
\n
"
"ref: x = %s
\n
"
" y = %s
\n
"
,
p
,
ecc
->
size
,
p
+
ecc
->
size
,
ecc
->
size
,
ref
->
x
,
ref
->
y
);
fprintf
(
stderr
,
"Incorrect point!
\n
"
"got: x = "
);
write_mpn
(
stderr
,
16
,
p
,
ecc
->
size
);
fprintf
(
stderr
,
"
\n
"
" y = "
);
write_mpn
(
stderr
,
16
,
p
+
ecc
->
size
,
ecc
->
size
);
fprintf
(
stderr
,
"
\n
"
"ref: x = %s
\n
"
" y = %s
\n
"
,
ref
->
x
,
ref
->
y
);
abort
();
}
}
...
...
This diff is collapsed.
Click to expand it.
testsuite/testutils.h
+
3
−
0
View file @
b2780333
...
...
@@ -164,6 +164,9 @@ test_armor(const struct nettle_armor *armor,
mp_limb_t
*
xalloc_limbs
(
mp_size_t
n
);
void
write_mpn
(
FILE
*
f
,
int
base
,
const
mp_limb_t
*
xp
,
mp_size_t
n
);
void
test_rsa_set_key_1
(
struct
rsa_public_key
*
pub
,
struct
rsa_private_key
*
key
);
...
...
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