linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] security: evm: Move evm_hmac and evm_hash from evm_main.c to evm_crypto.c
@ 2018-02-27 22:16 Hernán Gonzalez
  2018-02-27 22:17 ` [PATCH 2/2] security: evm: Constify *integrity_status_msg[] Hernán Gonzalez
  2018-03-11 22:01 ` [PATCH 1/2] security: evm: Move evm_hmac and evm_hash from evm_main.c to evm_crypto.c Mimi Zohar
  0 siblings, 2 replies; 3+ messages in thread
From: Hernán Gonzalez @ 2018-02-27 22:16 UTC (permalink / raw)
  To: zohar, jmorris, serge, linux-integrity, linux-security-module,
	linux-kernel, hernan

Note: This is compile only tested.
This variable was not used where it was defined, there was no point in
declaring it there as extern, thus it got moved and constified saving up 2
bytes.

Function                                     old     new   delta
init_desc                                    273     271      -2
Total: Before=2112094, After=2112092, chg -0.00%

Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
---
 security/integrity/evm/evm.h        | 2 --
 security/integrity/evm/evm_crypto.c | 3 +++
 security/integrity/evm/evm_main.c   | 2 --
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/security/integrity/evm/evm.h b/security/integrity/evm/evm.h
index 0482539..45c4a89 100644
--- a/security/integrity/evm/evm.h
+++ b/security/integrity/evm/evm.h
@@ -31,8 +31,6 @@
 		       EVM_ALLOW_METADATA_WRITES)
 
 extern int evm_initialized;
-extern char *evm_hmac;
-extern char *evm_hash;
 
 #define EVM_ATTR_FSUUID		0x0001
 
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index 691f3e0..fdde9cb 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -37,6 +37,9 @@ static DEFINE_MUTEX(mutex);
 
 static unsigned long evm_set_key_flags;
 
+char * const evm_hmac = "hmac(sha1)";
+char * const evm_hash = "sha1";
+
 /**
  * evm_set_key() - set EVM HMAC key from the kernel
  * @key: pointer to a buffer with the key data
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c
index a8d5028..826926d 100644
--- a/security/integrity/evm/evm_main.c
+++ b/security/integrity/evm/evm_main.c
@@ -33,8 +33,6 @@ int evm_initialized;
 static char *integrity_status_msg[] = {
 	"pass", "pass_immutable", "fail", "no_label", "no_xattrs", "unknown"
 };
-char *evm_hmac = "hmac(sha1)";
-char *evm_hash = "sha1";
 int evm_hmac_attrs;
 
 char *evm_config_xattrnames[] = {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] security: evm: Constify *integrity_status_msg[]
  2018-02-27 22:16 [PATCH 1/2] security: evm: Move evm_hmac and evm_hash from evm_main.c to evm_crypto.c Hernán Gonzalez
@ 2018-02-27 22:17 ` Hernán Gonzalez
  2018-03-11 22:01 ` [PATCH 1/2] security: evm: Move evm_hmac and evm_hash from evm_main.c to evm_crypto.c Mimi Zohar
  1 sibling, 0 replies; 3+ messages in thread
From: Hernán Gonzalez @ 2018-02-27 22:17 UTC (permalink / raw)
  To: zohar, jmorris, serge, linux-integrity, linux-security-module,
	linux-kernel, hernan

Note: This is compile only tested.
There is no gain from doing this except for some self-documenting.

Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
---
 security/integrity/evm/evm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c
index 826926d..7a968fa 100644
--- a/security/integrity/evm/evm_main.c
+++ b/security/integrity/evm/evm_main.c
@@ -30,7 +30,7 @@
 
 int evm_initialized;
 
-static char *integrity_status_msg[] = {
+static const char * const integrity_status_msg[] = {
 	"pass", "pass_immutable", "fail", "no_label", "no_xattrs", "unknown"
 };
 int evm_hmac_attrs;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] security: evm: Move evm_hmac and evm_hash from evm_main.c to evm_crypto.c
  2018-02-27 22:16 [PATCH 1/2] security: evm: Move evm_hmac and evm_hash from evm_main.c to evm_crypto.c Hernán Gonzalez
  2018-02-27 22:17 ` [PATCH 2/2] security: evm: Constify *integrity_status_msg[] Hernán Gonzalez
@ 2018-03-11 22:01 ` Mimi Zohar
  1 sibling, 0 replies; 3+ messages in thread
From: Mimi Zohar @ 2018-03-11 22:01 UTC (permalink / raw)
  To: Hernán Gonzalez, jmorris, serge, linux-integrity,
	linux-security-module, linux-kernel

On Tue, 2018-02-27 at 19:16 -0300, Hernán Gonzalez wrote:
> Note: This is compile only tested.
> This variable was not used where it was defined, there was no point in
> declaring it there as extern, thus it got moved and constified saving up 2
> bytes.
> 
> Function                                     old     new   delta
> init_desc                                    273     271      -2
> Total: Before=2112094, After=2112092, chg -0.00%
> 
> Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>

Thanks, both patches have been applied.

Mimi

> ---
>  security/integrity/evm/evm.h        | 2 --
>  security/integrity/evm/evm_crypto.c | 3 +++
>  security/integrity/evm/evm_main.c   | 2 --
>  3 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/security/integrity/evm/evm.h b/security/integrity/evm/evm.h
> index 0482539..45c4a89 100644
> --- a/security/integrity/evm/evm.h
> +++ b/security/integrity/evm/evm.h
> @@ -31,8 +31,6 @@
>  		       EVM_ALLOW_METADATA_WRITES)
> 
>  extern int evm_initialized;
> -extern char *evm_hmac;
> -extern char *evm_hash;
> 
>  #define EVM_ATTR_FSUUID		0x0001
> 
> diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
> index 691f3e0..fdde9cb 100644
> --- a/security/integrity/evm/evm_crypto.c
> +++ b/security/integrity/evm/evm_crypto.c
> @@ -37,6 +37,9 @@ static DEFINE_MUTEX(mutex);
> 
>  static unsigned long evm_set_key_flags;
> 
> +char * const evm_hmac = "hmac(sha1)";
> +char * const evm_hash = "sha1";
> +
>  /**
>   * evm_set_key() - set EVM HMAC key from the kernel
>   * @key: pointer to a buffer with the key data
> diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c
> index a8d5028..826926d 100644
> --- a/security/integrity/evm/evm_main.c
> +++ b/security/integrity/evm/evm_main.c
> @@ -33,8 +33,6 @@ int evm_initialized;
>  static char *integrity_status_msg[] = {
>  	"pass", "pass_immutable", "fail", "no_label", "no_xattrs", "unknown"
>  };
> -char *evm_hmac = "hmac(sha1)";
> -char *evm_hash = "sha1";
>  int evm_hmac_attrs;
> 
>  char *evm_config_xattrnames[] = {

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-11 22:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-27 22:16 [PATCH 1/2] security: evm: Move evm_hmac and evm_hash from evm_main.c to evm_crypto.c Hernán Gonzalez
2018-02-27 22:17 ` [PATCH 2/2] security: evm: Constify *integrity_status_msg[] Hernán Gonzalez
2018-03-11 22:01 ` [PATCH 1/2] security: evm: Move evm_hmac and evm_hash from evm_main.c to evm_crypto.c Mimi Zohar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).