]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: hash-method - Use named initializers
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 3 Dec 2020 14:24:52 +0000 (16:24 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 7 Dec 2020 10:09:56 +0000 (10:09 +0000)
src/lib/hash-method.c
src/lib/md4.c
src/lib/md5.c
src/lib/sha1.c
src/lib/sha2.c
src/lib/sha3.c

index c5e55023a58c12cf26c052d3b001c83b1b7b4f3c..a32e9951410e53de3df890ffb5b9c0653b80e084 100644 (file)
@@ -74,13 +74,13 @@ buffer_t *t_hash_data(const struct hash_method *meth,
 }
 
 static const struct hash_method hash_method_size = {
-       "size",
-       sizeof(uint64_t),
-       sizeof(uint64_t),
+       .name = "size",
+       .context_size = sizeof(uint64_t),
+       .digest_size = sizeof(uint64_t),
 
-       hash_method_init_size,
-       hash_method_loop_size,
-       hash_method_result_size
+       .init = hash_method_init_size,
+       .loop = hash_method_loop_size,
+       .result = hash_method_result_size
 };
 
 const struct hash_method *hash_methods[] = {
index 87228505b788bd95354f15253fbf159f732bdb63..ced55feb2a6f6fff3e87070cde8eaf50accae0c5 100644 (file)
@@ -289,11 +289,11 @@ static void hash_method_result_md4(void *context, unsigned char *result_r)
 }
 
 const struct hash_method hash_method_md4 = {
-       "md4",
-       sizeof(struct md4_context),
-       MD4_RESULTLEN,
+       .name = "md4",
+       .context_size = sizeof(struct md4_context),
+       .digest_size = MD4_RESULTLEN,
 
-       hash_method_init_md4,
-       hash_method_loop_md4,
-       hash_method_result_md4
+       .init = hash_method_init_md4,
+       .loop = hash_method_loop_md4,
+       .result = hash_method_result_md4,
 };
index 096e10fff58d56ef774e3795941ae76cdafb7d55..a479b80c9d35638dce5f17618b42da25b68908e6 100644 (file)
@@ -303,11 +303,11 @@ static void hash_method_result_md5(void *context, unsigned char *result_r)
 }
 
 const struct hash_method hash_method_md5 = {
-       "md5",
-       sizeof(struct md5_context),
-       MD5_RESULTLEN,
+       .name = "md5",
+       .context_size = sizeof(struct md5_context),
+       .digest_size = MD5_RESULTLEN,
 
-       hash_method_init_md5,
-       hash_method_loop_md5,
-       hash_method_result_md5
+       .init = hash_method_init_md5,
+       .loop = hash_method_loop_md5,
+       .result = hash_method_result_md5,
 };
index 781e54b3254fc10dbdb6ee6b15024fac873618de..62379e1634623e9a2cb9af323a2434de5df31e64 100644 (file)
@@ -277,11 +277,11 @@ static void hash_method_result_sha1(void *context, unsigned char *result_r)
 }
 
 const struct hash_method hash_method_sha1 = {
-       "sha1",
-       sizeof(struct sha1_ctxt),
-       SHA1_RESULTLEN,
+       .name = "sha1",
+       .context_size = sizeof(struct sha1_ctxt),
+       .digest_size = SHA1_RESULTLEN,
 
-       hash_method_init_sha1,
-       hash_method_loop_sha1,
-       hash_method_result_sha1
+       .init = hash_method_init_sha1,
+       .loop = hash_method_loop_sha1,
+       .result = hash_method_result_sha1,
 };
index cf058c5be71fa7f5915b0e3bda851c8ab65821f1..db7f82c0ed1ff15a4e05a7002e72433da9250cca 100644 (file)
@@ -441,13 +441,13 @@ static void hash_method_result_sha256(void *context, unsigned char *result_r)
 }
 
 const struct hash_method hash_method_sha256 = {
-       "sha256",
-       sizeof(struct sha256_ctx),
-       SHA256_RESULTLEN,
+       .name = "sha256",
+       .context_size = sizeof(struct sha256_ctx),
+       .digest_size = SHA256_RESULTLEN,
 
-       hash_method_init_sha256,
-       hash_method_loop_sha256,
-       hash_method_result_sha256
+       .init = hash_method_init_sha256,
+       .loop = hash_method_loop_sha256,
+       .result = hash_method_result_sha256,
 };
 
 static void hash_method_init_sha512(void *context)
@@ -465,11 +465,11 @@ static void hash_method_result_sha512(void *context, unsigned char *result_r)
 }
 
 const struct hash_method hash_method_sha512 = {
-       "sha512",
-       sizeof(struct sha512_ctx),
-       SHA512_RESULTLEN,
+       .name = "sha512",
+       .context_size = sizeof(struct sha512_ctx),
+       .digest_size = SHA512_RESULTLEN,
 
-       hash_method_init_sha512,
-       hash_method_loop_sha512,
-       hash_method_result_sha512
+       .init = hash_method_init_sha512,
+       .loop = hash_method_loop_sha512,
+       .result = hash_method_result_sha512,
 };
index e8d1c694d2462f7a543a4e7a7730c602dec210cf..a8bdfcdc6a711364f2f6864eae143823b7b79685 100644 (file)
@@ -303,13 +303,13 @@ static void hash_method_result_sha3_256(void *context, unsigned char *result_r)
 }
 
 const struct hash_method hash_method_sha3_256 = {
-       "sha3-256",
-       sizeof(struct sha3_ctx),
-       SHA256_RESULTLEN,
+       .name = "sha3-256",
+       .context_size = sizeof(struct sha3_ctx),
+       .digest_size = SHA256_RESULTLEN,
 
-       hash_method_init_sha3_256,
-       hash_method_loop_sha3,
-       hash_method_result_sha3_256
+       .init = hash_method_init_sha3_256,
+       .loop = hash_method_loop_sha3,
+       .result = hash_method_result_sha3_256,
 };
 
 static void hash_method_init_sha3_512(void *context)
@@ -323,11 +323,11 @@ static void hash_method_result_sha3_512(void *context, unsigned char *result_r)
 }
 
 const struct hash_method hash_method_sha3_512 = {
-       "sha3-512",
-       sizeof(struct sha3_ctx),
-       SHA512_RESULTLEN,
+       .name = "sha3-512",
+       .context_size = sizeof(struct sha3_ctx),
+       .digest_size = SHA512_RESULTLEN,
 
-       hash_method_init_sha3_512,
-       hash_method_loop_sha3,
-       hash_method_result_sha3_512
+       .init = hash_method_init_sha3_512,
+       .loop = hash_method_loop_sha3,
+       .result = hash_method_result_sha3_512,
 };