Add BSD-ppc85xx support and avoid copying overlapping buffers in fips_dssvs.c OpenSSL-fips-2_0_2
authorDr. Stephen Henson <steve@openssl.org>
Sun, 14 Oct 2012 12:02:53 +0000 (12:02 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 14 Oct 2012 12:02:53 +0000 (12:02 +0000)
Configure
config
fips/dsa/fips_dssvs.c
fips/fips_canister.c

index 90b108baaa4033b3c49b34e6e87b92a96572ef19..99b386b7c0feef400e45fc68c1f1434d399f7b47 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -409,6 +409,8 @@ my %table=(
 "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-ppc85xx","gcc:-DTERMIOS -O3 -fomit-frame-pointer -msoft-float -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debug-BSD-ppc85xx","gcc:-DTERMIOS -O0 -fomit-frame-pointer -msoft-float -Wall -g::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_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)",
 # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
diff --git a/config b/config
index 851a1611368482f2c93e0922d26c476514c99be6..93dde30168806397270c66ed23553f0d7fbb120d 100755 (executable)
--- a/config
+++ b/config
@@ -219,7 +219,11 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
        ;;
 
     NetBSD:*:*:*386*)
-        echo "`(/usr/sbin/sysctl -n hw.model || /sbin/sysctl -n hw.model) | sed 's,.*\(.\)86-class.*,i\186,'`-whatever-netbsd"; exit 0
+       if [ -z ${CROSS_COMPILE} ]; then
+           echo "`(/usr/sbin/sysctl -n hw.model || /sbin/sysctl -n hw.model) | sed 's,.*\(.\)86-class.*,i\186,'`-whatever-netbsd"; exit 0
+        else
+           echo "${MACHINE}-whatever-netbsd"; exit 0
+       fi
        ;;
 
     NetBSD:*)
@@ -734,17 +738,23 @@ case "$GUESSOS" in
   sparc64-*-*bsd*)     OUT="BSD-sparc64" ;;
   ia64-*-*bsd*)                OUT="BSD-ia64" ;;
   amd64-*-*bsd*)       OUT="BSD-x86_64" ;;
-  *86*-*-*bsd*)                # mimic ld behaviour when it's looking for libc...
-                       if [ -L /usr/lib/libc.so ]; then        # [Free|Net]BSD
-                           libc=/usr/lib/libc.so
-                       else                                    # OpenBSD
-                           # ld searches for highest libc.so.* and so do we
-                           libc=`(ls /usr/lib/libc.so.* | tail -1) 2>/dev/null`
-                       fi
-                       case "`(file -L $libc) 2>/dev/null`" in
-                       *ELF*)  OUT="BSD-x86-elf" ;;
-                       *)      OUT="BSD-x86"; options="$options no-sse2" ;;
-                       esac ;;
+  *86*-*-*bsd*)                if [ -z ${CROSS_COMPILE} ]; then 
+                          # mimic ld behaviour when it's looking for libc...
+                          if [ -L /usr/lib/libc.so ]; then     # [Free|Net]BSD
+                              libc=/usr/lib/libc.so
+                          else                                 # OpenBSD
+                              # ld searches for highest libc.so.* and so do we
+                              libc=`(ls /usr/lib/libc.so.* | tail -1) 2>/dev/null`
+                          fi
+                          echo "libc = $libc"
+                          case "`(file -L $libc) 2>/dev/null`" in
+                          *ELF*)       OUT="BSD-x86-elf" ;;
+                          *)   OUT="BSD-x86"; options="$options no-sse2" ;;
+                         esac 
+                       else
+                          OUT="BSD-x86-elf"
+                       fi;;
+  ppc85xx-*-*bsd*)      OUT="BSD-ppc85xx" ;;  # MPC85XX has no hardware FP accelerator
   *-*-*bsd*)           OUT="BSD-generic32" ;;
 
   *-*-osf)             OUT="osf1-alpha-cc" ;;
index e2f2297f00762a43396be1c369c86d4c00208725..cee5fb398e81a17912b56701ebfd09d516902abc 100644 (file)
@@ -46,7 +46,8 @@ static int parse_mod(char *line, int *pdsa2, int *pL, int *pN,
        if (strcmp(keyword, "L"))
                return 0;
        *pL = atoi(value);
-       strcpy(line, p + 1);
+       strcpy(lbuf, p + 1);
+        strcpy(line, lbuf);
        if (pmd)
                p = strchr(line, ',');
        else
index afe55a1bc739a015ce4942a423589a8cf3b7d895..016d94c9767ab08ec3b51473ed9c9c271d39ef66 100644 (file)
@@ -32,6 +32,7 @@ const void         *FIPS_text_end(void);
                                  defined(__i386__)|| defined(__i386))) || \
        (defined(__vxworks)   && (defined(__ppc__) || defined(__ppc)    || \
                                  defined(__mips__)|| defined(__mips))) || \
+        (defined(__NetBSD__)  && (defined(__powerpc__) || defined(__i386))) || \
        (defined(__linux)     && ((defined(__PPC__) && !defined(__PPC64__)) || \
                                  defined(__arm__) || defined(__arm)))  || \
        (defined(__APPLE__) /* verified on all MacOS X & iOS flavors */)|| \