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
1fd4cd40
Commit
1fd4cd40
authored
Jan 22, 2002
by
Niels Möller
Browse files
(test_armor): New function.
Rev: src/nettle/testsuite/testutils.c:1.8 Rev: src/nettle/testsuite/testutils.h:1.7
parent
f02c3d60
Changes
2
Show whitespace changes
Inline
Side-by-side
testsuite/testutils.c
View file @
1fd4cd40
...
...
@@ -222,6 +222,37 @@ test_hash(const struct nettle_hash *hash,
FAIL
();
}
void
test_armor
(
const
struct
nettle_armor
*
armor
,
unsigned
data_length
,
const
uint8_t
*
data
,
const
uint8_t
*
ascii
)
{
uint8_t
*
buffer
=
alloca
(
1
+
strlen
(
ascii
));
uint8_t
*
check
=
alloca
(
1
+
data_length
);
memset
(
buffer
,
0
,
1
+
strlen
(
ascii
));
memset
(
check
,
0
,
1
+
data_length
);
if
(
strlen
(
ascii
)
!=
armor
->
encode
(
buffer
,
data_length
,
data
))
FAIL
();
if
(
!
MEMEQ
(
strlen
(
ascii
),
buffer
,
ascii
))
FAIL
();
if
(
buffer
[
strlen
(
ascii
)])
FAIL
();
if
(
data_length
!=
armor
->
decode
(
check
,
strlen
(
ascii
),
buffer
))
FAIL
();
if
(
!
MEMEQ
(
data_length
,
check
,
data
))
FAIL
();
if
(
check
[
data_length
])
FAIL
();
}
#if HAVE_LIBGMP
#define SIGN(key, hash, msg, signature) do { \
hash##_update(&hash, LDATA(msg)); \
...
...
testsuite/testutils.h
View file @
1fd4cd40
...
...
@@ -58,6 +58,12 @@ test_hash(const struct nettle_hash *hash,
const
uint8_t
*
data
,
const
uint8_t
*
digest
);
void
test_armor
(
const
struct
nettle_armor
*
armor
,
unsigned
data_length
,
const
uint8_t
*
data
,
const
uint8_t
*
ascii
);
#if HAVE_LIBGMP
void
test_rsa_md5
(
struct
rsa_public_key
*
pub
,
...
...
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