diff mbox series

fscrypt: constify struct fscrypt_hkdf parameter to fscrypt_hkdf_expand()

Message ID 20191209204054.227736-1-ebiggers@kernel.org (mailing list archive)
State Accepted
Headers show
Series fscrypt: constify struct fscrypt_hkdf parameter to fscrypt_hkdf_expand() | expand

Commit Message

Eric Biggers Dec. 9, 2019, 8:40 p.m. UTC
From: Eric Biggers <ebiggers@google.com>

Constify the struct fscrypt_hkdf parameter to fscrypt_hkdf_expand().
This makes it clearer that struct fscrypt_hkdf contains the key only,
not any per-request state.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/crypto/fscrypt_private.h | 2 +-
 fs/crypto/hkdf.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Eric Biggers Jan. 3, 2020, 4:58 p.m. UTC | #1
On Mon, Dec 09, 2019 at 12:40:54PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Constify the struct fscrypt_hkdf parameter to fscrypt_hkdf_expand().
> This makes it clearer that struct fscrypt_hkdf contains the key only,
> not any per-request state.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  fs/crypto/fscrypt_private.h | 2 +-
>  fs/crypto/hkdf.c            | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h
> index 130b50e5a0115..23cef4d3793a5 100644
> --- a/fs/crypto/fscrypt_private.h
> +++ b/fs/crypto/fscrypt_private.h
> @@ -287,7 +287,7 @@ extern int fscrypt_init_hkdf(struct fscrypt_hkdf *hkdf, const u8 *master_key,
>  #define HKDF_CONTEXT_DIRECT_KEY		3
>  #define HKDF_CONTEXT_IV_INO_LBLK_64_KEY	4
>  
> -extern int fscrypt_hkdf_expand(struct fscrypt_hkdf *hkdf, u8 context,
> +extern int fscrypt_hkdf_expand(const struct fscrypt_hkdf *hkdf, u8 context,
>  			       const u8 *info, unsigned int infolen,
>  			       u8 *okm, unsigned int okmlen);
>  
> diff --git a/fs/crypto/hkdf.c b/fs/crypto/hkdf.c
> index f21873e1b4674..efb95bd19a894 100644
> --- a/fs/crypto/hkdf.c
> +++ b/fs/crypto/hkdf.c
> @@ -112,7 +112,7 @@ int fscrypt_init_hkdf(struct fscrypt_hkdf *hkdf, const u8 *master_key,
>   * adds to its application-specific info strings to guarantee that it doesn't
>   * accidentally repeat an info string when using HKDF for different purposes.)
>   */
> -int fscrypt_hkdf_expand(struct fscrypt_hkdf *hkdf, u8 context,
> +int fscrypt_hkdf_expand(const struct fscrypt_hkdf *hkdf, u8 context,
>  			const u8 *info, unsigned int infolen,
>  			u8 *okm, unsigned int okmlen)
>  {
> -- 
> 2.24.0.393.g34dc348eaf-goog
> 

Applied to fscrypt.git#master for 5.6.

- Eric
diff mbox series

Patch

diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h
index 130b50e5a0115..23cef4d3793a5 100644
--- a/fs/crypto/fscrypt_private.h
+++ b/fs/crypto/fscrypt_private.h
@@ -287,7 +287,7 @@  extern int fscrypt_init_hkdf(struct fscrypt_hkdf *hkdf, const u8 *master_key,
 #define HKDF_CONTEXT_DIRECT_KEY		3
 #define HKDF_CONTEXT_IV_INO_LBLK_64_KEY	4
 
-extern int fscrypt_hkdf_expand(struct fscrypt_hkdf *hkdf, u8 context,
+extern int fscrypt_hkdf_expand(const struct fscrypt_hkdf *hkdf, u8 context,
 			       const u8 *info, unsigned int infolen,
 			       u8 *okm, unsigned int okmlen);
 
diff --git a/fs/crypto/hkdf.c b/fs/crypto/hkdf.c
index f21873e1b4674..efb95bd19a894 100644
--- a/fs/crypto/hkdf.c
+++ b/fs/crypto/hkdf.c
@@ -112,7 +112,7 @@  int fscrypt_init_hkdf(struct fscrypt_hkdf *hkdf, const u8 *master_key,
  * adds to its application-specific info strings to guarantee that it doesn't
  * accidentally repeat an info string when using HKDF for different purposes.)
  */
-int fscrypt_hkdf_expand(struct fscrypt_hkdf *hkdf, u8 context,
+int fscrypt_hkdf_expand(const struct fscrypt_hkdf *hkdf, u8 context,
 			const u8 *info, unsigned int infolen,
 			u8 *okm, unsigned int okmlen)
 {