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
99377bdd
Commit
99377bdd
authored
8 years ago
by
Sergey Lyubka
Committed by
Cesanta Bot
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix user registration flow
PUBLISHED_FROM=bac8c10063215f7f7163f607213d15a3c5f81552
parent
c6b5343c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
23 deletions
+46
-23
mongoose.c
mongoose.c
+33
-16
mongoose.h
mongoose.h
+13
-7
No files found.
mongoose.c
View file @
99377bdd
...
...
@@ -805,7 +805,8 @@ double cs_time(void) {
/* Amalgamated: #include "common/md5.h" */
#if !DISABLE_MD5 && !defined(EXCLUDE_COMMON)
#if !defined(EXCLUDE_COMMON)
#if !DISABLE_MD5
/* Amalgamated: #include "common/cs_endian.h" */
...
...
@@ -992,21 +993,7 @@ void MD5_Final(unsigned char digest[16], MD5_CTX *ctx) {
memcpy
(
digest
,
ctx
->
buf
,
16
);
memset
((
char
*
)
ctx
,
0
,
sizeof
(
*
ctx
));
}
/*
* Stringify binary data. Output buffer size must be 2 * size_of_input + 1
* because each byte of input takes 2 bytes in string representation
* plus 1 byte for the terminating \0 character.
*/
void
cs_to_hex
(
char
*
to
,
const
unsigned
char
*
p
,
size_t
len
)
{
static
const
char
*
hex
=
"0123456789abcdef"
;
for
(;
len
--
;
p
++
)
{
*
to
++
=
hex
[
p
[
0
]
>>
4
];
*
to
++
=
hex
[
p
[
0
]
&
0x0f
];
}
*
to
=
'\0'
;
}
#endif
/* DISABLE_MD5 */
char
*
cs_md5
(
char
buf
[
33
],
...)
{
unsigned
char
hash
[
16
];
...
...
@@ -1736,6 +1723,36 @@ char *strdup(const char *src) {
}
#endif
void
cs_to_hex
(
char
*
to
,
const
unsigned
char
*
p
,
size_t
len
)
{
static
const
char
*
hex
=
"0123456789abcdef"
;
for
(;
len
--
;
p
++
)
{
*
to
++
=
hex
[
p
[
0
]
>>
4
];
*
to
++
=
hex
[
p
[
0
]
&
0x0f
];
}
*
to
=
'\0'
;
}
static
int
fourbit
(
int
ch
)
{
if
(
ch
>=
'0'
&&
ch
<=
'9'
)
{
return
ch
-
'0'
;
}
else
if
(
ch
>=
'a'
&&
ch
<=
'f'
)
{
return
ch
-
'a'
+
10
;
}
else
if
(
ch
>=
'A'
&&
ch
<=
'F'
)
{
return
ch
-
'A'
+
10
;
}
return
0
;
}
void
cs_from_hex
(
char
*
to
,
const
char
*
p
,
size_t
len
)
{
size_t
i
;
for
(
i
=
0
;
i
<
len
;
i
+=
2
)
{
*
to
++
=
(
fourbit
(
p
[
i
])
<<
4
)
+
fourbit
(
p
[
i
+
1
]);
}
*
to
=
'\0'
;
}
#endif
/* EXCLUDE_COMMON */
#ifdef MG_MODULE_LINES
#line 1 "mongoose/src/net.c"
...
...
This diff is collapsed.
Click to expand it.
mongoose.h
View file @
99377bdd
...
...
@@ -1485,13 +1485,6 @@ void MD5_Final(unsigned char *md, MD5_CTX *c);
*/
char
*
cs_md5
(
char
buf
[
33
],
...);
/*
* Stringify binary data. Output buffer size must be 2 * size_of_input + 1
* because each byte of input takes 2 bytes in string representation
* plus 1 byte for the terminating \0 character.
*/
void
cs_to_hex
(
char
*
to
,
const
unsigned
char
*
p
,
size_t
len
);
#ifdef __cplusplus
}
#endif
/* __cplusplus */
...
...
@@ -1573,6 +1566,19 @@ int c_vsnprintf(char *buf, size_t buf_size, const char *format, va_list ap);
*/
const
char
*
c_strnstr
(
const
char
*
s
,
const
char
*
find
,
size_t
slen
);
/*
* Stringify binary data. Output buffer size must be 2 * size_of_input + 1
* because each byte of input takes 2 bytes in string representation
* plus 1 byte for the terminating \0 character.
*/
void
cs_to_hex
(
char
*
to
,
const
unsigned
char
*
p
,
size_t
len
);
/*
* Convert stringified binary data back to binary.
* Does the reverse of `cs_to_hex()`.
*/
void
cs_from_hex
(
char
*
to
,
const
char
*
p
,
size_t
len
);
/*
* ARM C Compiler doesn't have strdup, so we provide it
*/
...
...
This diff is collapsed.
Click to expand it.
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