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
c6ce389e
Commit
c6ce389e
authored
Feb 13, 2014
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make eax_aes128 interface public.
parent
63108e98
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
172 additions
and
106 deletions
+172
-106
ChangeLog
ChangeLog
+16
-0
Makefile.in
Makefile.in
+2
-1
eax-aes128-meta.c
eax-aes128-meta.c
+50
-0
eax-aes128.c
eax-aes128.c
+70
-0
eax.h
eax.h
+32
-6
examples/nettle-benchmark.c
examples/nettle-benchmark.c
+1
-0
nettle-internal.c
nettle-internal.c
+0
-69
nettle-internal.h
nettle-internal.h
+0
-30
nettle-meta.h
nettle-meta.h
+1
-0
No files found.
ChangeLog
View file @
c6ce389e
2014-02-13 Niels Möller <nisse@lysator.liu.se>
* Makefile.in (nettle_SOURCES): Added eax-aes128.c
eax-aes128-meta.c.
* examples/nettle-benchmark.c: Include eax.h.
* nettle-meta.h (nettle_eax_aes128): Declare, moved from
nettle-internal.h.
* eax.h: Declare eax_aes128_ctx and related functions. Moved from
nettle-internal.h
(EAX_IV_SIZE): New constant.
* eax-aes128-meta.c (nettle_eax_aes128): Moved definition to new
file.
* eax-aes128.c (eax_aes128_set_key, eax_aes128_set_nonce)
(eax_aes128_update, eax_aes128_encrypt, eax_aes128_decrypt)
(eax_aes128_digest): Moved functions to a new file.
* nettle-internal.c: ... from old location.
* nettle-internal.h: Moved eax declarations elsewhere.
* tools/nettle-pbkdf2.c (main): Added missing deallocation.
2014-02-12 Niels Möller <nisse@lysator.liu.se>
...
...
Makefile.in
View file @
c6ce389e
...
...
@@ -91,7 +91,8 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c \
chacha-poly1305.c chacha-poly1305-meta.c
\
chacha-set-key.c chacha-set-nonce.c
\
chacha128-set-key.c chacha256-set-key.c
\
ctr.c des.c des3.c des-compat.c eax.c
\
ctr.c des.c des3.c des-compat.c
\
eax.c eax-aes128.c eax-aes128-meta.c
\
gcm.c gcm-aes.c
\
gcm-aes128.c gcm-aes128-meta.c
\
gcm-aes192.c gcm-aes192-meta.c
\
...
...
eax-aes128-meta.c
0 → 100644
View file @
c6ce389e
/* eax-aes128-meta.c
*/
/* nettle, low-level cryptographics library
*
* Copyright (C) 2013, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include "eax.h"
#include "nettle-meta.h"
static
nettle_set_key_func
eax_aes128_set_nonce_wrapper
;
static
void
eax_aes128_set_nonce_wrapper
(
void
*
ctx
,
const
uint8_t
*
nonce
)
{
eax_aes128_set_nonce
(
ctx
,
EAX_IV_SIZE
,
nonce
);
}
const
struct
nettle_aead
nettle_eax_aes128
=
{
"eax_aes128"
,
sizeof
(
struct
eax_aes128_ctx
),
EAX_BLOCK_SIZE
,
AES128_KEY_SIZE
,
EAX_IV_SIZE
,
EAX_DIGEST_SIZE
,
(
nettle_set_key_func
*
)
eax_aes128_set_key
,
(
nettle_set_key_func
*
)
eax_aes128_set_key
,
eax_aes128_set_nonce_wrapper
,
(
nettle_hash_update_func
*
)
eax_aes128_update
,
(
nettle_crypt_func
*
)
eax_aes128_encrypt
,
(
nettle_crypt_func
*
)
eax_aes128_decrypt
,
(
nettle_hash_digest_func
*
)
eax_aes128_digest
};
eax-aes128.c
0 → 100644
View file @
c6ce389e
/* eax-aes128.c
*/
/* nettle, low-level cryptographics library
*
* Copyright (C) 2013, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include "eax.h"
void
eax_aes128_set_key
(
struct
eax_aes128_ctx
*
ctx
,
const
uint8_t
*
key
)
{
EAX_SET_KEY
(
ctx
,
aes128_set_encrypt_key
,
aes128_encrypt
,
key
);
}
void
eax_aes128_set_nonce
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
iv
)
{
EAX_SET_NONCE
(
ctx
,
aes128_encrypt
,
length
,
iv
);
}
void
eax_aes128_update
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
data
)
{
EAX_UPDATE
(
ctx
,
aes128_encrypt
,
length
,
data
);
}
void
eax_aes128_encrypt
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
{
EAX_ENCRYPT
(
ctx
,
aes128_encrypt
,
length
,
dst
,
src
);
}
void
eax_aes128_decrypt
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
{
EAX_DECRYPT
(
ctx
,
aes128_encrypt
,
length
,
dst
,
src
);
}
void
eax_aes128_digest
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
digest
)
{
EAX_DIGEST
(
ctx
,
aes128_encrypt
,
length
,
digest
);
}
eax.h
View file @
c6ce389e
...
...
@@ -40,18 +40,20 @@ extern "C" {
#define eax_decrypt nettle_eax_decrypt
#define eax_digest nettle_eax_digest
#define eax_aes
_set_key nettle_eax_aes
_set_key
#define eax_aes
_set_nonce nettle_eax_aes
_set_nonce
#define eax_aes
_update nettle_eax_aes
_update
#define eax_aes
_encrypt nettle_eax_aes
_encrypt
#define eax_aes
_decrypt nettle_eax_aes
_decrypt
#define eax_aes
_digest nettle_eax_aes
_digest
#define eax_aes
128_set_key nettle_eax_aes128
_set_key
#define eax_aes
128_set_nonce nettle_eax_aes128
_set_nonce
#define eax_aes
128_update nettle_eax_aes128
_update
#define eax_aes
128_encrypt nettle_eax_aes128
_encrypt
#define eax_aes
128_decrypt nettle_eax_aes128
_decrypt
#define eax_aes
128_digest nettle_eax_aes128
_digest
/* Restricted to block ciphers with 128 bit block size. FIXME: Reflect
this in naming? */
#define EAX_BLOCK_SIZE 16
#define EAX_DIGEST_SIZE 16
/* FIXME: Reasonable default? */
#define EAX_IV_SIZE 16
/* Values independent of message and nonce */
struct
eax_key
...
...
@@ -138,6 +140,30 @@ eax_digest (struct eax_ctx *eax, const struct eax_key *key,
&(ctx)->cipher, (nettle_crypt_func *) (encrypt), \
(length), (digest)))
struct
eax_aes128_ctx
EAX_CTX
(
struct
aes128_ctx
);
void
eax_aes128_set_key
(
struct
eax_aes128_ctx
*
ctx
,
const
uint8_t
*
key
);
void
eax_aes128_set_nonce
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
iv
);
void
eax_aes128_update
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
data
);
void
eax_aes128_encrypt
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
void
eax_aes128_decrypt
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
void
eax_aes128_digest
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
digest
);
#ifdef __cplusplus
}
#endif
...
...
examples/nettle-benchmark.c
View file @
c6ce389e
...
...
@@ -47,6 +47,7 @@
#include "cbc.h"
#include "ctr.h"
#include "des.h"
#include "eax.h"
#include "gcm.h"
#include "memxor.h"
#include "salsa20.h"
...
...
nettle-internal.c
View file @
c6ce389e
...
...
@@ -34,8 +34,6 @@
#include "nettle-internal.h"
#include "blowfish.h"
#include "des.h"
#include "eax.h"
#include "gcm.h"
#include "chacha.h"
#include "salsa20.h"
...
...
@@ -120,70 +118,3 @@ nettle_salsa20r12 = {
(
nettle_crypt_func
*
)
salsa20r12_crypt
};
/* eax-aes128 */
void
eax_aes128_set_key
(
struct
eax_aes128_ctx
*
ctx
,
const
uint8_t
*
key
)
{
EAX_SET_KEY
(
ctx
,
aes128_set_encrypt_key
,
aes128_encrypt
,
key
);
}
void
eax_aes128_set_nonce
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
iv
)
{
EAX_SET_NONCE
(
ctx
,
aes128_encrypt
,
length
,
iv
);
}
void
eax_aes128_update
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
data
)
{
EAX_UPDATE
(
ctx
,
aes128_encrypt
,
length
,
data
);
}
void
eax_aes128_encrypt
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
{
EAX_ENCRYPT
(
ctx
,
aes128_encrypt
,
length
,
dst
,
src
);
}
void
eax_aes128_decrypt
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
)
{
EAX_DECRYPT
(
ctx
,
aes128_encrypt
,
length
,
dst
,
src
);
}
void
eax_aes128_digest
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
digest
)
{
EAX_DIGEST
(
ctx
,
aes128_encrypt
,
length
,
digest
);
}
/* FIXME: Reasonable default? */
#define EAX_IV_SIZE 16
static
nettle_set_key_func
eax_aes128_set_nonce_wrapper
;
static
void
eax_aes128_set_nonce_wrapper
(
void
*
ctx
,
const
uint8_t
*
nonce
)
{
eax_aes128_set_nonce
(
ctx
,
EAX_IV_SIZE
,
nonce
);
}
const
struct
nettle_aead
nettle_eax_aes128
=
{
"eax_aes128"
,
sizeof
(
struct
eax_aes128_ctx
),
EAX_BLOCK_SIZE
,
AES128_KEY_SIZE
,
EAX_IV_SIZE
,
EAX_DIGEST_SIZE
,
(
nettle_set_key_func
*
)
eax_aes128_set_key
,
(
nettle_set_key_func
*
)
eax_aes128_set_key
,
eax_aes128_set_nonce_wrapper
,
(
nettle_hash_update_func
*
)
eax_aes128_update
,
(
nettle_crypt_func
*
)
eax_aes128_encrypt
,
(
nettle_crypt_func
*
)
eax_aes128_decrypt
,
(
nettle_hash_digest_func
*
)
eax_aes128_digest
};
nettle-internal.h
View file @
c6ce389e
...
...
@@ -29,8 +29,6 @@
#include "nettle-meta.h"
#include "eax.h"
/* Temporary allocation, for systems that don't support alloca. Note
* that the allocation requests should always be reasonably small, so
* that they can fit on the stack. For non-alloca systems, we use a
...
...
@@ -82,32 +80,4 @@ extern const struct nettle_cipher nettle_openssl_cast128;
extern
const
struct
nettle_hash
nettle_openssl_md5
;
extern
const
struct
nettle_hash
nettle_openssl_sha1
;
/* Tentative interface. */
struct
eax_aes128_ctx
EAX_CTX
(
struct
aes128_ctx
);
void
eax_aes128_set_key
(
struct
eax_aes128_ctx
*
ctx
,
const
uint8_t
*
key
);
void
eax_aes128_set_nonce
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
iv
);
void
eax_aes128_update
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
data
);
void
eax_aes128_encrypt
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
void
eax_aes128_decrypt
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
void
eax_aes128_digest
(
struct
eax_aes128_ctx
*
ctx
,
size_t
length
,
uint8_t
*
digest
);
extern
const
struct
nettle_aead
nettle_eax_aes128
;
#endif
/* NETTLE_INTERNAL_H_INCLUDED */
nettle-meta.h
View file @
c6ce389e
...
...
@@ -151,6 +151,7 @@ extern const struct nettle_aead nettle_gcm_aes128;
extern
const
struct
nettle_aead
nettle_gcm_aes192
;
extern
const
struct
nettle_aead
nettle_gcm_aes256
;
extern
const
struct
nettle_aead
nettle_chacha_poly1305
;
extern
const
struct
nettle_aead
nettle_eax_aes128
;
struct
nettle_armor
{
...
...
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