OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: /dev/crypto

From: Artur Grabowski (artblahonga.org)
Date: Sat Aug 07 2004 - 08:49:39 CDT


Michal Ludvig <michal-bsdlogix.cz> writes:

> I ment - what is the difference when an application is doing:
>
> fd=open(/dev/crypto)
> ioctl(fd,CRIOGET,&fd_new1);
> ioctl(fd,CRIOGET,&fd_new2);
> ioctl(fd_new1,CIOCGSESSION);
> ioctl(fd_new2,CIOCGSESSION);
> ioctl(fd_new1,CIOCRYPT);
> ioctl(fd_new2,CIOCRYPT);
> ...
>
> instead of:
>
> fd_new1 = open(/dev/crypto);
> fd_new2 = open(/dev/crypto);
> ioctl(fd_new1,CIOCGSESSION);
> ioctl(fd_new2,CIOCGSESSION);
> ioctl(fd_new1,CIOCRYPT);
> ioctl(fd_new2,CIOCRYPT);
> ...
>
> Wouldn't opening the device twice give two independent descriptors?

Two indenpentent descriptors that talk to the same underlying vnode.
So all sessions would be shared for everyone who opens /dev/crypto.

CRIOGET is a hack. The real solution would be to make cloning devices
(one vnode for every open()). But we can't do it yet.

//art