Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
ngtcp2
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Kashyap Thimmaraju
ngtcp2
Commits
1964ec3d
There was an error fetching the commit references. Please try again later.
Commit
1964ec3d
authored
7 years ago
by
Tatsuhiro Tsujikawa
Browse files
Options
Downloads
Patches
Plain Diff
Add ngtcp2_pkt_verify
parent
21011259
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/includes/ngtcp2/ngtcp2.h
+1
-4
1 addition, 4 deletions
lib/includes/ngtcp2/ngtcp2.h
lib/ngtcp2_pkt.c
+13
-0
13 additions, 0 deletions
lib/ngtcp2_pkt.c
with
14 additions
and
4 deletions
lib/includes/ngtcp2/ngtcp2.h
+
1
−
4
View file @
1964ec3d
...
@@ -312,10 +312,7 @@ NGTCP2_EXTERN size_t ngtcp2_upe_final(ngtcp2_upe *upe, const uint8_t **ppkt);
...
@@ -312,10 +312,7 @@ NGTCP2_EXTERN size_t ngtcp2_upe_final(ngtcp2_upe *upe, const uint8_t **ppkt);
* `ngtcp2_pkt_verify` verifies the integrity of QUIC unprotected
* `ngtcp2_pkt_verify` verifies the integrity of QUIC unprotected
* packet included in |pkt| of length |pktlen|.
* packet included in |pkt| of length |pktlen|.
*
*
* This function returns 0 if it succeeds, or one of the following
* This function returns 0 if it succeeds, or -1.
* negative error codes:
*
* TBD
*/
*/
NGTCP2_EXTERN
int
ngtcp2_pkt_verify
(
const
uint8_t
*
pkt
,
size_t
pktlen
);
NGTCP2_EXTERN
int
ngtcp2_pkt_verify
(
const
uint8_t
*
pkt
,
size_t
pktlen
);
...
...
This diff is collapsed.
Click to expand it.
lib/ngtcp2_pkt.c
+
13
−
0
View file @
1964ec3d
...
@@ -747,3 +747,16 @@ ssize_t ngtcp2_pkt_encode_padding_frame(uint8_t *out, size_t outlen,
...
@@ -747,3 +747,16 @@ ssize_t ngtcp2_pkt_encode_padding_frame(uint8_t *out, size_t outlen,
return
(
ssize_t
)
fm
->
len
;
return
(
ssize_t
)
fm
->
len
;
}
}
int
ngtcp2_pkt_verify
(
const
uint8_t
*
pkt
,
size_t
pktlen
)
{
uint64_t
a
,
b
;
if
(
pktlen
<=
NGTCP2_PKT_MDLEN
)
{
return
-
1
;
}
a
=
ngtcp2_get_uint64
(
pkt
+
(
pktlen
-
NGTCP2_PKT_MDLEN
));
b
=
ngtcp2_fnv1a
(
pkt
,
pktlen
-
NGTCP2_PKT_MDLEN
);
return
a
==
b
?
0
:
-
1
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
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