1. 07 Jan, 2011 3 commits
    • Herbert Xu's avatar
      hwrng: via_rng - Fix memory scribbling on some CPUs · 55db8387
      Herbert Xu authored
      It has been reported that on at least one Nano CPU the xstore
      instruction will write as many as 16 bytes of data to the output
      buffer.
      
      This causes memory corruption as we use rng->priv which is only
      4-8 bytes long.
      
      This patch fixes this by using an intermediate buffer on the stack
      with at least 16 bytes and aligned to a 16-byte boundary.
      
      The problem was observed on the following processor:
      
      processor	: 0
      vendor_id	: CentaurHauls
      cpu family	: 6
      model		: 15
      model name	: VIA Nano processor U2250 (1.6GHz Capable)
      stepping	: 3
      cpu MHz		: 1600.000
      cache size	: 1024 KB
      fdiv_bug	: no
      hlt_bug		: no
      f00f_bug	: no
      coma_bug	: no
      fpu		: yes
      fpu_exception	: yes
      cpuid level	: 10
      wp		: yes
      flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush acpi mmx fxsr sse sse2 ss tm syscall nx lm constant_tsc up rep_good pni monitor vmx est tm2 ssse3 cx16 xtpr rng rng_en ace ace_en ace2 phe phe_en lahf_lm
      bogomips	: 3192.08
      clflush size	: 64
      cache_alignment	: 128
      address sizes	: 36 bits physical, 48 bits virtual
      power management:
      Tested-by: default avatarMario 'BitKoenig' Holbe <Mario.Holbe@TU-Ilmenau.DE>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      55db8387
    • Herbert Xu's avatar
      crypto: padlock - Move padlock.h into include/crypto · 21493088
      Herbert Xu authored
      This patch moves padlock.h from drivers/crypto into include/crypto
      so that it may be used by the via-rng driver.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      21493088
    • Herbert Xu's avatar
      hwrng: via_rng - Fix asm constraints · 0735ac1f
      Herbert Xu authored
      The inline asm to invoke xstore did not specify the constraints
      correctly.  In particular, dx/di should have been marked as output
      registers as well as input as they're modified by xstore.
      
      Thanks to Mario Holbe for creating this patch and testing it.
      Tested-by: default avatarMario 'BitKoenig' Holbe <Mario.Holbe@TU-Ilmenau.DE>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      0735ac1f
  2. 06 Jan, 2011 1 commit
  3. 04 Jan, 2011 3 commits
  4. 29 Dec, 2010 1 commit
  5. 28 Dec, 2010 1 commit
  6. 21 Dec, 2010 1 commit
  7. 13 Dec, 2010 1 commit
  8. 08 Dec, 2010 2 commits
  9. 03 Dec, 2010 1 commit
  10. 02 Dec, 2010 8 commits
  11. 30 Nov, 2010 2 commits
    • Herbert Xu's avatar
      crypto: algif_skcipher - Handle unaligned receive buffer · bc97e57e
      Herbert Xu authored
      As it is if user-space passes through a receive buffer that's not
      aligned to to the cipher block size, we'll end up encrypting or
      decrypting a partial block which causes a spurious EINVAL to be
      returned.
      
      This patch fixes this by moving the partial block test after the
      af_alg_make_sg call.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      bc97e57e
    • Herbert Xu's avatar
      crypto: algif_skcipher - Fixed overflow when sndbuf is page aligned · 0f6bb83c
      Herbert Xu authored
      When sk_sndbuf is not a multiple of PAGE_SIZE, the limit tests
      in sendmsg fail as the limit variable becomes negative and we're
      using an unsigned comparison.
      
      The same thing can happen if sk_sndbuf is lowered after a sendmsg
      call.
      
      This patch fixes this by always taking the signed maximum of limit
      and 0 before we perform the comparison.
      
      It also rounds the value of sk_sndbuf down to a multiple of PAGE_SIZE
      so that we don't end up allocating a page only to use a small number
      of bytes in it because we're bound by sk_sndbuf.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      0f6bb83c
  12. 29 Nov, 2010 2 commits
  13. 28 Nov, 2010 1 commit
  14. 27 Nov, 2010 11 commits
  15. 26 Nov, 2010 1 commit
    • Herbert Xu's avatar
      crypto: algif_skcipher - User-space interface for skcipher operations · 8ff59090
      Herbert Xu authored
      This patch adds the af_alg plugin for symmetric key ciphers,
      corresponding to the ablkcipher kernel operation type.
      
      Keys can optionally be set through the setsockopt interface.
      
      Once a sendmsg call occurs without MSG_MORE no further writes
      may be made to the socket until all previous data has been read.
      
      IVs and and whether encryption/decryption is performed can be
      set through the setsockopt interface or as a control message
      to sendmsg.
      
      The interface is completely synchronous, all operations are
      carried out in recvmsg(2) and will complete prior to the system
      call returning.
      
      The splice(2) interface support reading the user-space data directly
      without copying (except that the Crypto API itself may copy the data
      if alignment is off).
      
      The recvmsg(2) interface supports directly writing to user-space
      without additional copying, i.e., the kernel crypto interface will
      receive the user-space address as its output SG list.
      
      Thakns to Miloslav Trmac for reviewing this and contributing
      fixes and improvements.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      8ff59090
  16. 19 Nov, 2010 1 commit
    • Herbert Xu's avatar
      crypto: algif_hash - User-space interface for hash operations · fe869cdb
      Herbert Xu authored
      This patch adds the af_alg plugin for hash, corresponding to
      the ahash kernel operation type.
      
      Keys can optionally be set through the setsockopt interface.
      
      Each sendmsg call will finalise the hash unless sent with a MSG_MORE
      flag.
      
      Partial hash states can be cloned using accept(2).
      
      The interface is completely synchronous, all operations will
      complete prior to the system call returning.
      
      Both sendmsg(2) and splice(2) support reading the user-space
      data directly without copying (except that the Crypto API itself
      may copy the data if alignment is off).
      
      For now only the splice(2) interface supports performing digest
      instead of init/update/final.  In future the sendmsg(2) interface
      will also be modified to use digest/finup where possible so that
      hardware that cannot return a partial hash state can still benefit
      from this interface.
      
      Thakns to Miloslav Trmac for reviewing this and contributing
      fixes and improvements.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Tested-by: default avatarMartin Willi <martin@strongswan.org>
      fe869cdb