16 Feb, 2010

1 commit


14 Jul, 2009

2 commits


08 Jul, 2009

1 commit


02 Jun, 2009

2 commits


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
     

27 Mar, 2009

1 commit

  • * 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 Feb, 2009

1 commit

  • With the mandatory algorithm testing at registration, we have
    now created a deadlock with algorithms requiring fallbacks.
    This can happen if the module containing the algorithm requiring
    fallback is loaded first, without the fallback module being loaded
    first. The system will then try to test the new algorithm, find
    that it needs to load a fallback, and then try to load that.

    As both algorithms share the same module alias, it can attempt
    to load the original algorithm again and block indefinitely.

    As algorithms requiring fallbacks are a special case, we can fix
    this by giving them a different module alias than the rest. Then
    it's just a matter of using the right aliases according to what
    algorithms we're trying to find.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

18 Feb, 2009

2 commits

  • This is based on a report and patch by Geert Uytterhoeven.

    The functions crypto_alloc_tfm and create_create_tfm return a
    pointer that needs to be adjusted by the caller when successful
    and otherwise an error value. This means that the caller has
    to check for the error and only perform the adjustment if the
    pointer returned is valid.

    Since all callers want to make the adjustment and we know how
    to adjust it ourselves, it's much easier to just return adjusted
    pointer directly.

    The only caveat is that we have to return a void * instead of
    struct crypto_tfm *. However, this isn't that bad because both
    of these functions are for internal use only (by types code like
    shash.c, not even algorithms code).

    This patch also moves crypto_alloc_tfm into crypto/internal.h
    (crypto_create_tfm is already there) to reflect this.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • As it stands crypto_alg_mod_lookup will search either tested or
    untested algorithms, but never both at the same time. However,
    we need exactly that when constructing givcipher and aead so
    this patch adds support for that by setting the tested bit in
    type but clearing it in mask. This combination is currently
    unused.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

05 Feb, 2009

1 commit

  • Geert Uytterhoeven pointed out that we're not zeroing all the
    memory when freeing a transform. This patch fixes it by calling
    ksize to ensure that we zero everything in sight.

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

    Herbert Xu
     

25 Dec, 2008

2 commits

  • This patch reintroduces a completely revamped crypto_alloc_tfm.
    The biggest change is that we now take two crypto_type objects
    when allocating a tfm, a frontend and a backend. In fact this
    simply formalises what we've been doing behind the API's back.

    For example, as it stands crypto_alloc_ahash may use an
    actual ahash algorithm or a crypto_hash algorithm. Putting
    this in the API allows us to do this much more cleanly.

    The existing types will be converted across gradually.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The type exit function needs to undo any allocations done by the type
    init function. However, the type init function may differ depending
    on the upper-level type of the transform (e.g., a crypto_blkcipher
    instantiated as a crypto_ablkcipher).

    So we need to move the exit function out of the lower-level
    structure and into crypto_tfm itself.

    As it stands this is a no-op since nobody uses exit functions at
    all. However, all cases where a lower-level type is instantiated
    as a different upper-level type (such as blkcipher as ablkcipher)
    will be converted such that they allocate the underlying transform
    and use that instead of casting (e.g., crypto_ablkcipher casted
    into crypto_blkcipher). That will need to use a different exit
    function depending on the upper-level type.

    This patch also allows the type init/exit functions to call (or not)
    cra_init/cra_exit instead of always calling them from the top level.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

29 Aug, 2008

2 commits


10 Jul, 2008

1 commit


21 Apr, 2008

1 commit


11 Jan, 2008

1 commit

  • This patch makes crypto_alloc_ablkcipher/crypto_grab_skcipher always
    return algorithms that are capable of generating their own IVs through
    givencrypt and givdecrypt. Each algorithm may specify its default IV
    generator through the geniv field.

    For algorithms that do not set the geniv field, the blkcipher layer will
    pick a default. Currently it's chainiv for synchronous algorithms and
    eseqiv for asynchronous algorithms. Note that if these wrappers do not
    work on an algorithm then that algorithm must specify its own geniv or
    it can't be used at all.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

20 Oct, 2007

1 commit


11 Jul, 2007

1 commit


19 May, 2007

1 commit

  • The function crypto_mod_put first frees the algorithm and then drops
    the reference to its module. Unfortunately we read the module pointer
    which after freeing the algorithm and that pointer sits inside the
    object that we just freed.

    So this patch reads the module pointer out before we free the object.

    Thanks to Luca Tettamanti for reporting this.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

07 Feb, 2007

2 commits


07 Dec, 2006

1 commit

  • This patch removes the following no longer used functions:
    - api.c: crypto_alg_available()
    - digest.c: crypto_digest_init()
    - digest.c: crypto_digest_update()
    - digest.c: crypto_digest_final()
    - digest.c: crypto_digest_digest()

    Signed-off-by: Adrian Bunk
    Signed-off-by: Herbert Xu

    Adrian Bunk
     

11 Oct, 2006

1 commit

  • This patch makes crypto_alloc_base() return proper return value.

    - If kzalloc() failure happens within __crypto_alloc_tfm(),
    crypto_alloc_base() returns NULL. But crypto_alloc_base()
    is supposed to return error code as pointer. So this patch
    makes it return -ENOMEM in that case.

    - crypto_alloc_base() is suppose to return -EINTR, if it is
    interrupted by signal. But it may not return -EINTR.

    Signed-off-by: Akinobu Mita
    Signed-off-by: Herbert Xu

    Akinobu Mita
     

21 Sep, 2006

11 commits

  • This patch adds the crypto_comp type to complete the compile-time checking
    conversion. The functions crypto_has_alg and crypto_has_cipher, etc. are
    also added to replace crypto_alg_available.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds the crypto_type structure which will be used for all new
    crypto algorithm types, beginning with block ciphers.

    The primary purpose of this abstraction is to allow different crypto_type
    objects for crypto algorithms of the same type, in particular, there will
    be a different crypto_type objects for asynchronous algorithms.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Up until now all crypto transforms have been of the same type, struct
    crypto_tfm, regardless of whether they are ciphers, digests, or other
    types. As a result of that, we check the types at run-time before
    each crypto operation.

    This is rather cumbersome. We could instead use different C types for
    each crypto type to ensure that the correct types are used at compile
    time. That is, we would have crypto_cipher/crypto_digest instead of
    just crypto_tfm. The appropriate type would then be required for the
    actual operations such as crypto_digest_digest.

    Now that we have the type/mask fields when looking up algorithms, it
    is easy to request for an algorithm of the precise type that the user
    wants. However, crypto_alloc_tfm currently does not expose these new
    attributes.

    This patch introduces the function crypto_alloc_base which will carry
    these new parameters. It will be renamed to crypto_alloc_tfm once
    all existing users have been converted.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds the asynchronous flag and changes all existing users to
    only look up algorithms that are synchronous.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Spawns lock a specific crypto algorithm in place. They can then be used
    with crypto_spawn_tfm to allocate a tfm for that algorithm. When the base
    algorithm of a spawn is deregistered, all its spawns will be automatically
    removed.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • This patch also adds the infrastructure to pick an algorithm based on
    their type. For example, this allows you to select the encryption
    algorithm "aes", instead of any algorithm registered under the name
    "aes". For now this is only accessible internally. Eventually it
    will be made available through crypto_alloc_tfm.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • The cryptomgr module is a simple manager of crypto algorithm instances.
    It ensures that parameterised algorithms of the type tmpl(alg) (e.g.,
    cbc(aes)) are always created.

    This is meant to satisfy the needs for most users. For more complex
    cases such as deeper combinations or multiple parameters, a netlink
    module will be created which allows arbitrary expressions to be parsed
    in user-space.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • This patch adds a notifier chain for algorithm/template registration events.
    This will be used to register compound algorithms such as cbc(aes). In
    future this will also be passed onto user-space through netlink.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • The crypto API is made up of the part facing users such as IPsec and the
    low-level part which is used by cryptographic entities such as algorithms.
    This patch splits out the latter so that the two APIs are more clearly
    delineated. As a bonus the low-level API can now be modularised if all
    algorithms are built as modules.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Up until now we've relied on module reference counting to ensure that the
    crypto_alg structures don't disappear from under us. This was good enough
    as long as each crypto_alg came from exactly one module.

    However, with parameterised crypto algorithms a crypto_alg object may need
    two or more modules to operate. This means that we need to count the
    references to the crypto_alg object directly.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • The functions crypto_alg_get and crypto_alg_put operates on the crypto
    modules rather than the algorithms. Therefore it makes sense to call
    them crypto_mod_get and crypto_alg_put respectively.

    This is needed because we need to have real algorithm reference counters
    for parameterised algorithms as they can be unregistered from below by
    when their parameter algorithms are themselves unregistered.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

26 Jun, 2006

3 commits

  • We already allow asynchronous removal of existing algorithm modules. By
    allowing the replacement of existing algorithms, we can replace algorithms
    without having to wait for for all existing users to complete.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • We do need to change these names now and even more so in future with
    instantiated algorithms. So let's stop lying to the compiler and get
    rid of the const modifiers.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds the hooks cra_init/cra_exit which are called during a tfm's
    construction and destruction respectively. This will be used by the instances
    to allocate child tfm's.

    For now this lets us get rid of the coa_init/coa_exit functions which are
    used for exactly that purpose (unlike the dia_init function which is called
    for each transaction).

    In fact the coa_exit path is currently buggy as it may get called twice
    when an error is encountered during initialisation.

    Signed-off-by: Herbert Xu

    Herbert Xu