From: Simon Josefsson Date: Wed, 27 Jan 2010 15:23:22 +0000 (+0100) Subject: Indent and fix copyright notices. X-Git-Tag: gnutls_2_9_10~130 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d03d55606ec9aeb2628ddb60e47138ac8e55c10a;p=thirdparty%2Fgnutls.git Indent and fix copyright notices. --- diff --git a/src/benchmark.c b/src/benchmark.c index 39aa637bc7..b54a866d61 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -1,20 +1,23 @@ /* - * Copyright (C) 2009 Free Software Foundation, Inc. + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. * * This file is part of GNUTLS. * - * GNUTLS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * GNUTLS is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * GNUTLS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNUTLS is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see + * . + * + * Written by Nikos Mavrogiannopoulos . */ #include @@ -26,133 +29,142 @@ #include #include -static unsigned char data[64*1024]; +static unsigned char data[64 * 1024]; #define TOTAL_ITER 8*1024 -static void cipher_bench(int algo, int size) +static void +cipher_bench (int algo, int size) { -int ret, i; -gnutls_cipher_hd_t ctx; -void* _key,*_iv; -gnutls_datum_t key, iv; -struct timespec start, stop; -double secs; -long data_size = 0; -double dd; -int blocksize = gnutls_cipher_get_block_size(algo); -int keysize = gnutls_cipher_get_key_size(algo); - - _key = malloc(keysize); + int ret, i; + gnutls_cipher_hd_t ctx; + void *_key, *_iv; + gnutls_datum_t key, iv; + struct timespec start, stop; + double secs; + long data_size = 0; + double dd; + int blocksize = gnutls_cipher_get_block_size (algo); + int keysize = gnutls_cipher_get_key_size (algo); + + _key = malloc (keysize); if (_key == NULL) return; - memset(_key, 0xf0, keysize); + memset (_key, 0xf0, keysize); - _iv = malloc(blocksize); + _iv = malloc (blocksize); if (_iv == NULL) return; - memset(_iv, 0xf0, blocksize); + memset (_iv, 0xf0, blocksize); iv.data = _iv; iv.size = blocksize; - + key.data = _key; key.size = keysize; - - gnutls_global_init(); - - printf("Checking %s (%dkb payload)... ", gnutls_cipher_get_name(algo), size); - fflush(stdout); - clock_gettime(CLOCK_MONOTONIC, &start); - - ret = gnutls_cipher_init( &ctx, algo, &key, &iv); - if (ret < 0) { - fprintf(stderr, "error: %s\n", gnutls_strerror(ret)); - goto leave; - } - - for (i=0;i