06 Sep, 2009

1 commit


29 Aug, 2009

1 commit

  • As struct skcipher_givcrypt_request includes struct crypto_request
    at a non-zero offset, testing for NULL after converting the pointer
    returned by crypto_dequeue_request does not work. This can result
    in IPsec crashes when the queue is depleted.

    This patch fixes it by doing the pointer conversion only when the
    return value is non-NULL. In particular, we create a new function
    __crypto_dequeue_request that does the pointer conversion.

    Reported-by: Brad Bosch
    Signed-off-by: Herbert Xu

    Herbert Xu
     

31 Jul, 2009

1 commit

  • * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx:
    dmaengine: at_hdmac: add DMA slave transfers
    dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller
    dmaengine: dmatest: correct thread_count while using multiple thread per channel
    dmaengine: dmatest: add a maximum number of test iterations
    drivers/dma: Remove unnecessary semicolons
    drivers/dma/fsldma.c: Remove unnecessary semicolons
    dmaengine: move HIGHMEM64G restriction to ASYNC_TX_DMA
    fsldma: do not clear bandwidth control bits on the 83xx controller
    fsldma: enable external start for the 83xx controller
    fsldma: use PCI Read Multiple command

    Linus Torvalds
     

02 Jul, 2009

1 commit

  • On HIGHMEM64G systems dma_addr_t is known to be larger than (void *)
    which precludes async_xor from performing dma address conversions by
    reusing the input parameter address list. However, other parts of the
    dmaengine infrastructure do not suffer this constraint, so the
    HIGHMEM64G restriction can be down-levelled.

    Signed-off-by: Dan Williams

    Dan Williams
     

15 Jun, 2009

2 commits


02 Jun, 2009

22 commits

  • Besdies, for the old code, gcc-4.3.3 produced this warning:
    "format not a string literal and no format arguments"

    Signed-off-by: Alex Riesen
    Signed-off-by: Herbert Xu

    Alex Riesen
     
  • As it stands we will each test hash vector both linearly and as
    a scatter list if applicable. This means that we cannot have
    vectors longer than a page, even with scatter lists.

    This patch fixes this by skipping test vectors with np != 0 when
    testing linearly.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • As we cannot guarantee the availability of contiguous pages at
    run-time, all test vectors must either fit within a page, or use
    scatter lists. In some cases vectors were not checked as to
    whether they fit inside a page. This patch adds all the missing
    checks.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • At present, the tcrypt module always exits with an -EAGAIN upon
    successfully completing all the tests its been asked to run. In fips
    mode, integrity checking is done by running all self-tests from the
    initrd, and its much simpler to check the ret from modprobe for
    success than to scrape dmesg and/or /proc/crypto. Simply stay
    loaded, giving modprobe a retval of 0, if self-tests all pass and
    we're in fips mode.

    A side-effect of tracking success/failure for fips mode is that in
    non-fips mode, self-test failures will return the actual failure
    return codes, rather than always returning -EAGAIN, which seems more
    correct anyway.

    The tcrypt_test() portion of the patch is dependent on my earlier
    pair of patches that skip non-fips algs in fips mode, at least to
    achieve the fully intended behavior.

    Nb: testing this patch against the cryptodev tree revealed a test
    failure for sha384, which I have yet to look into...

    Signed-off-by: Jarod Wilson
    Acked-by: Neil Horman
    Signed-off-by: Herbert Xu

    Jarod Wilson
     
  • If crypto_{,de}compress_{update,final}() succeed, return the actual number of
    bytes produced instead of zero, so their users don't have to calculate that
    theirselves.

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Herbert Xu

    Geert Uytterhoeven
     
  • Because all fips-allowed algorithms must be self-tested before they
    can be used, they will all have entries in testmgr.c's alg_test_descs[].
    Skip self-tests for any algs not flagged as fips_approved and return
    -EINVAL when in fips mode.

    Signed-off-by: Jarod Wilson
    Acked-by: Neil Horman
    Signed-off-by: Herbert Xu

    Jarod Wilson
     
  • Set the fips_allowed flag in testmgr.c's alg_test_descs[] for algs
    that are allowed to be used when in fips mode.

    One caveat: des isn't actually allowed anymore, but des (and thus also
    ecb(des)) has to be permitted, because disallowing them results in
    des3_ede being unable to properly register (see des module init func).

    Also, crc32 isn't technically on the fips approved list, but I think
    it gets used in various places that necessitate it being allowed.

    This list is based on
    http://csrc.nist.gov/groups/STM/cavp/index.html

    Important note: allowed/approved here does NOT mean "validated", just
    that its an alg that *could* be validated.

    Signed-off-by: Jarod Wilson
    Acked-by: Neil Horman
    Signed-off-by: Herbert Xu

    Jarod Wilson
     
  • Now with multi-block test vectors, all from SP800-38A, Appendix F.5.
    Also added ctr(aes) to case 10 in tcrypt.

    Signed-off-by: Jarod Wilson
    Signed-off-by: Herbert Xu

    Jarod Wilson
     
  • We currently allocate temporary memory that is used for testing
    statically. This renders the testing engine non-reentrant. As
    algorithms may nest, i.e., one may construct another in order to
    carry out a part of its operation, this is unacceptable. For
    example, it has been reported that an AEAD implementation allocates
    a cipher in its setkey function, which causes it to fail during
    testing as the temporary memory is overwritten.

    This patch replaces the static memory with dynamically allocated
    buffers. We need a maximum of 16 pages so this slightly increases
    the chances of an algorithm failing due to memory shortage.
    However, as testing usually occurs at registration, this shouldn't
    be a big problem.

    Reported-by: Shasi Pulijala
    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • According to our FIPS CAVS testing lab guru, when we're in fips mode,
    we must print out notices of successful self-test completion for
    every alg to be compliant.

    New and improved v2, without strncmp crap. Doesn't need to touch a flag
    though, due to not moving the notest label around anymore.

    Applies atop '[PATCH v2] crypto: catch base cipher self-test failures
    in fips mode'.

    Personally, I wouldn't mind seeing this info printed out regardless of
    whether or not we're in fips mode, I think its useful info, but will
    stick with only in fips mode for now.

    Signed-off-by: Jarod Wilson
    Signed-off-by: Herbert Xu

    Jarod Wilson
     
  • Signed-off-by: Jarod Wilson
    Signed-off-by: Herbert Xu

    Jarod Wilson
     
  • Add ANSI X9.31 Continuous Pseudo-Random Number Generator (AES mode),
    aka 'ansi_cprng' test vectors, taken from Appendix B.2.9 and B.2.10
    of the NIST RNGVS document, found here:
    http://csrc.nist.gov/groups/STM/cavp/documents/rng/RNGVS.pdf

    Successfully tested against both the cryptodev-2.6 tree and a Red
    Hat Enterprise Linux 5.4 kernel, via 'modprobe tcrypt mode=150'.

    The selection of 150 was semi-arbitrary, didn't seem like it should
    go any place in particular, so I started a new range for rng tests.

    Signed-off-by: Jarod Wilson
    Acked-by: Neil Horman
    Signed-off-by: Herbert Xu

    Jarod Wilson
     
  • Add some necessary infrastructure to make it possible to run
    self-tests for ansi_cprng. The bits are likely very specific
    to the ANSI X9.31 CPRNG in AES mode, and thus perhaps should
    be named more specifically if/when we grow additional CPRNG
    support...

    Successfully tested against the cryptodev-2.6 tree and a
    Red Hat Enterprise Linux 5.x kernel with the follow-on
    patch that adds the actual test vectors.

    Signed-off-by: Jarod Wilson
    Acked-by: Neil Horman
    Signed-off-by: Herbert Xu

    Jarod Wilson
     
  • Add an array of encryption and decryption + verification self-tests
    for rfc4309(ccm(aes)).

    Test vectors all come from sample FIPS CAVS files provided to
    Red Hat by a testing lab. Unfortunately, all the published sample
    vectors in RFC 3610 and NIST Special Publication 800-38C contain nonce
    lengths that the kernel's rfc4309 implementation doesn't support, so
    while using some public domain vectors would have been preferred, its
    not possible at this time.

    Signed-off-by: Jarod Wilson
    Signed-off-by: Herbert Xu

    Jarod Wilson
     
  • Add infrastructure to tcrypt/testmgr to support handling ccm decryption
    test vectors that are expected to fail verification.

    Signed-off-by: Jarod Wilson
    Signed-off-by: Herbert Xu

    Jarod Wilson
     
  • make C=1:
    | crypto/pcompress.c:77:5: warning: symbol 'crypto_register_pcomp' was not declared. Should it be static?
    | crypto/pcompress.c:89:5: warning: symbol 'crypto_unregister_pcomp' was not declared. Should it be static?

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Herbert Xu

    Geert Uytterhoeven
     
  • make C=1:
    | crypto/testmgr.c:846:45: warning: incorrect type in argument 5 (different signedness)
    | crypto/testmgr.c:846:45: expected unsigned int *dlen
    | crypto/testmgr.c:846:45: got int *
    | crypto/testmgr.c:878:47: warning: incorrect type in argument 5 (different signedness)
    | crypto/testmgr.c:878:47: expected unsigned int *dlen
    | crypto/testmgr.c:878:47: got int *

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Herbert Xu

    Geert Uytterhoeven
     
  • Because kernel_fpu_begin() and kernel_fpu_end() operations are too
    slow, the performance gain of general mode implementation + aes-aesni
    is almost all compensated.

    The AES-NI support for more modes are implemented as follow:

    - Add a new AES algorithm implementation named __aes-aesni without
    kernel_fpu_begin/end()

    - Use fpu((AES)) to provide kenrel_fpu_begin/end() invoking

    - Add (AES) ablkcipher, which uses cryptd(fpu((AES))) to
    defer cryption to cryptd context in soft_irq context.

    Now the ctr, lrw, pcbc and xts support are added.

    Performance testing based on dm-crypt shows that cryption time can be
    reduced to 50% of general mode implementation + aes-aesni implementation.

    Signed-off-by: Huang Ying
    Signed-off-by: Herbert Xu

    Huang Ying
     
  • Blkcipher touching FPU need to be enclosed by kernel_fpu_begin() and
    kernel_fpu_end(). If they are invoked in cipher algorithm
    implementation, they will be invoked for each block, so that
    performance will be hurt, because they are "slow" operations. This
    patch implements "fpu" template, which makes these operations to be
    invoked for each request.

    Signed-off-by: Huang Ying
    Signed-off-by: Herbert Xu

    Huang Ying
     
  • Use crypto_alloc_base() instead of crypto_alloc_ablkcipher() to
    allocate underlying tfm in cryptd_alloc_ablkcipher. Because
    crypto_alloc_ablkcipher() prefer GENIV encapsulated crypto instead of
    raw one, while cryptd_alloc_ablkcipher needed the raw one.

    Signed-off-by: Huang Ying
    Signed-off-by: Herbert Xu

    Huang Ying
     
  • Use kzfree() instead of memset() + kfree().

    Signed-off-by: Johannes Weiner
    Reviewed-by: Pekka Enberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Herbert Xu

    Johannes Weiner
     
  • Applying kernel janitors todos (printk calls need KERN_*
    constants on linebeginnings, reduce stack footprint where
    possible) to tcrypts test_hash_speed (where stacks
    memory footprint was very high (on i386 1184 bytes to
    160 now).

    Signed-off-by: Frank Seidel
    Acked-by: Neil Horman
    Signed-off-by: Herbert Xu

    Frank Seidel
     

31 May, 2009

1 commit

  • A quirk that we've always supported is having an sg entry that's
    bigger than a page, or more generally an sg entry that crosses
    page boundaries. Even though it would be better to explicitly have
    to sg entries for this, we need to support it for the existing users,
    in particular, IPsec.

    The new ahash sg walking code did try to handle this, but there was
    a bug where we didn't increment the page so kept on walking on the
    first page over an dover again.

    This patch fixes it.

    Tested-by: Martin Willi
    Signed-off-by: Herbert Xu

    Herbert Xu
     

18 May, 2009

1 commit


21 Apr, 2009

1 commit

  • The commit a760a6656e6f00bb0144a42a048cf0266646e22c (crypto:
    api - Fix module load deadlock with fallback algorithms) broke
    the auto-loading of algorithms that require fallbacks. The
    problem is that the fallback mask check is missing an and which
    cauess bits that should be considered to interfere with the
    result.

    Reported-by: Chuck Ebbert
    Signed-off-by: Herbert Xu

    Herbert Xu
     

15 Apr, 2009

1 commit

  • If crypto_ablkcipher_encrypt() returns synchronous,
    eseqiv_complete2() is called even if req->giv is already the
    pointer to the generated IV. The generated IV is overwritten
    with some random data in this case. This patch fixes this by
    calling eseqiv_complete2() just if the generated IV has to be
    copied to req->giv.

    Signed-off-by: Steffen Klassert
    Signed-off-by: Herbert Xu

    Steffen Klassert
     

04 Apr, 2009

3 commits

  • * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx:
    dma: Add SoF and EoF debugging to ipu_idmac.c, minor cleanup
    dw_dmac: add cyclic API to DW DMA driver
    dmaengine: Add privatecnt to revert DMA_PRIVATE property
    dmatest: add dma interrupts and callbacks
    dmatest: add xor test
    dmaengine: allow dma support for async_tx to be toggled
    async_tx: provide __async_inline for HAS_DMA=n archs
    dmaengine: kill some unused headers
    dmaengine: initialize tx_list in dma_async_tx_descriptor_init
    dma: i.MX31 IPU DMA robustness improvements
    dma: improve section assignment in i.MX31 IPU DMA driver
    dma: ipu_idmac driver cosmetic clean-up
    dmaengine: fail device registration if channel registration fails

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: ixp4xx - Fix handling of chained sg buffers
    crypto: shash - Fix unaligned calculation with short length
    hwrng: timeriomem - Use phys address rather than virt

    Linus Torvalds
     
  • * 'for-linus' of git://neil.brown.name/md: (53 commits)
    md/raid5 revise rules for when to update metadata during reshape
    md/raid5: minor code cleanups in make_request.
    md: remove CONFIG_MD_RAID_RESHAPE config option.
    md/raid5: be more careful about write ordering when reshaping.
    md: don't display meaningless values in sysfs files resync_start and sync_speed
    md/raid5: allow layout and chunksize to be changed on active array.
    md/raid5: reshape using largest of old and new chunk size
    md/raid5: prepare for allowing reshape to change layout
    md/raid5: prepare for allowing reshape to change chunksize.
    md/raid5: clearly differentiate 'before' and 'after' stripes during reshape.
    Documentation/md.txt update
    md: allow number of drives in raid5 to be reduced
    md/raid5: change reshape-progress measurement to cope with reshaping backwards.
    md: add explicit method to signal the end of a reshape.
    md/raid5: enhance raid5_size to work correctly with negative delta_disks
    md/raid5: drop qd_idx from r6_state
    md/raid6: move raid6 data processing to raid6_pq.ko
    md: raid5 run(): Fix max_degraded for raid level 4.
    md: 'array_size' sysfs attribute
    md: centralize ->array_sectors modifications
    ...

    Linus Torvalds
     

31 Mar, 2009

1 commit


27 Mar, 2009

2 commits

  • When the total length is shorter than the calculated number of unaligned bytes, the call to shash->update breaks. For example, calling crc32c on unaligned buffer with length of 1 can result in a system crash.

    Signed-off-by: Yehuda Sadeh
    Signed-off-by: Herbert Xu

    Yehuda Sadeh
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (29 commits)
    crypto: sha512-s390 - Add missing block size
    hwrng: timeriomem - Breaks an allyesconfig build on s390:
    nlattr: Fix build error with NET off
    crypto: testmgr - add zlib test
    crypto: zlib - New zlib crypto module, using pcomp
    crypto: testmgr - Add support for the pcomp interface
    crypto: compress - Add pcomp interface
    netlink: Move netlink attribute parsing support to lib
    crypto: Fix dead links
    hwrng: timeriomem - New driver
    crypto: chainiv - Use kcrypto_wq instead of keventd_wq
    crypto: cryptd - Per-CPU thread implementation based on kcrypto_wq
    crypto: api - Use dedicated workqueue for crypto subsystem
    crypto: testmgr - Test skciphers with no IVs
    crypto: aead - Avoid infinite loop when nivaead fails selftest
    crypto: skcipher - Avoid infinite loop when cipher fails selftest
    crypto: api - Fix crypto_alloc_tfm/create_create_tfm return convention
    crypto: api - crypto_alg_mod_lookup either tested or untested
    crypto: amcc - Add crypt4xx driver
    crypto: ansi_cprng - Add maintainer
    ...

    Linus Torvalds
     

26 Mar, 2009

2 commits