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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Brian Smith
nettle
Commits
2620c890
Commit
2620c890
authored
Mar 18, 2014
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resurrect nettle_arcfour128, as an internal aead.
Do benchmarking of arcfour, salsa20 and chacha via time_aead.
parent
a9b47a42
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
1 deletion
+55
-1
ChangeLog
ChangeLog
+9
-0
examples/nettle-benchmark.c
examples/nettle-benchmark.c
+4
-0
examples/nettle-openssl.c
examples/nettle-openssl.c
+28
-0
nettle-internal.c
nettle-internal.c
+12
-1
nettle-internal.h
nettle-internal.h
+2
-0
No files found.
ChangeLog
View file @
2620c890
2014-03-18 Niels Möller <nisse@lysator.liu.se>
2014-03-18 Niels Möller <nisse@lysator.liu.se>
* examples/nettle-benchmark.c (main): Add benchmarking of arcfour,
salsa20 and chacha, via time_aead.
* nettle-internal.c (nettle_arcfour128): Define, as a struct
nettle_aead (with NULL set_nonce, update, and digest methods).
* examples/nettle-openssl.c (nettle_openssl_arcfour128): Likewise.
* nettle-internal.h (nettle_arcfour128)
(nettle_openssl_arcfour128): Declare.
* nettle-types.h (nettle_cipher_func): New typedef, similar to
* nettle-types.h (nettle_cipher_func): New typedef, similar to
nettle_crypt_func, but with a const context, intended for block
nettle_crypt_func, but with a const context, intended for block
ciphers.
ciphers.
...
...
examples/nettle-benchmark.c
View file @
2620c890
...
@@ -747,6 +747,10 @@ main(int argc, char **argv)
...
@@ -747,6 +747,10 @@ main(int argc, char **argv)
const
struct
nettle_aead
*
aeads
[]
=
const
struct
nettle_aead
*
aeads
[]
=
{
{
/* Stream ciphers */
&
nettle_arcfour128
,
OPENSSL
(
&
nettle_openssl_arcfour128
)
&
nettle_salsa20
,
&
nettle_salsa20r12
,
&
nettle_chacha
,
/* Proper AEAD algorithme. */
&
nettle_gcm_aes128
,
&
nettle_gcm_aes128
,
&
nettle_gcm_aes192
,
&
nettle_gcm_aes192
,
&
nettle_gcm_aes256
,
&
nettle_gcm_aes256
,
...
...
examples/nettle-openssl.c
View file @
2620c890
...
@@ -149,6 +149,34 @@ nettle_openssl_aes256 = {
...
@@ -149,6 +149,34 @@ nettle_openssl_aes256 = {
openssl_aes_encrypt
,
openssl_aes_decrypt
openssl_aes_encrypt
,
openssl_aes_decrypt
};
};
/* Arcfour */
static
nettle_set_key_func
openssl_arcfour128_set_key
;
static
void
openssl_arcfour128_set_key
(
void
*
ctx
,
const
uint8_t
*
key
)
{
RC4_set_key
(
ctx
,
16
,
key
);
}
static
nettle_crypt_func
openssl_arcfour_crypt
;
static
void
openssl_arcfour_crypt
(
void
*
ctx
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
{
RC4
(
ctx
,
length
,
src
,
dst
);
}
const
struct
nettle_aead
nettle_openssl_arcfour128
=
{
"openssl arcfour128"
,
sizeof
(
RC4_KEY
),
1
,
16
,
0
,
0
,
openssl_arcfour128_set_key
,
openssl_arcfour128_set_key
,
NULL
,
NULL
,
openssl_arcfour_crypt
,
openssl_arcfour_crypt
,
NULL
,
};
/* Blowfish */
/* Blowfish */
static
nettle_set_key_func
openssl_bf128_set_key
;
static
nettle_set_key_func
openssl_bf128_set_key
;
static
void
static
void
...
...
nettle-internal.c
View file @
2620c890
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include "nettle-internal.h"
#include "nettle-internal.h"
#include "arcfour.h"
#include "blowfish.h"
#include "blowfish.h"
#include "des.h"
#include "des.h"
#include "chacha.h"
#include "chacha.h"
...
@@ -71,6 +72,17 @@ nettle_blowfish128 =
...
@@ -71,6 +72,17 @@ nettle_blowfish128 =
(
nettle_cipher_func
*
)
blowfish_decrypt
(
nettle_cipher_func
*
)
blowfish_decrypt
};
};
const
struct
nettle_aead
nettle_arcfour128
=
{
"arcfour128"
,
sizeof
(
struct
arcfour_ctx
),
1
,
ARCFOUR128_KEY_SIZE
,
0
,
0
,
(
nettle_set_key_func
*
)
arcfour128_set_key
,
(
nettle_set_key_func
*
)
arcfour128_set_key
,
NULL
,
NULL
,
(
nettle_crypt_func
*
)
arcfour_crypt
,
(
nettle_crypt_func
*
)
arcfour_crypt
,
NULL
,
};
const
struct
nettle_aead
const
struct
nettle_aead
nettle_chacha
=
{
nettle_chacha
=
{
...
@@ -113,4 +125,3 @@ nettle_salsa20r12 = {
...
@@ -113,4 +125,3 @@ nettle_salsa20r12 = {
(
nettle_crypt_func
*
)
salsa20r12_crypt
,
(
nettle_crypt_func
*
)
salsa20r12_crypt
,
NULL
,
NULL
,
};
};
nettle-internal.h
View file @
2620c890
...
@@ -63,6 +63,7 @@ extern const struct nettle_cipher nettle_unified_aes192;
...
@@ -63,6 +63,7 @@ extern const struct nettle_cipher nettle_unified_aes192;
extern
const
struct
nettle_cipher
nettle_unified_aes256
;
extern
const
struct
nettle_cipher
nettle_unified_aes256
;
/* Stream ciphers treated as aead algorithms with no authentication. */
/* Stream ciphers treated as aead algorithms with no authentication. */
extern
const
struct
nettle_aead
nettle_arcfour128
;
extern
const
struct
nettle_aead
nettle_chacha
;
extern
const
struct
nettle_aead
nettle_chacha
;
extern
const
struct
nettle_aead
nettle_salsa20
;
extern
const
struct
nettle_aead
nettle_salsa20
;
extern
const
struct
nettle_aead
nettle_salsa20r12
;
extern
const
struct
nettle_aead
nettle_salsa20r12
;
...
@@ -75,6 +76,7 @@ extern const struct nettle_cipher nettle_openssl_aes256;
...
@@ -75,6 +76,7 @@ extern const struct nettle_cipher nettle_openssl_aes256;
extern
const
struct
nettle_cipher
nettle_openssl_blowfish128
;
extern
const
struct
nettle_cipher
nettle_openssl_blowfish128
;
extern
const
struct
nettle_cipher
nettle_openssl_des
;
extern
const
struct
nettle_cipher
nettle_openssl_des
;
extern
const
struct
nettle_cipher
nettle_openssl_cast128
;
extern
const
struct
nettle_cipher
nettle_openssl_cast128
;
extern
const
struct
nettle_aead
nettle_openssl_arcfour128
;
extern
const
struct
nettle_hash
nettle_openssl_md5
;
extern
const
struct
nettle_hash
nettle_openssl_md5
;
extern
const
struct
nettle_hash
nettle_openssl_sha1
;
extern
const
struct
nettle_hash
nettle_openssl_sha1
;
...
...
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