crypto: x86/aesni-gcm - make 'struct aesni_gcm_tfm_s' static const
authorEric Biggers <ebiggers@google.com>
Thu, 10 Jan 2019 20:17:57 +0000 (12:17 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 18 Jan 2019 10:43:43 +0000 (18:43 +0800)
Add missing static keywords to fix the following sparse warnings:

    arch/x86/crypto/aesni-intel_glue.c:197:24: warning: symbol 'aesni_gcm_tfm_sse' was not declared. Should it be static?
    arch/x86/crypto/aesni-intel_glue.c:246:24: warning: symbol 'aesni_gcm_tfm_avx_gen2' was not declared. Should it be static?
    arch/x86/crypto/aesni-intel_glue.c:291:24: warning: symbol 'aesni_gcm_tfm_avx_gen4' was not declared. Should it be static?

I also made the affected structures 'const', and adjusted the
indentation in the struct definition to not be insane.

Cc: Dave Watson <davejwatson@fb.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/aesni-intel_glue.c

index 1321700d6647f8be1f7894e00405c8ad40e51c38..9b5ccde3ef315289a17e53e6af7491544a3f86c7 100644 (file)
@@ -175,26 +175,18 @@ asmlinkage void aesni_gcm_finalize(void *ctx,
                                   struct gcm_context_data *gdata,
                                   u8 *auth_tag, unsigned long auth_tag_len);
 
-static struct aesni_gcm_tfm_s {
-void (*init)(void *ctx,
-                               struct gcm_context_data *gdata,
-                               u8 *iv,
-                               u8 *hash_subkey, const u8 *aad,
-                               unsigned long aad_len);
-void (*enc_update)(void *ctx,
-                                       struct gcm_context_data *gdata, u8 *out,
-                                       const u8 *in,
-                                       unsigned long plaintext_len);
-void (*dec_update)(void *ctx,
-                                       struct gcm_context_data *gdata, u8 *out,
-                                       const u8 *in,
-                                       unsigned long ciphertext_len);
-void (*finalize)(void *ctx,
-                               struct gcm_context_data *gdata,
-                               u8 *auth_tag, unsigned long auth_tag_len);
+static const struct aesni_gcm_tfm_s {
+       void (*init)(void *ctx, struct gcm_context_data *gdata, u8 *iv,
+                    u8 *hash_subkey, const u8 *aad, unsigned long aad_len);
+       void (*enc_update)(void *ctx, struct gcm_context_data *gdata, u8 *out,
+                          const u8 *in, unsigned long plaintext_len);
+       void (*dec_update)(void *ctx, struct gcm_context_data *gdata, u8 *out,
+                          const u8 *in, unsigned long ciphertext_len);
+       void (*finalize)(void *ctx, struct gcm_context_data *gdata,
+                        u8 *auth_tag, unsigned long auth_tag_len);
 } *aesni_gcm_tfm;
 
-struct aesni_gcm_tfm_s aesni_gcm_tfm_sse = {
+static const struct aesni_gcm_tfm_s aesni_gcm_tfm_sse = {
        .init = &aesni_gcm_init,
        .enc_update = &aesni_gcm_enc_update,
        .dec_update = &aesni_gcm_dec_update,
@@ -243,7 +235,7 @@ asmlinkage void aesni_gcm_dec_avx_gen2(void *ctx,
                        const u8 *aad, unsigned long aad_len,
                        u8 *auth_tag, unsigned long auth_tag_len);
 
-struct aesni_gcm_tfm_s aesni_gcm_tfm_avx_gen2 = {
+static const struct aesni_gcm_tfm_s aesni_gcm_tfm_avx_gen2 = {
        .init = &aesni_gcm_init_avx_gen2,
        .enc_update = &aesni_gcm_enc_update_avx_gen2,
        .dec_update = &aesni_gcm_dec_update_avx_gen2,
@@ -288,7 +280,7 @@ asmlinkage void aesni_gcm_dec_avx_gen4(void *ctx,
                        const u8 *aad, unsigned long aad_len,
                        u8 *auth_tag, unsigned long auth_tag_len);
 
-struct aesni_gcm_tfm_s aesni_gcm_tfm_avx_gen4 = {
+static const struct aesni_gcm_tfm_s aesni_gcm_tfm_avx_gen4 = {
        .init = &aesni_gcm_init_avx_gen4,
        .enc_update = &aesni_gcm_enc_update_avx_gen4,
        .dec_update = &aesni_gcm_dec_update_avx_gen4,
@@ -778,7 +770,7 @@ static int gcmaes_crypt_by_sg(bool enc, struct aead_request *req,
 {
        struct crypto_aead *tfm = crypto_aead_reqtfm(req);
        unsigned long auth_tag_len = crypto_aead_authsize(tfm);
-       struct aesni_gcm_tfm_s *gcm_tfm = aesni_gcm_tfm;
+       const struct aesni_gcm_tfm_s *gcm_tfm = aesni_gcm_tfm;
        struct gcm_context_data data AESNI_ALIGN_ATTR;
        struct scatter_walk dst_sg_walk = {};
        unsigned long left = req->cryptlen;