07 Nov, 2011

1 commit

  • * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
    Revert "tracing: Include module.h in define_trace.h"
    irq: don't put module.h into irq.h for tracking irqgen modules.
    bluetooth: macroize two small inlines to avoid module.h
    ip_vs.h: fix implicit use of module_get/module_put from module.h
    nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
    include: replace linux/module.h with "struct module" wherever possible
    include: convert various register fcns to macros to avoid include chaining
    crypto.h: remove unused crypto_tfm_alg_modname() inline
    uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
    pm_runtime.h: explicitly requires notifier.h
    linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
    miscdevice.h: fix up implicit use of lists and types
    stop_machine.h: fix implicit use of smp.h for smp_processor_id
    of: fix implicit use of errno.h in include/linux/of.h
    of_platform.h: delete needless include
    acpi: remove module.h include from platform/aclinux.h
    miscdevice.h: delete unnecessary inclusion of module.h
    device_cgroup.h: delete needless include
    net: sch_generic remove redundant use of
    net: inet_timewait_sock doesnt need
    ...

    Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in
    - drivers/media/dvb/frontends/dibx000_common.c
    - drivers/media/video/{mt9m111.c,ov6650.c}
    - drivers/mfd/ab3550-core.c
    - include/linux/dmaengine.h

    Linus Torvalds
     

01 Nov, 2011

1 commit

  • The (which is in turn in common headers
    like tcp.h) wants to use module_name() in an inline fcn.
    But having all of along for the ride is
    overkill and slows down compiles by a measureable amount,
    since it in turn includes lots of headers.

    Since the inline is never used anywhere in the kernel[1],
    we can just remove it, and then also remove the module.h
    include as well.

    In all the many crypto modules, there were some relying on
    crypto.h including module.h -- for them we now explicitly
    call out module.h for inclusion.

    [1] git grep shows some staging drivers also define the same
    static inline, but they also never ever use it.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

21 Oct, 2011

1 commit


27 Jul, 2011

1 commit

  • This allows us to move duplicated code in
    (atomic_inc_not_zero() for now) to

    Signed-off-by: Arun Sharma
    Reviewed-by: Eric Dumazet
    Cc: Ingo Molnar
    Cc: David Miller
    Cc: Eric Dumazet
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun Sharma
     

20 May, 2010

1 commit


19 Oct, 2009

1 commit

  • Remove unused digest_alg and hash_alg structs from crypto_alg union and
    kill their definitions. This also ensures that old-style digest/hash
    algorithms maintained out of tree will break at build time rather than
    oopsing at runtime.

    Signed-off-by: Benjamin Gilbert
    Signed-off-by: Herbert Xu

    Benjamin Gilbert
     

14 Jul, 2009

2 commits


12 Jul, 2009

1 commit


04 Mar, 2009

1 commit

  • The current "comp" crypto interface supports one-shot (de)compression only,
    i.e. the whole data buffer to be (de)compressed must be passed at once, and
    the whole (de)compressed data buffer will be received at once.
    In several use-cases (e.g. compressed file systems that store files in big
    compressed blocks), this workflow is not suitable.
    Furthermore, the "comp" type doesn't provide for the configuration of
    (de)compression parameters, and always allocates workspace memory for both
    compression and decompression, which may waste memory.

    To solve this, add a "pcomp" partial (de)compression interface that provides
    the following operations:
    - crypto_compress_{init,update,final}() for compression,
    - crypto_decompress_{init,update,final}() for decompression,
    - crypto_{,de}compress_setup(), to configure (de)compression parameters
    (incl. allocating workspace memory).

    The (de)compression methods take a struct comp_request, which was mimicked
    after the z_stream object in zlib, and contains buffer pointer and length
    pairs for input and output.

    The setup methods take an opaque parameter pointer and length pair. Parameters
    are supposed to be encoded using netlink attributes, whose meanings depend on
    the actual (name of the) (de)compression algorithm.

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

    Geert Uytterhoeven
     

18 Feb, 2009

1 commit

  • 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
     

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

6 commits

  • This patch allows shash algorithms to be used through the old hash
    interface. This is a transitional measure so we can convert the
    underlying algorithms to shash before converting the users across.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • It is often useful to save the partial state of a hash function
    so that it can be used as a base for two or more computations.

    The most prominent example is HMAC where all hashes start from
    a base determined by the key. Having an import/export interface
    means that we only have to compute that base once rather than
    for each message.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch allows shash algorithms to be used through the ahash
    interface. This is required before we can convert digest algorithms
    over to shash.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The shash interface replaces the current synchronous hash interface.
    It improves over hash in two ways. Firstly shash is reentrant,
    meaning that the same tfm may be used by two threads simultaneously
    as all hashing state is stored in a local descriptor.

    The other enhancement is that shash no longer takes scatter list
    entries. This is because shash is specifically designed for
    synchronous algorithms and as such scatter lists are unnecessary.

    All existing hash users will be converted to shash once the
    algorithms have been completely converted.

    There is also a new finup function that combines update with final.
    This will be extended to ahash once the algorithm conversion is
    done.

    This is also the first time that an algorithm type has their own
    registration function. Existing algorithm types will be converted
    to this way in due course.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • 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

3 commits


10 Jul, 2008

3 commits


21 Apr, 2008

1 commit


11 Jan, 2008

12 commits

  • Thanks to David Miller for pointing out that the SLAB (or SLOB/SLUB)
    cache uses the alignment of unsigned long long if the architecture
    kmalloc/slab alignment macros are not defined.

    This patch changes the CRYPTO_MINALIGN so that it uses the same default
    value.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch makes crypto_alloc_aead always return algorithms that is
    capable of generating their own IVs through givencrypt and givdecrypt.
    All existing AEAD algorithms already do. New ones must either supply
    their own or specify a generic IV generator with the geniv field.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch creates the infrastructure to help the construction of IV
    generator templates that wrap around AEAD algorithms by adding an IV
    generator to them. This is useful for AEAD algorithms with no built-in
    IV generator or to replace their built-in generator.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds the underlying givcrypt operations for aead and associated
    support elements. The rationale is identical to that of the skcipher
    givcrypt operations, i.e., sometimes only the algorithm knows how the
    IV should be generated.

    A new request type aead_givcrypt_request is added which contains an
    embedded aead_request structure with two new elements to support this
    operation. The new elements are seq and giv. The seq field should
    contain a strictly increasing 64-bit integer which may be used by
    certain IV generators as an input value. The giv field will be used
    to store the generated IV. It does not need to obey the alignment
    requirements of the algorithm because it's not used during the operation.

    The existing iv field must still be available as it will be used to store
    intermediate IVs and the output IV if chaining is desired.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • 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
     
  • This patch creates the infrastructure to help the construction of givcipher
    templates that wrap around existing blkcipher/ablkcipher algorithms by adding
    an IV generator to them.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch introduces the geniv field which indicates the default IV
    generator for each algorithm. It should point to a string that is not
    freed as long as the algorithm is registered.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Different block cipher modes have different requirements for intialisation
    vectors. For example, CBC can use a simple randomly generated IV while
    modes such as CTR must use an IV generation mechanisms that give a stronger
    guarantee on the lack of collisions. Furthermore, disk encryption modes
    have their own IV generation algorithms.

    Up until now IV generation has been left to the users of the symmetric
    key cipher API. This is inconvenient as the number of block cipher modes
    increase because the user needs to be aware of which mode is supposed to
    be paired with which IV generation algorithm.

    Therefore it makes sense to integrate the IV generation into the crypto
    API. This patch takes the first step in that direction by creating two
    new ablkcipher operations, givencrypt and givdecrypt that generates an
    IV before performing the actual encryption or decryption.

    The operations are currently not exposed to the user. That will be done
    once the underlying functionality has actually been implemented.

    It also creates the underlying givcipher type. Algorithms that directly
    generate IVs would use it instead of ablkcipher. All other algorithms
    (including all existing ones) would generate a givcipher algorithm upon
    registration. This givcipher algorithm will be constructed from the geniv
    string that's stored in every algorithm. That string will locate a template
    which is instantiated by the blkcipher/ablkcipher algorithm in question to
    give a givcipher algorithm.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Note: From now on the collective of ablkcipher/blkcipher/givcipher will
    be known as skcipher, i.e., symmetric key cipher. The name blkcipher has
    always been much of a misnomer since it supports stream ciphers too.

    This patch adds the function crypto_grab_skcipher as a new way of getting
    an ablkcipher spawn. The problem is that previously we did this in two
    steps, first getting the algorithm and then calling crypto_init_spawn.

    This meant that each spawn user had to be aware of what type and mask to
    use for these two steps. This is difficult and also presents a problem
    when the type/mask changes as they're about to be for IV generators.

    The new interface does both steps together just like crypto_alloc_ablkcipher.

    As a side-effect this also allows us to be stronger on type enforcement
    for spawns. For now this is only done for ablkcipher but it's trivial
    to extend for other types.

    This patch also moves the type/mask logic for skcipher into the helpers
    crypto_skcipher_type and crypto_skcipher_mask.

    Finally this patch introduces the function crypto_require_sync to determine
    whether the user is specifically requesting a sync algorithm.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • When allocating ablkcipher/hash objects, we use a mask that's wider than
    the usual type mask. This patch sanitises the mask supplied by the user
    so we don't end up using a narrower mask which may lead to unintended
    results.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • As it is authsize is an algorithm paramter which cannot be changed at
    run-time. This is inconvenient because hardware that implements such
    algorithms would have to register each authsize that they support
    separately.

    Since authsize is a property common to all AEAD algorithms, we can add
    a function setauthsize that sets it at run-time, just like setkey.

    This patch does exactly that and also changes authenc so that authsize
    is no longer a parameter of its template.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Up until now we have ablkcipher algorithms have been identified as
    type BLKCIPHER with the ASYNC bit set. This is suboptimal because
    ablkcipher refers to two things. On the one hand it refers to the
    top-level ablkcipher interface with requests. On the other hand it
    refers to and algorithm type underneath.

    As it is you cannot request a synchronous block cipher algorithm
    with the ablkcipher interface on top. This is a problem because
    we want to be able to eventually phase out the blkcipher top-level
    interface.

    This patch fixes this by making ABLKCIPHER its own type, just as
    we have distinct types for HASH and DIGEST. The type it associated
    with the algorithm implementation only.

    Which top-level interface is used for synchronous block ciphers is
    then determined by the mask that's used. If it's a specific mask
    then the old blkcipher interface is given, otherwise we go with the
    new ablkcipher interface.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

20 Oct, 2007

1 commit


11 Oct, 2007

2 commits