security/nss/lib/freebl/mpi/test-info.c

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /*
     2  *  test-info.c
     3  *
     4  *  Arbitrary precision integer arithmetic library
     5  *
     6  * This Source Code Form is subject to the terms of the Mozilla Public
     7  * License, v. 2.0. If a copy of the MPL was not distributed with this
     8  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    10 /* Table mapping test suite names to index numbers */
    11 const int   g_count = 42;
    12 const char *g_names[] = {
    13    "list",              /* print out a list of the available test suites */
    14    "copy",              /* test assignment of mp-int structures          */
    15    "exchange",          /* test exchange of mp-int structures            */
    16    "zero",              /* test zeroing of an mp-int                     */
    17    "set",               /* test setting an mp-int to a small constant    */
    18    "absolute-value",    /* test the absolute value function              */
    19    "negate",            /* test the arithmetic negation function         */
    20    "add-digit",         /* test digit addition                           */
    21    "add",               /* test full addition                            */
    22    "subtract-digit",    /* test digit subtraction                        */
    23    "subtract",          /* test full subtraction                         */
    24    "multiply-digit",    /* test digit multiplication                     */
    25    "multiply",          /* test full multiplication                      */
    26    "square",            /* test full squaring function                   */
    27    "divide-digit",      /* test digit division                           */
    28    "divide-2",          /* test division by two                          */
    29    "divide-2d",         /* test division & remainder by 2^d              */
    30    "divide",            /* test full division                            */
    31    "expt-digit",        /* test digit exponentiation                     */
    32    "expt",              /* test full exponentiation                      */
    33    "expt-2",            /* test power-of-two exponentiation              */
    34    "square-root",       /* test integer square root function             */
    35    "modulo-digit",      /* test digit modular reduction                  */
    36    "modulo",            /* test full modular reduction                   */
    37    "mod-add",           /* test modular addition                         */
    38    "mod-subtract",      /* test modular subtraction                      */
    39    "mod-multiply",      /* test modular multiplication                   */
    40    "mod-square",        /* test modular squaring function                */
    41    "mod-expt",          /* test full modular exponentiation              */
    42    "mod-expt-digit",    /* test digit modular exponentiation             */
    43    "mod-inverse",       /* test modular inverse function                 */
    44    "compare-digit",     /* test digit comparison function                */
    45    "compare-zero",      /* test zero comparison function                 */
    46    "compare",           /* test general signed comparison                */
    47    "compare-magnitude", /* test general magnitude comparison             */
    48    "parity",            /* test parity comparison functions              */
    49    "gcd",               /* test greatest common divisor functions        */
    50    "lcm",               /* test least common multiple function           */
    51    "conversion",        /* test general radix conversion facilities      */
    52    "binary",            /* test raw output format                        */
    53    "pprime",            /* test probabilistic primality tester           */
    54    "fermat"             /* test Fermat pseudoprimality tester            */
    55 };
    57 /* Test function prototypes */
    58 int  test_list(void);
    59 int  test_copy(void);
    60 int  test_exch(void);
    61 int  test_zero(void);
    62 int  test_set(void);
    63 int  test_abs(void);
    64 int  test_neg(void);
    65 int  test_add_d(void);
    66 int  test_add(void);
    67 int  test_sub_d(void);
    68 int  test_sub(void);
    69 int  test_mul_d(void);
    70 int  test_mul(void);
    71 int  test_sqr(void);
    72 int  test_div_d(void);
    73 int  test_div_2(void);
    74 int  test_div_2d(void);
    75 int  test_div(void);
    76 int  test_expt_d(void);
    77 int  test_expt(void);
    78 int  test_2expt(void);
    79 int  test_sqrt(void);
    80 int  test_mod_d(void);
    81 int  test_mod(void);
    82 int  test_addmod(void);
    83 int  test_submod(void);
    84 int  test_mulmod(void);
    85 int  test_sqrmod(void);
    86 int  test_exptmod(void);
    87 int  test_exptmod_d(void);
    88 int  test_invmod(void);
    89 int  test_cmp_d(void);
    90 int  test_cmp_z(void);
    91 int  test_cmp(void);
    92 int  test_cmp_mag(void);
    93 int  test_parity(void);
    94 int  test_gcd(void);
    95 int  test_lcm(void);
    96 int  test_convert(void);
    97 int  test_raw(void);
    98 int  test_pprime(void);
    99 int  test_fermat(void);
   101 /* Table mapping index numbers to functions */
   102 int (*g_tests[])(void)  = {
   103    test_list,     test_copy,     test_exch,     test_zero,     
   104    test_set,      test_abs,      test_neg,      test_add_d,    
   105    test_add,      test_sub_d,    test_sub,      test_mul_d,    
   106    test_mul,      test_sqr,      test_div_d,    test_div_2,    
   107    test_div_2d,   test_div,      test_expt_d,   test_expt,     
   108    test_2expt,    test_sqrt,     test_mod_d,    test_mod,      
   109    test_addmod,   test_submod,   test_mulmod,   test_sqrmod,   
   110    test_exptmod,  test_exptmod_d, test_invmod,   test_cmp_d,    
   111    test_cmp_z,    test_cmp,      test_cmp_mag,  test_parity,   
   112    test_gcd,      test_lcm,      test_convert,  test_raw,      
   113    test_pprime,   test_fermat
   114 };
   116 /* Table mapping index numbers to descriptions */
   117 const char *g_descs[] = {
   118    "print out a list of the available test suites",
   119    "test assignment of mp-int structures",
   120    "test exchange of mp-int structures",
   121    "test zeroing of an mp-int",
   122    "test setting an mp-int to a small constant",
   123    "test the absolute value function",
   124    "test the arithmetic negation function",
   125    "test digit addition",
   126    "test full addition",
   127    "test digit subtraction",
   128    "test full subtraction",
   129    "test digit multiplication",
   130    "test full multiplication",
   131    "test full squaring function",
   132    "test digit division",
   133    "test division by two",
   134    "test division & remainder by 2^d",
   135    "test full division",
   136    "test digit exponentiation",
   137    "test full exponentiation",
   138    "test power-of-two exponentiation",
   139    "test integer square root function",
   140    "test digit modular reduction",
   141    "test full modular reduction",
   142    "test modular addition",
   143    "test modular subtraction",
   144    "test modular multiplication",
   145    "test modular squaring function",
   146    "test full modular exponentiation",
   147    "test digit modular exponentiation",
   148    "test modular inverse function",
   149    "test digit comparison function",
   150    "test zero comparison function",
   151    "test general signed comparison",
   152    "test general magnitude comparison",
   153    "test parity comparison functions",
   154    "test greatest common divisor functions",
   155    "test least common multiple function",
   156    "test general radix conversion facilities",
   157    "test raw output format",
   158    "test probabilistic primality tester",
   159    "test Fermat pseudoprimality tester"
   160 };

mercurial