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
0a68c384
Commit
0a68c384
authored
May 04, 2014
by
Niels Möller
Browse files
Smaller updates to salsa20 documentation.
parent
4a69d892
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
0a68c384
2014-05-04 Niels Möller <nisse@lysator.liu.se>
* nettle.texinfo (DSA): Document new DSA interface.
(Salsa20): Update salsa20 docs.
2014-05-03 Niels Möller <nisse@lysator.liu.se>
...
...
nettle.texinfo
View file @
0a68c384
...
...
@@ -1610,19 +1610,18 @@ the input and output is of fixed size.
When using Salsa20 to process a message, one specifies both a key and a
@dfn
{
nonce
}
, the latter playing a similar rôle to the initialization
vector (@acronym
{
IV
}
) used with @acronym
{
CBC
}
or @acronym
{
CTR
}
mode. For
this reason, Nettle uses the term @acronym
{
IV
}
to refer to the Salsa20
nonce. One can use the same key for several messages, provided one uses
a unique random @acronym
{
iv
}
for each message. The @acronym
{
iv
}
is 64
bits (8 octets). The block counter is initialized to zero for each
message, and is also 64 bits (8 octets). Nettle defines Salsa20 in
vector (@acronym
{
IV
}
) used with @acronym
{
CBC
}
or @acronym
{
CTR
}
mode. One
can use the same key for several messages, provided one uses a unique
random @acronym
{
iv
}
for each message. The @acronym
{
iv
}
is 64 bits (8
octets). The block counter is initialized to zero for each message, and
is also 64 bits (8 octets). Nettle defines Salsa20 in
@file
{
<nettle/salsa20.h>
}
.
@deftp
{
Context struct
}
{
struct salsa20
_
ctx
}
@end deftp
@defvr Constant SALSA20
_
MIN
_
KEY
_
SIZE
@defvrx Constant SALSA20
_
MAX
_
KEY
_
SIZE
@defvr Constant SALSA20
_
128
_
KEY
_
SIZE
@defvrx Constant SALSA20
_
256
_
KEY
_
SIZE
The two supported key sizes, 16 and 32 octets.
@end defvr
...
...
@@ -1634,18 +1633,23 @@ Recommended key size, 32.
Salsa20 block size, 64.
@end defvr
@defvr Constant SALSA20
_
IV
_
SIZE
Size of the
@acronym
{
IV
}
, 8.
@defvr Constant SALSA20
_
NONCE
_
SIZE
Size of the
nonce
, 8.
@end defvr
@deftypefun void salsa20
_
set
_
key (struct salsa20
_
ctx *@var
{
ctx
}
, size
_
t @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
@deftypefun void salsa20
_
128
_
set
_
key (struct salsa20
_
ctx *@var
{
ctx
}
, const uint8
_
t *@var
{
key
}
)
@deftypefunx void salsa20
_
256
_
set
_
key (struct salsa20
_
ctx *@var
{
ctx
}
, const uint8
_
t *@var
{
key
}
)
@deftypefunx void salsa20
_
set
_
key (struct salsa20
_
ctx *@var
{
ctx
}
, size
_
t @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
Initialize the cipher. The same function is used for both encryption and
decryption. Before using the cipher, you @emph
{
must
}
also call
@code
{
salsa20
_
set
_
iv
}
, see below.
decryption. @code
{
salsa20
_
128
_
set
_
key
}
and @code
{
salsa20
_
128
_
set
_
key
}
use a fix key size each, 16 and 32 octets, respectively. The function
@code
{
salsa20
_
set
_
key
}
is provided for backwards compatibility, and the
@var
{
length
}
argument must be either 16 or 32. Before using the cipher,
you @emph
{
must
}
also call @code
{
salsa20
_
set
_
nonce
}
, see below.
@end deftypefun
@deftypefun void salsa20
_
set
_
iv
(struct salsa20
_
ctx *@var
{
ctx
}
, const uint8
_
t *@var
{
iv
}
)
Sets the
@acronym
{
IV
}
. It is always of size @code
{
SALSA20
_
IV
_
SIZE
}
, 8
@deftypefun void salsa20
_
set
_
nonce
(struct salsa20
_
ctx *@var
{
ctx
}
, const uint8
_
t *@var
{
nonce
}
)
Sets the
nonce
. It is always of size @code
{
SALSA20
_
NONCE
_
SIZE
}
, 8
octets. This function also initializes the block counter, setting it to
zero.
@end deftypefun
...
...
salsa20.h
View file @
0a68c384
...
...
@@ -92,7 +92,7 @@ salsa20_set_key(struct salsa20_ctx *ctx,
size_t
length
,
const
uint8_t
*
key
);
void
salsa20_set_nonce
(
struct
salsa20_ctx
*
ctx
,
const
uint8_t
*
iv
);
salsa20_set_nonce
(
struct
salsa20_ctx
*
ctx
,
const
uint8_t
*
nonce
);
void
salsa20_crypt
(
struct
salsa20_ctx
*
ctx
,
...
...
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