* [PATCH] fscrypt: constify struct fscrypt_hkdf parameter to fscrypt_hkdf_expand()
@ 2019-12-09 20:40 Eric Biggers
2020-01-03 16:58 ` Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2019-12-09 20:40 UTC (permalink / raw)
To: linux-fscrypt
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fscrypt: constify struct fscrypt_hkdf parameter to fscrypt_hkdf_expand()
2019-12-09 20:40 [PATCH] fscrypt: constify struct fscrypt_hkdf parameter to fscrypt_hkdf_expand() Eric Biggers
@ 2020-01-03 16:58 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2020-01-03 16:58 UTC (permalink / raw)
To: linux-fscrypt
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-03 16:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09 20:40 [PATCH] fscrypt: constify struct fscrypt_hkdf parameter to fscrypt_hkdf_expand() Eric Biggers
2020-01-03 16:58 ` Eric Biggers
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).