Skip to contentSkip to conversation

keyctl_dh_compute_kdf: use a void* for opaque data

PATCH In review Ben Boeckel 2 participants 3 messages Sep 24, 2018 – Sep 25, 2018 Keys/keyrings

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 keyctl_dh_compute_kdf: use a void* for opaque data

---
 keyutils.c              | 2 +-
 keyutils.h              | 4 ++--
 man/keyctl_dh_compute.3 | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
keyutils.c +1 -1
index a087a33..5cc90cb 100644
@@ -246,7 +246,7 @@ 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, const char *hashname,
-			   const char *otherinfo, size_t otherinfolen,
+			   const void *otherinfo, size_t otherinfolen,
 			   char *buffer, size_t buflen)
 {
 	struct keyctl_dh_params params = { .priv = private,
keyutils.h +2 -2
index 273f66f..bd6137f 100644
@@ -116,7 +116,7 @@ struct keyctl_dh_params {
 
 struct keyctl_kdf_params {
 	const char *hashname;
-	const char *otherinfo;
+	const void *otherinfo;
 	uint32_t otherinfolen;
 	uint32_t __spare[8];
 };
@@ -204,7 +204,7 @@ 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,
+				  void *otherinfo, size_t otherinfolen,
 				  char *buffer, size_t buflen);
 extern long keyctl_restrict_keyring(key_serial_t keyring, const char *type,
 				    const char *restriction);
man/keyctl_dh_compute.3 +1 -1
index 58ad5df..7aaf4a6 100644
@@ -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 ", const char *" hashname ", const char *" otherinfo ",
+.BI "key_serial_t " base ", const char *" hashname ", const void *" otherinfo ",
 .BI "size_t " otherinfolen ", char *" buffer ", size_t " buflen ");"
 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .SH DESCRIPTION
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · Ben Boeckel
---
 keyutils.c              | 2 +-
 keyutils.h              | 4 ++--
 man/keyctl_dh_compute.3 | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

I'll note that these changes seem to need patches applied to the kernel as well to at least update the documentation with respect to const and void*, but it's likely code needs updated as well.

I can submit patches for these as well. I assume I should also send them here (based on dhowells/keys-asym-keyctl)?

--Ben

#2 lore raw
In reply to Ben Boeckel

Am Montag, 24. September 2018, 22:45:18 CEST schrieb Ben Boeckel:

Hi Ben,

Quoted 2 lines

I can submit patches for these as well. I assume I should also send them here (based on dhowells/keys-asym-keyctl)?

Sure.

Quoted 2 lines

--Ben

Ciao
Stephan