All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 4/7] keyctl_dh_compute_kdf: const-ify input parameters
@ 2018-09-27 13:14 Ben Boeckel
  2018-11-02 14:50 ` David Howells
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ben Boeckel @ 2018-09-27 13:14 UTC (permalink / raw)
  To: keyrings

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
---
 keyutils.c              | 5 +++--
 keyutils.h              | 8 ++++----
 man/keyctl_dh_compute.3 | 2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/keyutils.c b/keyutils.c
index fc7dc4d..a087a33 100644
--- a/keyutils.c
+++ b/keyutils.c
@@ -245,8 +245,9 @@ long keyctl_dh_compute(key_serial_t priv, key_serial_t prime,
 }
 
 long keyctl_dh_compute_kdf(key_serial_t private, key_serial_t prime,
-			   key_serial_t base, char *hashname, char *otherinfo,
-			   size_t otherinfolen, char *buffer, size_t buflen)
+			   key_serial_t base, const char *hashname,
+			   const char *otherinfo, size_t otherinfolen,
+			   char *buffer, size_t buflen)
 {
 	struct keyctl_dh_params params = { .priv = private,
 					   .prime = prime,
diff --git a/keyutils.h b/keyutils.h
index 5f81c62..208c175 100644
--- a/keyutils.h
+++ b/keyutils.h
@@ -115,8 +115,8 @@ struct keyctl_dh_params {
 };
 
 struct keyctl_kdf_params {
-	char *hashname;
-	char *otherinfo;
+	const char *hashname;
+	const char *otherinfo;
 	uint32_t otherinfolen;
 	uint32_t __spare[8];
 };
@@ -203,8 +203,8 @@ extern long keyctl_get_persistent(uid_t uid, key_serial_t id);
 extern long keyctl_dh_compute(key_serial_t priv, key_serial_t prime,
 			      key_serial_t base, char *buffer, size_t buflen);
 extern long keyctl_dh_compute_kdf(key_serial_t private, key_serial_t prime,
-				  key_serial_t base, char *hashname,
-				  char *otherinfo, size_t otherinfolen,
+				  key_serial_t base, const char *hashname,
+				  const char *otherinfo, size_t otherinfolen,
 				  char *buffer, size_t buflen);
 extern long keyctl_restrict_keyring(key_serial_t keyring, const char *type,
 				    const char *restriction);
diff --git a/man/keyctl_dh_compute.3 b/man/keyctl_dh_compute.3
index 09c5d21..58ad5df 100644
--- a/man/keyctl_dh_compute.3
+++ b/man/keyctl_dh_compute.3
@@ -25,7 +25,7 @@ keyctl_dh_compute_kdf \- Derive key from a Diffie-Hellman shared secret
 .BI "key_serial_t " prime ", key_serial_t " base ", void **" _buffer ");"
 .sp
 .BI "long keyctl_dh_compute_kdf(key_serial_t " private ", key_serial_t " prime ,
-.BI "key_serial_t " base ", char *" hashname ", char *" otherinfo ",
+.BI "key_serial_t " base ", const char *" hashname ", const char *" otherinfo ",
 .BI "size_t " otherinfolen ", char *" buffer ", size_t " buflen ");"
 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .SH DESCRIPTION
-- 
2.19.0.221.g150f307afc

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

* Re: [PATCH v2 4/7] keyctl_dh_compute_kdf: const-ify input parameters
  2018-09-27 13:14 [PATCH v2 4/7] keyctl_dh_compute_kdf: const-ify input parameters Ben Boeckel
@ 2018-11-02 14:50 ` David Howells
  2018-11-02 15:08 ` David Howells
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Howells @ 2018-11-02 14:50 UTC (permalink / raw)
  To: keyrings

Applied.

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

* Re: [PATCH v2 4/7] keyctl_dh_compute_kdf: const-ify input parameters
  2018-09-27 13:14 [PATCH v2 4/7] keyctl_dh_compute_kdf: const-ify input parameters Ben Boeckel
  2018-11-02 14:50 ` David Howells
@ 2018-11-02 15:08 ` David Howells
  2018-11-02 16:05 ` Ben Boeckel
  2018-11-02 16:20 ` David Howells
  3 siblings, 0 replies; 5+ messages in thread
From: David Howells @ 2018-11-02 15:08 UTC (permalink / raw)
  To: keyrings

Ben Boeckel <mathstuf@gmail.com> wrote:

>  struct keyctl_kdf_params {
> -	char *hashname;
> -	char *otherinfo;
> +	const char *hashname;
> +	const char *otherinfo;
>  	uint32_t otherinfolen;
>  	uint32_t __spare[8];
>  };

Actually, that's potentially not okay.  If some code out there has:

	struct keyctl_kdf_params p = {
		.hashname = "foo"
	};

	...

	char *h = p.hashname;

that will no longer compile, so I'm not going to apply this patch for the
moment.

David

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

* Re: [PATCH v2 4/7] keyctl_dh_compute_kdf: const-ify input parameters
  2018-09-27 13:14 [PATCH v2 4/7] keyctl_dh_compute_kdf: const-ify input parameters Ben Boeckel
  2018-11-02 14:50 ` David Howells
  2018-11-02 15:08 ` David Howells
@ 2018-11-02 16:05 ` Ben Boeckel
  2018-11-02 16:20 ` David Howells
  3 siblings, 0 replies; 5+ messages in thread
From: Ben Boeckel @ 2018-11-02 16:05 UTC (permalink / raw)
  To: keyrings

On Fri, Nov 02, 2018 at 15:08:56 +0000, David Howells wrote:
> Actually, that's potentially not okay.  If some code out there has:
> 
> 	struct keyctl_kdf_params p = {
> 		.hashname = "foo"
> 	};
> 
> 	...
> 
> 	char *h = p.hashname;
> 
> that will no longer compile, so I'm not going to apply this patch for the
> moment.

What code is using a non-released version of libkeyutils and expects it
to work as-is when the relevant code does land? These patches are not
against `master`, but `next` (sorry, should have mentioned that or made
it clearer).

--Ben

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

* Re: [PATCH v2 4/7] keyctl_dh_compute_kdf: const-ify input parameters
  2018-09-27 13:14 [PATCH v2 4/7] keyctl_dh_compute_kdf: const-ify input parameters Ben Boeckel
                   ` (2 preceding siblings ...)
  2018-11-02 16:05 ` Ben Boeckel
@ 2018-11-02 16:20 ` David Howells
  3 siblings, 0 replies; 5+ messages in thread
From: David Howells @ 2018-11-02 16:20 UTC (permalink / raw)
  To: keyrings

Ben Boeckel <mathstuf@gmail.com> wrote:

> What code is using a non-released version of libkeyutils and expects it
> to work as-is when the relevant code does land?

Ummm...

	struct keyctl_kdf_params {
		char *hashname;
		char *otherinfo;
		uint32_t otherinfolen;
		uint32_t __spare[8];
	};

is in v1.5.11 as released in August.

David

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

end of thread, other threads:[~2018-11-02 16:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-27 13:14 [PATCH v2 4/7] keyctl_dh_compute_kdf: const-ify input parameters Ben Boeckel
2018-11-02 14:50 ` David Howells
2018-11-02 15:08 ` David Howells
2018-11-02 16:05 ` Ben Boeckel
2018-11-02 16:20 ` David Howells

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.