• Cyrille Pitchen's avatar
    crypto: atmel-sha - fix error management in atmel_sha_start() · 19998acb
    Cyrille Pitchen authored
    This patch clarifies and fixes how errors should be handled by
    atmel_sha_start().
    
    For update operations, the previous code wrongly assumed that
    (err != -EINPROGRESS) implies (err == 0). It's wrong because that doesn't
    take the error cases (err < 0) into account.
    
    This patch also adds many comments to detail all the possible returned
    values and what should be done in each case.
    
    Especially, when an error occurs, since atmel_sha_complete() has already
    been called, hence releasing the hardware, atmel_sha_start() must not call
    atmel_sha_finish_req() later otherwise atmel_sha_complete() would be
    called a second time.
    Signed-off-by: default avatarCyrille Pitchen <cyrille.pitchen@atmel.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    19998acb
atmel-sha.c 71.7 KB