Changeset 12238


Ignore:
Timestamp:
06/01/09 15:42:16 (4 years ago)
Author:
BrainSlayer
Message:

patches

Location:
src/router/openssl
Files:
36 edited

Legend:

Unmodified
Added
Removed
  • src/router/openssl/Configure

    r12237 r12238  
    1 : 
     1#!/usr/bin/perl 
    22eval 'exec perl -S $0 ${1+"$@"}' 
    33    if $running_under_some_shell; 
     
    3737# --with-krb5-flavor  Declare what flavor of Kerberos 5 is used.  Currently 
    3838#               supported values are "MIT" and "Heimdal".  A value is required. 
     39# --with-cryptodev Force support for cryptodev (ie., ocf-linux) 
     40# --with-cryptodev-digests Force support for cryptodev digests (generally slow) 
    3941# 
    4042# --test-sanity Make a number of sanity checks on the data in this file. 
     
    365367"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}", 
    366368"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}", 
     369# OpenWrt targets 
     370"linux-openwrt","gcc:-DTERMIO \$(OPENWRT_OPTIMIZATION_FLAGS) -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", 
    367371 
    368372#### *BSD [do see comment about ${BSDthreads} above!] 
     
    545549##### Compaq Non-Stop Kernel (Tandem) 
    546550"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::", 
     551 
     552# uClinux 
     553"uClinux-dist","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):BN_LLONG::::::::::::\$(LIBSSL_dlfcn):linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}", 
    547554 
    548555); 
     
    600607my $no_dso=0; 
    601608my $no_gmp=0; 
     609my $have_cryptodev=0; 
     610my $use_cryptodev_digests=0; 
    602611my @skip=(); 
    603612my $Makefile="Makefile"; 
     
    747756                        { 
    748757                        exit(&test_sanity()); 
     758                        } 
     759                elsif (/^--with-cryptodev$/) 
     760                        { 
     761                                $have_cryptodev = 1; 
     762                        } 
     763                elsif (/^--with-cryptodev-digests$/) 
     764                        { 
     765                                $use_cryptodev_digests = 1; 
    749766                        } 
    750767                elsif (/^reconfigure/ || /^reconf/) 
     
    10361053                 
    10371054                        if (/^err$/)    { $flags .= "-DOPENSSL_NO_ERR "; } 
     1055                        elsif (/^hw$/)  { $flags .= "-DOPENSSL_NO_HW "; } 
    10381056                        elsif (/^asm$/) { $no_asm = 1; } 
    10391057                        } 
     
    11581176                if $withargs{"krb5-include"} eq "" && 
    11591177                   $withargs{"krb5-dir"} ne ""; 
     1178        } 
     1179 
     1180# enable the linux cryptodev (ocf-linux) support 
     1181if ($have_cryptodev) 
     1182        { 
     1183        if ($use_cryptodev_digests) 
     1184                { 
     1185                $cflags = "-DUSE_CRYPTODEV_DIGESTS $cflags"; 
     1186                } 
     1187        $cflags = "-DHAVE_CRYPTODEV $cflags"; 
    11601188        } 
    11611189 
     
    18491877  } 
    18501878   
     1879# ugly hack to disable engines 
     1880if($target eq "mingwx") { 
     1881        system("sed -e s/^LIB/XLIB/g -i engines/Makefile"); 
     1882} 
     1883   
    18511884print <<EOF; 
    18521885 
  • src/router/openssl/INSTALL

    r12237 r12238  
    104104                library directories or other compiler options. 
    105105 
     106  --with-cryptodev Enabled the BSD cryptodev engine even if we are not using 
     107                BSD.  Useful if you are running ocf-linux or something 
     108                similar.  Once enabled you can also enable the use of 
     109                cryptodev digests,  with is usually slower unless you have 
     110                large amounts data.  Use --with-cryptodev-digests to force 
     111                it. 
    106112 
    107113 Installation in Detail 
  • src/router/openssl/Makefile

    r12237 r12238  
    1212SHLIB_MAJOR=0 
    1313SHLIB_MINOR=9.8 
    14 SHLIB_EXT= 
    15 PLATFORM=dist 
    16 OPTIONS= no-camellia no-capieng no-cms no-gmp no-jpake no-krb5 no-mdc2 no-montasm no-rc5 no-rfc3779 no-seed no-shared no-zlib no-zlib-dynamic 
    17 CONFIGURE_ARGS=dist 
    18 SHLIB_TARGET= 
     14SHLIB_EXT=.so.$(SHLIB_MAJOR).$(SHLIB_MINOR) 
     15PLATFORM=linux-openwrt 
     16OPTIONS=--prefix=/usr --openssldir=/etc/ssl -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -DHAVE_AR531X -ldl -DOPENSSL_SMALL_FOOTPRINT enable-zlib-dynamic no-aes192 no-ans1 no-camellia no-capieng no-cms no-ec no-ecdh no-ecdsa no-engines no-err no-gmp no-hw no-idea no-jpake no-krb5 no-md2 no-mdc2 no-montasm no-perlasm no-rc5 no-rfc3779 no-ripemd no-rmd160 no-seed no-sha0 no-shared no-smime no-sse2 no-threads 
     17CONFIGURE_ARGS=linux-openwrt --prefix=/usr --openssldir=/etc/ssl -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -DHAVE_AR531X -ldl -DOPENSSL_SMALL_FOOTPRINT no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-smime no-rmd160 no-aes192 no-ripemd no-camellia no-ans1 no-krb5 no-ec no-err no-hw no-threads zlib-dynamic no-engines no-sse2 no-perlasm 
     18SHLIB_TARGET=linux-shared 
    1919 
    2020# HERE indicates where this Makefile lives.  This can be used to indicate 
     
    2727# Normally it is left empty. 
    2828INSTALL_PREFIX= 
    29 INSTALLTOP=/usr/local/ssl 
     29INSTALLTOP=/usr 
    3030 
    3131# Do not edit this manually. Use Configure --openssldir=DIR do change this! 
    32 OPENSSLDIR=/usr/local/ssl 
     32OPENSSLDIR=/etc/ssl 
    3333 
    3434# NO_IDEA - Define to build without the IDEA algorithm 
     
    6060# PKCS1_CHECK - pkcs1 tests. 
    6161 
    62 CC= cc 
    63 CFLAG= -O 
    64 DEPFLAG= -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CMS -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED 
     62CC= mips-linux-uclibc-gcc 
     63CFLAG= -DZLIB_SHARED -DZLIB -DDSO_DLFCN -DHAVE_DLFCN_H -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -DHAVE_AR531X -DOPENSSL_SMALL_FOOTPRINT -DOPENSSL_NO_ERR -DOPENSSL_NO_HW -DTERMIO $(OPENWRT_OPTIMIZATION_FLAGS) -fomit-frame-pointer -Wall 
     64DEPFLAG= -DOPENSSL_NO_AES192 -DOPENSSL_NO_ANS1 -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CMS -DOPENSSL_NO_EC -DOPENSSL_NO_ECDH -DOPENSSL_NO_ECDSA -DOPENSSL_NO_ENGINES -DOPENSSL_NO_GMP -DOPENSSL_NO_IDEA -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_PERLASM -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_RIPEMD -DOPENSSL_NO_RMD160 -DOPENSSL_NO_SEED -DOPENSSL_NO_SHA0 -DOPENSSL_NO_SMIME 
    6565PEX_LIBS=  
    66 EX_LIBS=  
     66EX_LIBS= -ldl -ldl 
    6767EXE_EXT=  
    6868ARFLAGS=  
     
    134134BASEADDR=0xFB00000 
    135135 
    136 DIRS=   crypto ssl engines apps test tools 
     136DIRS=   crypto ssl apps 
    137137SHLIBDIRS= crypto ssl 
    138138 
     
    140140SDIRS=  \ 
    141141        objects \ 
    142         md2 md4 md5 sha hmac ripemd \ 
    143         des aes rc2 rc4 idea bf cast \ 
    144         bn ec rsa dsa ecdsa dh ecdh dso engine \ 
     142        md4 md5 sha hmac \ 
     143        des aes rc2 rc4 bf cast \ 
     144        bn rsa dsa dh dso engine \ 
    145145        buffer bio stack lhash rand err \ 
    146146        evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \ 
     
    170170SHARED_FIPS= 
    171171SHARED_LIBS= 
    172 SHARED_LIBS_LINK_EXTS= 
     172SHARED_LIBS_LINK_EXTS=.so.$(SHLIB_MAJOR) .so 
    173173SHARED_LDFLAGS= 
    174174 
     
    336336build_fips: 
    337337        @dir=fips; target=all; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD) 
    338 build_ssl: 
     338build_ssl: build_crypto 
    339339        @dir=ssl; target=all; $(BUILD_ONE_CMD) 
    340 build_engines: 
     340build_engines: build_crypto 
    341341        @dir=engines; target=all; $(BUILD_ONE_CMD) 
    342 build_apps: 
     342build_apps: build_libs 
    343343        @dir=apps; target=all; $(BUILD_ONE_CMD) 
    344 build_tests: 
     344build_tests: build_libs 
    345345        @dir=test; target=all; $(BUILD_ONE_CMD) 
    346 build_tools: 
     346build_tools: build_libs 
    347347        @dir=tools; target=all; $(BUILD_ONE_CMD) 
    348348 
     
    360360                else \ 
    361361                        if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \ 
    362                                 FIPSLD_CC=$(CC); CC=fips/fipsld; \ 
     362                                FIPSLD_CC="$(CC)"; CC=fips/fipsld; \ 
    363363                                export CC FIPSLD_CC; \ 
    364364                        fi; \ 
     
    383383libfips$(SHLIB_EXT):            fips/fipscanister.o 
    384384        @if [ "$(SHLIB_TARGET)" != "" ]; then \ 
    385                 FIPSLD_CC=$(CC); CC=fips/fipsld; export CC FIPSLD_CC; \ 
     385                FIPSLD_CC="$(CC)"; CC=fips/fipsld; export CC FIPSLD_CC; \ 
    386386                $(MAKE) -f Makefile.shared -e $(BUILDENV) \ 
    387387                        CC=$${CC} LIBNAME=fips THIS=$@ \ 
     
    505505links: 
    506506        @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl 
    507         @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER) 
     507        @$(PERL) $(TOP)/util/mklink.pl include/openssl $(HEADER) $(EXHEADER) 
    508508        @set -e; target=links; $(RECURSIVE_BUILD_CMD) 
    509509        @if [ -z "$(FIPSCANLIB)" ]; then \ 
     
    614614        (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean) 
    615615 
    616 install: all install_docs install_sw 
     616install: all install_sw 
    617617 
    618618install_sw: 
  • src/router/openssl/Makefile.org

    r12237 r12238  
    132132BASEADDR= 
    133133 
    134 DIRS=   crypto fips ssl engines apps test tools 
     134DIRS=   crypto fips ssl apps 
    135135SHLIBDIRS= crypto ssl fips 
    136136 
     
    334334build_fips: 
    335335        @dir=fips; target=all; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD) 
    336 build_ssl: 
     336build_ssl: build_crypto 
    337337        @dir=ssl; target=all; $(BUILD_ONE_CMD) 
    338 build_engines: 
     338build_engines: build_crypto 
    339339        @dir=engines; target=all; $(BUILD_ONE_CMD) 
    340 build_apps: 
     340build_apps: build_libs 
    341341        @dir=apps; target=all; $(BUILD_ONE_CMD) 
    342 build_tests: 
     342build_tests: build_libs 
    343343        @dir=test; target=all; $(BUILD_ONE_CMD) 
    344 build_tools: 
     344build_tools: build_libs 
    345345        @dir=tools; target=all; $(BUILD_ONE_CMD) 
    346346 
     
    358358                else \ 
    359359                        if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \ 
    360                                 FIPSLD_CC=$(CC); CC=fips/fipsld; \ 
     360                                FIPSLD_CC="$(CC)"; CC=fips/fipsld; \ 
    361361                                export CC FIPSLD_CC; \ 
    362362                        fi; \ 
     
    381381libfips$(SHLIB_EXT):            fips/fipscanister.o 
    382382        @if [ "$(SHLIB_TARGET)" != "" ]; then \ 
    383                 FIPSLD_CC=$(CC); CC=fips/fipsld; export CC FIPSLD_CC; \ 
     383                FIPSLD_CC="$(CC)"; CC=fips/fipsld; export CC FIPSLD_CC; \ 
    384384                $(MAKE) -f Makefile.shared -e $(BUILDENV) \ 
    385385                        CC=$${CC} LIBNAME=fips THIS=$@ \ 
     
    503503links: 
    504504        @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl 
    505         @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER) 
     505        @$(PERL) $(TOP)/util/mklink.pl include/openssl $(HEADER) $(EXHEADER) 
    506506        @set -e; target=links; $(RECURSIVE_BUILD_CMD) 
    507507        @if [ -z "$(FIPSCANLIB)" ]; then \ 
     
    612612        (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean) 
    613613 
    614 install: all install_docs install_sw 
     614install: all install_sw 
    615615 
    616616install_sw: 
  • src/router/openssl/Makefile.shared

    r12237 r12238  
    77 
    88# CC contains the current compiler.  This one MUST be defined 
    9 CC=cc 
    10 CFLAGS=$(CFLAG) 
     9CC?=cc 
     10CFLAGS?=$(CFLAG) 
    1111# LDFLAGS contains flags to be used when temporary object files (when building 
    1212# shared libraries) are created, or when an application is linked. 
    1313# SHARED_LDFLAGS contains flags to be used when the shared library is created. 
    14 LDFLAGS= 
    15 SHARED_LDFLAGS= 
     14LDFLAGS?= 
     15SHARED_LDFLAGS?= 
    1616 
    1717# LIBNAME contains just the name of the library, without prefix ("lib" 
     
    9494    LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \ 
    9595    LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \ 
    96     LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \ 
    9796    $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} ) 
    9897 
     
    104103    LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \ 
    105104    LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \ 
    106     LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \ 
    107105    $${SHAREDCMD} $${SHAREDFLAGS} \ 
    108106        -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \ 
  • src/router/openssl/apps/Makefile

    r12237 r12238  
    154154                shlib_target="$(SHLIB_TARGET)"; \ 
    155155        elif [ -n "$(FIPSCANLIB)" ]; then \ 
    156           FIPSLD_CC=$(CC); CC=$(TOP)/fips/fipsld; export CC FIPSLD_CC; \ 
     156          FIPSLD_CC="$(CC)"; CC=$(TOP)/fips/fipsld; export CC FIPSLD_CC; \ 
    157157        fi; \ 
    158158        LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \ 
    159159        [ "x$(FIPSCANLIB)" = "xlibfips" ] && LIBRARIES="$$LIBRARIES -lfips"; \ 
    160160        $(MAKE) -f $(TOP)/Makefile.shared -e \ 
    161                 CC=$${CC} APPNAME=$(EXE) OBJECTS="$(PROGRAM).o $(E_OBJ)" \ 
     161                CC="$${CC}" APPNAME=$(EXE) OBJECTS="$(PROGRAM).o $(E_OBJ)" \ 
    162162                LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \ 
    163163                link_app.$${shlib_target} 
  • src/router/openssl/apps/apps.h

    r12237 r12238  
    113113#define HEADER_APPS_H 
    114114 
    115 #include "e_os.h" 
     115#include <openssl/e_os.h> 
    116116 
    117117#include <openssl/bio.h> 
  • src/router/openssl/apps/progs.h

    r12237 r12238  
    130130        {FUNC_TYPE_GENERAL,"engine",engine_main}, 
    131131#endif 
     132#ifndef OPENSSL_NO_OCSP 
    132133        {FUNC_TYPE_GENERAL,"ocsp",ocsp_main}, 
     134#endif 
    133135        {FUNC_TYPE_GENERAL,"prime",prime_main}, 
    134136#ifndef OPENSSL_NO_MD2 
  • src/router/openssl/apps/speed.c

    r12237 r12238  
    293293  "aes-128 ige","aes-192 ige","aes-256 ige"}; 
    294294static double results[ALGOR_NUM][SIZE_NUM]; 
    295 static int lengths[SIZE_NUM]={16,64,256,1024,8*1024}; 
     295static int lengths[SIZE_NUM]={16,64,256,1024,2*1024,4*1024}; 
    296296static double rsa_results[RSA_NUM][2]; 
    297297static double dsa_results[DSA_NUM][2]; 
     
    328328#define START   0 
    329329#define STOP    1 
     330 
     331#ifdef __linux__ 
     332/* 
     333 * record CPU usage as well 
     334 */ 
     335 
     336static int do_cpu = 0; 
     337 
     338struct cpu_stat { 
     339        unsigned int    user; 
     340        unsigned int    nice; 
     341        unsigned int    system; 
     342        unsigned int    idle; 
     343        unsigned int    total; 
     344}; 
     345 
     346static unsigned int cpu_usage[ALGOR_NUM][SIZE_NUM]; 
     347static unsigned int rsa_cpu_usage[RSA_NUM][2]; 
     348static unsigned int dsa_cpu_usage[DSA_NUM][2]; 
     349static struct cpu_stat cpu_start, cpu_finish; 
     350 
     351static void 
     352get_cpu(int s) 
     353{ 
     354        FILE *fp = NULL; 
     355        unsigned char   buf[80]; 
     356        struct cpu_stat *st = s == START ? &cpu_start : &cpu_finish; 
     357 
     358        memset(st, 0, sizeof(*st)); 
     359 
     360        if (fp == NULL) 
     361                fp = fopen("/proc/stat", "r"); 
     362        if (!fp) 
     363                return; 
     364        if (fseek(fp, 0, SEEK_SET) == -1) { 
     365                fclose(fp); 
     366                return; 
     367        } 
     368        fscanf(fp, "%s %d %d %d %d", &buf[0], &st->user, &st->nice, 
     369                &st->system, &st->idle); 
     370        st->total = st->user + st->nice + st->system + st->idle; 
     371        fclose(fp); 
     372} 
     373 
     374static unsigned int 
     375calc_cpu() 
     376{ 
     377        unsigned int total, res; 
     378 
     379        total  = cpu_finish.total - cpu_start.total; 
     380        if (total <= 0) 
     381                return 0; 
     382#if 1 // busy 
     383        res   = ((cpu_finish.system + cpu_finish.user + cpu_finish.nice) - 
     384                         (cpu_start.system + cpu_start.user + cpu_start.nice)) * 
     385                         100 / total; 
     386#endif 
     387#if 0 // system 
     388        res   = (cpu_finish.system - cpu_start.system) * 100 / total; 
     389#endif 
     390#if 0 // user 
     391        res   = (cpu_finish.user   - cpu_start.user)   * 100 / total; 
     392#endif 
     393#if 0 // nice 
     394        res   = (cpu_finish.nice   - cpu_start.nice)   * 100 / total; 
     395#endif 
     396#if 0 // idle 
     397        res   = (cpu_finish.idle   - cpu_start.idle)   * 100 / total; 
     398#endif 
     399        return(res); 
     400} 
     401 
     402#endif 
    330403 
    331404#if defined(OPENSSL_SYS_NETWARE) 
     
    358431        { 
    359432        double ret; 
     433 
     434#ifdef __linux__ 
     435        if (do_cpu) 
     436                get_cpu(s); 
     437#endif 
    360438 
    361439#ifdef USE_TOD 
     
    833911                                   an algorithm. */ 
    834912                        } 
     913#ifdef __linux__ 
     914                else if ((argc > 0) && (strcmp(*argv,"-cpu") == 0)) 
     915                        { 
     916                        do_cpu = 1; 
     917                        j--;    /* Otherwise, -cpu gets confused with 
     918                                   an algorithm. */ 
     919                        } 
     920#endif 
    835921                else if ((argc > 0) && (strcmp(*argv,"-evp") == 0)) 
    836922                        { 
     
    12611347                        BIO_printf(bio_err,"-multi n        run n benchmarks in parallel.\n"); 
    12621348#endif 
     1349#ifdef __linux__ 
     1350                        BIO_printf(bio_err,"-cpu            calculate cpu utilisation.\n"); 
     1351#endif 
    12631352                        goto end; 
    12641353                        } 
     
    12671356                j++; 
    12681357                } 
    1269  
    1270 #ifdef HAVE_FORK 
    1271         if(multi && do_multi(multi)) 
    1272                 goto show_res; 
    1273 #endif 
    12741358 
    12751359        if (j == 0) 
     
    16051689#endif /* SIGALRM */ 
    16061690 
     1691#ifdef HAVE_FORK /* DM */ 
     1692        if(multi && do_multi(multi)) 
     1693                goto show_res; 
     1694#endif 
     1695 
    16071696#ifndef OPENSSL_NO_MD2 
    16081697        if (doit[D_MD2]) 
     
    20342123                                 * optimization here!  names[D_EVP] 
    20352124                                 * somehow becomes NULL */ 
    2036                                 print_message(names[D_EVP],save_count, 
    2037                                         lengths[j]); 
    20382125 
    20392126                                EVP_CIPHER_CTX_init(&ctx); 
     
    20432130                                        EVP_EncryptInit_ex(&ctx,evp_cipher,NULL,key16,iv); 
    20442131                                EVP_CIPHER_CTX_set_padding(&ctx, 0); 
     2132 
     2133                                print_message(names[D_EVP],save_count, 
     2134                                        lengths[j]); 
    20452135 
    20462136                                Time_F(START); 
     
    21082198                                } 
    21092199                        d=Time_F(STOP); 
     2200                        if (do_cpu) 
     2201                                rsa_cpu_usage[j][0] = calc_cpu(); 
    21102202                        BIO_printf(bio_err,mr ? "+R1:%ld:%d:%.2f\n" 
    21112203                                   : "%ld %d bit private RSA's in %.2fs\n", 
     
    21432235                                } 
    21442236                        d=Time_F(STOP); 
     2237                        if (do_cpu) 
     2238                                rsa_cpu_usage[j][1] = calc_cpu(); 
    21452239                        BIO_printf(bio_err,mr ? "+R2:%ld:%d:%.2f\n" 
    21462240                                   : "%ld %d bit public RSA's in %.2fs\n", 
     
    22022296                                } 
    22032297                        d=Time_F(STOP); 
     2298                        if (do_cpu) 
     2299                                dsa_cpu_usage[j][0] = calc_cpu(); 
    22042300                        BIO_printf(bio_err,mr ? "+R3:%ld:%d:%.2f\n" 
    22052301                                   : "%ld %d bit DSA signs in %.2fs\n", 
     
    22372333                                } 
    22382334                        d=Time_F(STOP); 
     2335                        if (do_cpu) 
     2336                                dsa_cpu_usage[j][1] = calc_cpu(); 
    22392337                        BIO_printf(bio_err,mr ? "+R4:%ld:%d:%.2f\n" 
    22402338                                   : "%ld %d bit DSA verify in %.2fs\n", 
     
    25312629                        fprintf(stdout,"type        "); 
    25322630                        } 
    2533                 for (j=0;  j<SIZE_NUM; j++) 
     2631                for (j=0;  j<SIZE_NUM; j++) { 
    25342632                        fprintf(stdout,mr ? ":%d" : "%7d bytes",lengths[j]); 
     2633                        if (do_cpu && !mr) 
     2634                                fprintf(stdout, " /cpu"); 
     2635                } 
    25352636                fprintf(stdout,"\n"); 
    25362637                } 
     
    25392640                { 
    25402641                if (!doit[k]) continue; 
     2642                if (k == D_EVP) { 
     2643                        if (evp_cipher) 
     2644                                names[D_EVP]=OBJ_nid2ln(evp_cipher->nid); 
     2645                        else 
     2646                                names[D_EVP]=OBJ_nid2ln(evp_md->type); 
     2647                } 
    25412648                if(mr) 
    25422649                        fprintf(stdout,"+F:%d:%s",k,names[k]); 
     
    25492656                        else 
    25502657                                fprintf(stdout,mr ? ":%.2f" : " %11.2f ",results[k][j]); 
     2658                        if (do_cpu) 
     2659                                fprintf(stdout, mr ? "/%d" : "/%%%-3d", cpu_usage[k][j]); 
    25512660                        } 
    25522661                fprintf(stdout,"\n"); 
     
    25632672                        } 
    25642673                if(mr) 
    2565                         fprintf(stdout,"+F2:%u:%u:%f:%f\n", 
    2566                                 k,rsa_bits[k],rsa_results[k][0], 
    2567                                 rsa_results[k][1]); 
    2568                 else 
    2569                         fprintf(stdout,"rsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n", 
    2570                                 rsa_bits[k],rsa_results[k][0],rsa_results[k][1], 
    2571                                 1.0/rsa_results[k][0],1.0/rsa_results[k][1]); 
     2674                        fprintf(stdout,"+F2:%u:%u:%f", k,rsa_bits[k],rsa_results[k][0]); 
     2675                else 
     2676                        fprintf(stdout,"rsa %4u bits %8.6fs",rsa_bits[k],rsa_results[k][0]); 
     2677                if (do_cpu) 
     2678                        fprintf(stdout, mr ? "/%d": "/%%%-3d", rsa_cpu_usage[k][0]); 
     2679                fprintf(stdout, mr ? ":%f" : " %8.6fs", rsa_results[k][1]); 
     2680                if (do_cpu) 
     2681                        fprintf(stdout, mr ? "/%d": "/%%%-3d", rsa_cpu_usage[k][1]); 
     2682                if(!mr) 
     2683                        fprintf(stdout, " %8.1f %8.1f", 
     2684                                        1.0/rsa_results[k][0],1.0/rsa_results[k][1]); 
     2685                fprintf(stdout, "\n"); 
    25722686                } 
    25732687#endif 
     
    25832697                        } 
    25842698                if(mr) 
    2585                         fprintf(stdout,"+F3:%u:%u:%f:%f\n", 
    2586                                 k,dsa_bits[k],dsa_results[k][0],dsa_results[k][1]); 
    2587                 else 
    2588                         fprintf(stdout,"dsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n", 
    2589                                 dsa_bits[k],dsa_results[k][0],dsa_results[k][1], 
    2590                                 1.0/dsa_results[k][0],1.0/dsa_results[k][1]); 
     2699                        fprintf(stdout,"+F3:%u:%u:%f", k,dsa_bits[k],dsa_results[k][0]); 
     2700                else 
     2701                        fprintf(stdout,"dsa %4u bits %8.6fs",dsa_bits[k],dsa_results[k][0]); 
     2702                if (do_cpu) 
     2703                        fprintf(stdout, mr ? "/%d": "/%%%-3d", dsa_cpu_usage[k][0]); 
     2704                fprintf(stdout, mr ? ":%f" : " %8.6fs", dsa_results[k][1]); 
     2705                if (do_cpu) 
     2706                        fprintf(stdout, mr ? "/%d": "/%%%-3d", dsa_cpu_usage[k][1]); 
     2707                if(!mr) 
     2708                        fprintf(stdout, " %8.1f %8.1f", 
     2709                                        1.0/dsa_results[k][0],1.0/dsa_results[k][1]); 
     2710                fprintf(stdout, "\n"); 
    25912711                } 
    25922712#endif 
     
    27132833static void print_result(int alg,int run_no,int count,double time_used) 
    27142834        { 
    2715         BIO_printf(bio_err,mr ? "+R:%d:%s:%f\n" 
    2716                    : "%d %s's in %.2fs\n",count,names[alg],time_used); 
     2835        if (do_cpu) 
     2836            cpu_usage[alg][run_no] = calc_cpu(); 
     2837        BIO_printf(bio_err,mr ? "+R:%ld:%s:%f\n" 
     2838                   : "%ld %s's in %.2fs\n",count,names[alg],time_used); 
    27172839        results[alg][run_no]=((double)count)/time_used*lengths[run_no]; 
    27182840        } 
     
    28092931                                alg=atoi(sstrsep(&p,sep)); 
    28102932                                sstrsep(&p,sep); 
    2811                                 for(j=0 ; j < SIZE_NUM ; ++j) 
     2933                                for(j=0 ; j < SIZE_NUM ; ++j) { 
     2934                                        if (do_cpu && strchr(p, '/')) 
     2935                                                cpu_usage[alg][j] = atoi(strchr(p, '/') + 1); 
    28122936                                        results[alg][j]+=atof(sstrsep(&p,sep)); 
     2937                                } 
    28132938                                } 
    28142939                        else if(!strncmp(buf,"+F2:",4)) 
     
    28212946                                sstrsep(&p,sep); 
    28222947 
     2948                                /* before we move the token along */ 
     2949                                if (do_cpu && strchr(p, '/')) 
     2950                                        rsa_cpu_usage[k][0] = atoi(strchr(p, '/') + 1); 
    28232951                                d=atof(sstrsep(&p,sep)); 
    28242952                                if(n) 
     
    28272955                                        rsa_results[k][0]=d; 
    28282956 
     2957                                /* before we move the token along */ 
     2958                                if (do_cpu && strchr(p, '/')) 
     2959                                        rsa_cpu_usage[k][1] = atoi(strchr(p, '/') + 1); 
    28292960                                d=atof(sstrsep(&p,sep)); 
    28302961                                if(n) 
     
    28332964                                        rsa_results[k][1]=d; 
    28342965                                } 
    2835                         else if(!strncmp(buf,"+F2:",4)) 
     2966                        else if(!strncmp(buf,"+F3:",4)) 
    28362967                                { 
    28372968                                int k; 
     
    28422973                                sstrsep(&p,sep); 
    28432974 
     2975                                /* before we move the token along */ 
     2976                                if (do_cpu && strchr(p, '/')) 
     2977                                        dsa_cpu_usage[k][0] = atoi(strchr(p, '/') + 1); 
    28442978                                d=atof(sstrsep(&p,sep)); 
    28452979                                if(n) 
    2846                                         rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d); 
     2980                                        dsa_results[k][0]=1/(1/dsa_results[k][0]+1/d); 
    28472981                                else 
    2848                                         rsa_results[k][0]=d; 
    2849  
     2982                                        dsa_results[k][0]=d; 
     2983 
     2984                                /* before we move the token along */ 
     2985                                if (do_cpu && strchr(p, '/')) 
     2986                                        dsa_cpu_usage[k][1] = atoi(strchr(p, '/') + 1); 
    28502987                                d=atof(sstrsep(&p,sep)); 
    28512988                                if(n) 
    2852                                         rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d); 
     2989                                        dsa_results[k][1]=1/(1/dsa_results[k][1]+1/d); 
    28532990                                else 
    2854                                         rsa_results[k][1]=d; 
    2855                                 } 
    2856                         else if(!strncmp(buf,"+F3:",4)) 
     2991                                        dsa_results[k][1]=d; 
     2992                                } 
     2993#ifndef OPENSSL_NO_ECDSA 
     2994                        else if(!strncmp(buf,"+F4:",4)) 
    28572995                                { 
    28582996                                int k; 
     
    28653003                                d=atof(sstrsep(&p,sep)); 
    28663004                                if(n) 
    2867                                         dsa_results[k][0]=1/(1/dsa_results[k][0]+1/d); 
     3005                                        ecdsa_results[k][0]=1/(1/ecdsa_results[k][0]+1/d); 
    28683006                                else 
    2869                                         dsa_results[k][0]=d; 
     3007                                        ecdsa_results[k][0]=d; 
    28703008 
    28713009                                d=atof(sstrsep(&p,sep)); 
    28723010                                if(n) 
    2873                                         dsa_results[k][1]=1/(1/dsa_results[k][1]+1/d); 
     3011                                        ecdsa_results[k][1]=1/(1/ecdsa_results[k][1]+1/d); 
    28743012                                else 
    2875                                         dsa_results[k][1]=d; 
    2876                                 } 
    2877 #ifndef OPENSSL_NO_ECDSA 
    2878                         else if(!strncmp(buf,"+F4:",4)) 
     3013                                        ecdsa_results[k][1]=d; 
     3014                                } 
     3015#endif  
     3016 
     3017#ifndef OPENSSL_NO_ECDH 
     3018                        else if(!strncmp(buf,"+F5:",4)) 
    28793019                                { 
    28803020                                int k; 
     
    28873027                                d=atof(sstrsep(&p,sep)); 
    28883028                                if(n) 
    2889                                         ecdsa_results[k][0]=1/(1/ecdsa_results[k][0]+1/d); 
    2890                                 else 
    2891                                         ecdsa_results[k][0]=d; 
    2892  
    2893                                 d=atof(sstrsep(&p,sep)); 
    2894                                 if(n) 
    2895                                         ecdsa_results[k][1]=1/(1/ecdsa_results[k][1]+1/d); 
    2896                                 else 
    2897                                         ecdsa_results[k][1]=d; 
    2898                                 } 
    2899 #endif  
    2900  
    2901 #ifndef OPENSSL_NO_ECDH 
    2902                         else if(!strncmp(buf,"+F5:",4)) 
    2903                                 { 
    2904                                 int k; 
    2905                                 double d; 
    2906                                  
    2907                                 p=buf+4; 
    2908                                 k=atoi(sstrsep(&p,sep)); 
    2909                                 sstrsep(&p,sep); 
    2910  
    2911                                 d=atof(sstrsep(&p,sep)); 
    2912                                 if(n) 
    29133029                                        ecdh_results[k][0]=1/(1/ecdh_results[k][0]+1/d); 
    29143030                                else 
  • src/router/openssl/config

    r12237 r12238  
    4949# First get uname entries that we use below 
    5050 
    51 MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown" 
    52 RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown" 
    53 SYSTEM=`(uname -s) 2>/dev/null`  || SYSTEM="unknown" 
    54 VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown" 
     51[ "$MACHINE" ] || MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown" 
     52[ "$RELEASE" ] || RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown" 
     53[ "$SYSTEM" ]  || SYSTEM=`(uname -s) 2>/dev/null`  || SYSTEM="unknown" 
     54[ "$VERSION" ] || VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown" 
    5555 
    5656 
     
    271271                ;; 
    272272            *) 
    273                 echo "i386-apple-darwin${VERSION}" 
     273                echo "${MACHINE}-apple-darwin${VERSION}" 
    274274                ;; 
    275275        esac 
     
    400400# --------------------------------------------------------------------------- 
    401401 
    402 GCCVER=`(gcc -dumpversion) 2>/dev/null` 
     402# figure out if gcc is available and if so we use it otherwise 
     403# we fallback to whatever cc does on the system 
     404CC="${CC:-gcc}" 
     405GCCVER=`(${CC} -dumpversion) 2>/dev/null` 
    403406if [ "$GCCVER" != "" ]; then 
    404407  # then strip off whatever prefix egcs prepends the number with... 
     
    410413  # peak single digit before and after first dot, e.g. 2.95.1 gives 29 
    411414  GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'` 
     415else 
     416  CC="${CC:-cc}" 
    412417fi 
    413418 
     
    489494# more time that I want to waste at the moment 
    490495case "$GUESSOS" in 
     496  uClinux*) 
     497    OUT=uClinux-dist 
     498        ;; 
    491499  mips2-sgi-irix) 
    492500        CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` 
  • src/router/openssl/crypto/cryptlib.h

    r12237 r12238  
    6363#include <string.h> 
    6464 
    65 #include "e_os.h" 
     65#include <openssl/e_os.h> 
    6666 
    6767#ifdef OPENSSL_USE_APPLINK 
  • src/router/openssl/crypto/engine/eng_all.c

    r12237 r12238  
    105105#endif 
    106106#ifndef OPENSSL_NO_HW 
    107 #if defined(__OpenBSD__) || defined(__FreeBSD__) 
     107#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) 
    108108        ENGINE_load_cryptodev(); 
    109109#endif 
     
    114114        } 
    115115 
    116 #if defined(__OpenBSD__) || defined(__FreeBSD__) 
     116#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) 
    117117void ENGINE_setup_bsd_cryptodev(void) { 
    118118        static int bsd_cryptodev_default_loaded = 0; 
  • src/router/openssl/crypto/engine/eng_cryptodev.c

    r12237 r12238  
    6969        struct session_op d_sess; 
    7070        int d_fd; 
     71 
     72#ifdef USE_CRYPTODEV_DIGESTS 
     73        char dummy_mac_key[20]; 
     74 
     75        unsigned char digest_res[20]; 
     76        char *mac_data; 
     77        int mac_len; 
     78 
     79        int copy; 
     80#endif 
    7181}; 
    7282 
     
    7686static int open_dev_crypto(void); 
    7787static int get_dev_crypto(void); 
     88#if 0 
    7889static int cryptodev_max_iv(int cipher); 
    7990static int cryptodev_key_length_valid(int cipher, int len); 
    8091static int cipher_nid_to_cryptodev(int nid); 
     92#endif 
    8193static int get_cryptodev_ciphers(const int **cnids); 
    8294static int get_cryptodev_digests(const int **cnids); 
     
    101113    const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); 
    102114static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, 
    103     RSA *rsa); 
     115    RSA *rsa, BN_CTX *ctx); 
    104116static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx); 
    105117static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, 
     
    131143        int     keylen; 
    132144} ciphers[] = { 
     145        { CRYPTO_ARC4,                  NID_rc4,                0,      16, }, 
    133146        { CRYPTO_DES_CBC,               NID_des_cbc,            8,       8, }, 
    134147        { CRYPTO_3DES_CBC,              NID_des_ede3_cbc,       8,      24, }, 
    135148        { CRYPTO_AES_CBC,               NID_aes_128_cbc,        16,     16, }, 
     149        { CRYPTO_AES_CBC,               NID_aes_192_cbc,        16,     24, }, 
     150        { CRYPTO_AES_CBC,               NID_aes_256_cbc,        16,     32, }, 
    136151        { CRYPTO_BLF_CBC,               NID_bf_cbc,             8,      16, }, 
    137152        { CRYPTO_CAST_CBC,              NID_cast5_cbc,          8,      16, }, 
     
    143158        int     id; 
    144159        int     nid; 
     160        int     keylen; 
    145161} digests[] = { 
    146         { CRYPTO_SHA1_HMAC,             NID_hmacWithSHA1,       }, 
    147         { CRYPTO_RIPEMD160_HMAC,        NID_ripemd160,          }, 
    148         { CRYPTO_MD5_KPDK,              NID_undef,              }, 
    149         { CRYPTO_SHA1_KPDK,             NID_undef,              }, 
    150         { CRYPTO_MD5,                   NID_md5,                }, 
    151         { CRYPTO_SHA1,                  NID_undef,              }, 
    152         { 0,                            NID_undef,              }, 
     162        { CRYPTO_SHA1_HMAC,             NID_hmacWithSHA1,       20}, 
     163        { CRYPTO_RIPEMD160_HMAC,        NID_ripemd160,          16/*?*/}, 
     164        { CRYPTO_MD5_KPDK,              NID_undef,              0}, 
     165        { CRYPTO_SHA1_KPDK,             NID_undef,              0}, 
     166        { CRYPTO_MD5,                   NID_md5,                16}, 
     167        { CRYPTO_SHA1,                  NID_sha1,               20}, 
     168        { 0,                            NID_undef,              0}, 
    153169}; 
    154170 
     
    177193get_dev_crypto(void) 
    178194{ 
    179         int fd, retfd; 
    180  
    181         if ((fd = open_dev_crypto()) == -1) 
    182                 return (-1); 
     195        static int fd = -1; 
     196        int retfd; 
     197 
     198        if (fd == -1) { 
     199                if ((fd = open_dev_crypto()) == -1) 
     200                        return (-1); 
     201                if (fcntl(fd, F_SETFD, 1) == -1) { 
     202                        close(fd); 
     203                        return (-1); 
     204                } 
     205        } 
    183206        if (ioctl(fd, CRIOGET, &retfd) == -1) 
    184207                return (-1); 
     
    203226} 
    204227 
     228#if 0 
    205229/* 
    206230 * XXXX this needs to be set for each alg - and determined from 
     
    246270        return (0); 
    247271} 
     272#endif 
    248273 
    249274/* 
     
    265290        } 
    266291        memset(&sess, 0, sizeof(sess)); 
    267         sess.key = (caddr_t)"123456781234567812345678"; 
     292        sess.key = (caddr_t)"123456789abcdefghijklmno"; 
    268293 
    269294        for (i = 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { 
     
    304329        } 
    305330        memset(&sess, 0, sizeof(sess)); 
     331        sess.mackey = (caddr_t)"123456789abcdefghijklmno"; 
    306332        for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { 
    307333                if (digests[i].nid == NID_undef) 
    308334                        continue; 
    309335                sess.mac = digests[i].id; 
     336                sess.mackeylen = digests[i].keylen; 
    310337                sess.cipher = 0; 
    311338                if (ioctl(fd, CIOCGSESSION, &sess) != -1 && 
     
    352379cryptodev_usable_digests(const int **nids) 
    353380{ 
     381#ifdef USE_CRYPTODEV_DIGESTS 
     382        return (get_cryptodev_digests(nids)); 
     383#else 
    354384        /* 
    355385         * XXXX just disable all digests for now, because it sucks. 
     
    366396        *nids = NULL; 
    367397        return (0); 
     398#endif 
    368399} 
    369400 
     
    428459        struct dev_crypto_state *state = ctx->cipher_data; 
    429460        struct session_op *sess = &state->d_sess; 
    430         int cipher; 
    431  
    432         if ((cipher = cipher_nid_to_cryptodev(ctx->cipher->nid)) == NID_undef) 
    433                 return (0); 
    434  
    435         if (ctx->cipher->iv_len > cryptodev_max_iv(cipher)) 
    436                 return (0); 
    437  
    438         if (!cryptodev_key_length_valid(cipher, ctx->key_len)) 
    439                 return (0); 
     461        int cipher, i; 
     462 
     463        for (i = 0; ciphers[i].id; i++) 
     464                if (ctx->cipher->nid == ciphers[i].nid && 
     465                    ctx->cipher->iv_len <= ciphers[i].ivmax && 
     466                    ctx->key_len == ciphers[i].keylen) { 
     467                        cipher = ciphers[i].id; 
     468                        break; 
     469                } 
     470 
     471        if (!ciphers[i].id) { 
     472                state->d_fd = -1; 
     473                return (0); 
     474        } 
    440475 
    441476        memset(sess, 0, sizeof(struct session_op)); 
     
    496531 * gets called when libcrypto requests a cipher NID. 
    497532 */ 
     533 
     534/* RC4 */ 
     535const EVP_CIPHER cryptodev_rc4 = { 
     536        NID_rc4, 
     537        1, 16, 0, 
     538        EVP_CIPH_VARIABLE_LENGTH, 
     539        cryptodev_init_key, 
     540        cryptodev_cipher, 
     541        cryptodev_cleanup, 
     542        sizeof(struct dev_crypto_state), 
     543        NULL, 
     544        NULL, 
     545        NULL 
     546}; 
    498547 
    499548/* DES CBC EVP */ 
     
    564613}; 
    565614 
     615const EVP_CIPHER cryptodev_aes_192_cbc = { 
     616        NID_aes_192_cbc, 
     617        16, 24, 16, 
     618        EVP_CIPH_CBC_MODE, 
     619        cryptodev_init_key, 
     620        cryptodev_cipher, 
     621        cryptodev_cleanup, 
     622        sizeof(struct dev_crypto_state), 
     623        EVP_CIPHER_set_asn1_iv, 
     624        EVP_CIPHER_get_asn1_iv, 
     625        NULL 
     626}; 
     627 
     628const EVP_CIPHER cryptodev_aes_256_cbc = { 
     629        NID_aes_256_cbc, 
     630        16, 32, 16, 
     631        EVP_CIPH_CBC_MODE, 
     632        cryptodev_init_key, 
     633        cryptodev_cipher, 
     634        cryptodev_cleanup, 
     635        sizeof(struct dev_crypto_state), 
     636        EVP_CIPHER_set_asn1_iv, 
     637        EVP_CIPHER_get_asn1_iv, 
     638        NULL 
     639}; 
     640 
    566641/* 
    567642 * Registered by the ENGINE when used to find out how to deal with 
     
    577652 
    578653        switch (nid) { 
     654        case NID_rc4: 
     655                *cipher = &cryptodev_rc4; 
     656                break; 
    579657        case NID_des_ede3_cbc: 
    580658                *cipher = &cryptodev_3des_cbc; 
     
    592670                *cipher = &cryptodev_aes_cbc; 
    593671                break; 
     672        case NID_aes_192_cbc: 
     673                *cipher = &cryptodev_aes_192_cbc; 
     674                break; 
     675        case NID_aes_256_cbc: 
     676                *cipher = &cryptodev_aes_256_cbc; 
     677                break; 
    594678        default: 
    595679                *cipher = NULL; 
     
    599683} 
    600684 
     685 
     686#ifdef USE_CRYPTODEV_DIGESTS 
     687 
     688/* convert digest type to cryptodev */ 
     689static int 
     690digest_nid_to_cryptodev(int nid) 
     691{ 
     692        int i; 
     693 
     694        for (i = 0; digests[i].id; i++) 
     695                if (digests[i].nid == nid) 
     696                        return (digests[i].id); 
     697        return (0); 
     698} 
     699 
     700 
     701static int 
     702digest_key_length(int nid) 
     703{ 
     704        int i; 
     705 
     706        for (i = 0; digests[i].id; i++) 
     707                if (digests[i].nid == nid) 
     708                        return digests[i].keylen; 
     709        return (0); 
     710} 
     711 
     712 
     713static int cryptodev_digest_init(EVP_MD_CTX *ctx) 
     714{ 
     715        struct dev_crypto_state *state = ctx->md_data; 
     716        struct session_op *sess = &state->d_sess; 
     717        int digest; 
     718 
     719        if ((digest = digest_nid_to_cryptodev(ctx->digest->type)) == NID_undef){ 
     720                printf("cryptodev_digest_init: Can't get digest \n"); 
     721                return (0); 
     722        } 
     723 
     724        memset(state, 0, sizeof(struct dev_crypto_state)); 
     725 
     726        if ((state->d_fd = get_dev_crypto()) < 0) { 
     727                printf("cryptodev_digest_init: Can't get Dev \n"); 
     728                return (0); 
     729        } 
     730 
     731        sess->mackey = state->dummy_mac_key; 
     732        sess->mackeylen = digest_key_length(ctx->digest->type); 
     733        sess->mac = digest; 
     734 
     735        if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) { 
     736                close(state->d_fd); 
     737                state->d_fd = -1; 
     738                printf("cryptodev_digest_init: Open session failed\n"); 
     739                return (0); 
     740        } 
     741 
     742        return (1); 
     743} 
     744 
     745static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data, 
     746                size_t count) 
     747{ 
     748        struct crypt_op cryp; 
     749        struct dev_crypto_state *state = ctx->md_data; 
     750        struct session_op *sess = &state->d_sess; 
     751 
     752        if (!data || state->d_fd < 0) { 
     753                printf("cryptodev_digest_update: illegal inputs \n"); 
     754                return (0); 
     755        } 
     756 
     757        if (!count) { 
     758                return (0); 
     759        } 
     760 
     761        if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) { 
     762                /* if application doesn't support one buffer */ 
     763                state->mac_data = OPENSSL_realloc(state->mac_data, state->mac_len + count); 
     764 
     765                if (!state->mac_data) { 
     766                        printf("cryptodev_digest_update: realloc failed\n"); 
     767                        return (0); 
     768                } 
     769 
     770                memcpy(state->mac_data + state->mac_len, data, count); 
     771                state->mac_len += count; 
     772         
     773                return (1); 
     774        } 
     775 
     776        memset(&cryp, 0, sizeof(cryp)); 
     777 
     778        cryp.ses = sess->ses; 
     779        cryp.flags = 0; 
     780        cryp.len = count; 
     781        cryp.src = (caddr_t) data; 
     782        cryp.dst = NULL; 
     783        cryp.mac = state->digest_res; 
     784        if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { 
     785                printf("cryptodev_digest_update: digest failed\n"); 
     786                return (0); 
     787        } 
     788        return (1); 
     789} 
     790 
     791 
     792static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md) 
     793{ 
     794        struct crypt_op cryp; 
     795        struct dev_crypto_state *state = ctx->md_data; 
     796        struct session_op *sess = &state->d_sess; 
     797 
     798        int ret = 1; 
     799 
     800        if (!md || state->d_fd < 0) { 
     801                printf("cryptodev_digest_final: illegal input\n"); 
     802                return(0); 
     803        } 
     804 
     805        if (! (ctx->flags & EVP_MD_CTX_FLAG_ONESHOT) ) { 
     806                /* if application doesn't support one buffer */ 
     807                memset(&cryp, 0, sizeof(cryp)); 
     808 
     809                cryp.ses = sess->ses; 
     810                cryp.flags = 0; 
     811                cryp.len = state->mac_len; 
     812                cryp.src = state->mac_data; 
     813                cryp.dst = NULL; 
     814                cryp.mac = md; 
     815 
     816                if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { 
     817                        printf("cryptodev_digest_final: digest failed\n"); 
     818                        return (0); 
     819                } 
     820 
     821                return 1; 
     822        } 
     823 
     824        memcpy(md, state->digest_res, ctx->digest->md_size); 
     825 
     826        return (ret); 
     827} 
     828 
     829 
     830static int cryptodev_digest_cleanup(EVP_MD_CTX *ctx) 
     831{ 
     832        int ret = 1; 
     833        struct dev_crypto_state *state = ctx->md_data; 
     834        struct session_op *sess = &state->d_sess; 
     835 
     836        if (state->d_fd < 0) { 
     837                printf("cryptodev_digest_cleanup: illegal input\n"); 
     838                return (0); 
     839        } 
     840 
     841        if (state->mac_data) { 
     842                OPENSSL_free(state->mac_data); 
     843                state->mac_data = NULL; 
     844                state->mac_len = 0; 
     845        } 
     846 
     847        if (state->copy) 
     848                return 1; 
     849 
     850        if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) { 
     851                printf("cryptodev_digest_cleanup: failed to close session\n"); 
     852                ret = 0; 
     853        } else { 
     854                ret = 1; 
     855        } 
     856        close(state->d_fd);      
     857        state->d_fd = -1; 
     858 
     859        return (ret); 
     860} 
     861 
     862static int cryptodev_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from) 
     863{ 
     864        struct dev_crypto_state *fstate = from->md_data; 
     865        struct dev_crypto_state *dstate = to->md_data; 
     866 
     867        memcpy(dstate, fstate, sizeof(struct dev_crypto_state)); 
     868 
     869        if (fstate->mac_len != 0) { 
     870                dstate->mac_data = OPENSSL_malloc(fstate->mac_len); 
     871                memcpy(dstate->mac_data, fstate->mac_data, fstate->mac_len); 
     872        } 
     873 
     874        dstate->copy = 1; 
     875 
     876        return 1; 
     877} 
     878 
     879 
     880const EVP_MD cryptodev_sha1 = { 
     881        NID_sha1, 
     882        NID_undef,  
     883        SHA_DIGEST_LENGTH,  
     884        EVP_MD_FLAG_ONESHOT, 
     885        cryptodev_digest_init, 
     886        cryptodev_digest_update, 
     887        cryptodev_digest_final, 
     888        cryptodev_digest_copy, 
     889        cryptodev_digest_cleanup, 
     890        EVP_PKEY_NULL_method, 
     891        SHA_CBLOCK, 
     892        sizeof(struct dev_crypto_state), 
     893}; 
     894 
     895const EVP_MD cryptodev_md5 = { 
     896        NID_md5, 
     897        NID_undef,  
     898        16 /* MD5_DIGEST_LENGTH */,  
     899        EVP_MD_FLAG_ONESHOT, 
     900        cryptodev_digest_init, 
     901        cryptodev_digest_update, 
     902        cryptodev_digest_final, 
     903        cryptodev_digest_copy, 
     904        cryptodev_digest_cleanup, 
     905        EVP_PKEY_NULL_method, 
     906        64 /* MD5_CBLOCK */, 
     907        sizeof(struct dev_crypto_state), 
     908}; 
     909 
     910#endif /* USE_CRYPTODEV_DIGESTS */ 
     911 
     912 
    601913static int 
    602914cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, 
     
    607919 
    608920        switch (nid) { 
     921#ifdef USE_CRYPTODEV_DIGESTS 
    609922        case NID_md5: 
    610                 *digest = NULL; /* need to make a clean md5 critter */ 
     923                *digest = &cryptodev_md5;  
    611924                break; 
     925        case NID_sha1: 
     926                *digest = &cryptodev_sha1; 
     927                break; 
    612928        default: 
     929#endif /* USE_CRYPTODEV_DIGESTS */ 
    613930                *digest = NULL; 
    614931                break; 
     
    626943{ 
    627944        int i, j, k; 
    628         ssize_t words, bytes, bits; 
     945        ssize_t bytes, bits; 
    629946        u_char *b; 
    630947 
     
    638955        if (b == NULL) 
    639956                return (1); 
     957        memset(b, 0, bytes); 
    640958 
    641959        crp->crp_p = b; 
     
    6821000        int i; 
    6831001 
    684         for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) { 
     1002        for (i = 0; i < kop->crk_iparams + kop->crk_oparams; i++) { 
    6851003                if (kop->crk_param[i].crp_p) 
    6861004                        free(kop->crk_param[i].crp_p); 
     
    7571075 
    7581076static int 
    759 cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) 
     1077cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) 
    7601078{ 
    7611079        int r; 
    762         BN_CTX *ctx; 
    763  
    764         ctx = BN_CTX_new(); 
     1080        ctx = BN_CTX_new(); /* not sure why we reallocate this. DM */ 
    7651081        r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL); 
    7661082        BN_CTX_free(ctx); 
  • src/router/openssl/crypto/engine/engine.h

    r12237 r12238  
    704704void *ENGINE_get_static_state(void); 
    705705 
    706 #if defined(__OpenBSD__) || defined(__FreeBSD__) 
     706#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) 
    707707void ENGINE_setup_bsd_cryptodev(void); 
    708708#endif 
  • src/router/openssl/crypto/evp/c_all.c

    r12237 r12238  
    8484        OpenSSL_add_all_digests(); 
    8585#ifndef OPENSSL_NO_ENGINE 
    86 # if defined(__OpenBSD__) || defined(__FreeBSD__) 
     86# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) 
    8787        ENGINE_setup_bsd_cryptodev(); 
    8888# endif 
  • src/router/openssl/crypto/evp/c_alld.c

    r12237 r12238  
    8282#endif 
    8383#endif 
    84 #ifndef OPENSSL_NO_SHA 
     84#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) 
    8585        EVP_add_digest(EVP_sha1()); 
    8686        EVP_add_digest_alias(SN_sha1,"ssl3-sha1"); 
  • src/router/openssl/crypto/opensslconf.h

    r12237 r12238  
    66 
    77 
     8#ifndef OPENSSL_NO_AES192 
     9# define OPENSSL_NO_AES192 
     10#endif 
     11#ifndef OPENSSL_NO_ANS1 
     12# define OPENSSL_NO_ANS1 
     13#endif 
    814#ifndef OPENSSL_NO_CAMELLIA 
    915# define OPENSSL_NO_CAMELLIA 
     
    1521# define OPENSSL_NO_CMS 
    1622#endif 
     23#ifndef OPENSSL_NO_EC 
     24# define OPENSSL_NO_EC 
     25#endif 
     26#ifndef OPENSSL_NO_ECDH 
     27# define OPENSSL_NO_ECDH 
     28#endif 
     29#ifndef OPENSSL_NO_ECDSA 
     30# define OPENSSL_NO_ECDSA 
     31#endif 
     32#ifndef OPENSSL_NO_ENGINES 
     33# define OPENSSL_NO_ENGINES 
     34#endif 
    1735#ifndef OPENSSL_NO_GMP 
    1836# define OPENSSL_NO_GMP 
    1937#endif 
     38#ifndef OPENSSL_NO_IDEA 
     39# define OPENSSL_NO_IDEA 
     40#endif 
    2041#ifndef OPENSSL_NO_JPAKE 
    2142# define OPENSSL_NO_JPAKE 
     
    2445# define OPENSSL_NO_KRB5 
    2546#endif 
     47#ifndef OPENSSL_NO_MD2 
     48# define OPENSSL_NO_MD2 
     49#endif 
    2650#ifndef OPENSSL_NO_MDC2 
    2751# define OPENSSL_NO_MDC2 
    2852#endif 
     53#ifndef OPENSSL_NO_PERLASM 
     54# define OPENSSL_NO_PERLASM 
     55#endif 
    2956#ifndef OPENSSL_NO_RC5 
    3057# define OPENSSL_NO_RC5 
     
    3360# define OPENSSL_NO_RFC3779 
    3461#endif 
     62#ifndef OPENSSL_NO_RIPEMD 
     63# define OPENSSL_NO_RIPEMD 
     64#endif 
     65#ifndef OPENSSL_NO_RMD160 
     66# define OPENSSL_NO_RMD160 
     67#endif 
    3568#ifndef OPENSSL_NO_SEED 
    3669# define OPENSSL_NO_SEED 
    3770#endif 
     71#ifndef OPENSSL_NO_SHA0 
     72# define OPENSSL_NO_SHA0 
     73#endif 
     74#ifndef OPENSSL_NO_SMIME 
     75# define OPENSSL_NO_SMIME 
     76#endif 
    3877 
    3978#endif /* OPENSSL_DOING_MAKEDEPEND */ 
    4079 
     80#ifndef OPENSSL_NO_ERR 
     81# define OPENSSL_NO_ERR 
     82#endif 
     83#ifndef OPENSSL_NO_HW 
     84# define OPENSSL_NO_HW 
     85#endif 
    4186#ifndef OPENSSL_NO_DYNAMIC_ENGINE 
    4287# define OPENSSL_NO_DYNAMIC_ENGINE 
     
    4893   applications.  */ 
    4994#ifdef OPENSSL_ALGORITHM_DEFINES 
     95# if defined(OPENSSL_NO_AES192) && !defined(NO_AES192) 
     96#  define NO_AES192 
     97# endif 
     98# if defined(OPENSSL_NO_ANS1) && !defined(NO_ANS1) 
     99#  define NO_ANS1 
     100# endif 
    50101# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA) 
    51102#  define NO_CAMELLIA 
     
    57108#  define NO_CMS 
    58109# endif 
     110# if defined(OPENSSL_NO_EC) && !defined(NO_EC) 
     111#  define NO_EC 
     112# endif 
     113# if defined(OPENSSL_NO_ECDH) && !defined(NO_ECDH) 
     114#  define NO_ECDH 
     115# endif 
     116# if defined(OPENSSL_NO_ECDSA) && !defined(NO_ECDSA) 
     117#  define NO_ECDSA 
     118# endif 
     119# if defined(OPENSSL_NO_ENGINES) && !defined(NO_ENGINES) 
     120#  define NO_ENGINES 
     121# endif 
    59122# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) 
    60123#  define NO_GMP 
    61124# endif 
     125# if defined(OPENSSL_NO_IDEA) && !defined(NO_IDEA) 
     126#  define NO_IDEA 
     127# endif 
    62128# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) 
    63129#  define NO_JPAKE 
     
    66132#  define NO_KRB5 
    67133# endif 
     134# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2) 
     135#  define NO_MD2 
     136# endif 
    68137# if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2) 
    69138#  define NO_MDC2 
    70139# endif 
     140# if defined(OPENSSL_NO_PERLASM) && !defined(NO_PERLASM) 
     141#  define NO_PERLASM 
     142# endif 
    71143# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) 
    72144#  define NO_RC5 
     
    75147#  define NO_RFC3779 
    76148# endif 
     149# if defined(OPENSSL_NO_RIPEMD) && !defined(NO_RIPEMD) 
     150#  define NO_RIPEMD 
     151# endif 
     152# if defined(OPENSSL_NO_RMD160) && !defined(NO_RMD160) 
     153#  define NO_RMD160 
     154# endif 
    77155# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED) 
    78156#  define NO_SEED 
     157# endif 
     158# if defined(OPENSSL_NO_SHA0) && !defined(NO_SHA0) 
     159#  define NO_SHA0 
     160# endif 
     161# if defined(OPENSSL_NO_SMIME) && !defined(NO_SMIME) 
     162#  define NO_SMIME 
    79163# endif 
    80164#endif 
     
    102186#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ 
    103187#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) 
    104 #define ENGINESDIR "/usr/local/ssl/lib/engines" 
    105 #define OPENSSLDIR "/usr/local/ssl" 
     188#define ENGINESDIR "/usr/lib/engines" 
     189#define OPENSSLDIR "/etc/ssl" 
    106190#endif 
    107191#endif 
     
    134218 * - elder Alpha because it lacks byte load/store instructions; 
    135219 */ 
    136 #define RC4_INT unsigned int 
     220#define RC4_INT unsigned char 
    137221#endif 
    138222#if !defined(RC4_CHUNK) 
     
    141225 * boundary. See crypto/rc4/rc4_enc.c for further details. 
    142226 */ 
    143 #undef RC4_CHUNK 
     227#define RC4_CHUNK unsigned long 
    144228#endif 
    145229#endif 
     
    149233 * %20 speed up (longs are 8 bytes, int's are 4). */ 
    150234#ifndef DES_LONG 
    151 #define DES_LONG unsigned long 
     235#define DES_LONG unsigned int 
    152236#endif 
    153237#endif 
     
    155239#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) 
    156240#define CONFIG_HEADER_BN_H 
    157 #undef BN_LLONG 
     241#define BN_LLONG 
    158242 
    159243/* Should we define BN_DIV2W here? */ 
     
    179263#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) 
    180264#define CONFIG_HEADER_BF_LOCL_H 
    181 #undef BF_PTR 
     265#define BF_PTR 
    182266#endif /* HEADER_BF_LOCL_H */ 
    183267 
     
    209293 * Very mucy CPU dependant */ 
    210294#ifndef DES_UNROLL 
    211 #undef DES_UNROLL 
     295#define DES_UNROLL 
    212296#endif 
    213297 
  • src/router/openssl/engines/Makefile

    r12237 r12238  
    9797                          if [ "$(PLATFORM)" != "Cygwin" ]; then \ 
    9898                                case "$(CFLAGS)" in \ 
     99                                *OPENSSL_NO_HW*)        continue;;      \ 
    99100                                *DSO_DLFCN*)    sfx="so";;      \ 
    100101                                *DSO_DL*)       sfx="sl";;      \ 
  • src/router/openssl/ssl/d1_clnt.c

    r12237 r12238  
    131131static SSL_METHOD *dtls1_get_client_method(int ver) 
    132132        { 
    133         if (ver == DTLS1_VERSION) 
     133        if (ver == DTLS1_VERSION || ver == DTLS1_BAD_VER) 
    134134                return(DTLSv1_client_method()); 
    135135        else 
     
    182182                        if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1); 
    183183 
    184                         if ((s->version & 0xff00 ) != (DTLS1_VERSION & 0xff00)) 
     184                        if ((s->version & 0xff00 ) != (DTLS1_VERSION & 0xff00) && 
     185                            (s->version & 0xff00 ) != (DTLS1_BAD_VER & 0xff00)) 
    185186                                { 
    186187                                SSLerr(SSL_F_DTLS1_CONNECT, ERR_R_INTERNAL_ERROR); 
  • src/router/openssl/ssl/d1_lib.c

    r12237 r12238  
    188188        { 
    189189        ssl3_clear(s); 
    190         s->version=DTLS1_VERSION; 
     190        if (s->options & SSL_OP_CISCO_ANYCONNECT) 
     191                s->version=DTLS1_BAD_VER; 
     192        else 
     193                s->version=DTLS1_VERSION; 
    191194        } 
    192195 
  • src/router/openssl/ssl/d1_pkt.c

    r12237 r12238  
    988988                { 
    989989                struct ccs_header_st ccs_hdr; 
     990                int ccs_hdr_len = DTLS1_CCS_HEADER_LENGTH; 
    990991 
    991992                dtls1_get_ccs_header(rr->data, &ccs_hdr); 
     
    994995                 * exactly what the record payload has to look like */ 
    995996                /* XDTLS: check that epoch is consistent */ 
    996                 if (    (s->client_version == DTLS1_BAD_VER && rr->length != 3) || 
    997                         (s->client_version != DTLS1_BAD_VER && rr->length != DTLS1_CCS_HEADER_LENGTH) ||  
    998                         (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) 
     997                if (s->client_version == DTLS1_BAD_VER || s->version == DTLS1_BAD_VER) 
     998                        ccs_hdr_len = 3; 
     999 
     1000                if ((rr->length != ccs_hdr_len) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) 
    9991001                        { 
    10001002                        i=SSL_AD_ILLEGAL_PARAMETER; 
     
    13121314        /* 'create_empty_fragment' is true only when this function calls itself */ 
    13131315        if (!clear && !create_empty_fragment && !s->s3->empty_fragment_done 
    1314                 && SSL_version(s) != DTLS1_VERSION) 
     1316            && SSL_version(s) != DTLS1_VERSION && SSL_version(s) != DTLS1_BAD_VER) 
    13151317                { 
    13161318                /* countermeasure against known-IV weakness in CBC ciphersuites 
  • src/router/openssl/ssl/s3_clnt.c

    r12237 r12238  
    709709        if (!ok) return((int)n); 
    710710 
    711         if ( SSL_version(s) == DTLS1_VERSION) 
     711        if ( SSL_version(s) == DTLS1_VERSION || SSL_version(s) == DTLS1_BAD_VER) 
    712712                { 
    713713                if ( s->s3->tmp.message_type == DTLS1_MT_HELLO_VERIFY_REQUEST) 
  • src/router/openssl/ssl/ssl.h

    r12237 r12238  
    511511/* Don't use RFC4507 ticket extension */ 
    512512#define SSL_OP_NO_TICKET                    0x00004000L 
     513/* Use Cisco's "speshul" version of DTLS_BAD_VER (as client)  */ 
     514#define SSL_OP_CISCO_ANYCONNECT             0x00008000L 
    513515 
    514516/* As server, disallow session resumption on renegotiation */ 
  • src/router/openssl/ssl/ssl_lib.c

    r12237 r12238  
    996996                return(l); 
    997997        case SSL_CTRL_SET_MTU: 
    998                 if (SSL_version(s) == DTLS1_VERSION) 
     998                if (SSL_version(s) == DTLS1_VERSION || 
     999                    SSL_version(s) == DTLS1_BAD_VER) 
    9991000                        { 
    10001001                        s->d1->mtu = larg; 
  • src/router/openssl/ssl/ssl_sess.c

    r12237 r12238  
    212212                        ss->session_id_length=SSL3_SSL_SESSION_ID_LENGTH; 
    213213                        } 
     214                else if (s->version == DTLS1_BAD_VER) 
     215                        { 
     216                        ss->ssl_version=DTLS1_BAD_VER; 
     217                        ss->session_id_length=SSL3_SSL_SESSION_ID_LENGTH; 
     218                        } 
    214219                else if (s->version == DTLS1_VERSION) 
    215220                        { 
  • src/router/openssl/ssl/t1_enc.c

    r12237 r12238  
    766766        HMAC_Init_ex(&hmac,mac_sec,EVP_MD_size(hash),hash,NULL); 
    767767 
    768         if (ssl->version == DTLS1_VERSION && ssl->client_version != DTLS1_BAD_VER) 
     768        if (ssl->version == DTLS1_BAD_VER || 
     769            (ssl->version == DTLS1_VERSION && ssl->client_version != DTLS1_BAD_VER)) 
    769770                { 
    770771                unsigned char dtlsseq[8],*p=dtlsseq; 
    771  
    772772                s2n(send?ssl->d1->w_epoch:ssl->d1->r_epoch, p); 
    773773                memcpy (p,&seq[2],6); 
     
    794794#endif 
    795795 
    796         if ( SSL_version(ssl) != DTLS1_VERSION) 
     796        if ( SSL_version(ssl) != DTLS1_VERSION && SSL_version(ssl) != DTLS1_BAD_VER) 
    797797                { 
    798798                for (i=7; i>=0; i--) 
  • src/router/openssl/tools/c_rehash

    r12237 r12238  
    77my $openssl; 
    88 
    9 my $dir = "/usr/local/ssl"; 
     9my $dir = "/etc/ssl"; 
    1010 
    1111if(defined $ENV{OPENSSL}) { 
  • src/router/openssl/tools/c_rehash.in

    r12237 r12238  
    1 #!/usr/local/bin/perl 
     1#!/usr/bin/perl 
    22 
    33 
  • src/router/openssl/util/clean-depend.pl

    r12237 r12238  
    1 #!/usr/local/bin/perl -w 
     1#!/usr/bin/perl -w 
    22# Clean the dependency list in a makefile of standard includes... 
    33# Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 
  • src/router/openssl/util/domd

    r12237 r12238  
    1 #!/bin/sh 
     1#!/usr/bin/env bash 
    22# Do a makedepend, only leave out the standard headers 
    33# Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 
     
    1515# fake the presence of Kerberos 
    1616touch $TOP/krb5.h 
    17 if [ "$MAKEDEPEND" = "gcc" ]; then 
     17D=${MAKEDEPEND/%*gcc/gcc} 
     18if [ "$D" = "gcc" ]; then 
    1819    args="" 
    1920    while [ $# -gt 0 ]; do 
     
    2324    sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp 
    2425    echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp 
    25     ${CC:-gcc} -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp 
     26    ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp && \ 
    2627    ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new 
     28      RC=$? 
    2729    rm -f Makefile.tmp 
    2830else 
    29     ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ 
     31    ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ && \ 
    3032    ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new 
     33      RC=$? 
    3134fi 
    3235mv Makefile.new Makefile 
    3336# unfake the presence of Kerberos 
    3437rm $TOP/krb5.h 
     38 
     39exit $RC 
  • src/router/openssl/util/libeay.num

    r12237 r12238  
    20722072KRB5_CHECKSUM_free                      2634    EXIST::FUNCTION: 
    20732073OCSP_REQUEST_get_ext                    2635    EXIST::FUNCTION: 
    2074 ENGINE_load_ubsec                       2636    EXIST::FUNCTION:ENGINE,STATIC_ENGINE 
    20752074ENGINE_register_all_digests             2637    EXIST::FUNCTION:ENGINE 
    20762075PKEY_USAGE_PERIOD_it                    2638    EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: 
     
    25462545OCSP_resp_count                         3025    EXIST::FUNCTION: 
    25472546KRB5_CHECKSUM_new                       3026    EXIST::FUNCTION: 
    2548 ENGINE_load_cswift                      3027    EXIST::FUNCTION:ENGINE,STATIC_ENGINE 
    25492547OCSP_onereq_get0_id                     3028    EXIST::FUNCTION: 
    25502548ENGINE_set_default_ciphers              3029    EXIST::FUNCTION:ENGINE 
     
    25772575i2d_OCSP_SIGNATURE                      3053    EXIST::FUNCTION: 
    25782576asn1_enc_save                           3054    EXIST::FUNCTION: 
    2579 ENGINE_load_nuron                       3055    EXIST::FUNCTION:ENGINE,STATIC_ENGINE 
    25802577_ossl_old_des_pcbc_encrypt              3056    EXIST::FUNCTION:DES 
    25812578PKCS12_MAC_DATA_it                      3057    EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: 
     
    26012598ENGINE_set_table_flags                  3073    EXIST::FUNCTION:ENGINE 
    26022599AES_options                             3074    EXIST::FUNCTION:AES 
    2603 ENGINE_load_chil                        3075    EXIST::FUNCTION:ENGINE,STATIC_ENGINE 
    26042600OCSP_id_cmp                             3076    EXIST::FUNCTION: 
    26052601OCSP_BASICRESP_new                      3077    EXIST::FUNCTION: 
     
    26682664i2d_KRB5_AUTHENTBODY                    3128    EXIST::FUNCTION: 
    26692665OCSP_REQUEST_get_ext_count              3129    EXIST::FUNCTION: 
    2670 ENGINE_load_atalla                      3130    EXIST::FUNCTION:ENGINE,STATIC_ENGINE 
    26712666X509_NAME_it                            3131    EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: 
    26722667X509_NAME_it                            3131    EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: 
     
    27632758UI_UTIL_read_pw                         3208    EXIST::FUNCTION: 
    27642759UI_UTIL_read_pw_string                  3209    EXIST::FUNCTION: 
    2765 ENGINE_load_aep                         3210    EXIST::FUNCTION:ENGINE,STATIC_ENGINE 
    2766 ENGINE_load_sureware                    3211    EXIST::FUNCTION:ENGINE,STATIC_ENGINE 
    27672760OPENSSL_add_all_algorithms_noconf       3212    EXIST:!VMS:FUNCTION: 
    27682761OPENSSL_add_all_algo_noconf             3212    EXIST:VMS:FUNCTION: 
     
    27732766AES_ctr128_encrypt                      3216    EXIST::FUNCTION:AES 
    27742767AES_cfb128_encrypt                      3217    EXIST::FUNCTION:AES 
    2775 ENGINE_load_4758cca                     3218    EXIST::FUNCTION:ENGINE,STATIC_ENGINE 
    27762768_ossl_096_des_random_seed               3219    EXIST::FUNCTION:DES 
    27772769EVP_aes_256_ofb                         3220    EXIST::FUNCTION:AES 
     
    31083100STORE_meth_set_modify_fn                3530    EXIST:VMS:FUNCTION: 
    31093101STORE_parse_attrs_next                  3531    EXIST::FUNCTION: 
    3110 ENGINE_load_padlock                     3532    EXIST::FUNCTION:ENGINE 
    31113102EC_GROUP_set_curve_name                 3533    EXIST::FUNCTION:EC 
    31123103X509_CERT_PAIR_it                       3534    EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: 
  • src/router/openssl/util/mkdef.pl

    r12237 r12238  
    1 #!/usr/local/bin/perl -w 
     1#!/usr/bin/perl 
    22# 
    33# generate a .def file 
  • src/router/openssl/util/mkerr.pl

    r12237 r12238  
    1 #!/usr/local/bin/perl -w 
     1#!/usr/bin/perl 
    22 
    33my $config = "crypto/err/openssl.ec"; 
  • src/router/openssl/util/mkstack.pl

    r12237 r12238  
    1 #!/usr/local/bin/perl -w 
     1#!/usr/bin/perl 
    22 
    33# This is a utility that searches out "DECLARE_STACK_OF()" 
  • src/router/openssl/util/pod2man.pl

    r12237 r12238  
    1 : #!/usr/bin/perl-5.005 
     1#!/usr/bin/perl 
    22    eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' 
    33        if $running_under_some_shell; 
  • src/router/openssl/util/selftest.pl

    r12237 r12238  
    1 #!/usr/local/bin/perl -w 
     1#!/usr/bin/perl 
    22# 
    33# Run the test suite and generate a report 
Note: See TracChangeset for help on using the changeset viewer.