Re: [CRYPTO] is it really optimized ?

2007-04-23 Thread Francis Moreau
Hi [Sorry for the late answer] On 4/19/07, Francis Moreau <[EMAIL PROTECTED]> wrote: On 4/17/07, Roland Dreier <[EMAIL PROTECTED]> wrote: > > > It seems trivial to keep the last key you were given and do a quick > > > memcmp in your setkey method to see if it's different from the last > > >

Re: [CRYPTO] is it really optimized ?

2007-04-23 Thread Francis Moreau
Hi [Sorry for the late answer] On 4/19/07, Francis Moreau [EMAIL PROTECTED] wrote: On 4/17/07, Roland Dreier [EMAIL PROTECTED] wrote: It seems trivial to keep the last key you were given and do a quick memcmp in your setkey method to see if it's different from the last key you

Re: [CRYPTO] is it really optimized ?

2007-04-19 Thread Francis Moreau
On 4/17/07, Roland Dreier <[EMAIL PROTECTED]> wrote: > > It seems trivial to keep the last key you were given and do a quick > > memcmp in your setkey method to see if it's different from the last > > key you pushed to hardware, and set a flag if it is. Then only do > > your set_key() if

Re: [CRYPTO] is it really optimized ?

2007-04-19 Thread Francis Moreau
On 4/17/07, Roland Dreier [EMAIL PROTECTED] wrote: It seems trivial to keep the last key you were given and do a quick memcmp in your setkey method to see if it's different from the last key you pushed to hardware, and set a flag if it is. Then only do your set_key() if you have a

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Roland Dreier
> > It seems trivial to keep the last key you were given and do a quick > > memcmp in your setkey method to see if it's different from the last > > key you pushed to hardware, and set a flag if it is. Then only do > > your set_key() if you have a new key to pass to hardware. > > > > I'm

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Roland Dreier <[EMAIL PROTECTED]> wrote: > > I wonder if there's some way you can cache the last caller and reload > > the key lazily (only when it changes). > > yes something that allows crypto drivers to detect if the key has > changed would be good. It seems trivial to keep

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Evgeniy Polyakov
On Tue, Apr 17, 2007 at 06:18:42PM +0200, Francis Moreau ([EMAIL PROTECTED]) wrote: > >If there are no another users, your code already has exclusive access. > > sorry I don't understand that. Since there are no users except your module, you do have exclusive access already, i.e. you can stop

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Roland Dreier
> > I wonder if there's some way you can cache the last caller and reload > > the key lazily (only when it changes). > > yes something that allows crypto drivers to detect if the key has > changed would be good. It seems trivial to keep the last key you were given and do a quick memcmp in

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Evgeniy Polyakov
On Tue, Apr 17, 2007 at 05:34:12PM +0200, Francis Moreau ([EMAIL PROTECTED]) wrote: > >Preventing anyone from using the module is incorrect. > >How will you handle the case when you have only one algo registered and > >it will be exclusively used by ecryptfs? > > > > As I tried to explain, in

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Roland Dreier
> Again, my code is faster only because I skip the key loading in > "cia_encrypt" method. Actually the gain is bigger in decryption mode > than in encryption one because I also generate the decryption key for > each block. I wonder if there's some way you can cache the last caller and

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Evgeniy Polyakov <[EMAIL PROTECTED]> wrote: On Tue, Apr 17, 2007 at 04:01:51PM +0200, Francis Moreau ([EMAIL PROTECTED]) wrote: > On 4/17/07, Herbert Xu <[EMAIL PROTECTED]> wrote: > > > >Yep. We don't need such a flag anyway. All we need is a way to tweak > >the priority and Bob's

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Herbert Xu <[EMAIL PROTECTED]> wrote: Francis Moreau <[EMAIL PROTECTED]> wrote: > On 4/17/07, Herbert Xu <[EMAIL PROTECTED]> wrote: >> >> Actually, I was referring to your AES module :) > > Well I don't if I can do that unfortunately. What's the problem? Always the same problem.

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Evgeniy Polyakov <[EMAIL PROTECTED]> wrote: If there are another users, then flag should not be set. depends if there's a 'generic' algo that can be used at the same time. Admin should know that. If there are no another users, your code already has exclusive access. sorry I

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Evgeniy Polyakov
On Tue, Apr 17, 2007 at 04:01:51PM +0200, Francis Moreau ([EMAIL PROTECTED]) wrote: > On 4/17/07, Herbert Xu <[EMAIL PROTECTED]> wrote: > > > >Yep. We don't need such a flag anyway. All we need is a way to tweak > >the priority and Bob's your uncle. > > > > Could you elaborate please, I don't

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Evgeniy Polyakov <[EMAIL PROTECTED]> wrote: > OK, I tried to cook up something very simple. Since I don't know this > code, please be indulgent when reading the following patch ;) Which means that after one has loaded ecryptfs module it can not use ipsec and dm-crypt if there is

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Herbert Xu
Francis Moreau <[EMAIL PROTECTED]> wrote: > On 4/17/07, Herbert Xu <[EMAIL PROTECTED]> wrote: >> >> Actually, I was referring to your AES module :) > > Well I don't if I can do that unfortunately. What's the problem? > Actually there's nothing really interesting in this code, only key or > acc

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Herbert Xu
Evgeniy Polyakov <[EMAIL PROTECTED]> wrote: > >> OK, I tried to cook up something very simple. Since I don't know this >> code, please be indulgent when reading the following patch ;) > > Which means that after one has loaded ecryptfs module it can not use > ipsec and dm-crypt if there is only

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Herbert Xu
Francis Moreau <[EMAIL PROTECTED]> wrote: > >> > normal version: >> > test 4 (128 bit key, 8192 byte blocks): 1 operation in 67991 cycles (8192 >> > bytes) >> > >> > optimized version: >> > test 4 (128 bit key, 8192 byte blocks): 1 operation in 51783 cycles (8192 >> > bytes) >> > >> > So the gain

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Roland Dreier <[EMAIL PROTECTED]> wrote: > Again, my code is faster only because I skip the key loading in > "cia_encrypt" method. Actually the gain is bigger in decryption mode > than in encryption one because I also generate the decryption key for > each block. I wonder if

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Herbert Xu <[EMAIL PROTECTED]> wrote: Yep. We don't need such a flag anyway. All we need is a way to tweak the priority and Bob's your uncle. Could you elaborate please, I don't see how you prevent others users to use this module with priority. Priority is a stuff that tells

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Herbert Xu <[EMAIL PROTECTED]> wrote: Actually, I was referring to your AES module :) Well I don't if I can do that unfortunately. Actually there's nothing really interesting in this code, only key or acc loadings and that's it. What do you want to see exactly ? Thanks --

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Herbert Xu <[EMAIL PROTECTED]> wrote: On Mon, Apr 16, 2007 at 10:37:01AM +0200, Francis Moreau wrote: > > BTW, here are figures I got with 2 different versions of the driver > when using tcrypt module. The second being the result with the > optimized driver (no key reloading on each

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Evgeniy Polyakov
On Tue, Apr 17, 2007 at 02:36:09PM +0200, Francis Moreau ([EMAIL PROTECTED]) wrote: > >> BTW, here are figures I got with 2 different versions of the driver > >> when using tcrypt module. The second being the result with the > >> optimized driver (no key reloading on each block): > >> > >> normal

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Evgeniy Polyakov
On Tue, Apr 17, 2007 at 02:36:09PM +0200, Francis Moreau ([EMAIL PROTECTED]) wrote: BTW, here are figures I got with 2 different versions of the driver when using tcrypt module. The second being the result with the optimized driver (no key reloading on each block): normal version:

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Herbert Xu [EMAIL PROTECTED] wrote: On Mon, Apr 16, 2007 at 10:37:01AM +0200, Francis Moreau wrote: BTW, here are figures I got with 2 different versions of the driver when using tcrypt module. The second being the result with the optimized driver (no key reloading on each

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Evgeniy Polyakov [EMAIL PROTECTED] wrote: OK, I tried to cook up something very simple. Since I don't know this code, please be indulgent when reading the following patch ;) Which means that after one has loaded ecryptfs module it can not use ipsec and dm-crypt if there is only

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Roland Dreier
Again, my code is faster only because I skip the key loading in cia_encrypt method. Actually the gain is bigger in decryption mode than in encryption one because I also generate the decryption key for each block. I wonder if there's some way you can cache the last caller and reload the

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Evgeniy Polyakov [EMAIL PROTECTED] wrote: On Tue, Apr 17, 2007 at 04:01:51PM +0200, Francis Moreau ([EMAIL PROTECTED]) wrote: On 4/17/07, Herbert Xu [EMAIL PROTECTED] wrote: Yep. We don't need such a flag anyway. All we need is a way to tweak the priority and Bob's your

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Evgeniy Polyakov
On Tue, Apr 17, 2007 at 05:34:12PM +0200, Francis Moreau ([EMAIL PROTECTED]) wrote: Preventing anyone from using the module is incorrect. How will you handle the case when you have only one algo registered and it will be exclusively used by ecryptfs? As I tried to explain, in that case

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Roland Dreier
I wonder if there's some way you can cache the last caller and reload the key lazily (only when it changes). yes something that allows crypto drivers to detect if the key has changed would be good. It seems trivial to keep the last key you were given and do a quick memcmp in your

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Herbert Xu [EMAIL PROTECTED] wrote: Francis Moreau [EMAIL PROTECTED] wrote: On 4/17/07, Herbert Xu [EMAIL PROTECTED] wrote: Actually, I was referring to your AES module :) Well I don't if I can do that unfortunately. What's the problem? Always the same problem. Some stupid

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Evgeniy Polyakov [EMAIL PROTECTED] wrote: If there are another users, then flag should not be set. depends if there's a 'generic' algo that can be used at the same time. Admin should know that. If there are no another users, your code already has exclusive access. sorry I

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Evgeniy Polyakov
On Tue, Apr 17, 2007 at 04:01:51PM +0200, Francis Moreau ([EMAIL PROTECTED]) wrote: On 4/17/07, Herbert Xu [EMAIL PROTECTED] wrote: Yep. We don't need such a flag anyway. All we need is a way to tweak the priority and Bob's your uncle. Could you elaborate please, I don't see how you

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Herbert Xu
Evgeniy Polyakov [EMAIL PROTECTED] wrote: OK, I tried to cook up something very simple. Since I don't know this code, please be indulgent when reading the following patch ;) Which means that after one has loaded ecryptfs module it can not use ipsec and dm-crypt if there is only one crypto

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Roland Dreier [EMAIL PROTECTED] wrote: Again, my code is faster only because I skip the key loading in cia_encrypt method. Actually the gain is bigger in decryption mode than in encryption one because I also generate the decryption key for each block. I wonder if there's

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Herbert Xu
Francis Moreau [EMAIL PROTECTED] wrote: On 4/17/07, Herbert Xu [EMAIL PROTECTED] wrote: Actually, I was referring to your AES module :) Well I don't if I can do that unfortunately. What's the problem? Actually there's nothing really interesting in this code, only key or acc loadings and

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Herbert Xu [EMAIL PROTECTED] wrote: Actually, I was referring to your AES module :) Well I don't if I can do that unfortunately. Actually there's nothing really interesting in this code, only key or acc loadings and that's it. What do you want to see exactly ? Thanks --

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Herbert Xu [EMAIL PROTECTED] wrote: Yep. We don't need such a flag anyway. All we need is a way to tweak the priority and Bob's your uncle. Could you elaborate please, I don't see how you prevent others users to use this module with priority. Priority is a stuff that tells you

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Herbert Xu
Francis Moreau [EMAIL PROTECTED] wrote: normal version: test 4 (128 bit key, 8192 byte blocks): 1 operation in 67991 cycles (8192 bytes) optimized version: test 4 (128 bit key, 8192 byte blocks): 1 operation in 51783 cycles (8192 bytes) So the gain is 16000 cycles which seems to

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Evgeniy Polyakov
On Tue, Apr 17, 2007 at 06:18:42PM +0200, Francis Moreau ([EMAIL PROTECTED]) wrote: If there are no another users, your code already has exclusive access. sorry I don't understand that. Since there are no users except your module, you do have exclusive access already, i.e. you can stop key

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Francis Moreau
On 4/17/07, Roland Dreier [EMAIL PROTECTED] wrote: I wonder if there's some way you can cache the last caller and reload the key lazily (only when it changes). yes something that allows crypto drivers to detect if the key has changed would be good. It seems trivial to keep the last

Re: [CRYPTO] is it really optimized ?

2007-04-17 Thread Roland Dreier
It seems trivial to keep the last key you were given and do a quick memcmp in your setkey method to see if it's different from the last key you pushed to hardware, and set a flag if it is. Then only do your set_key() if you have a new key to pass to hardware. I'm assuming the

Re: [CRYPTO] is it really optimized ?

2007-04-16 Thread Herbert Xu
On Mon, Apr 16, 2007 at 10:37:01AM +0200, Francis Moreau wrote: > > BTW, here are figures I got with 2 different versions of the driver > when using tcrypt module. The second being the result with the > optimized driver (no key reloading on each block): > > normal version: > test 4 (128 bit key,

Re: [CRYPTO] is it really optimized ?

2007-04-16 Thread Francis Moreau
On 4/15/07, Herbert Xu <[EMAIL PROTECTED]> wrote: On Sat, Apr 14, 2007 at 11:10:08PM +0200, Francis Moreau wrote: > > ok but do you think it's safe to assume that no others parts of the > kernel will request "aes-foo" ? Remember that the main point is to > optimize "aes-foo" ? What they request

Re: [CRYPTO] is it really optimized ?

2007-04-16 Thread Francis Moreau
On 4/15/07, Herbert Xu [EMAIL PROTECTED] wrote: On Sat, Apr 14, 2007 at 11:10:08PM +0200, Francis Moreau wrote: ok but do you think it's safe to assume that no others parts of the kernel will request aes-foo ? Remember that the main point is to optimize aes-foo ? What they request is up to

Re: [CRYPTO] is it really optimized ?

2007-04-16 Thread Herbert Xu
On Mon, Apr 16, 2007 at 10:37:01AM +0200, Francis Moreau wrote: BTW, here are figures I got with 2 different versions of the driver when using tcrypt module. The second being the result with the optimized driver (no key reloading on each block): normal version: test 4 (128 bit key, 8192

Re: [CRYPTO] is it really optimized ?

2007-04-15 Thread Herbert Xu
On Sat, Apr 14, 2007 at 11:10:08PM +0200, Francis Moreau wrote: > > ok but do you think it's safe to assume that no others parts of the > kernel will request "aes-foo" ? Remember that the main point is to > optimize "aes-foo" ? What they request is up to the administrator. Cheers, -- Visit

Re: [CRYPTO] is it really optimized ?

2007-04-15 Thread Herbert Xu
On Sat, Apr 14, 2007 at 11:10:08PM +0200, Francis Moreau wrote: ok but do you think it's safe to assume that no others parts of the kernel will request aes-foo ? Remember that the main point is to optimize aes-foo ? What they request is up to the administrator. Cheers, -- Visit Openswan at

Re: [CRYPTO] is it really optimized ?

2007-04-14 Thread Francis Moreau
On 4/14/07, Herbert Xu <[EMAIL PROTECTED]> wrote: Francis Moreau <[EMAIL PROTECTED]> wrote: > > hmm yes indeed it should do the job, but I don't see how you do that. > For example, let say I want to use "aes-foo" with eCryptfs. I can give > a higher priority to "aes-foo" than "aes" one. When

Re: [CRYPTO] is it really optimized ?

2007-04-14 Thread Herbert Xu
Francis Moreau <[EMAIL PROTECTED]> wrote: > > hmm yes indeed it should do the job, but I don't see how you do that. > For example, let say I want to use "aes-foo" with eCryptfs. I can give > a higher priority to "aes-foo" than "aes" one. When eCryptfs asks for > a aes cipher it will pass "aes"

Re: [CRYPTO] is it really optimized ?

2007-04-14 Thread Francis Moreau
Hi, On 4/14/07, Herbert Xu <[EMAIL PROTECTED]> wrote: It should be easy to restrict a crypto device so that it's used by one specific user. That's why we have generic names ("aes") vs. specific ones ("aes-foo"). So if you let the priority user pick "aes-foo" instead of "aes", and given that

Re: [CRYPTO] is it really optimized ?

2007-04-14 Thread Francis Moreau
Hi, On 4/14/07, Herbert Xu [EMAIL PROTECTED] wrote: It should be easy to restrict a crypto device so that it's used by one specific user. That's why we have generic names (aes) vs. specific ones (aes-foo). So if you let the priority user pick aes-foo instead of aes, and given that there is a

Re: [CRYPTO] is it really optimized ?

2007-04-14 Thread Herbert Xu
Francis Moreau [EMAIL PROTECTED] wrote: hmm yes indeed it should do the job, but I don't see how you do that. For example, let say I want to use aes-foo with eCryptfs. I can give a higher priority to aes-foo than aes one. When eCryptfs asks for a aes cipher it will pass aes name and since

Re: [CRYPTO] is it really optimized ?

2007-04-14 Thread Francis Moreau
On 4/14/07, Herbert Xu [EMAIL PROTECTED] wrote: Francis Moreau [EMAIL PROTECTED] wrote: hmm yes indeed it should do the job, but I don't see how you do that. For example, let say I want to use aes-foo with eCryptfs. I can give a higher priority to aes-foo than aes one. When eCryptfs asks for

Re: [CRYPTO] is it really optimized ?

2007-04-13 Thread Herbert Xu
Francis Moreau <[EMAIL PROTECTED]> wrote: > > Crypto core already seems to implement a priority mechanism. But I > don't think I'm able to say "I'd like to use this algo for encrypting > filesystems. If another part of the kernel wants to use this algo then > give it the generic one". This choice

Re: [CRYPTO] is it really optimized ?

2007-04-13 Thread Francis Moreau
Hi, On 4/13/07, Helge Hafting <[EMAIL PROTECTED]> wrote: Francis Moreau wrote: > So is this interpretation right ? If so wouldn't it be appropriate to > introduce a mechanism to reserve this AES hardware for a special > purpose (filesystem encryptions) and thus make it as fast as possible > ? >

Re: [CRYPTO] is it really optimized ?

2007-04-13 Thread Helge Hafting
Francis Moreau wrote: Hi, After reading the crypto code and trying to implement a AES driver, I'm wondering if the current implementation is optimum. My plan is to use _exclusively_ the AES driver to encrypt filesystems by using eCryptfs for example. But it seems that because the current

Re: [CRYPTO] is it really optimized ?

2007-04-13 Thread Helge Hafting
Francis Moreau wrote: Hi, After reading the crypto code and trying to implement a AES driver, I'm wondering if the current implementation is optimum. My plan is to use _exclusively_ the AES driver to encrypt filesystems by using eCryptfs for example. But it seems that because the current

Re: [CRYPTO] is it really optimized ?

2007-04-13 Thread Francis Moreau
Hi, On 4/13/07, Helge Hafting [EMAIL PROTECTED] wrote: Francis Moreau wrote: So is this interpretation right ? If so wouldn't it be appropriate to introduce a mechanism to reserve this AES hardware for a special purpose (filesystem encryptions) and thus make it as fast as possible ? Would

Re: [CRYPTO] is it really optimized ?

2007-04-13 Thread Herbert Xu
Francis Moreau [EMAIL PROTECTED] wrote: Crypto core already seems to implement a priority mechanism. But I don't think I'm able to say I'd like to use this algo for encrypting filesystems. If another part of the kernel wants to use this algo then give it the generic one. This choice seems

[CRYPTO] is it really optimized ?

2007-04-12 Thread Francis Moreau
Hi, After reading the crypto code and trying to implement a AES driver, I'm wondering if the current implementation is optimum. My plan is to use _exclusively_ the AES driver to encrypt filesystems by using eCryptfs for example. But it seems that because the current implementation of the

[CRYPTO] is it really optimized ?

2007-04-12 Thread Francis Moreau
Hi, After reading the crypto code and trying to implement a AES driver, I'm wondering if the current implementation is optimum. My plan is to use _exclusively_ the AES driver to encrypt filesystems by using eCryptfs for example. But it seems that because the current implementation of the