Skip to content
Snippets Groups Projects
Commit 09f2af0b authored by Niels Möller's avatar Niels Möller
Browse files

(time_cipher): Don't use GNU C

non-constant initializers.

Rev: src/nettle/examples/nettle-benchmark.c:1.7
parent 0069ff9b
Branches
Tags
No related merge requests found
...@@ -173,8 +173,11 @@ time_cipher(const struct nettle_cipher *cipher) ...@@ -173,8 +173,11 @@ time_cipher(const struct nettle_cipher *cipher)
init_data(data); init_data(data);
{ {
struct bench_cipher_info info /* Decent initializers are a GNU extension, so don't use it here. */
= { ctx, cipher->encrypt, data }; struct bench_cipher_info info;
info.ctx = ctx;
info.crypt = cipher->encrypt;
info.data = data;
init_key(cipher->key_size, key); init_key(cipher->key_size, key);
cipher->set_encrypt_key(ctx, cipher->key_size, key); cipher->set_encrypt_key(ctx, cipher->key_size, key);
...@@ -184,8 +187,10 @@ time_cipher(const struct nettle_cipher *cipher) ...@@ -184,8 +187,10 @@ time_cipher(const struct nettle_cipher *cipher)
} }
{ {
struct bench_cipher_info info struct bench_cipher_info info;
= { ctx, cipher->decrypt, data }; info.ctx = ctx;
info.crypt = cipher->decrypt;
info.data = data;
init_key(cipher->key_size, key); init_key(cipher->key_size, key);
cipher->set_decrypt_key(ctx, cipher->key_size, key); cipher->set_decrypt_key(ctx, cipher->key_size, key);
...@@ -200,8 +205,12 @@ time_cipher(const struct nettle_cipher *cipher) ...@@ -200,8 +205,12 @@ time_cipher(const struct nettle_cipher *cipher)
/* Do CBC mode */ /* Do CBC mode */
{ {
struct bench_cbc_info info struct bench_cbc_info info;
= { ctx, cipher->encrypt, data, cipher->block_size, iv }; info.ctx = ctx;
info.crypt = cipher->encrypt;
info.data = data;
info.block_size = cipher->block_size;
info.iv = iv;
memset(iv, 0, sizeof(iv)); memset(iv, 0, sizeof(iv));
...@@ -212,8 +221,12 @@ time_cipher(const struct nettle_cipher *cipher) ...@@ -212,8 +221,12 @@ time_cipher(const struct nettle_cipher *cipher)
} }
{ {
struct bench_cbc_info info struct bench_cbc_info info;
= { ctx, cipher->decrypt, data, cipher->block_size, iv }; info.ctx = ctx;
info.crypt = cipher->decrypt;
info.data = data;
info.block_size = cipher->block_size;
info.iv = iv;
memset(iv, 0, sizeof(iv)); memset(iv, 0, sizeof(iv));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment