Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Wim Lewis
nettle
Commits
2667d597
Commit
2667d597
authored
Dec 19, 2013
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New function poly1305_update.
parent
2cd7a854
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
24 deletions
+26
-24
ChangeLog
ChangeLog
+12
-0
poly1305-aes.c
poly1305-aes.c
+0
-7
poly1305-aes.h
poly1305-aes.h
+2
-4
poly1305.c
poly1305.c
+8
-0
poly1305.h
poly1305.h
+4
-13
No files found.
ChangeLog
View file @
2667d597
2013-12-19 Niels Möller <nisse@lysator.liu.se>
* poly1305-aes.h (poly1305_aes_update): Define as an alias for
poly1305_update, using preprocessor and a type cast.
* poly1305-aes.c (poly1305_aes_update): Deleted function.
* poly1305.h (poly1305_update): Declare.
(_POLY1305_BLOCK, POLY1305_UPDATE): Deleted macros.
* poly1305.c (poly1305_update): New function.
2013-11-21 Niels Möller <nisse@lysator.liu.se>
* x86_64/poly1305-internal.asm: New file. Almost a factor of two
...
...
poly1305-aes.c
View file @
2667d597
...
...
@@ -40,13 +40,6 @@ poly1305_aes_set_nonce (struct poly1305_aes_ctx *ctx,
POLY1305_SET_NONCE
(
ctx
,
nonce
);
}
void
poly1305_aes_update
(
struct
poly1305_aes_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
data
)
{
POLY1305_UPDATE
(
ctx
,
length
,
data
);
}
void
poly1305_aes_digest
(
struct
poly1305_aes_ctx
*
ctx
,
size_t
length
,
uint8_t
*
digest
)
...
...
poly1305-aes.h
View file @
2667d597
...
...
@@ -39,7 +39,6 @@ extern "C" {
#define poly1305_aes_set_key nettle_poly1305_aes_set_key
#define poly1305_aes_set_nonce nettle_poly1305_aes_set_nonce
#define poly1305_aes_update nettle_poly1305_aes_update
#define poly1305_aes_digest nettle_poly1305_aes_digest
struct
poly1305_aes_ctx
POLY1305_CTX
(
struct
aes_ctx
);
...
...
@@ -53,9 +52,8 @@ void
poly1305_aes_set_nonce
(
struct
poly1305_aes_ctx
*
ctx
,
const
uint8_t
*
nonce
);
void
poly1305_aes_update
(
struct
poly1305_aes_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
data
);
#define poly1305_aes_update \
(*(void(*)(struct poly1305_aes_ctx *, size_t, const uint8_t *))&poly1305_update)
/* The _digest functions increment the nonce */
void
...
...
poly1305.c
View file @
2667d597
...
...
@@ -26,8 +26,16 @@
#include "poly1305.h"
#include "macros.h"
void
poly1305_set_nonce
(
struct
poly1305_ctx
*
ctx
,
const
uint8_t
*
nonce
)
{
memcpy
(
ctx
->
nonce
,
nonce
,
16
);
}
void
poly1305_update
(
struct
poly1305_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
data
)
{
MD_UPDATE
(
ctx
,
length
,
data
,
poly1305_block
,
(
void
)
0
);
}
poly1305.h
View file @
2667d597
...
...
@@ -30,9 +30,7 @@
extern
"C"
{
#endif
/* Low level functions/macros for the poly1305 construction.
* For the macros to be useful include macros.h
*/
/* Low level functions/macros for the poly1305 construction. */
#include "nettle-types.h"
...
...
@@ -46,7 +44,7 @@ struct poly1305_ctx {
uint32_t
s32
[
3
];
/* State, represented as words of 26, 32 or 64 bits, depending on
implementation. */
/* High bits
,
first to maintain alignment. */
/* High bits first
,
to maintain alignment. */
uint32_t
hh
;
union
{
...
...
@@ -65,13 +63,14 @@ struct poly1305_ctx {
#define poly1305_set_key nettle_poly1305_set_key
#define poly1305_set_nonce nettle_poly1305_set_nonce
#define poly1305_update nettle_poly1305_update
#define poly1305_block nettle_poly1305_block
#define poly1305_digest nettle_poly1305_digest
void
poly1305_set_key
(
struct
poly1305_ctx
*
ctx
,
const
uint8_t
key
[
16
]);
void
poly1305_set_nonce
(
struct
poly1305_ctx
*
ctx
,
const
uint8_t
*
nonce
);
void
poly1305_block
(
struct
poly1305_ctx
*
ctx
,
const
uint8_t
m
[
16
]);
void
poly1305_update
(
struct
poly1305_ctx
*
ctx
,
size_t
size
,
const
uint8_t
*
data
);
void
poly1305_digest
(
struct
poly1305_ctx
*
ctx
,
size_t
length
,
uint8_t
*
digest
,
const
uint8_t
*
s
);
...
...
@@ -85,14 +84,6 @@ void poly1305_digest (struct poly1305_ctx *ctx,
#define POLY1305_SET_NONCE(ctx, data) \
poly1305_set_nonce(&(ctx)->pctx, (data))
#define _POLY1305_BLOCK(ctx, block) do { \
poly1305_block(ctx, block); \
} while (0)
#define POLY1305_UPDATE(ctx, length, data) \
MD_UPDATE (&(ctx)->pctx, (length), (data), _POLY1305_BLOCK, (void) 0)
#define POLY1305_DIGEST(ctx, encrypt, length, digest) \
do { \
uint8_t _ts[16]; \
...
...
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