Subject: lib/30355: crypto(4) ioctl names wrong
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 05/27/2005 23:01:00
>Number: 30355
>Category: lib
>Synopsis: crypto(4) gets ioctl names wrong
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: lib-bug-people
>State: open
>Class: doc-bug
>Submitter-Id: net
>Arrival-Date: Fri May 27 23:01:00 +0000 2005
>Originator: der Mouse
>Release: NetBSD 2.0
>Organization:
Dis-
>Environment:
Any 2.0. Reading crypto.4 makes me think -current has the same
problem but to a lesser extent.
>Description:
Some of the ioctl names in crypt(4) are wrong. In particular,
I see CRIOCGSESSION mentioned, when it's actually CIOCGSESSION.
In 2.0, this is true of the "IOCTL Request Descriptiosn" list;
in both 2.0 and -current (crypto.4,v 1.8), the BUGS section has
the same mistake, and additionally calls CIOCCRYPT CRIOCRYPT.
Both versions show CRIOCGET when it's actually CRIOGET.
The inconsistency between CRIOGET and the CIOC* ioctls is odd,
but (since it's documented) survivable. I'd prefer to see it
explicitly called out, though.
>How-To-Repeat:
Look at the manpage. Compare it to cryptodev.h.
>Fix:
This fixes all the above. It's relative to crypto.4,v 1.8.
For 2.0, a little additional patching is called for, to fix the
instance of CRIOCGSESSION in the ioctl list.
--- orig/crypto.4 Fri Apr 15 06:24:56 2005
+++ new/crypto.4 Fri May 27 18:52:16 2005
@@ -112,7 +112,7 @@
.\"
.Bl -tag -width CIOCFKEY
.\"
-.It Dv CRIOCGET Fa int *fd
+.It Dv CRIOGET Fa int *fd
Clone the fd argument to
.Xr ioctl 4 ,
yielding a new file descriptor which can be used to create
@@ -120,7 +120,7 @@
.\"
.It Dv CIOCGSESSION Fa struct session_op *sessp
Persistently bind a file descriptor returned by a previous
-.Dv CRIOCGET
+.Dv CRIOGET
to a session: that is, to the chosen privacy algorithm, integrity
algorithm, and keys specified in
.Fa sessp .
@@ -242,14 +242,20 @@
.Sh BUGS
Error checking and reporting is weak.
The values specified for symmetric-key key sizes to
-.Dv CRIOCGSESSION
+.Dv CIOCGSESSION
must exactly match the values expected by
.Xr opencrypto 9 .
The output buffer and MAC buffers supplied to
-.Dv CRIOCRYPT
+.Dv CIOCCRYPT
must follow whether privacy or integrity algorithms were specified for
session: if you request a
.No non- Ns Dv NULL
algorithm, you must supply a suitably-sized buffer.
.Pp
The scheme for passing arguments for asymmetric requests is Baroque.
+.Pp
+The naming inconsistency between
+.Dv CRIOGET
+and the various
+.Dv CIOC Ns \&*
+names is an unfortunate historical artifact.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B