replace polarssl with mbedtls

This commit is contained in:
Punk
2021-09-01 03:46:12 +08:00
parent 5da550284e
commit c5d2ad68c1

View File

@@ -31,11 +31,14 @@ run openwrtbuild.sh
# tomatoware
### openssl
cp Makefile.openssl.static Makefile
make
### porlarssl
cp Makefile.porlarssl.static Makefile
### mbedTLS
Compile and install mbedTLS into tomatoware first, then:
cp Makefile.mbedtls.static Makefile
make
@@ -73,7 +76,7 @@ Rport -remote port //远程端口tcp映射的时候制定端口使用
You can also register multiple Tunnel, but can only have one of each type.
- ngrokc -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Sdname:Example] -AddTun[Type:https,Lhost:127.0.0.1,Lport:81,Sdname:Example1]
## 2015/7/10更新增加
@@ -114,7 +117,7 @@ ngrokc.exe -SER[Shost:tunnel.mobi,Sport:44433] -AddTun[Type:http,Lhost:127.0.0.1
- 大幅减少内存占用
- 如无重大bug不更新了。。
-
## 2015/11/5
- 修复没网导致的内存泄漏问题。会导致路由不断重启
- 增加版本号。
@@ -183,7 +186,7 @@ ngrokc.exe -SER[Shost:tunnel.mobi,Sport:44433] -AddTun[Type:http,Lhost:127.0.0.1
## 2017/1/9
-1.41版本 修复一个网络不好可能导致的内存泄漏问题。
## 2018/5/7
-1.45版本 增加自定义转发Hostheader功能。用于那些本地会判断host的网站
 使用方法-AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Hostheader:localhost]
@@ -199,7 +202,7 @@ ngrokc.exe -SER[Shost:tunnel.mobi,Sport:44433] -AddTun[Type:http,Lhost:127.0.0.1
## 2021/8/31
-1.55 add support local tls。
Example -AddTun[Type:https,Lhost:127.0.0.1,Lport:443,Ltls:1]
### 关于编译对应路由的版本的ngrokc。
## 一。去http://downloads.openwrt.org/下载你路由对应的SDK版本 如OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2并且解压。
## 二.需要先编译polarssl或者openssl库取决你想用啥库,2选1
@@ -237,19 +240,19 @@ ngrokc.exe -SER[Shost:tunnel.mobi,Sport:44433] -AddTun[Type:http,Lhost:127.0.0.1
- 还有最后一行的libpolarssl-mips.a改成2.0版本libmbedtls.a libmbedcrypto.a libmbedx5.9.a1.3版本libpolarssl.a.
- 执行openwrtbuild.sh就行了。。
- 就会在build-mips生成ngrokc文件。。你用ssh上传到路由的/bin目录并且加入执行权限。。就可以了。。跑了。。
- 3.这里用Centos7 编译斐讯K2路由(polarssl库)做个(纯小白)教程
###安装相应软件包
yum install bzip2 gzip git vim wget -y
###下载并解压SDK(以下没说明的话均默认在/root目录下操作)
wget http://archive.openwrt.org/chaos_calmer/15.05/ramips/mt7621/OpenWrt-SDK-15.05-ramips-mt7621_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
tar jxvf OpenWrt-SDK-15.05.1-ramips-mt7621_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
###文件夹名字太长,改个名字....
mv OpenWrt-SDK-15.05.1-ramips-mt7621_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64 op
###拉取ngrok源码
git clone https://github.com/dosgo/ngrok-c.git
@@ -257,44 +260,44 @@ ngrokc.exe -SER[Shost:tunnel.mobi,Sport:44433] -AddTun[Type:http,Lhost:127.0.0.1
###开始编译polarsshl库###
###下载并解压polarssl
wget https://tls.mbed.org/download/mbedtls-2.14.1-gpl.tgz&&tar zxvf mbedtls-2.14.1-gpl.tgz
###复制buildlib.sh文件到polarssl文件夹
cp /root/ngrok-c/buildlib.sh /root/mbedtls-2.14.1/buildlib.sh
###修改buildlib.sh
vim /root/mbedtls-2.14.1/buildlib.sh
###我这里SDK是这个所以把PATH改成这个
###export PATH=$PATH:'/root/op/staging_dir/toolchain-mipsel_1004kc+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin'
###export STAGING_DIR="/root/op/staging_dir"
###下面的SDK编译器名字可以在SDK/bin 下找到,例如:
### ls /root/op/staging_dir/toolchain-mipsel_1004kc+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin
###看到一些gcc和g++之类的,把名字复制替换掉就行了
###运行buildlib.sh
cd /root/mbedtls-2.14.1&&chmod 777 buildlib.sh&&./buildlib.sh
###不出意外的话会在library文件夹生成三个文件libmbedcrypto.a,libmbedtls.a,libmbedx509.a
###把生成的文件复制到ngrok目录下
cd /root/mbedtls-2.14.1/library
cp {libmbedcrypto.a,libmbedtls.a,libmbedx509.a} /root/ngrok-c/
###复制mbedtls文件夹到SDK/include下
cp -r /root/mbedtls-2.14.1/include/mbedtls /root/op/staging_dir/toolchain-mipsel_1004kc+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include/
###修改config.h文件我们用的是polarssl2.0 所以把 #define OPENSSL 1改成#define OPENSSL 0#define ISMBEDTLS 0改成#define ISMBEDTLS 1(其实默认就是1.....)
vim /root/ngrok-c/config.h
###修改openwrtbuild.sh里面 SDK路径和编译器SDK路径上边说了就不再重复这里的编译器改成上面编译polarssh时buildlib.sh里的那个CXX的值
###我这里是CXX=mipsel-openwrt-linux-g++所以openwrtbuild.sh的CC=mipsel-openwrt-linux-g++
vim /root/ngrok-c/openwrtbuild.sh
###修改CC=mipsel-openwrt-linux-g++,保存退出
cd /root/ngrok-c/
chmod 777 openwrtbuild.sh&&./openwrtbuild.sh
###执行完openwrtbuild.sh如果没有提示erroe的话就行了。。。
###然后会在build-mips生成ngrokc文件。。你用ssh上传到路由的/bin目录并且加入执行权限
###下面在SSH连接到路由后的操作
###记得安装libstdcpp.ipk官网有下载我这个SDK对应的下载地址是
@@ -304,7 +307,8 @@ ngrokc.exe -SER[Shost:tunnel.mobi,Sport:44433] -AddTun[Type:http,Lhost:127.0.0.1
安装完就可以用了。。。。。
小声BB:作者很有耐心纯小白问一下很愚蠢的问题他都会耐心解答哈哈再次感谢dosgo
## 四.简单编译ngrokc。
1. 去http://downloads.openwrt.org/下载你路由对应的SDK版本 如OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2并且解压。
2.编辑openwrtbuildv2.sh 修改export STAGING_DIR export PATH,把里面的路径改成你下载的SDK。
@@ -315,9 +319,9 @@ ngrokc.exe -SER[Shost:tunnel.mobi,Sport:44433] -AddTun[Type:http,Lhost:127.0.0.1
## 五.zig交叉编译ngrokc。
1. 去https://ziglang.org/download/下载zig编译器并且安装好
2. 修改crossbuild.bat文件的TARGET=mipsel-linux-musl改成你的平台。
3. 运行crossbuild.bat就会在当前目录生成编译文件。
3. 运行crossbuild.bat就会在当前目录生成编译文件。
4. 记得安装libopenssl.ipk官网有下载。
编译就这样了以后请不要邮件问我怎么编译了有bug可以联系。