summaryrefslogtreecommitdiff
path: root/cipher/mac.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2022-01-04 14:06:54 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2022-01-04 14:06:54 +0900
commitf9ba07942b10c72af50bd73c92c4851b6981546e (patch)
tree988f95d30b6d44d58704f415e767cd69e8672908 /cipher/mac.c
parent034e4402dade7a4bcc239913b78c702c5c6f0dbb (diff)
downloadlibgcrypt-f9ba07942b10c72af50bd73c92c4851b6981546e.tar.gz
cipher: Use const for *_spec_t, if possible.
* cipher/blake2.c: Use const. * cipher/camellia-glue.c, cipher/cipher.c, cipher/crc.c: Likewise. * cipher/des.c, cipher/gost28147.c, cipher/gostr3411-94.c: Likewise. * cipher/keccak.c, cipher/mac-cmac.c, cipher/mac-gmac.c: Likewise. * cipher/mac-hmac.c, cipher/mac-internal.h: Likewise. * cipher/mac-poly1305.c, cipher/mac.c, cipher/md.c: Likewise. * cipher/md.c, cipher/md2.c, cipher/md4.c, cipher/md5.c: Likewise. * cipher/pubkey.c, cipher/rfc2268.c, cipher/rijndael.c: Likewise. * cipher/rmd160.c, cipher/seed.c, cipher/serpent.c: Likewise. * cipher/sha1.c, cipher/sha256.c, cipher/sha512.c: Likewise. * cipher/sm3.c, cipher/sm4.c, cipher/stribog.c: Likewise. * cipher/pubkey.c, cipher/rfc2268.c, cipher/rijndael.c: Likewise. * src/cipher-proto.h, src/cipher.h: Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'cipher/mac.c')
-rw-r--r--cipher/mac.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/cipher/mac.c b/cipher/mac.c
index 9851b81c..ba1eb300 100644
--- a/cipher/mac.c
+++ b/cipher/mac.c
@@ -29,7 +29,7 @@
/* This is the list of the digest implementations included in
libgcrypt. */
-static gcry_mac_spec_t * const mac_list[] = {
+static const gcry_mac_spec_t * const mac_list[] = {
#if USE_SHA1
&_gcry_mac_type_spec_hmac_sha1,
#endif
@@ -137,7 +137,7 @@ static gcry_mac_spec_t * const mac_list[] = {
};
/* HMAC implementations start with index 101 (enum gcry_mac_algos) */
-static gcry_mac_spec_t * const mac_list_algo101[] =
+static const gcry_mac_spec_t * const mac_list_algo101[] =
{
#if USE_SHA256
&_gcry_mac_type_spec_hmac_sha256,
@@ -250,7 +250,7 @@ static gcry_mac_spec_t * const mac_list_algo101[] =
};
/* CMAC implementations start with index 201 (enum gcry_mac_algos) */
-static gcry_mac_spec_t * const mac_list_algo201[] =
+static const gcry_mac_spec_t * const mac_list_algo201[] =
{
#if USE_AES
&_gcry_mac_type_spec_cmac_aes,
@@ -315,7 +315,7 @@ static gcry_mac_spec_t * const mac_list_algo201[] =
};
/* GMAC implementations start with index 401 (enum gcry_mac_algos) */
-static gcry_mac_spec_t * const mac_list_algo401[] =
+static const gcry_mac_spec_t * const mac_list_algo401[] =
{
#if USE_AES
&_gcry_mac_type_spec_gmac_aes,
@@ -345,7 +345,7 @@ static gcry_mac_spec_t * const mac_list_algo401[] =
};
/* Poly1305-MAC implementations start with index 501 (enum gcry_mac_algos) */
-static gcry_mac_spec_t * const mac_list_algo501[] =
+static const gcry_mac_spec_t * const mac_list_algo501[] =
{
&_gcry_mac_type_spec_poly1305mac,
#if USE_AES
@@ -414,10 +414,10 @@ spec_from_algo (int algo)
/* Lookup a mac's spec by its name. */
-static gcry_mac_spec_t *
+static const gcry_mac_spec_t *
spec_from_name (const char *name)
{
- gcry_mac_spec_t *spec;
+ const gcry_mac_spec_t *spec;
int idx;
for (idx = 0; (spec = mac_list[idx]); idx++)
@@ -434,7 +434,7 @@ spec_from_name (const char *name)
int
_gcry_mac_map_name (const char *string)
{
- gcry_mac_spec_t *spec;
+ const gcry_mac_spec_t *spec;
if (!string)
return 0;
@@ -457,7 +457,7 @@ _gcry_mac_map_name (const char *string)
const char *
_gcry_mac_algo_name (int algorithm)
{
- gcry_mac_spec_t *spec;
+ const gcry_mac_spec_t *spec;
spec = spec_from_algo (algorithm);
return spec ? spec->name : "?";
@@ -483,7 +483,7 @@ check_mac_algo (int algorithm)
static gcry_err_code_t
mac_open (gcry_mac_hd_t * hd, int algo, int secure, gcry_ctx_t ctx)
{
- gcry_mac_spec_t *spec;
+ const gcry_mac_spec_t *spec;
gcry_err_code_t err;
gcry_mac_hd_t h;
@@ -674,7 +674,7 @@ _gcry_mac_get_algo (gcry_mac_hd_t hd)
unsigned int
_gcry_mac_get_algo_maclen (int algo)
{
- gcry_mac_spec_t *spec;
+ const gcry_mac_spec_t *spec;
spec = spec_from_algo (algo);
if (!spec || !spec->ops || !spec->ops->get_maclen)
@@ -687,7 +687,7 @@ _gcry_mac_get_algo_maclen (int algo)
unsigned int
_gcry_mac_get_algo_keylen (int algo)
{
- gcry_mac_spec_t *spec;
+ const gcry_mac_spec_t *spec;
spec = spec_from_algo (algo);
if (!spec || !spec->ops || !spec->ops->get_keylen)