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
00c5dcca
Commit
00c5dcca
authored
May 03, 2014
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid >= 32 bit shifts when size_t is only 32 bits.
parent
fe869abe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
ChangeLog
ChangeLog
+4
-0
ccm.c
ccm.c
+10
-7
configure.ac
configure.ac
+1
-0
No files found.
ChangeLog
View file @
00c5dcca
2014-05-03 Niels Möller <nisse@lysator.liu.se>
2014-05-03 Niels Möller <nisse@lysator.liu.se>
* configure.ac: Check for SIZEOF_SIZE_T.
* ccm.c (ccm_set_nonce): Skip code for 64-bit encoding when size_t
is only 32 bits.
* nettle.texinfo (CCM): Document new ccm macros and constants.
* nettle.texinfo (CCM): Document new ccm macros and constants.
Describe ccm restrictions.
Describe ccm restrictions.
...
...
ccm.c
View file @
00c5dcca
...
@@ -135,6 +135,7 @@ ccm_set_nonce(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f,
...
@@ -135,6 +135,7 @@ ccm_set_nonce(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f,
/* Encrypt B0 (with the adata flag), and input L(a) to the CBC-MAC. */
/* Encrypt B0 (with the adata flag), and input L(a) to the CBC-MAC. */
ctx
->
tag
.
b
[
CCM_OFFSET_FLAGS
]
|=
CCM_FLAG_ADATA
;
ctx
->
tag
.
b
[
CCM_OFFSET_FLAGS
]
|=
CCM_FLAG_ADATA
;
f
(
cipher
,
CCM_BLOCK_SIZE
,
ctx
->
tag
.
b
,
ctx
->
tag
.
b
);
f
(
cipher
,
CCM_BLOCK_SIZE
,
ctx
->
tag
.
b
,
ctx
->
tag
.
b
);
#if SIZEOF_SIZE_T > 4
if
(
authlen
>=
(
0x01ULL
<<
32
))
{
if
(
authlen
>=
(
0x01ULL
<<
32
))
{
/* Encode L(a) as 0xff || 0xff || <64-bit integer> */
/* Encode L(a) as 0xff || 0xff || <64-bit integer> */
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
0xff
;
...
@@ -146,13 +147,15 @@ ccm_set_nonce(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f,
...
@@ -146,13 +147,15 @@ ccm_set_nonce(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f,
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
24
)
&
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
24
)
&
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
16
)
&
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
16
)
&
0xff
;
}
}
else
if
(
authlen
>=
((
0x1ULL
<<
16
)
-
(
0x1ULL
<<
8
)))
{
else
/* Encode L(a) as 0xff || 0xfe || <32-bit integer> */
#endif
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
0xff
;
if
(
authlen
>=
((
0x1ULL
<<
16
)
-
(
0x1ULL
<<
8
)))
{
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
0xfe
;
/* Encode L(a) as 0xff || 0xfe || <32-bit integer> */
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
24
)
&
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
16
)
&
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
0xfe
;
}
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
24
)
&
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
16
)
&
0xff
;
}
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
8
)
&
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
8
)
&
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
0
)
&
0xff
;
ctx
->
tag
.
b
[
ctx
->
blength
++
]
^=
(
authlen
>>
0
)
&
0xff
;
}
}
...
...
configure.ac
View file @
00c5dcca
...
@@ -630,6 +630,7 @@ AC_TYPE_UID_T
...
@@ -630,6 +630,7 @@ AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_HEADER_TIME
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_HEADERS([openssl/blowfish.h openssl/des.h openssl/cast.h openssl/aes.h openssl/ecdsa.h],,
AC_CHECK_HEADERS([openssl/blowfish.h openssl/des.h openssl/cast.h openssl/aes.h openssl/ecdsa.h],,
[enable_openssl=no
[enable_openssl=no
...
...
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