[PATCH] crypto: Add AES-NI accelerated CTR mode

2010-02-28 Thread Huang Ying
To take advantage of the hardware pipeline implementation of AES-NI instructions. CTR mode cryption is implemented in ASM to schedule multiple AES-NI instructions one after another. This way, some latency of AES-NI instruction can be eliminated. Performance testing based on dm-crypt should 50% red

Re: [PATCH v1] compiler: prevent dead store elimination

2010-02-28 Thread Arjan van de Ven
On Sat, 27 Feb 2010 21:47:42 +0100 Roel Kluin wrote: > +void secure_bzero(void *p, size_t n) > +{ > + memset(p, 0, n); > + ARRAY_PREVENT_DSE(p, n); > +} > +EXPORT_SYMBOL(secure_bzero); please don't introduce bzero again to the kernel; make it secure_memset() please. -- Arjan van de V

Re: [PATCH v1] compiler: prevent dead store elimination

2010-02-28 Thread Bill Davidsen
Andi Kleen wrote: Every byte in the [p,p+n[ range must be used. If you only use the first byte, via e.g. asm("" :: "m"(*(char*)p)), then the compiler _will_ skip scrubbing bytes beyond the first. This works with gcc-3.2.3 up to gcc-4.4.3. You forgot to credit Mikael who did all the hard work fi

[PATCH v2] compiler: prevent dead store elimination

2010-02-28 Thread Roel Kluin
Due to optimization A call to memset() may be removed as a dead store when the buffer is not used after its value is overwritten. The new function secure_bzero() ensures a section of memory is padded with zeroes. >From the GCC manual, section 5.37: If your assembler instructions access memory in a

Re: [PATCH v1] compiler: prevent dead store elimination

2010-02-28 Thread Andi Kleen
> Every byte in the [p,p+n[ range must be used. If you only use the > first byte, via e.g. asm("" :: "m"(*(char*)p)), then the compiler > _will_ skip scrubbing bytes beyond the first. This works with > gcc-3.2.3 up to gcc-4.4.3. You forgot to credit Mikael who did all the hard work figuring this o