From: Michal Ludvig <mludvig@suse.cz>
To: Christoph Hellwig <hch@infradead.org>
Cc: CryptoAPI List <cryptoapi@lists.logix.cz>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] /dev/crypto for Linux
Date: Wed, 25 Aug 2004 17:44:18 +0200 [thread overview]
Message-ID: <412CB3D2.9020706@suse.cz> (raw)
In-Reply-To: <20040825152651.A8381@infradead.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Christoph Hellwig told me that:
>>+static int
>>+clonefd(struct file *filp)
>>+{
>>+ struct files_struct * files = current->files;
>>+ int fd;
>>+
>>+ fd = get_unused_fd();
>>+ if (fd >= 0) {
>>+ get_file(filp);
>>+ FD_SET(fd, files->open_fds);
>>+ fd_install(fd, filp);
>>+ }
>>+
>>+ return fd;
>>+}
>
>
> Yikes.
>
>
>>+static int
>>+cryptodev_ioctl(struct inode *inode, struct file *filp,
>>+ unsigned int cmd, unsigned long arg)
>>+{
>>+ struct session_op sop;
>>+ struct crypt_op cop;
>>+ struct fcrypt *fcr = filp->private_data;
>>+ uint32_t ses;
>>+ int ret, fd;
>>+
>>+ if (!fcr)
>>+ BUG();
>>+
>>+ switch (cmd) {
>>+ case CRIOGET:
>>+ fd = clonefd(filp);
>>+ put_user(fd, (int*)arg);
>>+ return 0;
>
>
> Extremly bad API. Just allow opening the device multiple times,
> and get a new context each time (can be stored in file->private_data
As I already said - these are relicts from the OpenBSD API. Will be
redesigned and rewritten.
Michal Ludvig
- --
SUSE Labs mludvig@suse.cz
(+420) 296.542.396 http://www.suse.cz
Personal homepage http://www.logix.cz/michal
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFBLLPQDDolCcRbIhgRAvglAJ48SiKsO2NymzGqsn9x8EYZSoMoMQCfWqsC
t8E+AdtAgZc9Wi2Ta0xz1bs=
=emM8
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2004-08-25 15:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-24 21:37 [PATCH] /dev/crypto for Linux Michal Ludvig
[not found] ` <20040824215351.GA9272@halcrow.us>
2004-08-25 7:37 ` Michal Ludvig
2004-08-25 14:17 ` Jeff Garzik
2004-08-25 14:41 ` Michal Ludvig
2004-08-25 14:26 ` Christoph Hellwig
2004-08-25 15:44 ` Michal Ludvig [this message]
2004-08-25 14:42 ` Christoph Hellwig
2004-08-25 14:44 ` James Morris
2004-08-25 21:28 ` Bill Davidsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=412CB3D2.9020706@suse.cz \
--to=mludvig@suse.cz \
--cc=cryptoapi@lists.logix.cz \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.