Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jun 2012 00:39:51 +0000
From:      exxo@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r238311 - in soc2012/exxo/openssl-1.0.1c: . apps crypto/bio crypto/err
Message-ID:  <20120626003952.224DA106568E@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: exxo
Date: Tue Jun 26 00:39:50 2012
New Revision: 238311
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238311

Log:
  BIO API fully migrated except the connection state machine. s_client and s_server fixed.

Modified:
  soc2012/exxo/openssl-1.0.1c/Configure
  soc2012/exxo/openssl-1.0.1c/Makefile
  soc2012/exxo/openssl-1.0.1c/Makefile.bak
  soc2012/exxo/openssl-1.0.1c/apps/s_apps.h
  soc2012/exxo/openssl-1.0.1c/apps/s_client.c
  soc2012/exxo/openssl-1.0.1c/apps/s_server.c
  soc2012/exxo/openssl-1.0.1c/apps/s_socket.c
  soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c
  soc2012/exxo/openssl-1.0.1c/crypto/bio/bio.h
  soc2012/exxo/openssl-1.0.1c/crypto/bio/bio_err.c
  soc2012/exxo/openssl-1.0.1c/crypto/bio/bss_dgram.c
  soc2012/exxo/openssl-1.0.1c/crypto/err/err.c
  soc2012/exxo/openssl-1.0.1c/crypto/err/err.h

Modified: soc2012/exxo/openssl-1.0.1c/Configure
==============================================================================
--- soc2012/exxo/openssl-1.0.1c/Configure	Mon Jun 25 23:40:58 2012	(r238310)
+++ soc2012/exxo/openssl-1.0.1c/Configure	Tue Jun 26 00:39:50 2012	(r238311)
@@ -168,8 +168,8 @@
 "purify",	"purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
 "debug",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::",
 "debug-ben",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::",
-"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
-"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
+"debug-ben-openbsd","gcc:-DHAVE_SIN_LEN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
+"debug-ben-openbsd-debug","gcc:-DHAVE_SIN_LEN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
 "debug-ben-debug",	"gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::",
 "debug-ben-macos",	"cc:$gcc_devteam_warn -arch i386 -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::-Wl,-search_paths_first::::",
 "debug-ben-macos-gcc46",	"gcc-mp-4.6:$gcc_devteam_warn -Wconversion -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::::::",
@@ -407,21 +407,21 @@
 "android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 
 #### *BSD [do see comment about ${BSDthreads} above!]
-"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"BSD-x86",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"BSD-x86-elf",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"debug-BSD-x86-elf",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"BSD-sparcv8",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-generic32","gcc:-DHAVE_SIN_LEN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-x86",	"gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-x86-elf",	"gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-BSD-x86-elf",	"gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-sparcv8",	"gcc:-DHAVE_SIN_LEN -DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 
-"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-generic64","gcc:-DHAVE_SIN_LEN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
 # simply *happens* to work around a compiler bug in gcc 3.3.3,
 # triggered by RIPEMD160 code.
-"BSD-sparc64",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"BSD-ia64",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"BSD-x86_64",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-sparc64",	"gcc:-DHAVE_SIN_LEN -DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-ia64",	"gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"BSD-x86_64",	"gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 
-"bsdi-elf-gcc",     "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"bsdi-elf-gcc",     "gcc:-DHAVE_SIN_LEN -DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 
 "nextstep",	"cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
 "nextstep3.3",	"cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
@@ -574,13 +574,13 @@
 ##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
 
 ##### MacOS X (a.k.a. Rhapsody or Darwin) setup
-"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
-"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"rhapsody-ppc-cc","cc:-O3 -DHAVE_SIN_LEN -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
+"darwin-ppc-cc","cc:-arch ppc -O3 -DHAVE_SIN_LEN -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DHAVE_SIN_LEN -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DHAVE_SIN_LEN -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"debug-darwin-i386-cc","cc:-arch i386 -g3 -DHAVE_SIN_LEN -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DHAVE_SIN_LEN -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"debug-darwin-ppc-cc","cc:-DHAVE_SIN_LEN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 # iPhoneOS/iOS
 "iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 

Modified: soc2012/exxo/openssl-1.0.1c/Makefile
==============================================================================
--- soc2012/exxo/openssl-1.0.1c/Makefile	Mon Jun 25 23:40:58 2012	(r238310)
+++ soc2012/exxo/openssl-1.0.1c/Makefile	Tue Jun 26 00:39:50 2012	(r238311)
@@ -13,8 +13,8 @@
 SHLIB_MINOR=0.0
 SHLIB_EXT=.so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 PLATFORM=BSD-x86-elf
-OPTIONS=-g -Wa,--noexecstack 386 no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-sse2 no-store no-zlib no-zlib-dynamic static-engine
-CONFIGURE_ARGS=BSD-x86-elf -g -Wa,--noexecstack 386
+OPTIONS=-Wa,--noexecstack 386 no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-sse2 no-store no-zlib no-zlib-dynamic static-engine
+CONFIGURE_ARGS=BSD-x86-elf -Wa,--noexecstack 386
 SHLIB_TARGET=bsd-shared
 
 # HERE indicates where this Makefile lives.  This can be used to indicate
@@ -60,7 +60,7 @@
 # PKCS1_CHECK - pkcs1 tests.
 
 CC= gcc
-CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -g -Wa,--noexecstack -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DGHASH_ASM
+CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DGHASH_ASM
 DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE
 PEX_LIBS= 
 EX_LIBS= 

Modified: soc2012/exxo/openssl-1.0.1c/Makefile.bak
==============================================================================
--- soc2012/exxo/openssl-1.0.1c/Makefile.bak	Mon Jun 25 23:40:58 2012	(r238310)
+++ soc2012/exxo/openssl-1.0.1c/Makefile.bak	Tue Jun 26 00:39:50 2012	(r238311)
@@ -13,8 +13,8 @@
 SHLIB_MINOR=0.0
 SHLIB_EXT=.so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 PLATFORM=BSD-x86-elf
-OPTIONS=-g -Wa,--noexecstack 386 no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-sse2 no-store no-zlib no-zlib-dynamic static-engine
-CONFIGURE_ARGS=BSD-x86-elf -g -Wa,--noexecstack 386
+OPTIONS=-Wa,--noexecstack 386 no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-sse2 no-store no-zlib no-zlib-dynamic static-engine
+CONFIGURE_ARGS=BSD-x86-elf -Wa,--noexecstack 386
 SHLIB_TARGET=bsd-shared
 
 # HERE indicates where this Makefile lives.  This can be used to indicate
@@ -60,7 +60,7 @@
 # PKCS1_CHECK - pkcs1 tests.
 
 CC= gcc
-CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -g -Wa,--noexecstack -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DGHASH_ASM
+CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DGHASH_ASM
 DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE
 PEX_LIBS= 
 EX_LIBS= 

Modified: soc2012/exxo/openssl-1.0.1c/apps/s_apps.h
==============================================================================
--- soc2012/exxo/openssl-1.0.1c/apps/s_apps.h	Mon Jun 25 23:40:58 2012	(r238310)
+++ soc2012/exxo/openssl-1.0.1c/apps/s_apps.h	Tue Jun 26 00:39:50 2012	(r238311)
@@ -148,7 +148,7 @@
 #define PORT_STR        "4433"
 #define PROTOCOL        "tcp"
 
-int do_server(int port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context);
+int do_server(char *port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context, int family);
 #ifdef HEADER_X509_H
 int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
 #endif
@@ -156,10 +156,8 @@
 int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
 int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key);
 #endif
-int init_client(int *sock, char *server, int port, int type);
+int init_client(int *sock, char *server, char *port, int type, int family);
 int should_retry(int i);
-int extract_port(char *str, short *port_ptr);
-int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p);
 
 long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
 				   int argi, long argl, long ret);

Modified: soc2012/exxo/openssl-1.0.1c/apps/s_client.c
==============================================================================
--- soc2012/exxo/openssl-1.0.1c/apps/s_client.c	Mon Jun 25 23:40:58 2012	(r238310)
+++ soc2012/exxo/openssl-1.0.1c/apps/s_client.c	Tue Jun 26 00:39:50 2012	(r238311)
@@ -287,6 +287,10 @@
 	BIO_printf(bio_err,"\n");
 	BIO_printf(bio_err," -host host     - use -connect instead\n");
 	BIO_printf(bio_err," -port port     - use -connect instead\n");
+	BIO_printf(bio_err," -4            - use IPv4 only\n");
+#if OPENSSL_USE_IPV6
+	BIO_printf(bio_err," -6            - use IPv6 only\n");
+#endif
 	BIO_printf(bio_err," -connect host:port - who to connect to (default is %s:%s)\n",SSL_HOST_NAME,PORT_STR);
 
 	BIO_printf(bio_err," -verify arg   - turn on peer certificate verification\n");
@@ -563,7 +567,8 @@
 	int cbuf_len,cbuf_off;
 	int sbuf_len,sbuf_off;
 	fd_set readfds,writefds;
-	short port=PORT;
+	char *port=PORT_STR;
+	int family;
 	int full_log=1;
 	char *host=SSL_HOST_NAME;
 	char *cert_file=NULL,*key_file=NULL;
@@ -652,6 +657,12 @@
 	c_nbio=0;
 #endif
 
+#if OPENSSL_USE_IPV6
+	family = PF_INET6;
+#else
+	family = PF_INET;
+#endif
+
 	argc--;
 	argv++;
 	while (argc >= 1)
@@ -664,13 +675,19 @@
 		else if	(strcmp(*argv,"-port") == 0)
 			{
 			if (--argc < 1) goto bad;
-			port=atoi(*(++argv));
-			if (port == 0) goto bad;
+			port= *(++argv);
 			}
+		else if (strcmp(*argv,"-4") == 0)
+			family = PF_INET;
+#if OPENSSL_USE_IPV6
+		else if (strcmp(*argv,"-6") == 0)
+			family = PF_INET6;
+#endif
 		else if (strcmp(*argv,"-connect") == 0)
 			{
 			if (--argc < 1) goto bad;
-			if (!extract_host_port(*(++argv),&host,NULL,&port))
+			/* TODO 
+			if (!extract_host_port(*(++argv),&host,NULL,&port)) */
 				goto bad;
 			}
 		else if	(strcmp(*argv,"-verify") == 0)
@@ -1252,10 +1269,9 @@
 
 re_start:
 
-	if (init_client(&s,host,port,socket_type) == 0)
+	if (init_client(&s,host,port,socket_type,family) == 0)
 		{
-		BIO_printf(bio_err,"connect:errno=%d\n",get_last_socket_error());
-		SHUTDOWN(s);
+		ERR_print_errors(bio_err);
 		goto end;
 		}
 	BIO_printf(bio_c_out,"CONNECTED(%08X)\n",s);

Modified: soc2012/exxo/openssl-1.0.1c/apps/s_server.c
==============================================================================
--- soc2012/exxo/openssl-1.0.1c/apps/s_server.c	Mon Jun 25 23:40:58 2012	(r238310)
+++ soc2012/exxo/openssl-1.0.1c/apps/s_server.c	Tue Jun 26 00:39:50 2012	(r238311)
@@ -460,6 +460,10 @@
 	BIO_printf(bio_err,"usage: s_server [args ...]\n");
 	BIO_printf(bio_err,"\n");
 	BIO_printf(bio_err," -accept arg   - port to accept on (default is %d)\n",PORT);
+	BIO_printf(bio_err," -4            - use IPv4 only\n");
+#if OPENSSL_USE_IPV6
+	BIO_printf(bio_err," -6            - use IPv6 only\n");
+#endif
 	BIO_printf(bio_err," -context arg  - set session ID context\n");
 	BIO_printf(bio_err," -verify arg   - turn on peer certificate verification\n");
 	BIO_printf(bio_err," -Verify arg   - turn on peer certificate verification, must have a cert.\n");
@@ -929,7 +933,8 @@
 	{
 	X509_VERIFY_PARAM *vpm = NULL;
 	int badarg = 0;
-	short port=PORT;
+	char *port = PORT_STR;
+	int family;
 	char *CApath=NULL,*CAfile=NULL;
 	unsigned char *context = NULL;
 	char *dhfile = NULL;
@@ -991,6 +996,12 @@
 #endif
 	s_nbio_test=0;
 
+#if OPENSSL_USE_IPV6
+	family = PF_INET6;
+#else
+	family = PF_INET;
+#endif
+
 	argc--;
 	argv++;
 
@@ -1000,9 +1011,14 @@
 			 (strcmp(*argv,"-accept") == 0))
 			{
 			if (--argc < 1) goto bad;
-			if (!extract_port(*(++argv),&port))
-				goto bad;
+			port= *(++argv); 
 			}
+		else if (strcmp(*argv,"-4") == 0)
+			family = PF_INET;
+#if OPENSSL_USE_IPV6
+		else if (strcmp(*argv,"-6") == 0)
+			family = PF_INET6;
+#endif
 		else if	(strcmp(*argv,"-verify") == 0)
 			{
 			s_server_verify=SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE;
@@ -1874,9 +1890,11 @@
 	BIO_printf(bio_s_out,"ACCEPT\n");
 	(void)BIO_flush(bio_s_out);
 	if (www)
-		do_server(port,socket_type,&accept_socket,www_body, context);
+		ret = do_server(port,socket_type,&accept_socket,www_body, context, family);
 	else
-		do_server(port,socket_type,&accept_socket,sv_body, context);
+		ret = do_server(port,socket_type,&accept_socket,sv_body, context, family);
+	if (ret == 0)
+	    ERR_print_errors(bio_err);
 	print_stats(bio_s_out,ctx);
 	ret=0;
 end:

Modified: soc2012/exxo/openssl-1.0.1c/apps/s_socket.c
==============================================================================
--- soc2012/exxo/openssl-1.0.1c/apps/s_socket.c	Mon Jun 25 23:40:58 2012	(r238310)
+++ soc2012/exxo/openssl-1.0.1c/apps/s_socket.c	Tue Jun 26 00:39:50 2012	(r238311)
@@ -97,16 +97,15 @@
 #include "netdb.h"
 #endif
 
-static struct hostent *GetHostByName(char *name);
+#if 0
 #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK))
 static void ssl_sock_cleanup(void);
 #endif
 static int ssl_sock_init(void);
-static int init_client_ip(int *sock,unsigned char ip[4], int port, int type);
-static int init_server(int *sock, int port, int type);
-static int init_server_long(int *sock, int port,char *ip, int type);
 static int do_accept(int acc_sock, int *sock, char **host);
-static int host_ip(char *str, unsigned char ip[4]);
+#endif
+static int init_server(int *sock, char *port, int type, int family);
+static int init_server_long(int *sock, char *port,char *ip, int type, int family);
 
 #ifdef OPENSSL_SYS_WIN16
 #define SOCKET_PROTOCOL	0 /* more microsoft stupidity */
@@ -114,6 +113,8 @@
 #define SOCKET_PROTOCOL	IPPROTO_TCP
 #endif
 
+#if 0
+
 #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
 static int wsa_init_done=0;
 #endif
@@ -234,64 +235,68 @@
 	return(1);
 	}
 
-int init_client(int *sock, char *host, int port, int type)
-	{
-	unsigned char ip[4];
-
-	memset(ip, '\0', sizeof ip);
-	if (!host_ip(host,&(ip[0])))
-		return 0;
-	return init_client_ip(sock,ip,port,type);
-	}
+#endif
 
-static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
+int init_client(int *sock, char *host, char *port, int type, int family)
 	{
-	unsigned long addr;
-	struct sockaddr_in them;
-	int s,i;
-
-	if (!ssl_sock_init()) return(0);
-
-	memset((char *)&them,0,sizeof(them));
-	them.sin_family=AF_INET;
-	them.sin_port=htons((unsigned short)port);
-	addr=(unsigned long)
-		((unsigned long)ip[0]<<24L)|
-		((unsigned long)ip[1]<<16L)|
-		((unsigned long)ip[2]<< 8L)|
-		((unsigned long)ip[3]);
-	them.sin_addr.s_addr=htonl(addr);
-
-	if (type == SOCK_STREAM)
-		s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
-	else /* ( type == SOCK_DGRAM) */
-		s=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
-			
-	if (s == INVALID_SOCKET) { perror("socket"); return(0); }
+	char addr[128]; /* Should be enough */
+	union sa_storage them;
+	int themlen;
+	int s=INVALID_SOCKET;
+	int ret=0;
+	int i=0;
 
+	if (BIO_sock_init() != 1) return(0);
+	if (host == NULL)
+		host="*";
+#if OPENSSL_USE_IPV6
+	if (family == PF_INET6)
+		BIO_snprintf(addr, sizeof(addr), "[%s]:%s", host, port);
+	else
+#endif
+	BIO_snprintf(addr, sizeof(addr), "%s:%s", host, port);
+	s=socket(family,type,SOCKET_PROTOCOL);
+	if (s == INVALID_SOCKET) goto err;
+	if (BIO_get_host_addr(addr, &them, &themlen, 0) != 1) goto err;
 #if defined(SO_KEEPALIVE) && !defined(OPENSSL_SYS_MPE)
 	if (type == SOCK_STREAM)
-		{
-		i=0;
+	 	{
 		i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
-		if (i < 0) { perror("keepalive"); return(0); }
+		if (i < 0)
+			{
+			SYSerr(SYS_F_SETSOCKOPT,get_last_socket_error());
+			goto err;
+			}
 		}
 #endif
-
-	if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1)
-		{ closesocket(s); perror("connect"); return(0); }
+	if (connect(s,(struct sockaddr *)&them,themlen) == -1)
+		{
+		SYSerr(SYS_F_CONNECT,get_last_socket_error());
+		goto err;
+		}
 	*sock=s;
-	return(1);
+	ret=1;
+err:
+	if ((ret == 0) && (s != INVALID_SOCKET))
+		{
+		SHUTDOWN(s);
+		}
+	return (ret);
 	}
 
-int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context)
+int do_server(char *port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context, int family)
 	{
 	int sock;
 	char *name = NULL;
 	int accept_socket = 0;
 	int i;
 
-	if (!init_server(&accept_socket,port,type)) return(0);
+	if (!init_server(&accept_socket,port,type,family))
+		return(0);
+
+#ifdef SIGINT
+	signal(SIGINT,(void (*)(int))BIO_sock_cleanup);
+#endif
 
 	if (ret != NULL)
 		{
@@ -302,7 +307,8 @@
   		{
 		if (type==SOCK_STREAM)
 			{
-			if (do_accept(accept_socket,&sock,&name) == 0)
+			sock = BIO_accept(accept_socket, &name);
+			if (sock == INVALID_SOCKET)
 				{
 				SHUTDOWN(accept_socket);
 				return(0);
@@ -322,33 +328,33 @@
 		}
 	}
 
-static int init_server_long(int *sock, int port, char *ip, int type)
+static int init_server_long(int *sock, char *port, char *ip, int type, int family)
 	{
+	char addr[128]; /* Should be enough */
+	union sa_storage server;
+	int servlen;
+	int s=INVALID_SOCKET;
 	int ret=0;
-	struct sockaddr_in server;
-	int s= -1;
 
-	if (!ssl_sock_init()) return(0);
-
-	memset((char *)&server,0,sizeof(server));
-	server.sin_family=AF_INET;
-	server.sin_port=htons((unsigned short)port);
+	if (BIO_sock_init() != 1) return(0);
 	if (ip == NULL)
-		server.sin_addr.s_addr=INADDR_ANY;
+		ip="*";
+#if OPENSSL_USE_IPV6
+	if (family == PF_INET6)
+		BIO_snprintf(addr, sizeof(addr), "[%s]:%s", ip, port);
 	else
-/* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */
-#ifndef BIT_FIELD_LIMITS
-		memcpy(&server.sin_addr.s_addr,ip,4);
-#else
-		memcpy(&server.sin_addr,ip,4);
 #endif
-	
-		if (type == SOCK_STREAM)
-			s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
-		else /* type == SOCK_DGRAM */
-			s=socket(AF_INET, SOCK_DGRAM,IPPROTO_UDP);
-
-	if (s == INVALID_SOCKET) goto err;
+	BIO_snprintf(addr, sizeof(addr), "%s:%s", ip, port);
+	if (type == SOCK_STREAM)
+		{
+		s = BIO_get_accept_socket(addr, BIO_BIND_REUSEADDR);
+		if (s == INVALID_SOCKET) goto err;
+		}
+	else /* type == SOCK_DGRAM */
+		{
+		s=socket(family, SOCK_DGRAM,IPPROTO_UDP);
+		if (s == INVALID_SOCKET) goto err;
+		if (BIO_get_host_addr(addr, &server, &servlen, 1) != 1) goto err;
 #if defined SOL_SOCKET && defined SO_REUSEADDR
 		{
 		int j = 1;
@@ -356,30 +362,28 @@
 			   (void *) &j, sizeof j);
 		}
 #endif
-	if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1)
-		{
-#ifndef OPENSSL_SYS_WINDOWS
-		perror("bind");
-#endif
-		goto err;
+		if (bind(s,(struct sockaddr *)&server,servlen) == -1)
+			{
+			SYSerr(SYS_F_BIND,get_last_socket_error());
+			goto err;
+			}
 		}
-	/* Make it 128 for linux */
-	if (type==SOCK_STREAM && listen(s,128) == -1) goto err;
 	*sock=s;
 	ret=1;
 err:
-	if ((ret == 0) && (s != -1))
+	if ((ret == 0) && (s != INVALID_SOCKET))
 		{
 		SHUTDOWN(s);
 		}
-	return(ret);
+	return (ret);
 	}
 
-static int init_server(int *sock, int port, int type)
+static int init_server(int *sock, char *port, int type, int family)
 	{
-	return(init_server_long(sock, port, NULL, type));
+	return(init_server_long(sock, port, NULL, type, family));
 	}
 
+#if 0
 static int do_accept(int acc_sock, int *sock, char **host)
 	{
 	int ret;
@@ -470,150 +474,6 @@
 	*sock=ret;
 	return(1);
 	}
-
-int extract_host_port(char *str, char **host_ptr, unsigned char *ip,
-	     short *port_ptr)
-	{
-	char *h,*p;
-
-	h=str;
-	p=strchr(str,':');
-	if (p == NULL)
-		{
-		BIO_printf(bio_err,"no port defined\n");
-		return(0);
-		}
-	*(p++)='\0';
-
-	if ((ip != NULL) && !host_ip(str,ip))
-		goto err;
-	if (host_ptr != NULL) *host_ptr=h;
-
-	if (!extract_port(p,port_ptr))
-		goto err;
-	return(1);
-err:
-	return(0);
-	}
-
-static int host_ip(char *str, unsigned char ip[4])
-	{
-	unsigned int in[4]; 
-	int i;
-
-	if (sscanf(str,"%u.%u.%u.%u",&(in[0]),&(in[1]),&(in[2]),&(in[3])) == 4)
-		{
-		for (i=0; i<4; i++)
-			if (in[i] > 255)
-				{
-				BIO_printf(bio_err,"invalid IP address\n");
-				goto err;
-				}
-		ip[0]=in[0];
-		ip[1]=in[1];
-		ip[2]=in[2];
-		ip[3]=in[3];
-		}
-	else
-		{ /* do a gethostbyname */
-		struct hostent *he;
-
-		if (!ssl_sock_init()) return(0);
-
-		he=GetHostByName(str);
-		if (he == NULL)
-			{
-			BIO_printf(bio_err,"gethostbyname failure\n");
-			goto err;
-			}
-		/* cast to short because of win16 winsock definition */
-		if ((short)he->h_addrtype != AF_INET)
-			{
-			BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n");
-			return(0);
-			}
-		ip[0]=he->h_addr_list[0][0];
-		ip[1]=he->h_addr_list[0][1];
-		ip[2]=he->h_addr_list[0][2];
-		ip[3]=he->h_addr_list[0][3];
-		}
-	return(1);
-err:
-	return(0);
-	}
-
-int extract_port(char *str, short *port_ptr)
-	{
-	int i;
-	struct servent *s;
-
-	i=atoi(str);
-	if (i != 0)
-		*port_ptr=(unsigned short)i;
-	else
-		{
-		s=getservbyname(str,"tcp");
-		if (s == NULL)
-			{
-			BIO_printf(bio_err,"getservbyname failure for %s\n",str);
-			return(0);
-			}
-		*port_ptr=ntohs((unsigned short)s->s_port);
-		}
-	return(1);
-	}
-
-#define GHBN_NUM	4
-static struct ghbn_cache_st
-	{
-	char name[128];
-	struct hostent ent;
-	unsigned long order;
-	} ghbn_cache[GHBN_NUM];
-
-static unsigned long ghbn_hits=0L;
-static unsigned long ghbn_miss=0L;
-
-static struct hostent *GetHostByName(char *name)
-	{
-	struct hostent *ret;
-	int i,lowi=0;
-	unsigned long low= (unsigned long)-1;
-
-	for (i=0; i<GHBN_NUM; i++)
-		{
-		if (low > ghbn_cache[i].order)
-			{
-			low=ghbn_cache[i].order;
-			lowi=i;
-			}
-		if (ghbn_cache[i].order > 0)
-			{
-			if (strncmp(name,ghbn_cache[i].name,128) == 0)
-				break;
-			}
-		}
-	if (i == GHBN_NUM) /* no hit*/
-		{
-		ghbn_miss++;
-		ret=gethostbyname(name);
-		if (ret == NULL) return(NULL);
-		/* else add to cache */
-		if(strlen(name) < sizeof ghbn_cache[0].name)
-			{
-			strcpy(ghbn_cache[lowi].name,name);
-			memcpy((char *)&(ghbn_cache[lowi].ent),ret,sizeof(struct hostent));
-			ghbn_cache[lowi].order=ghbn_miss+ghbn_hits;
-			}
-		return(ret);
-		}
-	else
-		{
-		ghbn_hits++;
-		ret= &(ghbn_cache[i].ent);
-		ghbn_cache[i].order=ghbn_miss+ghbn_hits;
-		return(ret);
-		}
-	}
+#endif
 
 #endif

Modified: soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c
==============================================================================
--- soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c	Mon Jun 25 23:40:58 2012	(r238310)
+++ soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c	Tue Jun 26 00:39:50 2012	(r238311)
@@ -59,7 +59,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
-#include <assert.h>
 #define USE_SOCKETS
 #include "cryptlib.h"
 #include <openssl/bio.h>
@@ -85,10 +84,6 @@
 #define MAX_LISTEN  32
 #endif
 
-#ifdef OPENSSL_USE_IPV6
-extern const struct in6_addr in6addr_any;
-#endif
-
 #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK))
 static int wsa_init_done=0;
 #endif
@@ -118,12 +113,22 @@
 #endif
 
 static int get_ip(const char *str,unsigned char *ip);
+static int parse_ip(char *str, char **host, char **port, int *is_inet6);
+static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6, int is_local);
 #if 0
 static void ghbn_free(struct hostent *a);
 static struct hostent *ghbn_dup(struct hostent *a);
 #endif
 int BIO_get_host_ip(const char *str, unsigned char *ip)
 	{
+	int err;
+
+	err = BIO_get_host_ip6(str, ip, BIO_RESOLV_INETONLY);
+	return (err > 0); /* don't generate another error code here */
+	}
+
+int BIO_get_host_ip6(const char *str, unsigned char *ip, unsigned char mode)
+	{
 	int i;
 	int err = 1;
 	int locked = 0;
@@ -133,10 +138,15 @@
 	int addrlen = 4;
 	int gai_err;
 
+	if ((mode & BIO_RESOLV_INETONLY) && (mode & BIO_RESOLV_INET6ONLY))
+		{
+		BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INVALID_ARGUMENT);
+		return 0;
+		}
 	i=get_ip(str,ip); /* Search for an IPv4 address in in standard dot notation */
 	if (i < 0)
 		{
-		BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_INVALID_IP_ADDRESS);
+		BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INVALID_IP_ADDRESS);
 		goto err;
 		}
 
@@ -147,14 +157,27 @@
 
 	/* If the string actually contained an IP address, we need not do
 	   anything more */
-	if (i > 0) return(1);
+	if (i > 0) return(4);
 
 	memset(&hint,0,sizeof(hint));
 #if OPENSSL_USE_IPV6
-	hint.ai_family=AF_INET6;
+	if ((mode & BIO_RESOLV_INETONLY))
+		hint.ai_family=AF_INET;
+	else if ((mode & BIO_RESOLV_INET6ONLY))
+		hint.ai_family=AF_INET6;
+	else
+		hint.ai_family=AF_UNSPEC;
 #else
+	if ((mode & BIO_RESOLV_INET6ONLY))
+		{
+		/* Non sense, openssl is not configured to support inet6 */
+		BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INET6_UNSUPPORTED);
+		goto err;
+		}
 	hint.ai_family=AF_INET;
 #endif
+	if ((mode & BIO_RESOLV_LOCAL))
+		hint.ai_flags = AI_PASSIVE;
 	gai_err = BIO_getaddrinfo(str, NULL, &hint, &res);
 	if (gai_err == 0)
 		{
@@ -163,21 +186,26 @@
 		}
 	else if (gai_err < 0) /* Not supported fallback in gethostbyname */
 		{
-		ERR_get_error(); /* suppress the error generated by BIO_getaddrinfo */
+		if ((mode & BIO_RESOLV_INET6ONLY))
+			{
+			/* Do not expect that BIO_gethostbyname succeeds with inet6 only */
+			BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INET6_UNSUPPORTED);
+			goto err;
+			}
 		/* do a gethostbyname */
 		CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME);
 		locked = 1;
 		he=BIO_gethostbyname(str);
 		if (he == NULL)
 			{
-			BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_BAD_HOSTNAME_LOOKUP);
+			BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_BAD_HOSTNAME_LOOKUP);
 			goto err;
 			}
 
 		/* cast to short because of win16 winsock definition */
 		if ((short)he->h_addrtype != AF_INET)
 			{
-			BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET);
+			BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET);
 			goto err;
 			}
 		addr = he->h_addr;
@@ -187,13 +215,13 @@
 		{
 		if (res->ai_family == AF_INET)
 			{
-			assert(res->ai_addrlen == sizeof(struct sockaddr_in));
+			OPENSSL_assert(res->ai_addrlen == sizeof(struct sockaddr_in));
 			addr = (char *) &((struct sockaddr_in *) res->ai_addr)->sin_addr.s_addr;
 			addrlen = 4;
 			}
 		else if (res->ai_family == AF_INET6)
 			{
-			assert(res->ai_addrlen == sizeof(struct sockaddr_in6));
+			OPENSSL_assert(res->ai_addrlen == sizeof(struct sockaddr_in6));
 			addr = (char *) &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr.s6_addr;
 			addrlen = 16;
 			}
@@ -215,7 +243,7 @@
 		return 0;
 		}
 	else
-		return 1;
+		return addrlen;
 	}
 
 int BIO_get_port(const char *str, unsigned short *port_ptr)
@@ -562,7 +590,37 @@
 
 	if ((p_freeaddrinfo.p=DSO_global_lookup("freeaddrinfo"))!=NULL)
 	    (*p_freeaddrinfo.f)(ai);
+	else
+#endif
+	BIOerr(BIO_F_BIO_FREEADDRINFO,BIO_R_UNSUPPORTED_METHOD);
+	}
+			
+int BIO_getnameinfo(const struct sockaddr *sa, size_t salen,
+	char *host, size_t hostlen, char *serv, size_t servlen, int flags)
+	{
+#ifdef EAI_FAMILY
+	static union {	void *p;
+			int (WSAAPI *f)(const struct sockaddr *,size_t/*socklen_t*/,
+				 char *,size_t,char *,size_t,int);
+			} p_getnameinfo = {NULL};
+			/* 2nd argument to getnameinfo is specified to
+			 * be socklen_t. Unfortunately there is a number
+			 * of environments where socklen_t is not defined.
+			 * As it's passed by value, it's safe to pass it
+			 * as size_t... <appro> */
+
+	if ((p_getnameinfo.p=DSO_global_lookup("getnameinfo"))!=NULL)
+		{
+		if (((*p_getnameinfo.f)(sa,salen,host,hostlen,serv,servlen,flags))!=0)
+			{
+			BIOerr(BIO_F_BIO_GETNAMEINFO,BIO_R_BAD_ADDR_RLOOKUP);
+			return (0);
+			}
+		return (1);
+		}
 #endif
+	BIOerr(BIO_F_BIO_GETNAMEINFO,BIO_R_UNSUPPORTED_METHOD);
+	return (-1);
 	}
 
 int BIO_sock_init(void)
@@ -762,7 +820,7 @@
 	return (1);
 	}
 
-static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6)
+static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6, int is_local)
 	{ 
 	unsigned short p;
 	int sa_len = 0;
@@ -772,68 +830,85 @@
 	unsigned char h[4];
 #endif
 
+	is_local = (is_local ? BIO_RESOLV_LOCAL : 0);
 	if (!BIO_get_port(port,&p)) return (0);
 	memset((char *)sa,0,sizeof(*sa));
 	memset(h, 0, sizeof(h));
 	if (is_inet6) /* deal with inet6 format (ie: [host]:port) */
 		{
 #ifdef OPENSSL_USE_IPV6
-		assert(sizeof(*sa) >= sizeof(struct sockaddr_in6));
+		OPENSSL_assert(sizeof(*sa) >= sizeof(struct sockaddr_in6));
 		sa->sa_in6.sin6_family = AF_INET6;
 		sa->sa_in6.sin6_port = htons(p);
 		sa_len = sizeof(sa->sa_in6);
 #ifdef SIN6_LEN /* BSD 4.4 */
 		sa->sa_in6.sin6_len = sa_len;
 #endif
-		if (h == NULL)
+		if (host == NULL)
 			sa->sa_in6.sin6_addr = in6addr_any;
 		else
 			{
-			if (!BIO_get_host_ip(host, h)) return (0);
+			if (!BIO_get_host_ip6(host, h, BIO_RESOLV_INET6ONLY|is_local)) return (0);
+#ifndef BIT_FIELD_LIMITS /* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */
 			memcpy(&sa->sa_in6.sin6_addr.s6_addr, h, sizeof(h));
+#else
+			memcpy(&sa->sa_in6.sin6_addr, h, sizeof(h));
+#endif
 			}
 #else
 		/* inet6 format used without OPENSSL configured properly, thus invalid */
-		BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_INVALID_IP_ADDRESS);
 		return (0);
 #endif
 	 	}
 	else /* we must resolve an inet4 address */
 		{
-		assert(sizeof(*sa) >= sizeof(struct sockaddr_in));
+		OPENSSL_assert(sizeof(*sa) >= sizeof(struct sockaddr_in));
 		sa->sa_in.sin_family=AF_INET;
 		sa->sa_in.sin_port=htons(p);
 		sa_len = sizeof(sa->sa_in);
-#if 1
-		/* TODO add a definition at compile time */
+#if HAVE_SIN_LEN /* BSD 4.4 */
 		sa->sa_in.sin_len = sa_len;
 #endif
-		if (h == NULL)
+		if (host == NULL)
 			sa->sa_in.sin_addr.s_addr=INADDR_ANY;
 		else
 			{
-			/* 
-			 * TODO force inet4 listening even with OPENSSL_USE_IPV6
-			 *
-			 * CONF_LOCAL(h)
-			 * CONF_INETONLY(h)
-			 */
-			if (!BIO_get_host_ip(host, h)) return (0);
+			if (!BIO_get_host_ip6(host, h, BIO_RESOLV_INETONLY|is_local)) return (0);
+#ifndef BIT_FIELD_LIMITS
 			memcpy(&sa->sa_in.sin_addr.s_addr, h, 4); /* always 4 here especially when using inet6 */
+#else
+			memcpy(&sa->sa_in.sin_addr, h, 4);
+#endif
 			}
 		}
 	return (sa_len);
 	}
 
+int BIO_get_host_addr(char *host, union sa_storage *sa, int *sa_len, int local_query)
+	{
+	char *h, *p;
+	int is_inet6 = 0;
+
+	if (parse_ip(host, &h, &p, &is_inet6) != 1)
+		{
+		BIOerr(BIO_F_BIO_GET_HOST_ADDR,BIO_R_INVALID_IP_ADDRESS);
+		return (0);
+		}
+	*sa_len = fill_addr(sa, h, p, is_inet6, local_query);
+	if (*sa_len == 0)
+		return (0); /* Errors have been already generated */
+	return (1);
+	}
+
 int BIO_get_accept_socket(char *host, int bind_mode)
 	{
 	union sa_storage server,client;
 	int s=INVALID_SOCKET,cs,addrlen;
 	char *str=NULL;
-	char *h,*p;
 	int err_num;
-	int is_inet6 = 0;
 	int ret = 0;
+	char *h, *p;
+	int is_inet6 = 0;
 
 	if (BIO_sock_init() != 1) return(INVALID_SOCKET);
 	if ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET);
@@ -842,7 +917,8 @@
 		BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_INVALID_IP_ADDRESS);
 		goto err;
 		}
-	if ((addrlen = fill_addr(&server, h, p, is_inet6)) == 0) goto err; /* Errors have been already generated */
+	if ((addrlen = fill_addr(&server, h, p, is_inet6, 1)) == 0)
+		goto err;
 again:
 	s=socket(server.sa.sa_family,SOCK_STREAM,SOCKET_PROTOCOL);
 	if (s == INVALID_SOCKET)
@@ -939,6 +1015,9 @@
 	unsigned long l;
 	unsigned short port;
 	char *p;
+	int err;
+	char   h[NI_MAXHOST],s[NI_MAXSERV];
+	size_t nl;
 
 	struct {
 	/*
@@ -963,13 +1042,7 @@
 	 * <appro>
 	 */
 	union { size_t s; int i; } len;
-	union {
-		struct sockaddr sa;
-		struct sockaddr_in sa_in;
-#if OPENSSL_USE_IPV6
-		struct sockaddr_in6 sa_in6;
-#endif
-		} from;
+	union sa_storage from;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120626003952.224DA106568E>