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

4 commits

  • This patch changes the return type of crypto_*_reqsize from int to
    unsigned int which matches what the underlying type is (and should
    be).

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Since not everyone needs a queue pointer and those who need it can
    always get it from the context anyway the queue pointer in the
    common alg object is redundant.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds support for having multiple parameters to
    a template, separated by a comma. It also adds support
    for integer parameters in addition to the current algorithm
    parameter type.

    This will be used by the authenc template which will have
    four parameters: the authentication algorithm, the encryption
    algorithm, the authentication size and the encryption key
    length.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds crypto_aead which is the interface for AEAD
    (Authenticated Encryption with Associated Data) algorithms.

    AEAD algorithms perform authentication and encryption in one
    step. Traditionally users (such as IPsec) would use two
    different crypto algorithms to perform these. With AEAD
    this comes down to one algorithm and one operation.

    Of course if traditional algorithms were used we'd still
    be doing two operations underneath. However, real AEAD
    algorithms may allow the underlying operations to be
    optimised as well.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

11 Jul, 2007

1 commit


02 May, 2007

4 commits

  • This patch adds ablkcipher_request_set_tfm for those users that need
    to manage the memory for ablkcipher requests directly.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds the mid-level interface for asynchronous block ciphers.
    It also includes a generic queueing mechanism that can be used by other
    asynchronous crypto operations in future.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch passes the type/mask along when constructing instances of
    templates. This is in preparation for templates that may support
    multiple types of instances depending on what is requested. For example,
    the planned software async crypto driver will use this construct.

    For the moment this allows us to check whether the instance constructed
    is of the correct type and avoid returning success if the type does not
    match.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds the frontend interface for asynchronous block ciphers.
    In addition to the usual block cipher parameters, there is a callback
    function pointer and a data pointer. The callback will be invoked only
    if the encrypt/decrypt handlers return -EINPROGRESS. In other words,
    if the return value of zero the completion handler (or the equivalent
    code) needs to be invoked by the caller.

    The request structure is allocated and freed by the caller. Its size
    is determined by calling crypto_ablkcipher_reqsize(). The helpers
    ablkcipher_request_alloc/ablkcipher_request_free can be used to manage
    the memory for a request.

    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
     

20 Nov, 2006

1 commit


21 Sep, 2006

10 commits

  • This patch marks the crypto_digest_* functions and crypto_alg_available
    as deprecated. They've been replaced by crypto_hash_* and crypto_has_*
    respectively.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch converts padlock-sha to use crypto_hash for its fallback.
    It also changes the fallback selection to use selection by type instead
    of name. This is done through the new CRYPTO_ALG_NEED_FALLBACK bit,
    which is set if and only if an algorithm needs a fallback of the same
    type.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch converts all users to use the new crypto_comp type and the
    crypto_has_* functions.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • 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 removes the old HMAC implementation now that nobody uses it
    anymore.

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

    Herbert Xu
     
  • The existing digest user interface is inadequate for support asynchronous
    operations. For one it doesn't return a value to indicate success or
    failure, nor does it take a per-operation descriptor which is essential
    for the issuing of requests while other requests are still outstanding.

    This patch is the first in a series of steps to remodel the interface
    for asynchronous operations.

    For the ease of transition the new interface will be known as "hash"
    while the old one will remain as "digest".

    This patch also changes sg_next to allow chaining.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Mark the parts of the cipher interface that have been replaced by
    block ciphers as deprecated. Thanks to Andrew Morton for suggesting
    doing this before removing them completely.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds the new type of block ciphers. Unlike current cipher
    algorithms which operate on a single block at a time, block ciphers
    operate on an arbitrarily long linear area of data. As it is block-based,
    it will skip any data remaining at the end which cannot form a block.

    The block cipher has one major difference when compared to the existing
    block cipher implementation. The sg walking is now performed by the
    algorithm rather than the cipher mid-layer. This is needed for drivers
    that directly support sg lists. It also improves performance for all
    algorithms as it reduces the total number of indirect calls by one.

    In future the existing cipher algorithm will be converted to only have
    a single-block interface. This will be done after all existing users
    have switched over to the new block cipher type.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds two new operations for the simple cipher that encrypts or
    decrypts a single block at a time. This will be the main interface after
    the existing block operations have moved over to the new block ciphers.

    It also adds the crypto_cipher type which is currently only used on the
    new operations but will be extended to setkey as well once existing users
    have been converted to use block ciphers where applicable.

    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