Ejemplo n.º 1
0
int main(int argc, char *argv[]) {
	splash_init();

		test_state_creation();
		test_state_machine();
	
	splash_quit();
	splash_init();
		if(luaL_dofile(splash_lua_state, "../scripts/test/state_test.lua")){
			printf("Could not load file: %s\n", lua_tostring(splash_lua_state, -1));
		}
	splash_quit();
  return 0;
}
Ejemplo n.º 2
0
bool unabto_test_all(void) {
//    NABTO_DECLARE_LOCAL_MODULE(NABTO_LOG_APP);
    bool ret = true;
    bool r;

    NABTO_LOG_INFO(("Testing sha256 implementation"));

    r = sha256_test();
    if (!r) {
        NABTO_LOG_INFO(("sha256 test failed"));
        ret = false;
    }


#if NABTO_ENABLE_SHA256_TESTS
    NABTO_LOG_INFO(("Testing hmac_sha256"));
    r = hmac_sha256_test();
    if (!r) {
        NABTO_LOG_INFO(("hmac sha256 tests failed"));
        ret = false;
    }
#endif

    NABTO_LOG_INFO(("Testing AES implementation"));
    r = aes_test();
    if (!r) {
        NABTO_LOG_INFO(("AES test failed"));
        ret = false;
    }

    NABTO_LOG_INFO(("Testing AES cbc encrypt/decrypt"));
    r = aes_cbc_test();
    if (!r) {
        NABTO_LOG_INFO(("AES_CBC encrypt/decrypt failed"));
        ret = false;
    }

    NABTO_LOG_INFO(("Testing prfplus"));
    r = unabto_prfplus_test();
    if (!r) {
        NABTO_LOG_INFO(("Prfplus_sha256 failed"));
        ret = false;
    }

    NABTO_LOG_INFO(("Testing truncated_hmac_sha256_verify_integrity"));
    truncated_hmac_sha256_verify_integrity_test(&r);
    //NABTO_LOG_TRACE(("ret %u", r));
    if (!r) {
        NABTO_LOG_INFO(("integrity verification test failed"));
        ret = false;
    }

    NABTO_LOG_INFO(("testing unabto_crypto.c"));
    r = test_nabto_crypto_create_key_material();
    if (!r) {
        NABTO_LOG_INFO(("unabto_crypto.c test failed"));
        ret = false;
    }

    NABTO_LOG_INFO(("Testing unabto_util"));
    r = unabto_util_test();
    if (!r) {
        NABTO_LOG_INFO(("testing of unabto_util failed"));
        ret = false;
    }

    NABTO_LOG_INFO(("Testing unabto_buffer"));
    r = unabto_buffer_test();
    if (!r) {
        NABTO_LOG_ERROR(("Test of unabto_buffer failed"));
        ret = false;
    }

    {
        int i;
        NABTO_LOG_INFO(("testing unabto crypto timings"));
        i = integrity_verify_timing();
        NABTO_LOG_INFO(("%i integrity checks in one second.", i));

        i = aes_cbc_timing_test();
        NABTO_LOG_INFO(("%i aes_cbc en/decryptions in one second.", i));

        i = sha256_timing_test();
        NABTO_LOG_INFO(("%i 131bytes sha256 hashes in one second.", i));

        i = aes_timing_test();
        NABTO_LOG_INFO(("%i aes blocks en/decryptiong in one second.", i));
    }

    r = test_state_machine();
    
    if (!r) {
        NABTO_LOG_ERROR(("Test of unabto stream state machine failed."));
        ret = false;
    }

    r = unabto_base32_test();
    if (!r) {
        NABTO_LOG_ERROR(("Test of base32 failed."));
        ret = false;
    }
    
    if (ret) {
        NABTO_LOG_INFO(("All uNabto tests succeded"));
    } else {
        NABTO_LOG_INFO(("Some uNabto test failed"));
    }
    return ret;
}