Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nettle
nettle
Commits
509dc4ba
Commit
509dc4ba
authored
Jul 24, 2010
by
Niels Möller
Browse files
Document aes_invert_key, and Camellia.
Rev: nettle/nettle.texinfo:1.12
parent
9ec781b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
nettle.texinfo
View file @
509dc4ba
...
...
@@ -137,6 +137,10 @@ The implementation of the BLOWFISH cipher is written by Werner Koch,
copyright owned by the Free Software Foundation. Also hacked by Ray
Dassen and @value
{
AUTHOR
}
. Released under the GPL.
@item CAMELLIA
The implementation is by Nippon Telegraph and Telephone
Corporation (NTT), heavily modified by Niels Möller. Released under the LGPL.
@item CAST128
The implementation of the CAST128 cipher is written by Steve Reid.
Released into the public domain.
...
...
@@ -206,9 +210,9 @@ nevertheless be aware of. There is no big difference between the
functions for stream ciphers and for block ciphers, although they should
be used quite differently by the application.
If your application uses more than one algorithm
, you should probably
create an interface that is tailor-made for your needs,
and then write a
few lines of glue code on top of Nettle.
If your application uses more than one algorithm
of the same type, you
should probably
create an interface that is tailor-made for your needs,
and then write a
few lines of glue code on top of Nettle.
By convention, for an algorithm named @code
{
foo
}
, the struct tag for the
context struct is @code
{
foo
_
ctx
}
, constants and functions uses prefixes
...
...
@@ -719,7 +723,7 @@ keys.
To encrypt a message, you first initialize a cipher context for
encryption or decryption with a particular key. You then use the context
to process plaintext or ciphertext messages. The initialization is known
as
called
@dfn
{
key setup
}
. With Nettle, it is recommended to use each
as @dfn
{
key setup
}
. With Nettle, it is recommended to use each
context struct for only one direction, even if some of the ciphers use a
single key setup function that can be used for both encryption and
decryption.
...
...
@@ -757,6 +761,17 @@ Default AES key size, 32
Initialize the cipher, for encryption or decryption, respectively.
@end deftypefun
@deftypefun void aes
_
invert
_
key (struct aes
_
ctx *@var
{
dst
}
, const struct aes
_
ctx *@var
{
src
}
)
Given a context @var
{
src
}
initialized for encryption, initializes the
context struct @var
{
dst
}
for decryption, using the same key. If the same
context struct is passed for both @code
{
src
}
and @code
{
dst
}
, it is
converted in place. Calling @code
{
aes
_
set
_
encrypt
_
key
}
and
@code
{
aes
_
invert
_
key
}
is more efficient than calling
@code
{
aes
_
set
_
encrypt
_
key
}
and @code
{
aes
_
set
_
decrypt
_
key
}
. This function
is mainly useful for applications which needs to both encrypt and
decrypt using the @emph
{
same
}
key.
@end deftypefun
@deftypefun void aes
_
encrypt (struct aes
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Encryption function. @var
{
length
}
must be an integral multiple of the
block size. If it is more than one block, the data is processed in ECB
...
...
@@ -889,47 +904,6 @@ overlap in any other way.
Analogous to @code
{
arctwo
_
encrypt
}
@end deftypefun
@subsection CAST128
CAST-128 is a block cipher, specified in @cite
{
RFC 2144
}
. It uses a 64
bit (8 octets) block size, and a variable key size of up to 128 bits.
Nettle defines cast128 in @file
{
<nettle/cast128.h>
}
.
@deftp
{
Context struct
}
{
struct cast128
_
ctx
}
@end deftp
@defvr Constant CAST128
_
BLOCK
_
SIZE
The CAST128 block-size, 8
@end defvr
@defvr Constant CAST128
_
MIN
_
KEY
_
SIZE
Minimum CAST128 key size, 5
@end defvr
@defvr Constant CAST128
_
MAX
_
KEY
_
SIZE
Maximum CAST128 key size, 16
@end defvr
@defvr Constant CAST128
_
KEY
_
SIZE
Default CAST128 key size, 16
@end defvr
@deftypefun void cast128
_
set
_
key (struct cast128
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
Initialize the cipher. The same function is used for both encryption and
decryption.
@end deftypefun
@deftypefun void cast128
_
encrypt (struct cast128
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Encryption function. @var
{
length
}
must be an integral multiple of the
block size. If it is more than one block, the data is processed in ECB
mode. @code
{
src
}
and @code
{
dst
}
may be equal, but they must not overlap
in any other way.
@end deftypefun
@deftypefun void cast128
_
decrypt (struct cast128
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Analogous to @code
{
cast128
_
encrypt
}
@end deftypefun
@subsection BLOWFISH
BLOWFISH is a block cipher designed by Bruce Schneier. It uses a block
...
...
@@ -976,6 +950,103 @@ in any other way.
Analogous to @code
{
blowfish
_
encrypt
}
@end deftypefun
@subsection Camellia
Camellia is a block cipher developed by Mitsubishi and Nippon Telegraph
and Telephone Corporation, described in @cite
{
RFC3713
}
, and recommended
by some Japanese and European authorities as an alternative to AES. The
algorithm is patented. The implementation in Nettle is derived from the
implementation released by NTT under the GNU LGPL (v2.1 or later), and
relies on the implicit patent license of the LGPL. There is also a
statement of royalty-free licensing for Camellia at
@url
{
http://www.ntt.co.jp/news/news01e/0104/010417.html
}
, but this
statement has some limitations which seem problematic for free software.
Camellia uses a the same block size and key sizes as AES: The block size
is 128 bits (16 octets), and the supported key sizes are 128, 192, and
256 bits. Nettle defines Camellia in @file
{
<nettle/camellia.h>
}
.
@deftp
{
Context struct
}
{
struct camellia
_
ctx
}
@end deftp
@defvr Constant CAMELLIA
_
BLOCK
_
SIZE
The CAMELLIA block-size, 16
@end defvr
@defvr Constant CAMELLIA
_
MIN
_
KEY
_
SIZE
@end defvr
@defvr Constant CAMELLIA
_
MAX
_
KEY
_
SIZE
@end defvr
@defvr Constant CAMELLIA
_
KEY
_
SIZE
Default CAMELLIA key size, 32
@end defvr
@deftypefun void camellia
_
set
_
encrypt
_
key (struct camellia
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
@deftypefunx void camellia
_
set
_
decrypt
_
key (struct camellia
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
Initialize the cipher, for encryption or decryption, respectively.
@end deftypefun
@deftypefun void camellia
_
invert
_
key (struct camellia
_
ctx *@var
{
dst
}
, const struct camellia
_
ctx *@var
{
src
}
)
Given a context @var
{
src
}
initialized for encryption, initializes the
context struct @var
{
dst
}
for decryption, using the same key. If the same
context struct is passed for both @code
{
src
}
and @code
{
dst
}
, it is
converted in place. Calling @code
{
camellia
_
set
_
encrypt
_
key
}
and
@code
{
camellia
_
invert
_
key
}
is more efficient than calling
@code
{
camellia
_
set
_
encrypt
_
key
}
and @code
{
camellia
_
set
_
decrypt
_
key
}
. This function
is mainly useful for applications which needs to both encrypt and
decrypt using the @emph
{
same
}
key.
@end deftypefun
@deftypefun void camellia
_
crypt (struct camellia
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
The same function is used for both encryption and decryption.
@var
{
length
}
must be an integral multiple of the block size. If it is
more than one block, the data is processed in ECB mode. @code
{
src
}
and
@code
{
dst
}
may be equal, but they must not overlap in any other way.
@end deftypefun
@subsection CAST128
CAST-128 is a block cipher, specified in @cite
{
RFC 2144
}
. It uses a 64
bit (8 octets) block size, and a variable key size of up to 128 bits.
Nettle defines cast128 in @file
{
<nettle/cast128.h>
}
.
@deftp
{
Context struct
}
{
struct cast128
_
ctx
}
@end deftp
@defvr Constant CAST128
_
BLOCK
_
SIZE
The CAST128 block-size, 8
@end defvr
@defvr Constant CAST128
_
MIN
_
KEY
_
SIZE
Minimum CAST128 key size, 5
@end defvr
@defvr Constant CAST128
_
MAX
_
KEY
_
SIZE
Maximum CAST128 key size, 16
@end defvr
@defvr Constant CAST128
_
KEY
_
SIZE
Default CAST128 key size, 16
@end defvr
@deftypefun void cast128
_
set
_
key (struct cast128
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
Initialize the cipher. The same function is used for both encryption and
decryption.
@end deftypefun
@deftypefun void cast128
_
encrypt (struct cast128
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Encryption function. @var
{
length
}
must be an integral multiple of the
block size. If it is more than one block, the data is processed in ECB
mode. @code
{
src
}
and @code
{
dst
}
may be equal, but they must not overlap
in any other way.
@end deftypefun
@deftypefun void cast128
_
decrypt (struct cast128
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Analogous to @code
{
cast128
_
encrypt
}
@end deftypefun
@subsection DES
DES is the old Data Encryption Standard, specified by NIST. It uses a
block size of 64 bits (8 octets), and a key size of 56 bits. However,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment