Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nettle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Wim Lewis
nettle
Commits
e2da8384
Commit
e2da8384
authored
Mar 31, 2012
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
salsa20_set_iv: Deleted size argument.
parent
588e0e8f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
15 deletions
+18
-15
ChangeLog
ChangeLog
+7
-0
nettle-internal.c
nettle-internal.c
+1
-1
salsa20.c
salsa20.c
+1
-3
salsa20.h
salsa20.h
+1
-2
testsuite/salsa20-test.c
testsuite/salsa20-test.c
+8
-9
No files found.
ChangeLog
View file @
e2da8384
2012-03-31 Niels Möller <nisse@lysator.liu.se>
* salsa20.c: (salsa20_set_iv): Deleted size argument, only one
size allowed.
* nettle-internal.c (salsa20_set_key_hack): Updated salsa20_set_iv
call.
* testsuite/salsa20-test.c (test_salsa20): Deleted iv_length
argument, updated all calls.
* salsa20.h (SALSA20_BLOCK_SIZE): New constant.
(_SALSA20_INPUT_LENGTH): New constant.
* salsa20.c: Use these constants.
...
...
nettle-internal.c
View file @
e2da8384
...
...
@@ -84,7 +84,7 @@ salsa20_set_key_hack(void *ctx, unsigned length, const uint8_t *key)
{
static
const
uint8_t
iv
[
SALSA20_IV_SIZE
];
salsa20_set_key
(
ctx
,
length
,
key
);
salsa20_set_iv
(
ctx
,
SALSA20_IV_SIZE
,
iv
);
salsa20_set_iv
(
ctx
,
iv
);
}
/* Claim zero block size, to classify as a stream cipher. */
...
...
salsa20.c
View file @
e2da8384
...
...
@@ -128,10 +128,8 @@ salsa20_set_key(struct salsa20_ctx *ctx,
}
void
salsa20_set_iv
(
struct
salsa20_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
iv
)
salsa20_set_iv
(
struct
salsa20_ctx
*
ctx
,
const
uint8_t
*
iv
)
{
assert
(
length
==
SALSA20_IV_SIZE
);
ctx
->
input
[
6
]
=
U8TO32_LITTLE
(
iv
+
0
);
ctx
->
input
[
7
]
=
U8TO32_LITTLE
(
iv
+
4
);
ctx
->
input
[
8
]
=
0
;
...
...
salsa20.h
View file @
e2da8384
...
...
@@ -68,8 +68,7 @@ salsa20_set_key(struct salsa20_ctx *ctx,
unsigned
length
,
const
uint8_t
*
key
);
void
salsa20_set_iv
(
struct
salsa20_ctx
*
ctx
,
unsigned
length
,
const
uint8_t
*
iv
);
salsa20_set_iv
(
struct
salsa20_ctx
*
ctx
,
const
uint8_t
*
iv
);
void
salsa20_crypt
(
struct
salsa20_ctx
*
ctx
,
...
...
testsuite/salsa20-test.c
View file @
e2da8384
...
...
@@ -4,7 +4,6 @@
static
void
test_salsa20
(
unsigned
key_length
,
const
uint8_t
*
key
,
unsigned
iv_length
,
const
uint8_t
*
iv
,
unsigned
length
,
const
uint8_t
*
cleartext
,
...
...
@@ -14,7 +13,7 @@ test_salsa20(unsigned key_length,
uint8_t
*
data
=
xalloc
(
length
);
salsa20_set_key
(
&
ctx
,
key_length
,
key
);
salsa20_set_iv
(
&
ctx
,
iv
_length
,
iv
);
salsa20_set_iv
(
&
ctx
,
iv
);
salsa20_crypt
(
&
ctx
,
length
,
data
,
cleartext
);
if
(
!
MEMEQ
(
length
,
data
,
ciphertext
))
...
...
@@ -29,7 +28,7 @@ test_salsa20(unsigned key_length,
FAIL
();
}
salsa20_set_key
(
&
ctx
,
key_length
,
key
);
salsa20_set_iv
(
&
ctx
,
iv
_length
,
iv
);
salsa20_set_iv
(
&
ctx
,
iv
);
salsa20_crypt
(
&
ctx
,
length
,
data
,
data
);
if
(
!
MEMEQ
(
length
,
data
,
cleartext
))
...
...
@@ -53,35 +52,35 @@ test_main(void)
/* 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
(
HL
(
"80000000 00000000 00000000 00000000"
),
H
L
(
"00000000 00000000"
),
H
(
"00000000 00000000"
),
HL
(
"00000000 00000000"
),
H
(
"4DFA5E48 1DA23EA0"
));
test_salsa20
(
HL
(
"00000000 00000000 00000000 00000000"
),
H
L
(
"80000000 00000000"
),
H
(
"80000000 00000000"
),
HL
(
"00000000 00000000"
),
H
(
"B66C1E44 46DD9557"
));
test_salsa20
(
HL
(
"0053A6F94C9FF24598EB3E91E4378ADD"
),
H
L
(
"0D74DB42A91077DE"
),
H
(
"0D74DB42A91077DE"
),
HL
(
"00000000 00000000"
),
H
(
"05E1E7BE B697D999"
));
test_salsa20
(
HL
(
"80000000 00000000 00000000 00000000"
"00000000 00000000 00000000 00000000"
),
H
L
(
"00000000 00000000"
),
H
(
"00000000 00000000"
),
HL
(
"00000000 00000000"
),
H
(
"E3BE8FDD 8BECA2E3"
));
test_salsa20
(
HL
(
"00000000 00000000 00000000 00000000"
"00000000 00000000 00000000 00000000"
),
H
L
(
"80000000 00000000"
),
H
(
"80000000 00000000"
),
HL
(
"00000000 00000000"
),
H
(
"2ABA3DC45B494700"
));
test_salsa20
(
HL
(
"0053A6F94C9FF24598EB3E91E4378ADD"
"3083D6297CCF2275C81B6EC11467BA0D"
),
H
L
(
"0D74DB42A91077DE"
),
H
(
"0D74DB42A91077DE"
),
HL
(
"00000000 00000000"
),
H
(
"F5FAD53F 79F9DF58"
));
...
...
Write
Preview
Markdown
is supported
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