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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Marcus Hoffmann
nettle
Commits
21f197b9
Commit
21f197b9
authored
8 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Test for memeql_sec.
parent
1a0a8dce
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ChangeLog
+4
-0
4 additions, 0 deletions
ChangeLog
testsuite/.test-rules.make
+3
-0
3 additions, 0 deletions
testsuite/.test-rules.make
testsuite/Makefile.in
+1
-1
1 addition, 1 deletion
testsuite/Makefile.in
testsuite/memeql-test.c
+53
-0
53 additions, 0 deletions
testsuite/memeql-test.c
with
61 additions
and
1 deletion
ChangeLog
+
4
−
0
View file @
21f197b9
...
...
@@ -51,6 +51,10 @@
* memops.h: New header file, generalizing memxor.h.
* testsuite/memeql-test.c (test_main): New test case.
(memeql_sec_for_test): Wrapper to get valgrind to check for
side-channel silence.
2016-08-29 Niels Möller <nisse@lysator.liu.se>
* sexp-format.c (strlen_u8): New helper function.
...
...
This diff is collapsed.
Click to expand it.
testsuite/.test-rules.make
+
3
−
0
View file @
21f197b9
...
...
@@ -46,6 +46,9 @@ md5-test$(EXEEXT): md5-test.$(OBJEXT)
md5-compat-test$(EXEEXT)
:
md5-compat-test.$(OBJEXT)
$(
LINK
)
md5-compat-test.
$(
OBJEXT
)
$(
TEST_OBJS
)
-o
md5-compat-test
$(
EXEEXT
)
memeql-test$(EXEEXT)
:
memeql-test.$(OBJEXT)
$(
LINK
)
memeql-test.
$(
OBJEXT
)
$(
TEST_OBJS
)
-o
memeql-test
$(
EXEEXT
)
memxor-test$(EXEEXT)
:
memxor-test.$(OBJEXT)
$(
LINK
)
memxor-test.
$(
OBJEXT
)
$(
TEST_OBJS
)
-o
memxor-test
$(
EXEEXT
)
...
...
This diff is collapsed.
Click to expand it.
testsuite/Makefile.in
+
1
−
1
View file @
21f197b9
...
...
@@ -16,7 +16,7 @@ TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
camellia-test.c chacha-test.c
\
des-test.c des3-test.c des-compat-test.c
\
md2-test.c md4-test.c md5-test.c md5-compat-test.c
\
memxor-test.c gosthash94-test.c
\
memeql-test.c
memxor-test.c gosthash94-test.c
\
ripemd160-test.c
\
salsa20-test.c
\
sha1-test.c sha224-test.c sha256-test.c
\
...
...
This diff is collapsed.
Click to expand it.
testsuite/memeql-test.c
0 → 100644
+
53
−
0
View file @
21f197b9
#include
"testutils.h"
#include
"knuth-lfib.h"
#include
"memops.h"
#if HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
static
int
memeql_sec_for_test
(
const
void
*
a
,
const
void
*
b
,
size_t
n
)
{
int
res
;
/* Makes valgrind trigger on any branches depending on the input
data. */
VALGRIND_MAKE_MEM_UNDEFINED
(
a
,
n
);
VALGRIND_MAKE_MEM_UNDEFINED
(
b
,
n
);
res
=
memeql_sec
(
a
,
b
,
n
);
VALGRIND_MAKE_MEM_DEFINED
(
&
res
,
sizeof
(
res
));
return
res
;
}
#else
#define memeql_sec_for_test memeql_sec
#endif
#define MAX_SIZE 50
void
test_main
(
void
)
{
uint8_t
orig
[
MAX_SIZE
];
uint8_t
a
[
MAX_SIZE
];
uint8_t
b
[
MAX_SIZE
];
struct
knuth_lfib_ctx
random_ctx
;
knuth_lfib_init
(
&
random_ctx
,
11
);
size_t
size
;
for
(
size
=
0
;
size
<
50
;
size
++
)
{
size_t
i
;
uint8_t
bit
;
knuth_lfib_random
(
&
random_ctx
,
size
,
orig
);
memcpy
(
a
,
orig
,
size
);
memcpy
(
b
,
orig
,
size
);
ASSERT
(
memeql_sec_for_test
(
a
,
b
,
size
));
for
(
i
=
0
;
i
<
size
;
i
++
)
for
(
bit
=
0x80
;
bit
;
bit
>>=
1
)
{
b
[
i
]
=
orig
[
i
]
^
bit
;
ASSERT
(
!
memeql_sec_for_test
(
a
,
b
,
size
));
b
[
i
]
=
orig
[
i
];
}
}
}
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