Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
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
cpp-libs
libnice
Commits
e2f01510
Commit
e2f01510
authored
Feb 12, 2009
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stupid WLM 2009 CRC32 typo workaround (ugly, I know...)
parent
455f2734
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
stun/stunagent.c
stun/stunagent.c
+9
-0
stun/stuncrc32.c
stun/stuncrc32.c
+7
-2
stun/stuncrc32.h
stun/stuncrc32.h
+1
-0
No files found.
stun/stunagent.c
View file @
e2f01510
...
@@ -146,6 +146,11 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
...
@@ -146,6 +146,11 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
return
STUN_VALIDATION_BAD_REQUEST
;
return
STUN_VALIDATION_BAD_REQUEST
;
}
}
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_WLM2009
)
wlm2009_stupid_crc32_typo
=
1
;
else
wlm2009_stupid_crc32_typo
=
0
;
/* Checks FINGERPRINT */
/* Checks FINGERPRINT */
crc32
=
stun_fingerprint
(
msg
->
buffer
,
stun_message_length
(
msg
));
crc32
=
stun_fingerprint
(
msg
->
buffer
,
stun_message_length
(
msg
));
fpr
=
ntohl
(
fpr
);
fpr
=
ntohl
(
fpr
);
...
@@ -575,6 +580,10 @@ size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg,
...
@@ -575,6 +580,10 @@ size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg,
}
}
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_WLM2009
)
wlm2009_stupid_crc32_typo
=
1
;
else
wlm2009_stupid_crc32_typo
=
0
;
fpr
=
stun_fingerprint
(
msg
->
buffer
,
stun_message_length
(
msg
));
fpr
=
stun_fingerprint
(
msg
->
buffer
,
stun_message_length
(
msg
));
memcpy
(
ptr
,
&
fpr
,
sizeof
(
fpr
));
memcpy
(
ptr
,
&
fpr
,
sizeof
(
fpr
));
...
...
stun/stuncrc32.c
View file @
e2f01510
...
@@ -89,6 +89,7 @@
...
@@ -89,6 +89,7 @@
#include "stuncrc32.h"
#include "stuncrc32.h"
int
wlm2009_stupid_crc32_typo
=
0
;
static
const
uint32_t
crc32_tab
[]
=
{
static
const
uint32_t
crc32_tab
[]
=
{
0x00000000
,
0x77073096
,
0xee0e612c
,
0x990951ba
,
0x076dc419
,
0x706af48f
,
0x00000000
,
0x77073096
,
0xee0e612c
,
0x990951ba
,
0x076dc419
,
0x706af48f
,
...
@@ -147,8 +148,12 @@ uint32_t crc32 (const crc_data *data, size_t n)
...
@@ -147,8 +148,12 @@ uint32_t crc32 (const crc_data *data, size_t n)
const
uint8_t
*
p
=
data
[
i
].
buf
;
const
uint8_t
*
p
=
data
[
i
].
buf
;
size_t
size
=
data
[
i
].
len
;
size_t
size
=
data
[
i
].
len
;
while
(
size
--
)
while
(
size
--
)
{
crc
=
crc32_tab
[(
crc
^
*
p
++
)
&
0xFF
]
^
(
crc
>>
8
);
uint32_t
lkp
=
crc32_tab
[(
crc
^
*
p
++
)
&
0xFF
];
if
(
lkp
==
0x8bbeb8ea
&&
wlm2009_stupid_crc32_typo
)
lkp
=
0x8bbe8ea
;
crc
=
lkp
^
(
crc
>>
8
);
}
}
}
return
crc
^
0xffffffff
;
return
crc
^
0xffffffff
;
...
...
stun/stuncrc32.h
View file @
e2f01510
...
@@ -53,6 +53,7 @@ typedef struct {
...
@@ -53,6 +53,7 @@ typedef struct {
}
crc_data
;
}
crc_data
;
int
wlm2009_stupid_crc32_typo
;
uint32_t
crc32
(
const
crc_data
*
data
,
size_t
n
);
uint32_t
crc32
(
const
crc_data
*
data
,
size_t
n
);
#endif
/* _CRC32_H */
#endif
/* _CRC32_H */
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