• Eric Biggers's avatar
    crypto: hash - introduce crypto_shash_tfm_digest() · 822a98b8
    Eric Biggers authored
    Currently the simplest use of the shash API is to use
    crypto_shash_digest() to digest a whole buffer.  However, this still
    requires allocating a hash descriptor (struct shash_desc).  Many users
    don't really want to preallocate one and instead just use a one-off
    descriptor on the stack like the following:
    
    	{
    		SHASH_DESC_ON_STACK(desc, tfm);
    		int err;
    
    		desc->tfm = tfm;
    
    		err = crypto_shash_digest(desc, data, len, out);
    
    		shash_desc_zero(desc);
    	}
    
    Wrap this in a new helper function crypto_shash_tfm_digest() that can be
    used instead of the above.
    Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    822a98b8
hash.h 33.4 KB