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
Dmitry Baryshkov
nettle
Commits
cfc88891
Commit
cfc88891
authored
Apr 30, 2014
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
New macros related to ccm nonce size.
parent
b9451863
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ChangeLog
+10
-0
10 additions, 0 deletions
ChangeLog
ccm.c
+2
-5
2 additions, 5 deletions
ccm.c
ccm.h
+10
-0
10 additions, 0 deletions
ccm.h
with
22 additions
and
5 deletions
ChangeLog
+
10
−
0
View file @
cfc88891
2014-04-30 Niels Möller <nisse@lysator.liu.se>
* ccm.c (CCM_IV_MAX_SIZE, CCM_IV_MIN_SIZE): Deleted, replaced by
public constants CCM_MIN_NONCE_SIZE and CCM_MAX_NONCE_SIZE.
(ccm_build_iv): Updated for above rename.
(CCM_L_MAX_SIZE): Deleted, no longer used.
* ccm.h (CCM_MIN_NONCE_SIZE, CCM_MAX_NONCE_SIZE): New constants.
(CCM_MAX_MSG_SIZE): New macro.
2014-04-27 Niels Möller <nisse@lysator.liu.se>
2014-04-27 Niels Möller <nisse@lysator.liu.se>
* nettle.texinfo (Cipher modes): Subsection on AEAD constructions.
* nettle.texinfo (Cipher modes): Subsection on AEAD constructions.
...
...
This diff is collapsed.
Click to expand it.
ccm.c
+
2
−
5
View file @
cfc88891
...
@@ -68,9 +68,6 @@
...
@@ -68,9 +68,6 @@
#define CCM_OFFSET_FLAGS 0
#define CCM_OFFSET_FLAGS 0
#define CCM_OFFSET_NONCE 1
#define CCM_OFFSET_NONCE 1
#define CCM_L_SIZE(_nlen_) (CCM_BLOCK_SIZE - CCM_OFFSET_NONCE - (_nlen_))
#define CCM_L_SIZE(_nlen_) (CCM_BLOCK_SIZE - CCM_OFFSET_NONCE - (_nlen_))
#define CCM_L_MAX_SIZE (CCM_FLAG_L+1)
#define CCM_IV_MAX_SIZE (CCM_BLOCK_SIZE - CCM_OFFSET_NONCE - 1)
#define CCM_IV_MIN_SIZE (CCM_BLOCK_SIZE - CCM_OFFSET_NONCE - CCM_L_MAX_SIZE)
/*
/*
* The data input to the CBC-MAC: L(a) | adata | padding | plaintext | padding
* The data input to the CBC-MAC: L(a) | adata | padding | plaintext | padding
...
@@ -104,8 +101,8 @@ ccm_build_iv(uint8_t *iv, size_t noncelen, const uint8_t *nonce,
...
@@ -104,8 +101,8 @@ ccm_build_iv(uint8_t *iv, size_t noncelen, const uint8_t *nonce,
unsigned
int
i
;
unsigned
int
i
;
/* Sanity check the nonce length. */
/* Sanity check the nonce length. */
assert
(
noncelen
>=
CCM_
IV_
MIN_SIZE
);
assert
(
noncelen
>=
CCM_MIN
_NONCE
_SIZE
);
assert
(
noncelen
<=
CCM_
IV_
MAX_SIZE
);
assert
(
noncelen
<=
CCM_MAX
_NONCE
_SIZE
);
/* Generate the IV */
/* Generate the IV */
iv
[
CCM_OFFSET_FLAGS
]
=
flags
|
CCM_FLAG_SET_L
(
CCM_L_SIZE
(
noncelen
));
iv
[
CCM_OFFSET_FLAGS
]
=
flags
|
CCM_FLAG_SET_L
(
CCM_L_SIZE
(
noncelen
));
...
...
This diff is collapsed.
Click to expand it.
ccm.h
+
10
−
0
View file @
cfc88891
...
@@ -89,6 +89,16 @@ extern "C" {
...
@@ -89,6 +89,16 @@ extern "C" {
/* For CCM, the block size of the block cipher shall be 128 bits. */
/* For CCM, the block size of the block cipher shall be 128 bits. */
#define CCM_BLOCK_SIZE 16
#define CCM_BLOCK_SIZE 16
#define CCM_MIN_NONCE_SIZE 7
#define CCM_MAX_NONCE_SIZE 14
/* Maximum cleartext message size, as a function of the nonce size N.
The length field is L octets, with L = 15 - N, and then the maximum
size M = 2^{8L} - 1. */
#define CCM_MAX_MSG_SIZE(N) \
((sizeof(size_t) + (N) <= 15) \
? ~(size_t) 0 \
: ((size_t) 1 << (8*(15 - N))) - 1)
/* Per-message state */
/* Per-message state */
struct
ccm_ctx
{
struct
ccm_ctx
{
...
...
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