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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Nettle
nettle
Commits
c44b8d2e
Commit
c44b8d2e
authored
Apr 3, 2013
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Tests for salsa20r12.
parent
8ab86f23
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
+5
-0
5 additions, 0 deletions
ChangeLog
testsuite/salsa20-test.c
+51
-7
51 additions, 7 deletions
testsuite/salsa20-test.c
with
56 additions
and
7 deletions
ChangeLog
+
5
−
0
View file @
c44b8d2e
2013-04-03 Niels Möller <nisse@lysator.liu.se>
* testsuite/salsa20-test.c (test_main): Tests for salsa20r12,
contributed by Nikos Mavrogiannopoulos.
2013-03-26 Niels Möller <nisse@lysator.liu.se>
2013-03-26 Niels Möller <nisse@lysator.liu.se>
* armv7/salsa20-core-internal.asm: New file. 45% speedup.
* armv7/salsa20-core-internal.asm: New file. 45% speedup.
...
...
This diff is collapsed.
Click to expand it.
testsuite/salsa20-test.c
+
51
−
7
View file @
c44b8d2e
...
@@ -116,8 +116,12 @@ test_salsa20_stream(const struct tstring *key,
...
@@ -116,8 +116,12 @@ test_salsa20_stream(const struct tstring *key,
}
}
}
}
typedef
void
salsa20_func
(
struct
salsa20_ctx
*
ctx
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
static
void
static
void
test_salsa20
(
const
struct
tstring
*
key
,
_test_salsa20
(
salsa20_func
*
crypt
,
const
struct
tstring
*
key
,
const
struct
tstring
*
iv
,
const
struct
tstring
*
iv
,
const
struct
tstring
*
cleartext
,
const
struct
tstring
*
cleartext
,
const
struct
tstring
*
ciphertext
)
const
struct
tstring
*
ciphertext
)
...
@@ -136,7 +140,7 @@ test_salsa20(const struct tstring *key,
...
@@ -136,7 +140,7 @@ test_salsa20(const struct tstring *key,
salsa20_set_key
(
&
ctx
,
key
->
length
,
key
->
data
);
salsa20_set_key
(
&
ctx
,
key
->
length
,
key
->
data
);
salsa20_set_iv
(
&
ctx
,
iv
->
data
);
salsa20_set_iv
(
&
ctx
,
iv
->
data
);
data
[
length
]
=
17
;
data
[
length
]
=
17
;
salsa20_
crypt
(
&
ctx
,
length
,
data
,
cleartext
->
data
);
crypt
(
&
ctx
,
length
,
data
,
cleartext
->
data
);
if
(
data
[
length
]
!=
17
)
if
(
data
[
length
]
!=
17
)
{
{
fprintf
(
stderr
,
"Encrypt of %u bytes wrote too much!
\n
Input:"
,
length
);
fprintf
(
stderr
,
"Encrypt of %u bytes wrote too much!
\n
Input:"
,
length
);
...
@@ -157,7 +161,7 @@ test_salsa20(const struct tstring *key,
...
@@ -157,7 +161,7 @@ test_salsa20(const struct tstring *key,
}
}
salsa20_set_key
(
&
ctx
,
key
->
length
,
key
->
data
);
salsa20_set_key
(
&
ctx
,
key
->
length
,
key
->
data
);
salsa20_set_iv
(
&
ctx
,
iv
->
data
);
salsa20_set_iv
(
&
ctx
,
iv
->
data
);
salsa20_
crypt
(
&
ctx
,
length
,
data
,
data
);
crypt
(
&
ctx
,
length
,
data
,
data
);
if
(
!
MEMEQ
(
length
,
data
,
cleartext
->
data
))
if
(
!
MEMEQ
(
length
,
data
,
cleartext
->
data
))
{
{
...
@@ -174,9 +178,49 @@ test_salsa20(const struct tstring *key,
...
@@ -174,9 +178,49 @@ test_salsa20(const struct tstring *key,
free
(
data
);
free
(
data
);
}
}
#define test_salsa20(key, iv, cleartext, ciphertext) \
_test_salsa20 (salsa20_crypt, (key), (iv), (cleartext), (ciphertext))
#define test_salsa20r12(key, iv, cleartext, ciphertext) \
_test_salsa20 (salsa20r12_crypt, (key), (iv), (cleartext), (ciphertext))
void
void
test_main
(
void
)
test_main
(
void
)
{
{
/* http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/reduced/12-rounds/verified.test-vectors?logsort=rev&rev=210&view=markup */
test_salsa20r12
(
SHEX
(
"80000000 00000000 00000000 00000000"
),
SHEX
(
"00000000 00000000"
),
SHEX
(
"00000000 00000000"
),
SHEX
(
"FC207DBF C76C5E17"
));
test_salsa20r12
(
SHEX
(
"00400000 00000000 00000000 00000000"
),
SHEX
(
"00000000 00000000"
),
SHEX
(
"00000000 00000000"
),
SHEX
(
"6C11A3F9 5FEC7F48"
));
test_salsa20r12
(
SHEX
(
"09090909090909090909090909090909"
),
SHEX
(
"0000000000000000"
),
SHEX
(
"00000000 00000000"
),
SHEX
(
"78E11FC3 33DEDE88"
));
test_salsa20r12
(
SHEX
(
"1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B"
),
SHEX
(
"00000000 00000000"
),
SHEX
(
"00000000 00000000"
),
SHEX
(
"A6747461 1DF551FF"
));
test_salsa20r12
(
SHEX
(
"80000000000000000000000000000000"
"00000000000000000000000000000000"
),
SHEX
(
"00000000 00000000"
),
SHEX
(
"00000000 00000000"
),
SHEX
(
"AFE411ED 1C4E07E4"
));
test_salsa20r12
(
SHEX
(
"0053A6F94C9FF24598EB3E91E4378ADD"
"3083D6297CCF2275C81B6EC11467BA0D"
),
SHEX
(
"0D74DB42A91077DE"
),
SHEX
(
"00000000 00000000"
),
SHEX
(
"52E20CF8 775AE882"
));
/* http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/full/verified.test-vectors?logsort=rev&rev=210&view=markup */
/* http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/full/verified.test-vectors?logsort=rev&rev=210&view=markup */
test_salsa20
(
SHEX
(
"80000000 00000000 00000000 00000000"
),
test_salsa20
(
SHEX
(
"80000000 00000000 00000000 00000000"
),
...
@@ -260,7 +304,7 @@ test_main(void)
...
@@ -260,7 +304,7 @@ test_main(void)
"4CD6D2E1B750D5E011D1DF2E80F7210A"
));
"4CD6D2E1B750D5E011D1DF2E80F7210A"
));
}
}
/* Intermediate values for the first test case.
/* Intermediate values for the first
salsa20
test case.
0: 61707865 80 0 0
0: 61707865 80 0 0
0 3120646e 0 0
0 3120646e 0 0
0 0 79622d36 80
0 0 79622d36 80
...
...
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