build openssl with vc10 and add the cert to the distro

This commit is contained in:
berkeviktor@aol.com 2010-10-08 01:06:53 +02:00
parent 6e209f8eba
commit eb22ad9067
4 changed files with 21714 additions and 5 deletions

View File

@ -1,13 +1,14 @@
@echo off
set OPENSSL_DEST=..\openssl-wdk-1.0.0a-x86
set OPENSSL_DEST=..\openssl-wdk-1.0.0a-x64
set INCLUDE=c:\WinDDK\7600.16385.1\inc\api;c:\WinDDK\7600.16385.1\inc\crt;c:\WinDDK\7600.16385.1\inc\ddk;c:\mozilla-build\build\openssl-1.0.0a\ms;c:\mozilla-build\build\zlib-x64\include
set LIB=c:\WinDDK\7600.16385.1\lib\wnet\amd64;c:\WinDDK\7600.16385.1\lib\Crt\amd64;c:\mozilla-build\build\zlib-x64\lib
set PATH=c:\WinDDK\7600.16385.1\bin\x86\amd64;c:\WinDDK\7600.16385.1\bin\x86;c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin;c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin;c:\mozilla-build\perl-5.12-x64\bin;c:\Windows\System32;c:\mozilla-build\nasm;c:\mozilla-build\build\zlib-x64\bin
set PATH=c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64;c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64;c:\mozilla-build\perl-5.12-x64\bin;c:\Windows\System32;c:\mozilla-build\nasm;c:\mozilla-build\build\zlib-x64\bin
perl Configure VC-WIN64A enable-camellia no-asm zlib-dynamic --openssldir=./
call ms\do_win64a
nmake -f ms\ntdll.mak vclean
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak test
perl mk-ca-bundle.pl -n
echo.Press return when ready to install!
pause
move include include-orig
@ -17,8 +18,10 @@ mkdir %OPENSSL_DEST%
move bin %OPENSSL_DEST%
move include %OPENSSL_DEST%
move lib %OPENSSL_DEST%
move openssl.cnf %OPENSSL_DEST%
mkdir %OPENSSL_DEST%\share
move openssl.cnf %OPENSSL_DEST%\share\openssl.cnf.example
move include-orig include
copy c:\mozilla-build\build\zlib-x64\bin\zlib1.dll %OPENSSL_DEST%\bin
move cert.pem %OPENSSL_DEST%\bin
echo.Finished!
pause

View File

@ -2,13 +2,14 @@
set OPENSSL_DEST=..\openssl-wdk-1.0.0a-x86
set INCLUDE=c:\WinDDK\7600.16385.1\inc\api;c:\WinDDK\7600.16385.1\inc\crt;c:\WinDDK\7600.16385.1\inc\ddk;c:\mozilla-build\build\openssl-1.0.0a\ms;c:\mozilla-build\build\zlib-x86\include
set LIB=c:\WinDDK\7600.16385.1\lib\wxp\i386;c:\WinDDK\7600.16385.1\lib\Crt\i386;c:\mozilla-build\build\zlib-x86\lib
set PATH=c:\WinDDK\7600.16385.1\bin\x86\x86;c:\WinDDK\7600.16385.1\bin\x86;c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin;c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin;c:\mozilla-build\perl-5.12-x86\bin;c:\Windows\System32;c:\mozilla-build\nasm;c:\mozilla-build\build\zlib-x86\bin
set PATH=c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin;c:\mozilla-build\perl-5.12-x86\bin;c:\Windows\System32;c:\mozilla-build\nasm;c:\mozilla-build\build\zlib-x86\bin
perl Configure VC-WIN32 enable-camellia zlib-dynamic --openssldir=./
call ms\do_nasm
@echo off
nmake -f ms\ntdll.mak vclean
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak test
perl mk-ca-bundle.pl -n
echo.Press return when ready to install!
pause
move include include-orig
@ -18,8 +19,10 @@ mkdir %OPENSSL_DEST%
move bin %OPENSSL_DEST%
move include %OPENSSL_DEST%
move lib %OPENSSL_DEST%
move openssl.cnf %OPENSSL_DEST%
mkdir %OPENSSL_DEST%\share
move openssl.cnf %OPENSSL_DEST%\share\openssl.cnf.example
move include-orig include
copy c:\mozilla-build\build\zlib-x86\bin\zlib1.dll %OPENSSL_DEST%\bin
move cert.pem %OPENSSL_DEST%\bin
echo.Finished!
pause

21510
ext/openssl-wdk/certdata.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,193 @@
#!/usr/bin/perl -w
# ***************************************************************************
# * _ _ ____ _
# * Project ___| | | | _ \| |
# * / __| | | | |_) | |
# * | (__| |_| | _ <| |___
# * \___|\___/|_| \_\_____|
# *
# * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
# *
# * This software is licensed as described in the file COPYING, which
# * you should have received as part of this distribution. The terms
# * are also available at http://curl.haxx.se/docs/copyright.html.
# *
# * You may opt to use, copy, modify, merge, publish, distribute and/or sell
# * copies of the Software, and permit persons to whom the Software is
# * furnished to do so, under the terms of the COPYING file.
# *
# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# * KIND, either express or implied.
# *
# * $Id: mk-ca-bundle.pl,v 1.10 2008/02/15 00:41:54 gknauf Exp $
# ***************************************************************************
# This Perl script creates a fresh ca-bundle.crt file for use with libcurl.
# It downloads certdata.txt from Mozilla's source tree (see URL below),
# then parses certdata.txt and extracts CA Root Certificates into PEM format.
# These are then processed with the OpenSSL commandline tool to produce the
# final ca-bundle.crt file.
# The script is based on the parse-certs script written by Roland Krikava.
# This Perl script works on almost any platform since its only external
# dependency is the OpenSSL commandline tool for optional text listing.
# Hacked by Guenter Knauf.
#
# Hacked again by Cameron Kaiser to use cURL *instead* of LWP.
#
use Getopt::Std;
use MIME::Base64;
#use LWP::UserAgent;
use strict;
use vars qw($opt_b $opt_h $opt_i $opt_l $opt_n $opt_q $opt_t $opt_u $opt_v);
my $url = 'http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1';
# If the OpenSSL commandline is not in search path you can configure it here!
my $openssl = 'openssl';
my $version = $1 if ('$Revision: 1.10 $' =~ /\s(\d+\.\d+)\s/);
getopts('bhilnqtuv');
if ($opt_i) {
print ("=" x 78 . "\n");
print "Script Version : $version\n";
print "Perl Version : $]\n";
print "Operating System Name : $^O\n";
print "Getopt::Std.pm Version : ${Getopt::Std::VERSION}\n";
print "MIME::Base64.pm Version : ${MIME::Base64::VERSION}\n";
# print "LWP::UserAgent.pm Version : ${LWP::UserAgent::VERSION}\n";
# print "LWP.pm Version : ${LWP::VERSION}\n";
print "This version uses cURL. As it should.\n";
print `curl --version`;
print ("=" x 78 . "\n");
}
$0 =~ s/\\/\//g;
$0 = substr($0, rindex($0, '/') + 1);
if ($opt_h) {
printf("Usage:\t%s [-b] [-i] [-l] [-n] [-q] [-t] [-u] [-v] [<outputfile>]\n", $0);
print "\t-b\tbackup an existing version of ca-bundle.crt\n";
print "\t-i\tprint version info about used modules\n";
print "\t-l\tprint license info about certdata.txt\n";
print "\t-n\tno download of certdata.txt (to use existing)\n";
print "\t-q\tbe really quiet (no progress output at all)\n";
print "\t-t\tinclude plain text listing of certificates\n";
print "\t-u\tunlink (remove) certdata.txt after processing\n";
print "\t-v\tbe verbose and print out processed CAs\n";
exit;
}
#my $crt = $ARGV[0] || 'ca-bundle.crt';
my $crt = $ARGV[0] || 'cert.pem';
my $txt = substr($url, rindex($url, '/') + 1);
$txt =~ s/\?.*//;
if (!$opt_n || !-e $txt) {
print "Downloading '$txt' ...\n" if (!$opt_q);
#my $ua = new LWP::UserAgent(agent => "$0/$version");
#my $req = new HTTP::Request('GET', $url);
#my $res = $ua->request($req);
#if ($res->is_success) {
# open(TXT,">$txt") or die "Couldn't open $txt: $!";
# print TXT $res->content . "\n";
# close(TXT) or die "Couldn't close $txt: $!";
#} else {
# die $res->status_line;
#}
system("curl $url > $txt");
}
if ($opt_b && -e $crt) {
my $bk = 1;
while (-e "$crt.~${bk}~") {
$bk++;
}
rename $crt, "$crt.~${bk}~";
}
my $format = $opt_t ? "plain text and " : "";
my $currentdate = scalar gmtime() . " UTC";
open(CRT,">$crt") or die "Couldn't open $crt: $!";
print CRT <<EOT;
##
## $crt -- Bundle of CA Root Certificates
##
## Converted at: ${currentdate}
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
## '/mozilla/security/nss/lib/ckfw/builtins/certdata.txt'
##
## It contains the certificates in ${format}PEM format and therefore
## can be directly used with curl / libcurl / php_curl, or with
## an Apache+mod_ssl webserver for SSL client authentication.
## Just configure this file as the SSLCACertificateFile.
##
EOT
close(CRT) or die "Couldn't close $crt: $!";
print "Processing '$txt' ...\n" if (!$opt_q);
my $caname;
my $certnum = 0;
open(TXT,"$txt") or die "Couldn't open $txt: $!";
while (<TXT>) {
if (/\*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*/) {
open(CRT, ">>$crt") or die "Couldn't open $crt: $!";
print CRT;
print if ($opt_l);
while (<TXT>) {
print CRT;
print if ($opt_l);
last if (/\*\*\*\*\* END LICENSE BLOCK \*\*\*\*\*/);
}
close(CRT) or die "Couldn't close $crt: $!";
}
next if /^#|^\s*$/;
chomp;
if (/^CVS_ID\s+\"(.*)\"/) {
open(CRT, ">>$crt") or die "Couldn't open $crt: $!";
print CRT "# $1\n";
close(CRT) or die "Couldn't close $crt: $!";
}
if (/^CKA_LABEL\s+[A-Z0-9]+\s+\"(.*)\"/) {
$caname = $1;
}
if (/^CKA_VALUE MULTILINE_OCTAL/) {
my $data;
while (<TXT>) {
last if (/^END/);
chomp;
my @octets = split(/\\/);
shift @octets;
for (@octets) {
$data .= chr(oct);
}
}
my $pem = "-----BEGIN CERTIFICATE-----\n"
. MIME::Base64::encode($data)
. "-----END CERTIFICATE-----\n";
open(CRT, ">>$crt") or die "Couldn't open $crt: $!";
print CRT "\n$caname\n";
print CRT ("=" x length($caname) . "\n");
if (!$opt_t) {
print CRT $pem;
}
close(CRT) or die "Couldn't close $crt: $!";
if ($opt_t) {
open(TMP, "|$openssl x509 -md5 -fingerprint -text -inform PEM >> $crt") or die "Couldn't open openssl pipe: $!";
print TMP $pem;
close(TMP) or die "Couldn't close openssl pipe: $!";
}
print "Parsing: $caname\n" if ($opt_v);
$certnum ++;
}
}
close(TXT) or die "Couldn't close $txt: $!";
unlink $txt if ($opt_u);
print "Done ($certnum CA certs processed).\n" if (!$opt_q);
exit;