Esempio n. 1
0
void benchmark_tls(int debug_level, int ciphers)
{
	int size;

	gnutls_global_set_log_function(tls_log_func);
	gnutls_global_set_log_level(debug_level);
	gnutls_global_init();

	if (ciphers != 0) {
		size = 1400;
		printf
		    ("Testing throughput in cipher/MAC combinations (payload: %d bytes)\n",
		     size);

		test_ciphersuite(PRIO_TLS12_AES_GCM, size);
		test_ciphersuite(PRIO_AES_GCM, size);
		test_ciphersuite(PRIO_TLS12_AES_CCM, size);
		test_ciphersuite(PRIO_AES_CCM, size);
		test_ciphersuite(PRIO_TLS12_CHACHA_POLY1305, size);
		test_ciphersuite(PRIO_CHACHA_POLY1305, size);
		test_ciphersuite(PRIO_AES_CBC_SHA1, size);
		test_ciphersuite(PRIO_CAMELLIA_CBC_SHA1, size);

		size = 16 * 1024;
		printf
		    ("\nTesting throughput in cipher/MAC combinations (payload: %d bytes)\n",
		     size);
		test_ciphersuite(PRIO_TLS12_AES_GCM, size);
		test_ciphersuite(PRIO_AES_GCM, size);
		test_ciphersuite(PRIO_TLS12_AES_CCM, size);
		test_ciphersuite(PRIO_AES_CCM, size);
		test_ciphersuite(PRIO_TLS12_CHACHA_POLY1305, size);
		test_ciphersuite(PRIO_CHACHA_POLY1305, size);
		test_ciphersuite(PRIO_AES_CBC_SHA1, size);
		test_ciphersuite(PRIO_CAMELLIA_CBC_SHA1, size);
	} else {
		printf
		    ("Testing key exchanges (RSA/DH bits: %d, EC bits: %d)\n\n",
		     rsa_bits, ec_bits);
		test_ciphersuite_kx(PRIO_DHE_RSA, GNUTLS_PK_RSA);
		test_ciphersuite_kx(PRIO_ECDH_RSA_PSS, GNUTLS_PK_RSA_PSS);
		test_ciphersuite_kx(PRIO_ECDH, GNUTLS_PK_RSA);
		test_ciphersuite_kx(PRIO_ECDH_X25519, GNUTLS_PK_RSA);
		test_ciphersuite_kx(PRIO_ECDHE_ECDSA, GNUTLS_PK_ECC);
		test_ciphersuite_kx(PRIO_ECDH_X25519_ECDSA, GNUTLS_PK_ECC);
		test_ciphersuite_kx(PRIO_ECDH_X25519_EDDSA, GNUTLS_PK_EDDSA_ED25519);
		test_ciphersuite_kx(PRIO_RSA, GNUTLS_PK_RSA);
	}

	gnutls_global_deinit();

}
Esempio n. 2
0
void benchmark_tls(int debug_level)
{
    gnutls_global_set_log_function(tls_log_func);
    gnutls_global_set_log_level(debug_level);
    gnutls_global_init();

    printf("Testing throughput in cipher/MAC combinations:\n");
    test_ciphersuite(PRIO_ARCFOUR_128_MD5, 1024);
    test_ciphersuite(PRIO_ARCFOUR_128_MD5, 4096);
    test_ciphersuite(PRIO_ARCFOUR_128_MD5, 8 * 1024);
    test_ciphersuite(PRIO_ARCFOUR_128_MD5, 15 * 1024);

    test_ciphersuite(PRIO_AES_GCM, 1024);
    test_ciphersuite(PRIO_AES_GCM, 4096);
    test_ciphersuite(PRIO_AES_GCM, 8 * 1024);
    test_ciphersuite(PRIO_AES_GCM, 15 * 1024);

    test_ciphersuite(PRIO_AES_CBC_SHA1, 1024);
    test_ciphersuite(PRIO_AES_CBC_SHA1, 4096);
    test_ciphersuite(PRIO_AES_CBC_SHA1, 8 * 1024);
    test_ciphersuite(PRIO_AES_CBC_SHA1, 15 * 1024);

    test_ciphersuite(PRIO_CAMELLIA_CBC_SHA1, 1024);
    test_ciphersuite(PRIO_CAMELLIA_CBC_SHA1, 4096);
    test_ciphersuite(PRIO_CAMELLIA_CBC_SHA1, 8 * 1024);
    test_ciphersuite(PRIO_CAMELLIA_CBC_SHA1, 15 * 1024);
    printf("\n");

    printf("Testing key exchanges:\n");
    test_ciphersuite_kx(PRIO_DH);
    test_ciphersuite_kx(PRIO_ECDH);


    gnutls_global_deinit();
    
}