Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wim Lewis
nettle
Commits
52f99db2
Commit
52f99db2
authored
11 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Move nonce from poly1305_ctx to poly1305_aes_ctx.
parent
0164c997
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
ChangeLog
+10
-0
10 additions, 0 deletions
ChangeLog
asm.m4
+0
-1
0 additions, 1 deletion
asm.m4
poly1305-aes.c
+4
-4
4 additions, 4 deletions
poly1305-aes.c
poly1305.c
+0
-6
0 additions, 6 deletions
poly1305.c
poly1305.h
+2
-3
2 additions, 3 deletions
poly1305.h
with
16 additions
and
14 deletions
ChangeLog
+
10
−
0
View file @
52f99db2
2014-01-17 Niels Möller <nisse@lysator.liu.se>
* poly1305.h (struct poly1305_ctx): Moved nonce field from here...
(struct poly1305_aes_ctx): ... to here.
* poly1305-aes.c (poly1305_aes_set_nonce, poly1305_aes_digest):
Updated for above.
* poly1305.c (poly1305_set_nonce): Deleted function.
* asm.m4: Delete nonce also from the assembly definition of struct
poly1305_ctx.
2014-01-16 Niels Möller <nisse@lysator.liu.se>
2014-01-16 Niels Möller <nisse@lysator.liu.se>
* poly1305-aes.c: Include poly1305.c. Rewrite functions without
* poly1305-aes.c: Include poly1305.c. Rewrite functions without
...
...
This diff is collapsed.
Click to expand it.
asm.m4
+
0
−
1
View file @
52f99db2
...
@@ -85,7 +85,6 @@ STRUCTURE(P1305)
...
@@ -85,7 +85,6 @@ STRUCTURE(P1305)
STRUCT(H2, 4)
STRUCT(H2, 4)
STRUCT(H0, 8)
STRUCT(H0, 8)
STRUCT(H1, 8)
STRUCT(H1, 8)
STRUCT(NONCE, 16)
STRUCT(BLOCK, 16)
STRUCT(BLOCK, 16)
STRUCT(INDEX, 4)
STRUCT(INDEX, 4)
...
...
This diff is collapsed.
Click to expand it.
poly1305-aes.c
+
4
−
4
View file @
52f99db2
...
@@ -40,7 +40,7 @@ void
...
@@ -40,7 +40,7 @@ void
poly1305_aes_set_nonce
(
struct
poly1305_aes_ctx
*
ctx
,
poly1305_aes_set_nonce
(
struct
poly1305_aes_ctx
*
ctx
,
const
uint8_t
*
nonce
)
const
uint8_t
*
nonce
)
{
{
poly1305_set_nonce
(
&
ctx
->
pctx
,
nonce
);
memcpy
(
ctx
->
nonce
,
nonce
,
POLY1305_AES_NONCE_SIZE
);
}
}
void
void
...
@@ -48,8 +48,8 @@ poly1305_aes_digest (struct poly1305_aes_ctx *ctx,
...
@@ -48,8 +48,8 @@ poly1305_aes_digest (struct poly1305_aes_ctx *ctx,
size_t
length
,
uint8_t
*
digest
)
size_t
length
,
uint8_t
*
digest
)
{
{
uint8_t
s
[
POLY1305_BLOCK_SIZE
];
uint8_t
s
[
POLY1305_BLOCK_SIZE
];
aes128_encrypt
(
&
ctx
->
aes
,
POLY1305_BLOCK_SIZE
,
s
,
ctx
->
pctx
.
nonce
);
aes128_encrypt
(
&
ctx
->
aes
,
POLY1305_BLOCK_SIZE
,
s
,
ctx
->
nonce
);
poly1305_digest
(
&
ctx
->
pctx
,
length
,
digest
,
s
);
poly1305_digest
(
&
ctx
->
pctx
,
length
,
digest
,
s
);
INCREMENT
(
16
,
(
ctx
)
->
pctx
.
nonce
);
INCREMENT
(
16
,
ctx
->
nonce
);
(
ctx
)
->
pctx
.
index
=
0
;
ctx
->
pctx
.
index
=
0
;
}
}
This diff is collapsed.
Click to expand it.
poly1305.c
+
0
−
6
View file @
52f99db2
...
@@ -28,12 +28,6 @@
...
@@ -28,12 +28,6 @@
#include
"macros.h"
#include
"macros.h"
void
poly1305_set_nonce
(
struct
poly1305_ctx
*
ctx
,
const
uint8_t
*
nonce
)
{
memcpy
(
ctx
->
nonce
,
nonce
,
16
);
}
void
void
poly1305_update
(
struct
poly1305_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
data
)
poly1305_update
(
struct
poly1305_ctx
*
ctx
,
size_t
length
,
const
uint8_t
*
data
)
{
{
...
...
This diff is collapsed.
Click to expand it.
poly1305.h
+
2
−
3
View file @
52f99db2
...
@@ -35,7 +35,6 @@ extern "C" {
...
@@ -35,7 +35,6 @@ extern "C" {
/* Name mangling */
/* Name mangling */
#define poly1305_set_key nettle_poly1305_set_key
#define poly1305_set_key nettle_poly1305_set_key
#define poly1305_set_nonce nettle_poly1305_set_nonce
#define poly1305_update nettle_poly1305_update
#define poly1305_update nettle_poly1305_update
#define poly1305_block nettle_poly1305_block
#define poly1305_block nettle_poly1305_block
#define poly1305_digest nettle_poly1305_digest
#define poly1305_digest nettle_poly1305_digest
...
@@ -68,13 +67,11 @@ struct poly1305_ctx {
...
@@ -68,13 +67,11 @@ struct poly1305_ctx {
uint64_t
h64
[
2
];
uint64_t
h64
[
2
];
}
h
;
}
h
;
uint8_t
nonce
[
POLY1305_BLOCK_SIZE
];
uint8_t
block
[
POLY1305_BLOCK_SIZE
];
uint8_t
block
[
POLY1305_BLOCK_SIZE
];
unsigned
index
;
unsigned
index
;
};
};
void
poly1305_set_key
(
struct
poly1305_ctx
*
ctx
,
const
uint8_t
key
[
POLY1305_KEY_SIZE
]);
void
poly1305_set_key
(
struct
poly1305_ctx
*
ctx
,
const
uint8_t
key
[
POLY1305_KEY_SIZE
]);
void
poly1305_set_nonce
(
struct
poly1305_ctx
*
ctx
,
const
uint8_t
*
nonce
);
void
poly1305_block
(
struct
poly1305_ctx
*
ctx
,
const
uint8_t
m
[
POLY1305_BLOCK_SIZE
]);
void
poly1305_block
(
struct
poly1305_ctx
*
ctx
,
const
uint8_t
m
[
POLY1305_BLOCK_SIZE
]);
void
poly1305_update
(
struct
poly1305_ctx
*
ctx
,
size_t
size
,
const
uint8_t
*
data
);
void
poly1305_update
(
struct
poly1305_ctx
*
ctx
,
size_t
size
,
const
uint8_t
*
data
);
void
poly1305_digest
(
struct
poly1305_ctx
*
ctx
,
void
poly1305_digest
(
struct
poly1305_ctx
*
ctx
,
...
@@ -84,11 +81,13 @@ void poly1305_digest (struct poly1305_ctx *ctx,
...
@@ -84,11 +81,13 @@ void poly1305_digest (struct poly1305_ctx *ctx,
#define POLY1305_AES_KEY_SIZE 32
#define POLY1305_AES_KEY_SIZE 32
#define POLY1305_AES_DIGEST_SIZE 16
#define POLY1305_AES_DIGEST_SIZE 16
#define POLY1305_AES_NONCE_SIZE 16
struct
poly1305_aes_ctx
struct
poly1305_aes_ctx
{
{
/* Must be first element, for the poly1305_aes_update cast to work. */
/* Must be first element, for the poly1305_aes_update cast to work. */
struct
poly1305_ctx
pctx
;
struct
poly1305_ctx
pctx
;
uint8_t
nonce
[
POLY1305_BLOCK_SIZE
];
struct
aes128_ctx
aes
;
struct
aes128_ctx
aes
;
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment