ec/ecp_nistz256.c: harmonize with latest indent script.
[oweals/openssl.git] / crypto / bn / bn_lib.c
index cbac3c1391fbb954096493fc43dc42c1984c033c..e664fa6df204ca0adaea53a0febba7810eeec9b6 100644 (file)
@@ -72,7 +72,8 @@ const char BN_version[]="Big Number" OPENSSL_VERSION_PTEXT;
 
 /* This stuff appears to be completely unused, so is deprecated */
 #ifndef OPENSSL_NO_DEPRECATED
-/* For a 32 bit machine
+/*-
+ * For a 32 bit machine
  * 2 -   4 ==  128
  * 3 -   8 ==  256
  * 4 -  16 ==  512
@@ -355,10 +356,13 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
                case 3: A[2]=B[2];
                case 2: A[1]=B[1];
                case 1: A[0]=B[0];
-               case 0: /* workaround for ultrix cc: without 'case 0', the optimizer does
-                        * the switch table by doing a=top&3; a--; goto jump_table[a];
-                        * which fails for top== 0 */
+               case 0:
                        ;
+                       /*
+                        * workaround for ultrix cc: without 'case 0', the optimizer does
+                        * the switch table by doing a=top&3; a--; goto jump_table[a];
+                        * which fails for top== 0
+                        */
                        }
                }
 
@@ -370,63 +374,6 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
        return(a);
        }
 
-/* This is an internal function that can be used instead of bn_expand2()
- * when there is a need to copy BIGNUMs instead of only expanding the
- * data part, while still expanding them.
- * Especially useful when needing to expand BIGNUMs that are declared
- * 'const' and should therefore not be changed.
- * The reason to use this instead of a BN_dup() followed by a bn_expand2()
- * is memory allocation overhead.  A BN_dup() followed by a bn_expand2()
- * will allocate new memory for the BIGNUM data twice, and free it once,
- * while bn_dup_expand() makes sure allocation is made only once.
- */
-
-#ifndef OPENSSL_NO_DEPRECATED
-BIGNUM *bn_dup_expand(const BIGNUM *b, int words)
-       {
-       BIGNUM *r = NULL;
-
-       bn_check_top(b);
-
-       /* This function does not work if
-        *      words <= b->dmax && top < words
-        * because BN_dup() does not preserve 'dmax'!
-        * (But bn_dup_expand() is not used anywhere yet.)
-        */
-
-       if (words > b->dmax)
-               {
-               BN_ULONG *a = bn_expand_internal(b, words);
-
-               if (a)
-                       {
-                       r = BN_new();
-                       if (r)
-                               {
-                               r->top = b->top;
-                               r->dmax = words;
-                               r->neg = b->neg;
-                               r->d = a;
-                               }
-                       else
-                               {
-                               /* r == NULL, BN_new failure */
-                               OPENSSL_free(a);
-                               }
-                       }
-               /* If a == NULL, there was an error in allocation in
-                  bn_expand_internal(), and NULL should be returned */
-               }
-       else
-               {
-               r = BN_dup(b);
-               }
-
-       bn_check_top(r);
-       return r;
-       }
-#endif
-
 /* This is an internal function that should not be used in applications.
  * It ensures that 'b' has enough room for a 'words' word number
  * and initialises any unused part of b->d with leading zeros.