Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
d703197a
Commit
d703197a
authored
Jan 07, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttp2_hd: Mitigate timing attack
parent
9eb031ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
lib/nghttp2_hd.c
lib/nghttp2_hd.c
+15
-6
No files found.
lib/nghttp2_hd.c
View file @
d703197a
...
...
@@ -103,6 +103,17 @@ static nghttp2_hd_entry static_table[] = {
static
const
size_t
STATIC_TABLE_LENGTH
=
sizeof
(
static_table
)
/
sizeof
(
static_table
[
0
]);
static
int
memeq
(
const
void
*
s1
,
const
void
*
s2
,
size_t
n
)
{
const
uint8_t
*
a
=
(
const
uint8_t
*
)
s1
,
*
b
=
(
const
uint8_t
*
)
s2
;
uint8_t
c
=
0
;
while
(
n
>
0
)
{
c
|=
(
*
a
++
)
^
(
*
b
++
);
--
n
;
}
return
c
==
0
;
}
typedef
struct
{
nghttp2_nv
*
nva
;
size_t
nvacap
;
...
...
@@ -914,13 +925,12 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context,
static
int
name_eq
(
const
nghttp2_nv
*
a
,
const
nghttp2_nv
*
b
)
{
return
a
->
namelen
==
b
->
namelen
&&
mem
cmp
(
a
->
name
,
b
->
name
,
a
->
namelen
)
==
0
;
return
a
->
namelen
==
b
->
namelen
&&
mem
eq
(
a
->
name
,
b
->
name
,
a
->
namelen
)
;
}
static
int
value_eq
(
const
nghttp2_nv
*
a
,
const
nghttp2_nv
*
b
)
{
return
a
->
valuelen
==
b
->
valuelen
&&
memcmp
(
a
->
value
,
b
->
value
,
a
->
valuelen
)
==
0
;
return
a
->
valuelen
==
b
->
valuelen
&&
memeq
(
a
->
value
,
b
->
value
,
a
->
valuelen
);
}
typedef
struct
{
...
...
@@ -1020,9 +1030,8 @@ nghttp2_hd_entry* nghttp2_hd_table_get(nghttp2_hd_context *context,
}
}
#define name_match(NV, NAME) \
(nv->namelen == sizeof(NAME) - 1 && \
memcmp(nv->name, NAME, sizeof(NAME) - 1) == 0)
#define name_match(NV, NAME) \
(nv->namelen == sizeof(NAME) - 1 && memeq(nv->name, NAME, sizeof(NAME) - 1))
static
int
should_indexing
(
const
nghttp2_nv
*
nv
)
{
...
...
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