示例#1
0
void sh_speed_init() {
	if (timer_id == -1)
		timer_id = timer_add_cb(speed_timeout_cb,NULL);

	speed_start(speed_l);
	speed_start(speed_r);
}
示例#2
0
文件: test.c 项目: Hasimir/tcpcrypt
void test_mac_throughput(void)
{
	struct crypt *c;
	int id = TC_HMAC_SHA1_128;
	int len = get_test_param(0, 8);
	int num = get_test_param(1, 1);
	struct iovec *iov;
	int i;
	unsigned char out[1024];
	int outlen = sizeof(out);

	c = setup_cipher(TYPE_SYM, id, 1);

	iov = alloca(sizeof(*iov) * num);

	for (i = 0; i < num; i++) {
		iov[i].iov_len  = len;
		iov[i].iov_base = alloca(iov[i].iov_len);
		memset(iov[i].iov_base, 0, iov[i].iov_len);
	}

	printf("MACing %d iovecs of %d bytes each\n", num, len);

	speed_start(cipher_throughput);

	while (1) {
		crypt_mac(c, iov, num, out, &outlen);
		speed_add(1);
	}

	crypt_destroy(c);
}
示例#3
0
文件: test.c 项目: Hasimir/tcpcrypt
void test_sym_throughput(void)
{
	struct crypt *c; 
	int id	    = TC_AES128_HMAC_SHA2;
	uint64_t iv = 0;
	int dlen    = 1420;
	void *data;

	c   	      = setup_cipher(TYPE_SYM, id, 0);
	data	      = alloca(dlen);
	_state.s_dlen = dlen;
	memset(data, 0, dlen);

	printf("Encrypting %d bytes of data\n", dlen);

	speed_start(cipher_throughput);

	while (1) {
		crypt_encrypt(c, &iv, data, dlen);
		speed_add(1);
	}

	crypt_destroy(c);
}