Use a seperate section for each nested struct member in INIT macro

This commit is contained in:
Martin Willi
2010-08-18 12:15:03 +02:00
parent 53115857ae
commit ba31fe1fd6
77 changed files with 615 additions and 448 deletions
@@ -278,14 +278,16 @@ gcrypt_crypter_t *gcrypt_crypter_create(encryption_algorithm_t algo,
}
INIT(this,
.public.crypter = {
.encrypt = _encrypt,
.decrypt = _decrypt,
.get_block_size = _get_block_size,
.get_iv_size = _get_iv_size,
.get_key_size = _get_key_size,
.set_key = _set_key,
.destroy = _destroy,
.public = {
.crypter = {
.encrypt = _encrypt,
.decrypt = _decrypt,
.get_block_size = _get_block_size,
.get_iv_size = _get_iv_size,
.get_key_size = _get_key_size,
.set_key = _set_key,
.destroy = _destroy,
},
},
.alg = gcrypt_alg,
.ctr_mode = mode == GCRY_CIPHER_MODE_CTR,
+8 -6
View File
@@ -185,12 +185,14 @@ gcrypt_dh_t *gcrypt_dh_create(diffie_hellman_group_t group)
}
INIT(this,
.public.dh = {
.get_shared_secret = _get_shared_secret,
.set_other_public_value = _set_other_public_value,
.get_my_public_value = _get_my_public_value,
.get_dh_group = _get_dh_group,
.destroy = _destroy,
.public = {
.dh = {
.get_shared_secret = _get_shared_secret,
.set_other_public_value = _set_other_public_value,
.get_my_public_value = _get_my_public_value,
.get_dh_group = _get_dh_group,
.destroy = _destroy,
},
},
.group = group,
.p_len = params->prime.len,
@@ -121,12 +121,14 @@ gcrypt_hasher_t *gcrypt_hasher_create(hash_algorithm_t algo)
}
INIT(this,
.public.hasher = {
.get_hash = _get_hash,
.allocate_hash = _allocate_hash,
.get_hash_size = _get_hash_size,
.reset = _reset,
.destroy = _destroy,
.public = {
.hasher = {
.get_hash = _get_hash,
.allocate_hash = _allocate_hash,
.get_hash_size = _get_hash_size,
.reset = _reset,
.destroy = _destroy,
},
},
);
@@ -138,7 +138,11 @@ plugin_t *gcrypt_plugin_create()
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
INIT(this,
.public.plugin.destroy = _destroy,
.public = {
.plugin = {
.destroy = _destroy,
},
},
);
/* hashers */
@@ -83,10 +83,12 @@ gcrypt_rng_t *gcrypt_rng_create(rng_quality_t quality)
}
INIT(this,
.public.rng = {
.get_bytes = _get_bytes,
.allocate_bytes = _allocate_bytes,
.destroy = _destroy,
.public = {
.rng = {
.get_bytes = _get_bytes,
.allocate_bytes = _allocate_bytes,
.destroy = _destroy,
},
},
.quality = quality,
);
@@ -427,19 +427,21 @@ static private_gcrypt_rsa_private_key_t *create_empty()
private_gcrypt_rsa_private_key_t *this;
INIT(this,
.public.key = {
.get_type = _get_type,
.sign = _sign,
.decrypt = _decrypt,
.get_keysize = _get_keysize,
.get_public_key = _get_public_key,
.equals = private_key_equals,
.belongs_to = private_key_belongs_to,
.get_fingerprint = _get_fingerprint,
.has_fingerprint = private_key_has_fingerprint,
.get_encoding = _get_encoding,
.get_ref = _get_ref,
.destroy = _destroy,
.public = {
.key = {
.get_type = _get_type,
.sign = _sign,
.decrypt = _decrypt,
.get_keysize = _get_keysize,
.get_public_key = _get_public_key,
.equals = private_key_equals,
.belongs_to = private_key_belongs_to,
.get_fingerprint = _get_fingerprint,
.has_fingerprint = private_key_has_fingerprint,
.get_encoding = _get_encoding,
.get_ref = _get_ref,
.destroy = _destroy,
},
},
.ref = 1,
);
@@ -322,17 +322,19 @@ gcrypt_rsa_public_key_t *gcrypt_rsa_public_key_load(key_type_t type,
}
INIT(this,
.public.key = {
.get_type = _get_type,
.verify = _verify,
.encrypt = _encrypt_,
.equals = public_key_equals,
.get_keysize = _get_keysize,
.get_fingerprint = _get_fingerprint,
.has_fingerprint = public_key_has_fingerprint,
.get_encoding = _get_encoding,
.get_ref = _get_ref,
.destroy = _destroy,
.public = {
.key = {
.get_type = _get_type,
.verify = _verify,
.encrypt = _encrypt_,
.equals = public_key_equals,
.get_keysize = _get_keysize,
.get_fingerprint = _get_fingerprint,
.has_fingerprint = public_key_has_fingerprint,
.get_encoding = _get_encoding,
.get_ref = _get_ref,
.destroy = _destroy,
},
},
.ref = 1,
);