summaryrefslogtreecommitdiffstats
path: root/providers/implementations/include/prov/ciphercommon_gcm.h
diff options
context:
space:
mode:
authorWeiguo Li <liwg06@foxmail.com>2022-02-09 19:30:25 +0100
committerDr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com>2022-02-16 16:11:56 +0100
commit3d27ac8d92ef89c202b518cf6c4e15477eb594b2 (patch)
treec3146e3f1fc6caffde9e0a4afc1466d33022784d /providers/implementations/include/prov/ciphercommon_gcm.h
parenttest/helpers/handshake.c: Add check for OPENSSL_strdup (diff)
downloadopenssl-3d27ac8d92ef89c202b518cf6c4e15477eb594b2.tar.xz
openssl-3d27ac8d92ef89c202b518cf6c4e15477eb594b2.zip
Add define guards to avoid multi-inclusion
This header files are included by multiple other headers. It's better to add define guards to prevent multi-inclusion. Adhere to the coding style, all preprocessor directives inside the guards gain a space. Signed-off-by: Weiguo Li <liwg06@foxmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/17666)
Diffstat (limited to '')
-rw-r--r--providers/implementations/include/prov/ciphercommon_gcm.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/providers/implementations/include/prov/ciphercommon_gcm.h b/providers/implementations/include/prov/ciphercommon_gcm.h
index 7c4a548f9d..801a89b29c 100644
--- a/providers/implementations/include/prov/ciphercommon_gcm.h
+++ b/providers/implementations/include/prov/ciphercommon_gcm.h
@@ -8,16 +8,20 @@
* https://www.openssl.org/source/license.html
*/
-#include <openssl/aes.h>
-#include "ciphercommon_aead.h"
+#ifndef OSSL_PROV_CIPHERCOMMON_GCM_H
+# define OSSL_PROV_CIPHERCOMMON_GCM_H
+# pragma once
+
+# include <openssl/aes.h>
+# include "ciphercommon_aead.h"
typedef struct prov_gcm_hw_st PROV_GCM_HW;
-#define GCM_IV_DEFAULT_SIZE 12 /* IV's for AES_GCM should normally be 12 bytes */
-#define GCM_IV_MAX_SIZE (1024 / 8)
-#define GCM_TAG_MAX_SIZE 16
+# define GCM_IV_DEFAULT_SIZE 12 /* IV's for AES_GCM should normally be 12 bytes */
+# define GCM_IV_MAX_SIZE (1024 / 8)
+# define GCM_TAG_MAX_SIZE 16
-#if defined(OPENSSL_CPUID_OBJ) && defined(__s390__)
+# if defined(OPENSSL_CPUID_OBJ) && defined(__s390__)
/*-
* KMA-GCM-AES parameter block - begin
* (see z/Architecture Principles of Operation >= SA22-7832-11)
@@ -42,7 +46,7 @@ typedef struct S390X_kma_params_st {
unsigned char k[32]; /* key */
} S390X_KMA_PARAMS;
-#endif
+# endif
typedef struct prov_gcm_ctx_st {
unsigned int mode; /* The mode that we are using */
@@ -121,9 +125,11 @@ int ossl_gcm_one_shot(PROV_GCM_CTX *ctx, unsigned char *aad, size_t aad_len,
int ossl_gcm_cipher_update(PROV_GCM_CTX *ctx, const unsigned char *in,
size_t len, unsigned char *out);
-#define GCM_HW_SET_KEY_CTR_FN(ks, fn_set_enc_key, fn_block, fn_ctr) \
+# define GCM_HW_SET_KEY_CTR_FN(ks, fn_set_enc_key, fn_block, fn_ctr) \
ctx->ks = ks; \
fn_set_enc_key(key, keylen * 8, ks); \
CRYPTO_gcm128_init(&ctx->gcm, ks, (block128_f)fn_block); \
ctx->ctr = (ctr128_f)fn_ctr; \
ctx->key_set = 1;
+
+#endif