Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Mbedtls
比较版本
de3a6678aaf5a42c8af22ec8de841c0046817452...28df59d4cf89c14eea1e857772e296218e19e133
T
Third Party Mbedtls
项目概览
OpenHarmony
/
Third Party Mbedtls
9 个月 前同步成功
通知
0
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Mbedtls
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
源分支
28df59d4cf89c14eea1e857772e296218e19e133
选择Git版本
...
目标分支
de3a6678aaf5a42c8af22ec8de841c0046817452
选择Git版本
比较
Commits (5)
https://gitcode.net/openharmony/third_party_mbedtls/-/commit/77b675543a0f1d0ce9a5e7d09cfd142f161072e3
liteos only ipv4
2023-08-03T15:10:42+08:00
maosiping
maosiping@huawei.com
Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:maosiping@huawei.com" title="maosiping@huawei.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg1" style="text-decoration: none">N</a><a href="mailto:maosiping@huawei.com" title="maosiping@huawei.com">maosiping</a> <<a href="mailto:maosiping@huawei.com" title="maosiping@huawei.com">maosiping@huawei.com</a>></span>
https://gitcode.net/openharmony/third_party_mbedtls/-/commit/c8797c6d4c204b4ce71449d3d0b46e694bcc7df9
!90 LITEOS只支持IPv4类型的连接
2023-08-03T08:18:26+00:00
openharmony_ci
120357966@qq.com
Merge pull request !90 from maosiping/master
https://gitcode.net/openharmony/third_party_mbedtls/-/commit/971e0dddb54f593fe72056da2bd3c7f27b202463
add sasdk
2023-08-03T16:36:58+08:00
liyufan
liyufan5@huawei.com
Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:liyufan5@huawei.com" title="liyufan5@huawei.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg3" style="text-decoration: none">N</a><a href="mailto:liyufan5@huawei.com" title="liyufan5@huawei.com">liyufan</a> <<a href="mailto:liyufan5@huawei.com" title="liyufan5@huawei.com">liyufan5@huawei.com</a>></span>
https://gitcode.net/openharmony/third_party_mbedtls/-/commit/1932185e1d29892f6a98dd5702ffcee4844c13a4
bundle check
2023-08-03T17:20:40+08:00
liyufan
liyufan5@huawei.com
Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:liyufan5@huawei.com" title="liyufan5@huawei.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg3" style="text-decoration: none">N</a><a href="mailto:liyufan5@huawei.com" title="liyufan5@huawei.com">liyufan</a> <<a href="mailto:liyufan5@huawei.com" title="liyufan5@huawei.com">liyufan5@huawei.com</a>></span>
https://gitcode.net/openharmony/third_party_mbedtls/-/commit/28df59d4cf89c14eea1e857772e296218e19e133
!91 inner api 纳入 SASDK 诉求修改
2023-08-03T13:31:09+00:00
openharmony_ci
120357966@qq.com
Merge pull request !91 from liyufan/master
隐藏空白更改
内联
并排
Showing
8 changed file
with
66 addition
and
10 deletion
+66
-10
BUILD.gn
BUILD.gn
+17
-1
bundle.json
bundle.json
+14
-2
library/net_sockets.c
library/net_sockets.c
+16
-0
mbedtls.gni
mbedtls.gni
+11
-1
port/BUILD.gn
port/BUILD.gn
+2
-1
port/include/mbedtls_log.h
port/include/mbedtls_log.h
+0
-1
port/include/tls_client.h
port/include/tls_client.h
+4
-1
port/src/tls_client.c
port/src/tls_client.c
+2
-3
未找到文件。
BUILD.gn
浏览文件 @
28df59d4
...
...
@@ -27,10 +27,23 @@ MBEDTLS_SOURCES += [
"library/x509write_csr.c",
]
if (defined(ohos_lite)) {
MBEDTLS_SOURCES -= [ "library/ssl_srv.c" ]
}
if (defined(ohos_lite)) {
import("//build/lite/config/component/lite_component.gni")
import("//build/lite/ndk/ndk.gni")
if (ohos_kernel_type != "liteos_m") {
MBEDTLS_SOURCES += [ "library/ssl_srv.c" ]
MBEDTLS_SOURCES -= [
"$MBEDTLSDIR/library/ssl_srv.c",
"$MBEDTLSDIR/port/src/tls_client.c",
"$MBEDTLSDIR/port/src/tls_certificate.c",
]
}
config("mbedtls_config") {
include_dirs = MBEDTLS_INLCUDE_DIRS
if (ohos_kernel_type == "liteos_m") {
...
...
@@ -117,7 +130,10 @@ if (defined(ohos_lite)) {
public_configs = [ ":mbedtls_config" ]
output_name = "mbedtls"
subsystem_name = "thirdparty"
innerapi_tags = [ "platformsdk_indirect" ]
innerapi_tags = [
"platformsdk_indirect",
"sasdk",
]
part_name = "mbedtls"
sources = MBEDTLS_SOURCES
install_images = [
...
...
bundle.json
浏览文件 @
28df59d4
...
...
@@ -14,7 +14,7 @@
"subsystem"
:
"thirdparty"
,
"syscap"
:
[],
"features"
:
[],
"adapted_system_type"
:
[],
"adapted_system_type"
:
[
"small"
,
"standard"
],
"rom"
:
""
,
"ram"
:
""
,
"deps"
:
{
...
...
@@ -23,7 +23,19 @@
},
"build"
:
{
"sub_component"
:
[],
"inner_kits"
:
[],
"inner_kits"
:
[
{
"header"
:
{
"header_base"
:
"//third_party/mbedtls/include"
,
"header_files"
:
[
"md.h"
,
"rsa.h"
,
"x509.h"
]
},
"name"
:
"//third_party/mbedtls:mbedtls_shared"
}
],
"test"
:
[]
}
}
...
...
library/net_sockets.c
浏览文件 @
28df59d4
...
...
@@ -193,8 +193,15 @@ int mbedtls_net_connect( mbedtls_net_context *ctx, const char *host,
ret
=
MBEDTLS_ERR_NET_UNKNOWN_HOST
;
for
(
cur
=
addr_list
;
cur
!=
NULL
;
cur
=
cur
->
ai_next
)
{
#ifdef LITEOS_VERSION
if
(
cur
->
ai_family
!=
AF_INET
||
cur
->
ai_socktype
!=
SOCK_STREAM
)
{
continue
;
}
ctx
->
fd
=
(
int
)
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
#else
ctx
->
fd
=
(
int
)
socket
(
cur
->
ai_family
,
cur
->
ai_socktype
,
cur
->
ai_protocol
);
#endif
if
(
ctx
->
fd
<
0
)
{
ret
=
MBEDTLS_ERR_NET_SOCKET_FAILED
;
...
...
@@ -575,8 +582,12 @@ int mbedtls_net_recv( void *ctx, unsigned char *buf, size_t len )
ret
=
check_fd
(
fd
,
0
);
if
(
ret
!=
0
)
return
(
ret
);
#ifdef LITEOS_VERSION
ret
=
(
int
)
recv
(
fd
,
buf
,
len
,
0
);
#else
ret
=
(
int
)
read
(
fd
,
buf
,
len
);
#endif
if
(
ret
<
0
)
{
...
...
@@ -658,7 +669,12 @@ int mbedtls_net_send( void *ctx, const unsigned char *buf, size_t len )
if
(
ret
!=
0
)
return
(
ret
);
#ifdef LITEOS_VERSION
ret
=
(
int
)
send
(
fd
,
buf
,
len
,
0
);
#else
ret
=
(
int
)
write
(
fd
,
buf
,
len
);
#endif
if
(
ret
<
0
)
{
...
...
mbedtls.gni
浏览文件 @
28df59d4
...
...
@@ -24,7 +24,7 @@
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MBEDTLSDIR = "//third_party/mbedtls/"
KERNELDIR = "//kernel/liteos_m/"
...
...
@@ -129,3 +129,13 @@ MBEDTLS_INLCUDE_DIRS = [
"$MBEDTLSDIR/include/mbedtls",
"$MBEDTLSDIR/tests/include",
]
if (defined(ohos_lite)) {
MBEDTLS_SOURCES += [
"$MBEDTLSDIR/library/ssl_srv.c",
"$MBEDTLSDIR/port/src/tls_client.c",
"$MBEDTLSDIR/port/src/tls_certificate.c",
]
MBEDTLS_INLCUDE_DIRS += [ "$MBEDTLSDIR/port/include" ]
}
port/BUILD.gn
浏览文件 @
28df59d4
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
import("//build/lite/config/component/lite_component.gni")
...
...
@@ -22,6 +22,7 @@ if (ohos_build_type == "debug") {
"//third_party/mbedtls/include",
"//commonlibrary/utils_lite/include",
"//third_party/bounds_checking_function/include",
"//third_party/mbedtls/port/include",
]
}
...
...
port/include/mbedtls_log.h
浏览文件 @
28df59d4
...
...
@@ -30,7 +30,6 @@
#ifndef OHOS_DEBUG
#define DECORATOR_HILOG(op, fmt, args...) \
do
{
\
op
(
LOG_CORE
,
fmt
,
##
args
);
\
}
while
(
0
)
#else
#define DECORATOR_HILOG(op, fmt, args...) \
...
...
port/include/tls_client.h
浏览文件 @
28df59d4
...
...
@@ -17,7 +17,7 @@
#define MBEDTLS_CLIENT_H
#include "mbedtls/platform.h"
#include "mbedtls/net_sockets"
#include "mbedtls/net_sockets
.h
"
#include "mbedtls/ssl.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
...
...
@@ -25,6 +25,9 @@
#define RET_ERROR -1;
#define RET_EOK 0
#ifndef LOG_CORE
#define LOG_CORE 3
#endif
typedef
struct
MbedTLSSession
{
char
*
host
;
...
...
port/src/tls_client.c
浏览文件 @
28df59d4
...
...
@@ -90,7 +90,7 @@ int MbedtlsClientContext(MbedTLSSession *session)
int
ret
=
mbedtls_x509_crt_parse
(
&
session
->
cacert
,
(
const
unsigned
char
*
)
G_MBEDTLS_ROOT_CERTIFICATE
,
G_MBEDTLS_ROOT_CERTIFICATE_LEN
);
if
(
ret
<
0
)
{
LOG
E
(
"mbedtls_x509_crt_parse error, return -0x%x."
,
-
ret
);
LOG
D
(
"mbedtls_x509_crt_parse error, return -0x%x."
,
-
ret
);
return
ret
;
}
...
...
@@ -135,7 +135,7 @@ int MbedtlsClientConnect(MbedTLSSession *session)
if
(
session
==
NULL
)
{
return
-
RET_ERROR
;
}
LOG
I
(
"connect: host:%s, port: %s"
,
session
->
host
,
session
->
port
);
LOG
D
(
"connect: host:%s, port: %s"
,
session
->
host
,
session
->
port
);
int
ret
=
mbedtls_net_connect
(
&
session
->
server_fd
,
session
->
host
,
session
->
port
,
MBEDTLS_NET_PROTO_TCP
);
if
(
ret
!=
0
)
{
...
...
@@ -145,7 +145,6 @@ int MbedtlsClientConnect(MbedTLSSession *session)
LOGD
(
"Connected %s:%s fd:%d, success..."
,
session
->
host
,
session
->
port
,
session
->
server_fd
.
fd
);
mbedtls_ssl_set_bio
(
&
session
->
ssl
,
&
session
->
server_fd
,
mbedtls_net_send
,
mbedtls_net_recv
,
NULL
);
LOGD
(
"ssl state=%d"
,
session
->
ssl
.
state
);
while
((
ret
=
mbedtls_ssl_handshake
(
&
session
->
ssl
))
!=
0
)
{
LOGD
(
"mbedtls_ssl_handshake ret=0x%x."
,
-
ret
);
...
...