Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
bde9a633
Commit
bde9a633
authored
Jan 03, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Endianess patch by Forrest
parent
8eb816c3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
mongoose.c
mongoose.c
+10
-4
No files found.
mongoose.c
View file @
bde9a633
...
@@ -1984,6 +1984,11 @@ static void get_mime_type(struct mg_context *ctx, const char *path,
...
@@ -1984,6 +1984,11 @@ static void get_mime_type(struct mg_context *ctx, const char *path,
vec
->
len
=
strlen
(
vec
->
ptr
);
vec
->
len
=
strlen
(
vec
->
ptr
);
}
}
static
int
is_big_endian
(
void
)
{
static
const
int
n
=
1
;
return
((
char
*
)
&
n
)[
0
]
==
0
;
}
#ifndef HAVE_MD5
#ifndef HAVE_MD5
typedef
struct
MD5Context
{
typedef
struct
MD5Context
{
uint32_t
buf
[
4
];
uint32_t
buf
[
4
];
...
@@ -1992,9 +1997,10 @@ typedef struct MD5Context {
...
@@ -1992,9 +1997,10 @@ typedef struct MD5Context {
}
MD5_CTX
;
}
MD5_CTX
;
static
void
byteReverse
(
unsigned
char
*
buf
,
unsigned
longs
)
{
static
void
byteReverse
(
unsigned
char
*
buf
,
unsigned
longs
)
{
static
const
int
endianess_check
=
1
;
uint32_t
t
;
uint32_t
t
;
if
(((
char
*
)
&
endianess_check
)[
0
]
==
1
)
{
// Forrest: MD5 expect LITTLE_ENDIAN, swap if BIG_ENDIAN
if
(
is_big_endian
())
{
do
{
do
{
t
=
(
uint32_t
)
((
unsigned
)
buf
[
3
]
<<
8
|
buf
[
2
])
<<
16
|
t
=
(
uint32_t
)
((
unsigned
)
buf
[
3
]
<<
8
|
buf
[
2
])
<<
16
|
((
unsigned
)
buf
[
1
]
<<
8
|
buf
[
0
]);
((
unsigned
)
buf
[
1
]
<<
8
|
buf
[
0
]);
...
@@ -3633,8 +3639,8 @@ union char64long16 { unsigned char c[64]; uint32_t l[16]; };
...
@@ -3633,8 +3639,8 @@ union char64long16 { unsigned char c[64]; uint32_t l[16]; };
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
static
uint32_t
blk0
(
union
char64long16
*
block
,
int
i
)
{
static
uint32_t
blk0
(
union
char64long16
*
block
,
int
i
)
{
static
const
int
endianess_check
=
1
;
// Forrest: SHA expect BIG_ENDIAN, swap if LITTLE_ENDIAN
if
(
((
char
*
)
&
endianess_check
)[
0
]
==
1
)
{
if
(
!
is_big_endian
()
)
{
block
->
l
[
i
]
=
(
rol
(
block
->
l
[
i
],
24
)
&
0xFF00FF00
)
|
block
->
l
[
i
]
=
(
rol
(
block
->
l
[
i
],
24
)
&
0xFF00FF00
)
|
(
rol
(
block
->
l
[
i
],
8
)
&
0x00FF00FF
);
(
rol
(
block
->
l
[
i
],
8
)
&
0x00FF00FF
);
}
}
...
...
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