Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tor
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jarl
tor
Commits
c113544a
Commit
c113544a
authored
10 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'public/bug15436_025' into maint-0.2.6
parents
ca03b10b
732f522a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changes/bug15436
+4
-0
4 additions, 0 deletions
changes/bug15436
src/ext/csiphash.c
+13
-3
13 additions, 3 deletions
src/ext/csiphash.c
with
17 additions
and
3 deletions
changes/bug15436
0 → 100644
+
4
−
0
View file @
c113544a
o Minor bugfixes (portability):
- Use the correct datatype in the SipHash-2-4 function to prevent compilers
from assuming any sort of alignment. Fixes bug 15436; bugfix on
0.2.5.3-alpha.
This diff is collapsed.
Click to expand it.
src/ext/csiphash.c
+
13
−
3
View file @
c113544a
...
...
@@ -100,10 +100,18 @@ uint64_t siphash24(const void *src, unsigned long src_sz, const struct sipkey *k
uint64_t
k0
=
key
->
k0
;
uint64_t
k1
=
key
->
k1
;
uint64_t
b
=
(
uint64_t
)
src_sz
<<
56
;
#ifdef UNALIGNED_OK
const
uint64_t
*
in
=
(
uint64_t
*
)
src
;
#else
/* On platforms where alignment matters, if 'in' is a pointer to a
* datatype that must be aligned, the compiler is allowed to
* generate code that assumes that it is aligned as such.
*/
const
uint8_t
*
in
=
(
uint8_t
*
)
src
;
#endif
uint64_t
t
;
uint8_t
*
pt
,
*
m
;
uint64_t
t
;
uint8_t
*
pt
,
*
m
;
uint64_t
v0
=
k0
^
0x736f6d6570736575ULL
;
uint64_t
v1
=
k1
^
0x646f72616e646f6dULL
;
...
...
@@ -113,12 +121,14 @@ uint64_t siphash24(const void *src, unsigned long src_sz, const struct sipkey *k
while
(
src_sz
>=
8
)
{
#ifdef UNALIGNED_OK
uint64_t
mi
=
_le64toh
(
*
in
);
in
+=
1
;
#else
uint64_t
mi
;
memcpy
(
&
mi
,
in
,
8
);
mi
=
_le64toh
(
mi
);
in
+=
8
;
#endif
in
+=
1
;
src_sz
-=
8
;
src_sz
-=
8
;
v3
^=
mi
;
DOUBLE_ROUND
(
v0
,
v1
,
v2
,
v3
);
v0
^=
mi
;
...
...
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