1. 11 10月, 2007 2 次提交
  2. 21 9月, 2006 1 次提交
    • H
      [CRYPTO] api: Get rid of flags argument to setkey · 560c06ae
      Herbert Xu 提交于
      Now that the tfm is passed directly to setkey instead of the ctx, we no
      longer need to pass the &tfm->crt_flags pointer.
      
      This patch also gets rid of a few unnecessary checks on the key length
      for ciphers as the cipher layer guarantees that the key length is within
      the bounds specified by the algorithm.
      
      Rather than testing dia_setkey every time, this patch does it only once
      during crypto_alloc_tfm.  The redundant check from crypto_digest_setkey
      is also removed.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      560c06ae
  3. 26 6月, 2006 2 次提交
    • H
      [CRYPTO] aes: Add wrappers for assembly routines · e90b1a2b
      Herbert Xu 提交于
      The wrapper routines are required when asmlinkage differs from the usual
      calling convention.  So we need to have them.  However, by rearranging
      the parameters, they will get optimised away to a single jump for most
      people.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      e90b1a2b
    • H
      [CRYPTO] all: Pass tfm instead of ctx to algorithms · 6c2bb98b
      Herbert Xu 提交于
      Up until now algorithms have been happy to get a context pointer since
      they know everything that's in the tfm already (e.g., alignment, block
      size).
      
      However, once we have parameterised algorithms, such information will
      be specific to each tfm.  So the algorithm API needs to be changed to
      pass the tfm structure instead of the context pointer.
      
      This patch is basically a text substitution.  The only tricky bit is
      the assembly routines that need to get the context pointer offset
      through asm-offsets.h.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      6c2bb98b
  4. 21 3月, 2006 1 次提交
    • D
      [CRYPTO] aes: Fixed array boundary violation · 55e9dce3
      David McCullough 提交于
      The AES setkey routine writes 64 bytes to the E_KEY area even though
      there are only 60 bytes there.  It is in fact safe since E_KEY is
      immediately follwed by D_KEY which is initialised afterwards.  However,
      doing this may trigger undefined behaviour and makes Coverity unhappy.
      
      So by combining E_KEY and D_KEY into one array we sidestep this issue
      altogether.
      
      This problem was reported by Adrian Bunk.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      55e9dce3
  5. 10 1月, 2006 2 次提交
  6. 09 8月, 2005 1 次提交
  7. 07 7月, 2005 1 次提交
    • A
      [CRYPTO] Add x86_64 asm AES · a2a892a2
      Andreas Steinmetz 提交于
      Implementation:
      ===============
      The encrypt/decrypt code is based on an x86 implementation I did a while
      ago which I never published. This unpublished implementation does
      include an assembler based key schedule and precomputed tables. For
      simplicity and best acceptance, however, I took Gladman's in-kernel code
      for table generation and key schedule for the kernel port of my
      assembler code and modified this code to produce the key schedule as
      required by my assembler implementation. File locations and Kconfig are
      kept similar to the i586 AES assembler implementation.
      It may seem a little bit strange to use 32 bit I/O and registers in the
      assembler implementation but this gives the best code size. My
      implementation takes one instruction more per round compared to
      Gladman's x86 assembler but it doesn't require any stack for local
      variables or saved registers and it is less serialized than Gladman's
      code.
      Note that all comparisons to Gladman's code were done after my code was
      implemented. I did only use FIPS PUB 197 for the implementation so my
      implementation is independent work.
      If anybody has a better assembler solution for x86_64 I'll be pleased to
      have my code replaced with the better solution.
      
      Testing:
      ========
      The implementation passes the in-kernel crypto testing module and I'm
      running it without any problems on my laptop where it is mainly used for
      dm-crypt.
      
      Microbenchmark:
      ===============
      The microbenchmark was done in userspace with similar compile flags as
      used during kernel compile.
      Encrypt/decrypt is about 35% faster than the generic C implementation.
      As the generic C as well as my assembler implementation are both table
      I don't really expect that there is much room for further
      improvements though I'll be glad to be corrected here.
      The key schedule is about 5% slower than the generic C implementation.
      This is due to the fact that some more work has to be done in the key
      schedule routine to fit the schedule to the assembler implementation.
      
      Code Size:
      ==========
      Encrypt and decrypt are together about 2.1 Kbytes smaller than the
      generic C implementation which is important with regard to L1 cache
      usage. The key schedule routine is about 100 bytes larger than the
      generic C implementation.
      
      Data Size:
      ==========
      There's no difference in data size requirements between the assembler
      implementation and the generic C implementation.
      
      License:
      ========
      Gladmans's code is dual BSD/GPL whereas my assembler code is GPLv2 only
      (I'm  not going to change the license for my code). So I had to change
      the module license for the x86_64 aes module from 'Dual BSD/GPL' to
      'GPL' to reflect the most restrictive license within the module.
      Signed-off-by: NAndreas Steinmetz <ast@domdv.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a2a892a2