Re: [Ocf-linux-users] crypto_newsession / crypto_freesession
                
                Brought to you by:
                
                    david-m
                    
                
            
            
        
        
        
    | 
      
      
      From: Pirasenna T. <pir...@gm...> - 2009-01-29 05:12:58
      
     | 
| I'm writing a driver and attempting it to make it OCF compatible. I was intending on passing the virtual memory address I allocate for driver data structures for a given operation as the session id. To avoid 32/64bit issues, having the crypto_newsession pass in u_int64_t * would make it convenient. Otherwise, I'll have to keep a mapping table and look up routines appropriately (unnecessary computation cycles). >From the looks of it, it seems just like an interface definition issue, since as I pointed out, from within the ioctl, it does use u_int64_t internally. Piras On Wed, Jan 28, 2009 at 3:58 PM, David McCullough < Dav...@se...> wrote: > > Jivin Pirasenna Thiyagarajan lays it down ... > > I've used OCF patch and attempting to use the cryptodev interface. In > > ocf-compat.h, I see crypto_newsession's session ID is passed in as a > > u_int32_t *, whereas, the crypto_freesession takes the session id as > > u_int64_t. It seems like this is in error. Looks like sid data type > should > > be u_int64_t *sidp. In cryptodev.c where it is used, the sid is defined > as > > u_int64_t in cryptodev_ioctl. > > I had to look twice at that too now that you point it out. > > The trick is that device_method_t structure and resulting > CRYPTODEV_NEWSESSION and cryptodev_newsession used for it are > part of the interface for OCF drivers. This is how OCF communicates > with it's crypto drivers (ie., safe, hifn7751, cryptosoft etc). > > cryptodev, the user interface driver, doesn't talk to the crypto > drivers, it uses the OCF API's: > > crypto_newsession > crypto_freesession > > and they are both u_int64_t. > > Are you having a problem with cryptodev or did you just notice this oddity > in the code ? > > I admit the naming is confusing, but we inherited that with that last > round of BSD updates. Unless you are writing a driver, ignore the section > at the top of ocf-compat.h, in fact, ignore as much of ocf-compat.h > as you can every chance you get :-) It's where we hide the older OS > support and some BSD compat things to try and keep the driver source as > close to the original as practical. > > Cheers, > Davidm > > -- > David McCullough, dav...@se..., Ph:+61 > 734352815 > Secure Computing - SnapGear http://www.uCdot.org > http://www.snapgear.com > -- Online Gallery: http://www.deptons.com You comments and ratings are very welcome!! |