lighttpd:network.c:483:错误:未声明EC_KEY(此功能首次使用)错误和解决方案

时间:2020-01-09 10:41:54  来源:igfitidea点击:

我正在尝试在RHEL 6.1 AMD64下安装最新版本的Lighttpd v1.4.29 Web服务器并收到以下错误:

network.c: In function ‘network_init’:
network.c:483: error: ‘EC_KEY’ undeclared (first use in this function)
network.c:483: error: (Each undeclared identifier is reported only once
network.c:483: error: for each function it appears in.)
network.c:483: error: ‘ecdh’ undeclared (first use in this function)
network.c:484: warning: unused variable ‘nid’
make[3]: *** [network.o] Error 1
make[3]: Leaving directory /opt/new/lighttpd-1.4.29/src’
make[2]: *** [all] Error 2
make[2]: Leaving directory /opt/new/lighttpd-1.4.29/src’
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory /opt/new/lighttpd-1.4.29
make: *** [all] Error 2

如何在CentOS 5.x,RHEL,Red Hat Enterprise Linux 6.x或者Fedora Linux下解决此问题?

椭圆曲线密码学(ECC)是一种用于移动/无线环境的新型公钥密码系统。

Lighttpd支持ECC,但是RHEL 6.x或者CenOS 5.x随OpenSSL的旧版本一起提供。
解决此问题的方法:

  • 使用较新的OpenSSL版本,该版本支持椭圆曲线密码术。 (这意味着您需要在RHEL上重新编译OpenSSL)
  • 在没有OpenSSL的情况下编译lighttpd(仅当您运行所有不具有https支持的网站时,此方法才有效)
  • 使用OPENSSL_NO_ECDH补丁编译lighttpd。它在network.c中添加了对OPENSSL_NO_ECDH的丢失检查,由于专利问题,该检查已从Fedora/RHEL/CentOS Linux中的openssl中删除。此补丁将包含在lighttpd v1.4.30中。

应用补丁的命令如下。
在/tmp中下载补丁:

$ cd /tmp
$ wget http://redmine.lighttpd.net/attachments/1294/lighttpd_1.4.29_ssl_no_ecdh.patch

cd到lighttpd v1.4.29源代码目录:

$ cd /opt/lighttpd-1.4.29

应用补丁,执行:

$ patch -p1 < /tmp/lighttpd_1.4.29_ssl_no_ecdh.patch

现在,您可以按以下方式编译lighttpd:

$ ./configure --with-openssl --option1 --option2
$ make
$ sudo make install

用必需的选项替换--option1,--option2。
这是一个工作示例:

$ ./configure --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-openssl --with-fam
$ make
$ sudo make install