Esempio n. 1
0
void fapp_debug_cmd( fnet_shell_desc_t desc, fnet_index_t argc, fnet_char_t ** argv )
{
    FNET_COMP_UNUSED_ARG(desc);
    FNET_COMP_UNUSED_ARG(argc);
    FNET_COMP_UNUSED_ARG(argv);

    /* Put here you debugging information.*/
#if 0
    fnet_fec_debug_mii_print_regs(fnet_netif_get_default());
#endif

#if 0
    {
        fnet_index_t    i = 0;
        fnet_ip6_addr_t addr_dns;
        fnet_uint8_t    ip_str[FNET_IP_ADDR_STR_SIZE]={0};
        
        while(fnet_netif_get_ip6_dns(fnet_netif_get_default(), i, &addr_dns ) == FNET_TRUE)
        {
            fnet_inet_ntop(AF_INET6, (fnet_uint8_t*)(&addr_dns), ip_str, sizeof(ip_str));
            fnet_shell_println(desc, "DNS[%d]=%s", i, ip_str);
            i++;
        }
    }
#endif

#if 0 /* Test ctacrypt library.*/
    extern void ctaocrypt_test(void);
    
    ctaocrypt_test();
#endif
}
Esempio n. 2
0
    int main(int argc, char** argv)
    {
        func_args args;

        args.argc = argc;
        args.argv = argv;

        ctaocrypt_test(&args);
        return args.return_code;
    }
Esempio n. 3
0
/*
 * Main driver for CTaoCrypt tests.
 */
int main(int argc, char** argv) {
    int i ;

    init_serial() ;  /* initialize PIC32MZ serial I/O */
    SYSTEMConfigPerformance(80000000);
    DBINIT();
    printf("CTaoCrypt Test:\n");
    func_args args;

    args.argc = argc;
    args.argv = argv;

    ctaocrypt_test(&args);

    if (args.return_code == 0) {
        printf("All tests passed!\n");
    }
    
    return 0;
}
Esempio n. 4
0
int main(int argc, char** argv)
{
    func_args server_args;

    server_args.argc = argc;
    server_args.argv = argv;

    if (CurrentDir("testsuite") || CurrentDir("_build"))
        ChangeDirBack(1);
    else if (CurrentDir("Debug") || CurrentDir("Release"))
        ChangeDirBack(3);          /* Xcode->Preferences->Locations->Locations*/
                                   /* Derived Data Advanced -> Custom  */
                                   /* Relative to Workspace, Build/Products */
                                   /* Debug or Release */

    ctaocrypt_test(&server_args);
    if (server_args.return_code != 0) return server_args.return_code;

    printf("\nAll tests passed!\n");
    return EXIT_SUCCESS;
}
Esempio n. 5
0
int main(int argc, char** argv)
{
    func_args server_args;

    tcp_ready ready;
    THREAD_TYPE serverThread;

#ifdef HAVE_CAVIUM
        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
        if (ret != 0)
            err_sys("Cavium OpenNitroxDevice failed");
#endif /* HAVE_CAVIUM */

    StartTCP();

    server_args.argc = argc;
    server_args.argv = argv;

    CyaSSL_Init();
#if defined(DEBUG_CYASSL) && !defined(HAVE_VALGRIND)
    CyaSSL_Debugging_ON();
#endif

    if (CurrentDir("testsuite") || CurrentDir("_build"))
        ChangeDirBack(1);
    else if (CurrentDir("Debug") || CurrentDir("Release"))
        ChangeDirBack(3);          /* Xcode->Preferences->Locations->Locations*/
                                   /* Derived Data Advanced -> Custom  */
                                   /* Relative to Workspace, Build/Products */
                                   /* Debug or Release */
    server_args.signal = &ready;
    InitTcpReady(&ready);

    /* CTaoCrypt test */
    ctaocrypt_test(&server_args);
    if (server_args.return_code != 0) return server_args.return_code;
 
    /* Simple CyaSSL client server test */
    simple_test(&server_args);
    if (server_args.return_code != 0) return server_args.return_code;

    /* Echo input yaSSL client server test */
    start_thread(echoserver_test, &server_args, &serverThread);
    wait_tcp_ready(&server_args);
    {
        func_args echo_args;
        char* myArgv[NUMARGS];

        char argc0[32];
        char argc1[32];
        char argc2[32];

        myArgv[0] = argc0;
        myArgv[1] = argc1;
        myArgv[2] = argc2;

        echo_args.argc = NUMARGS;
        echo_args.argv = myArgv;
   
        strcpy(echo_args.argv[0], "echoclient");
        strcpy(echo_args.argv[1], "input");
        strcpy(echo_args.argv[2], outputName);
        remove(outputName);

        /* Share the signal, it has the new port number in it. */
        echo_args.signal = server_args.signal;

        /* make sure OK */
        echoclient_test(&echo_args);
        if (echo_args.return_code != 0) return echo_args.return_code;  

#ifdef CYASSL_DTLS
        wait_tcp_ready(&server_args);
#endif
        /* send quit to echoserver */
        echo_args.argc = 2;
        strcpy(echo_args.argv[1], "quit");

        echoclient_test(&echo_args);
        if (echo_args.return_code != 0) return echo_args.return_code;
        join_thread(serverThread);
        if (server_args.return_code != 0) return server_args.return_code;
    }

    /* validate output equals input */
    {
        byte input[SHA256_DIGEST_SIZE];
        byte output[SHA256_DIGEST_SIZE];

        file_test("input",  input);
        file_test(outputName, output);
        if (memcmp(input, output, sizeof(input)) != 0)
            return EXIT_FAILURE;
    }

    CyaSSL_Cleanup();
    FreeTcpReady(&ready);

#ifdef HAVE_CAVIUM
        CspShutdown(CAVIUM_DEV_ID);
#endif
    printf("\nAll tests passed!\n");
    return EXIT_SUCCESS;
}
Esempio n. 6
0
int main(int argc, char** argv)
{
    func_args args;
    func_args server_args;

    tcp_ready ready;
    THREAD_TYPE serverThread;

    StartTCP();

    args.argc = server_args.argc = argc;
    args.argv = server_args.argv = argv;

    /* CTaoCrypt test */
    ctaocrypt_test(&args);
    if (args.return_code != 0) return args.return_code;

    /* Simple CyaSSL client server test */
    InitCyaSSL();
    InitTcpReady(&ready);
    server_args.signal = &ready;
    start_thread(server_test, &server_args, &serverThread);
    wait_tcp_ready(&server_args);

    client_test(&args);
    if (args.return_code != 0) return args.return_code;
    join_thread(serverThread);
    if (server_args.return_code != 0) return server_args.return_code;

    /* Echo input yaSSL client server test */
    start_thread(echoserver_test, &server_args, &serverThread);
    wait_tcp_ready(&server_args);
    {
        func_args echo_args;
        char* myArgv[NUMARGS];

        char argc0[32];
        char argc1[32];
        char argc2[32];

        myArgv[0] = argc0;
        myArgv[1] = argc1;
        myArgv[2] = argc2;

        echo_args.argc = NUMARGS;
        echo_args.argv = myArgv;

        strcpy(echo_args.argv[0], "echoclient");
        strcpy(echo_args.argv[1], "input");
        strcpy(echo_args.argv[2], "output");
        remove("output");

        /* make sure OK */
        echoclient_test(&echo_args);
        if (echo_args.return_code != 0) return echo_args.return_code;

#ifdef CYASSL_DTLS
        wait_tcp_ready(&server_args);
#endif
        /* send quit to echoserver */
        echo_args.argc = 2;
        strcpy(echo_args.argv[1], "quit");

        echoclient_test(&echo_args);
        if (echo_args.return_code != 0) return echo_args.return_code;
        join_thread(serverThread);
        if (server_args.return_code != 0) return server_args.return_code;
    }

    /* validate output equals input */
    {
        byte input[MD5_DIGEST_SIZE];
        byte output[MD5_DIGEST_SIZE];

        file_test("input",  input);
        file_test("output", output);
        if (memcmp(input, output, sizeof(input)) != 0)
            return -1;
    }

    FreeCyaSSL();
    FreeTcpReady(&ready);

    printf("\nAll tests passed!\n");
    return 0;
}