Giter VIP home page Giter VIP logo

Comments (11)

mrpre avatar mrpre commented on June 3, 2024

@memdumper
You need installlibssl-dev for Ubuntu or openssl-devel for Centos before you compile Atls.
Using uname -a to supply system infomation
Using openssl versionto supply openssl info

from atls.

memdumper avatar memdumper commented on June 3, 2024
  1. 环境信息
    CentOS release 6.7 (Final),
    Linux gmssl 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    OpenSSL 1.0.1e-fips 11 Feb 2013
    GmSSL 2.3.1 - OpenSSL 1.1.0d 30 Mar 2018
    #yum install openssl-devel
  2. 已编辑安装GmSSL到/root/GmSSL-master
    [root@gmssl GmSSL-master]# ll lib*
    -rw-r--r--. 1 root root 5671298 Sep 7 09:14 libcrypto.a
    -rw-r--r--. 1 root root 279 Sep 7 09:15 libcrypto.pc
    lrwxrwxrwx. 1 root root 16 Sep 7 09:15 libcrypto.so -> libcrypto.so.1.1
    -rwxr-xr-x. 1 root root 3277813 Sep 7 09:15 libcrypto.so.1.1
    -rw-r--r--. 1 root root 830924 Sep 7 09:15 libssl.a
    -rw-r--r--. 1 root root 289 Sep 7 09:15 libssl.pc
    lrwxrwxrwx. 1 root root 13 Sep 7 09:15 libssl.so -> libssl.so.1.1
    -rwxr-xr-x. 1 root root 556193 Sep 7 09:15 libssl.so.1.1
  3. 编译atls出错
    #export LD_LIBRARY_PATH=/root/GmSSL-master
    #make cryptodir=/root/GmSSL-master
    gcc -Wall -O -g -fPIC -I./ -I/root/GmSSL-master/include -L/root/GmSSL-master/lib -Wl,-rpath=/root/GmSSL-master/lib -c a_crypto.c a_kdf.c a_tls13.c a_tls.c a_tls_cipher.c a_tls_extension.c a_tls_lib.c
    a_crypto.c:317: error: 'NID_sm4_cbc' undeclared here (not in a function)
    a_tls_lib.c: In function 'a_tls_cfg_set_sign_key':
    a_tls_lib.c:1721: error: 'NID_sm2' undeclared (first use in this function)
    a_tls_lib.c:1721: error: (Each undeclared identifier is reported only once
    a_tls_lib.c:1721: error: for each function it appears in.)
    a_tls_lib.c: In function 'a_tls_cfg_set_sign_cert':
    a_tls_lib.c:1759: error: 'NID_sm2' undeclared (first use in this function)
    a_tls_lib.c: In function 'a_tls_cfg_set_cert':
    a_tls_lib.c:1827: error: 'EVP_PKEY_RSA_PSS' undeclared (first use in this function)
    a_tls_lib.c:1836: error: 'NID_sm2' undeclared (first use in this function)
    a_tls_lib.c: In function 'a_tls_cfg_set_key':
    a_tls_lib.c:1920: error: 'NID_sm2' undeclared (first use in this function)
    make: *** [a_crypto.o] Error 1

from atls.

memdumper avatar memdumper commented on June 3, 2024
  1. GmSSL里没有NID_sm2的定义,ec_curve.c有个
    #ifndef OPENSSL_NO_SM2
    {NID_sm2p256v1, &_EC_SM2_PRIME_256V1.h, 0,
    "SM2 curve over a 256 bit prime field"},
  2. e_gmi.c有定义NID_sm4_cbc
    #define NID_sm4_cbc NID_sms4_cbc
    不知为什么说没定义
  3. EVP_PKEY_RSA_PSS在GmSSL代码里没有出现

from atls.

mrpre avatar mrpre commented on June 3, 2024

@memdumper 我这里判断有误,openssl 1.1.1-3 后才有集成了SM相关的算法,我这里判断版本号错误。不建议你用GMSSL的库编译来ATLS,现在OpenSSL master 已经集成了SM系列算法了。

from atls.

memdumper avatar memdumper commented on June 3, 2024

@mrpre 谢谢回复,我用最新openssl版本试下。

from atls.

memdumper avatar memdumper commented on June 3, 2024
  1. 编译最新版本openssl
    openssl-1.1.1-pre9
    #config
    #make
    #make install
    #mkdir lib
    复制so文件到 /root/openssl-1.1.1-pre9/lib
    2.编译atls
    #[root@gmssl atls-master]# make cryptodir=/root/openssl-1.1.1-pre9
    ar rcs libatls.a a_crypto.o a_kdf.o a_tls13.o a_tls.o a_tls_cipher.o a_tls_extension.o a_tls_lib.o
    gcc a_crypto.o a_kdf.o a_tls13.o a_tls.o a_tls_cipher.o a_tls_extension.o a_tls_lib.o -shared -fPIC -lcrypto -o libatls.so
    gcc -Wall -O -g -fPIC -I./ -I/root/openssl-1.1.1-pre9/include -L/root/openssl-1.1.1-pre9/lib -Wl,-rpath=/root/openssl-1.1.1-pre9/lib ./daemon/daemon_server.c -o daemon_server libatls.a -lcrypto
    libatls.a(a_crypto.o): In function a_crypto_sm2_dec_openssl': /root/atls-master/a_crypto.c:941: undefined reference to sm2_decrypt'
    libatls.a(a_crypto.o): In function a_crypto_sm2_sign_openssl': /root/atls-master/a_crypto.c:914: undefined reference to sm2_do_sign'
    collect2: ld returned 1 exit status
    make: *** [bin] Error 1
    查看 nm -D libcrypto.so.1.1
    导出函数没有sm2_decrypt和sm2_do_sign,但是sm2_sign.c有,不知道是否要添加编译参数才支持sm2?

from atls.

mrpre avatar mrpre commented on June 3, 2024

@memdumper 新版本OpenSSL 中 这两个函数不在源文件libcrypto.map中,所以OpenSSL在生成libcrypto.so时,这两个函数被定义为local函数了。 已经修改Makefile,让其Atls链接libcrypto.a

from atls.

memdumper avatar memdumper commented on June 3, 2024

@mrpre 已编译成功,并且nginx模块编译也成功了,感谢!能否编译好一些版本发布出来,让更多人试用?

from atls.

mrpre avatar mrpre commented on June 3, 2024

@memdumper linux发行版本太多了,一一编译不太现实。

from atls.

JI23 avatar JI23 commented on June 3, 2024

@mrpre 已编译成功,并且nginx模块编译也成功了,感谢!能否编译好一些版本发布出来,让更多人试用?

你好我编译时遇到了和你一样的问题,请问是怎么解决的呢

from atls.

Lucaks avatar Lucaks commented on June 3, 2024

@mrpre 已编译成功,并且nginx模块编译也成功了,感谢!能否编译好一些版本发布出来,让更多人试用?

你好我编译时遇到了和你一样的问题,请问是怎么解决的呢

cp libcrypto.a /lib 就可以编译了。感谢大佬们

from atls.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.