一、正常编译
使用版本
curl7.85.0
…/ 表示需要自己确定的目录
1、编译openssl
./config no-asm no-async -shared --cross-compile-prefix=arm-linux-gnueabihf- --prefix=.../openssl1.1.0e-lz_328arm
2、编译curl
…/ 指定的目录自己修改
./configure --host=arm-linux CC=.../arm-linux-gnueabihf-gcc --prefix=.../out --with-openssl=.../openssl_install --disable-tls-srp --disable-rtsp --disable-hsts --disable-alt-svc --disable-mqtt --disable-ftp --disable-tftp --disable-smb --disable-gopher --disable-imap --disable-pop3 --disable-smtp --disable-telnet --disable-dict
3、测试
-v 查看具体信息
-k 跳过验证,那么就无需指定证书了
./curl <https-url> -v -k
顺便提一下wget的跳过证书校验命令
wget 'https://192.168.0.100:9200' --no-check-certificate
正常出现
下边出现的异常,单独会描述。
4、代码设置
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,0L);//设定为不验证证书和HOST
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYHOST,0L);
二、遇到问题
1、wrong signature length
因为我是在虚拟机上编译,的虚拟机是64位,设备是32位,导致编译后的libcrypto.so不对,报签名长度出错。解决办法,编译之前加上 setarch i386。
setarch i386 ./config no-asm no-async -shared --cross-compile-prefix=arm-linux-gnueabihf- --prefix=.../openssl1.1.0e-lz_328arm