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
0264847a
Commit
0264847a
authored
Sep 19, 2021
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpf: Use LINUX_KERNEL_VERSION extern variable
parent
d276ca0a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
bpf/reuseport_kern.c
bpf/reuseport_kern.c
+19
-13
No files found.
bpf/reuseport_kern.c
View file @
0264847a
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
*/
*/
#include <linux/udp.h>
#include <linux/udp.h>
#include <linux/bpf.h>
#include <linux/bpf.h>
#include <linux/version.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_helpers.h>
...
@@ -235,22 +234,29 @@ static void InvMixColumns(state_t *state) {
...
@@ -235,22 +234,29 @@ static void InvMixColumns(state_t *state) {
}
}
}
}
extern
__u32
LINUX_KERNEL_VERSION
__kconfig
;
/* The SubBytes Function Substitutes the values in the state matrix
/* The SubBytes Function Substitutes the values in the state matrix
with values in an S-box. */
with values in an S-box. */
static
void
InvSubBytes
(
state_t
*
state
)
{
static
void
InvSubBytes
(
state_t
*
state
)
{
__u8
i
,
j
;
__u8
i
,
j
;
if
(
LINUX_KERNEL_VERSION
<
KERNEL_VERSION
(
5
,
10
,
0
))
{
for
(
i
=
0
;
i
<
4
;
++
i
)
{
for
(
i
=
0
;
i
<
4
;
++
i
)
{
for
(
j
=
0
;
j
<
4
;
++
j
)
{
for
(
j
=
0
;
j
<
4
;
++
j
)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
/* Ubuntu 20.04 LTS kernel 5.4.0 needs this workaround
/* Ubuntu 20.04 LTS kernel 5.4.0 needs this workaround otherwise
otherwise "math between map_value pointer and register with
"math between map_value pointer and register with unbounded
unbounded min value is not allowed". 5.10.0 is a kernel
min value is not allowed". 5.10.0 is a kernel version that
version that works but it might not be the minimum
works but it might not be a minimum
version. */
version. */
__u8
k
=
(
*
state
)[
j
][
i
];
__u8
k
=
(
*
state
)[
j
][
i
];
(
*
state
)[
j
][
i
]
=
k
?
getSBoxInvert
(
k
)
:
getSBoxInvert
(
0
);
(
*
state
)[
j
][
i
]
=
k
?
getSBoxInvert
(
k
)
:
getSBoxInvert
(
0
);
#else
/* !(LINUX_VERSION_CDOE < KERNEL_VERSION(5, 10, 0)) */
}
}
}
else
{
for
(
i
=
0
;
i
<
4
;
++
i
)
{
for
(
j
=
0
;
j
<
4
;
++
j
)
{
(
*
state
)[
j
][
i
]
=
getSBoxInvert
((
*
state
)[
j
][
i
]);
(
*
state
)[
j
][
i
]
=
getSBoxInvert
((
*
state
)[
j
][
i
]);
#endif
/* !(LINUX_VERSION_CDOE < KERNEL_VERSION(5, 10, 0)) */
}
}
}
}
}
}
}
...
...
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