Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
7696dcc7
Unverified
Commit
7696dcc7
authored
Jan 17, 2024
by
Jason2866
Committed by
GitHub
Jan 17, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WebServer: use MD5Builder instead of mbedtls (#9123)
Backport of #8667
parent
911061c8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
18 deletions
+7
-18
libraries/WebServer/src/WebServer.cpp
libraries/WebServer/src/WebServer.cpp
+7
-18
No files found.
libraries/WebServer/src/WebServer.cpp
View file @
7696dcc7
...
...
@@ -24,12 +24,13 @@
#include <Arduino.h>
#include <esp32-hal-log.h>
#include <libb64/cencode.h>
#include "esp_random.h"
#include "WiFiServer.h"
#include "WiFiClient.h"
#include "WebServer.h"
#include "FS.h"
#include "detail/RequestHandlersImpl.h"
#include "
mbedtls/md5
.h"
#include "
MD5Builder
.h"
static
const
char
AUTHORIZATION_HEADER
[]
=
"Authorization"
;
...
...
@@ -119,23 +120,11 @@ String WebServer::_extractParam(String& authReq,const String& param,const char d
}
static
String
md5str
(
String
&
in
){
char
out
[
33
]
=
{
0
};
mbedtls_md5_context
_ctx
;
uint8_t
i
;
uint8_t
*
_buf
=
(
uint8_t
*
)
malloc
(
16
);
if
(
_buf
==
NULL
)
return
String
(
out
);
memset
(
_buf
,
0x00
,
16
);
mbedtls_md5_init
(
&
_ctx
);
mbedtls_md5_starts_ret
(
&
_ctx
);
mbedtls_md5_update_ret
(
&
_ctx
,
(
const
uint8_t
*
)
in
.
c_str
(),
in
.
length
());
mbedtls_md5_finish_ret
(
&
_ctx
,
_buf
);
for
(
i
=
0
;
i
<
16
;
i
++
)
{
sprintf
(
out
+
(
i
*
2
),
"%02x"
,
_buf
[
i
]);
}
out
[
32
]
=
0
;
free
(
_buf
);
return
String
(
out
);
MD5Builder
md5
=
MD5Builder
();
md5
.
begin
();
md5
.
add
(
in
);
md5
.
calculate
();
return
md5
.
toString
();
}
bool
WebServer
::
authenticate
(
const
char
*
username
,
const
char
*
password
){
...
...
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