简介 因为美国专利法和其它法律对加密技术的限制,Apache Web Server 的二进制发行版不 包含对SSL的支持。但是所有相关源代码却可以从网上找到,美国司法部居然这么弱? 1. 编译OpenSSL OpenSSL是一个开放源码的工具集,它支持SSL v2/v3,TSL v1,以及其它通用加密算法。 编译之前,你需要以下东东: a. OpenSSL源码 b. ActiveState Perl c. C 编译器,本文选用Visual C++ 6.0。OpenSSL文档上推荐的其它编译器有Borland C 和GNU C (Mingw32 or Cygwin) d. ASM 编译器,本文选用Free Netwide Assembler NASM。OpenSSL文档上推荐的其它编 译器有Microsoft MASM 开始 a. 解开OpenSSL源码,假设解到c:\openssl c:\>cd openssl b. 配置环境变量 c:\openssl>perl Configure VC-WIN32 c. 生成make文件 c:\openssl>ms\do_nasm d. 编译 c:\openssl>nmake -f ms\ntdll.mak 如果nmake找不到MSPDB60.DLL,你可以把以下路径加到PATH环境变量里: Microsoft Visual Studio\Common\MSDev98\Bin\ e. 测试 c:\openssl>cd out32dll c:\openssl>..\ms\test 2. 编译Apache 编译之前,你需要: a. Visual C++ 6.0,上节课你已经用过了 b. AWK Utility, AWK是一种特殊用途的编程语言,主要用来进行简单的数据格式处理。 AWK Utility 就是处理AWK文件的工具 c. OpenSSL libraries,就是上节课的作业啦。 开始 a. 解开Apache源码,假设解到c:\>httpd-2.0.36 c:\>cd httpd-2.0.36 b. 复制OpenSSL libraries c:\httpd-2.0.36>mkdir srclib\openssl c:\httpd-2.0.36>xcopy/e openssl srclib\openssl。 d. 打开httpd-2.0.36\modules\ssl\mod_ssl.mak,删除以下代码 bison -y -d ssl_expr_parse.y sed -e "s;yy;ssl_expr_yy;g" -e "/#if defined(c_plusplus) || defined(__cplusplus)/,/#endif/d" <y.tab.c >ssl_expr_parse.c del y.tab.c sed -e "s;yy;ssl_expr_yy;g" <y.tab.h >ssl_expr_parse.h del y.tab.h flex -Pssl_expr_yy -s -B ssl_expr_scan.l sed -e "/$$Header:/d" <lex.ssl_expr_yy.c >ssl_expr_scan.c del lex.ssl_expr_yy.c e. 编译 nmake -f makefile.win SERVERNAME=myDomainName PORT=myPort INSTDIR=myInstallDir installr 缺省设置 SERVERNAME=localhost PORT=80 INSTDIR=\Apache2 3. 资源列表 ActiveState Perl, http://www.activestate.com/ActivePerl Apache-2.0.x Source Code for Win32 compilers http://www.apache.org/dist/httpd AWK Utility http://cm.bell-labs.com/cm/cs/who/bwk 注意,这位同学发明了C、AWK,还是几本牛书的作者 C Programming Language Practice of Programming NASM http://www.kernel.org/pub/software/devel/nasm/binaries/win32 OpenSSL-0.9.6d Source Code http://www.openssl.org/source Visual C++ 6.0 http://msdn.microsoft.com/visualc/productinfo/previous/default.asp
|