void run_tests (void)
{
    bool polled = true;
    diag_printf ("Running Freescale Kinetis/MPC5xxx DSPI driver loopback tests.\n");

    diag_printf ("\nPolled\n");
    run_test_tick (polled, 1024);
    run_test_1 (polled, &tx_data0[3], 4);
    run_test_2 (polled);
    run_test_3 (polled);
    run_test_4 (polled);

    polled = false;
    diag_printf ("\nInterrupt driven.\n");
    run_test_tick (polled,2048);
    run_test_1 (polled, &tx_data0[7], 10);
    run_test_2 (polled);
    run_test_3 (polled);
    run_test_4 (polled);

    if(errors)
        CYG_TEST_FAIL("Errors detected");
    else
        CYG_TEST_PASS_FINISH ("Loopback tests ran OK");
}
Beispiel #2
0
void run_tests (void)
{
    diag_printf ("Running STM32 SPI driver loopback tests.\n");
    run_test_1 (true); 
    run_test_1 (false); 
    run_test_2 (true); 
    run_test_2 (false); 
    CYG_TEST_PASS_FINISH ("Loopback tests ran OK");
}
Beispiel #3
0
bool test_sign_inc(bool fast_flag, bool quiet_flag) {

    /*
     * First set of tests; for several different parameter sets, create the
     * same key with two different working_keys; generate signatures with both
     * (one using the standard API, and one with the incremental, and see if
     * they match
     */
    {
        int d = 1;
        param_set_t lm_array[1] = { LMS_SHA256_N32_H5 };
        param_set_t lm_ots_array[1] = { LMOTS_SHA256_N32_W8 };
        if (!run_test( d, lm_array, lm_ots_array, 32, true )) return false;
    }
    {
        int d = 1;
        param_set_t lm_array[1] = { LMS_SHA256_N32_H10 };
        param_set_t lm_ots_array[1] = { LMOTS_SHA256_N32_W4 };
        if (!run_test( d, lm_array, lm_ots_array, 1024, true )) return false;
    }
    {
        int d = 2;
        param_set_t lm_array[2] = { LMS_SHA256_N32_H5, LMS_SHA256_N32_H5 };
        param_set_t lm_ots_array[2] = { LMOTS_SHA256_N32_W4, LMOTS_SHA256_N32_W2 };
        if (!run_test( d, lm_array, lm_ots_array, 1024, true )) return false;
    }
    {
        int d = 2;
        param_set_t lm_array[2] = { LMS_SHA256_N32_H10, LMS_SHA256_N32_H5 };
        param_set_t lm_ots_array[2] = { LMOTS_SHA256_N32_W8, LMOTS_SHA256_N32_W2 };
        if (!run_test( d, lm_array, lm_ots_array, 100, false )) return false;
    }
    {
        int d = 3;
        param_set_t lm_array[3] = {
            LMS_SHA256_N32_H10, LMS_SHA256_N32_H5, LMS_SHA256_N32_H5 };
        param_set_t lm_ots_array[3] = {
            LMOTS_SHA256_N32_W8, LMOTS_SHA256_N32_W4, LMOTS_SHA256_N32_W2 };
        if (!run_test( d, lm_array, lm_ots_array, 2000, false )) return false;
    }

    /*
     * Second test; for one particular parm set, initiate a large number of
     * signature ops, but don't close them out; then, close them out in
     * order, and see if they match the normal signature.  This verifies that
     * stepping the tree past where the original auth path was doesn't mess
     * things up
     * In slow mode, we make sure to step past the first penultimate Merkle
     * tree (level 2 in this case), to make sure that we don't need the
     * original tree there to be valid; it takes too long for fast mode
     */
    {
        int d = 3;
        param_set_t lm_array[3] = {
            LMS_SHA256_N32_H10, LMS_SHA256_N32_H5, LMS_SHA256_N32_H5 };
        param_set_t lm_ots_array[3] = {
            LMOTS_SHA256_N32_W8, LMOTS_SHA256_N32_W8, LMOTS_SHA256_N32_W8 };
        int num_iter;
        if (fast_flag) num_iter = 100; else num_iter = 10000;
        if (!run_test_2( d, lm_array, lm_ots_array, num_iter )) return false;
    }

    return true;
}