14 Jul, 2009

14 commits


12 Jul, 2009

2 commits


11 Jul, 2009

8 commits


09 Jul, 2009

2 commits


08 Jul, 2009

10 commits


07 Jul, 2009

2 commits

  • This patch adds a new argument to crypto_alloc_instance which
    sets aside some space before the instance for use by algorithms
    such as shash that place type-specific data before crypto_alg.

    For compatibility the function has been renamed so that existing
    users aren't affected.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch introduces the template->create function intended
    to replace the existing alloc function. The intention is for
    create to handle the registration directly, whereas currently
    the caller of alloc has to handle the registration.

    This allows type-specific code to be run prior to registration.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

03 Jul, 2009

2 commits

  • As reported by Eric Sesterhenn the re-allocation of the cipher in reset leads
    to:
    |BUG: sleeping function called from invalid context at kernel/rwsem.c:21
    |in_atomic(): 1, irqs_disabled(): 0, pid: 4926, name: modprobe
    |INFO: lockdep is turned off.
    |Pid: 4926, comm: modprobe Tainted: G M 2.6.31-rc1-22297-g5298976 #24
    |Call Trace:
    | [] __might_sleep+0xf9/0x101
    | [] down_read+0x16/0x68
    | [] crypto_alg_lookup+0x16/0x34
    | [] crypto_larval_lookup+0x30/0xf9
    | [] crypto_alg_mod_lookup+0x1d/0x62
    | [] crypto_alloc_base+0x1e/0x64
    | [] reset_prng_context+0xab/0x13f
    | [] ? __spin_lock_init+0x27/0x51
    | [] cprng_init+0x2a/0x42
    | [] __crypto_alloc_tfm+0xfa/0x128
    | [] crypto_alloc_base+0x33/0x64
    | [] alg_test_cprng+0x30/0x1f4
    | [] alg_test+0x12f/0x19f
    | [] ? __alloc_pages_nodemask+0x14d/0x481
    | [] do_test+0xf9d/0x163f [tcrypt]
    | [] do_test+0x3a1/0x163f [tcrypt]
    | [] tcrypt_mod_init+0x35/0x7c [tcrypt]
    | [] _stext+0x54/0x12c
    | [] ? tcrypt_mod_init+0x0/0x7c [tcrypt]
    | [] ? up_read+0x16/0x2b
    | [] ? __blocking_notifier_call_chain+0x40/0x4c
    | [] sys_init_module+0xa9/0x1bf
    | [] sysenter_do_call+0x12/0x32

    because a spin lock is held and crypto_alloc_base() may sleep.
    There is no reason to re-allocate the cipher, the state is resetted in
    ->setkey(). This patches makes the cipher allocation a one time thing and
    moves it to init.

    Reported-by: Eric Sesterhenn
    Signed-off-by: Sebastian Andrzej Siewior
    Acked-by: Neil Horman
    Signed-off-by: Herbert Xu

    Sebastian Andrzej Siewior
     
  • The current code uses a mix of sping_lock() & spin_lock_irqsave(). This can
    lead to deadlock with the correct timming & cprng_get_random() + cprng_reset()
    sequence.
    I've converted them to bottom half locks since all three user grab just a BH
    lock so this runs probably in softirq :)

    Signed-off-by: Sebastian Andrzej Siewior
    Acked-by: Neil Horman
    Signed-off-by: Herbert Xu

    Sebastian Andrzej Siewior