• Herbert Xu's avatar
    [CRYPTO] api: Added crypto_alloc_base · 6d7d684d
    Herbert Xu authored
    Up until now all crypto transforms have been of the same type, struct
    crypto_tfm, regardless of whether they are ciphers, digests, or other
    types.  As a result of that, we check the types at run-time before
    each crypto operation.
    
    This is rather cumbersome.  We could instead use different C types for
    each crypto type to ensure that the correct types are used at compile
    time.  That is, we would have crypto_cipher/crypto_digest instead of
    just crypto_tfm.  The appropriate type would then be required for the
    actual operations such as crypto_digest_digest.
    
    Now that we have the type/mask fields when looking up algorithms, it
    is easy to request for an algorithm of the precise type that the user
    wants.  However, crypto_alloc_tfm currently does not expose these new
    attributes.
    
    This patch introduces the function crypto_alloc_base which will carry
    these new parameters.  It will be renamed to crypto_alloc_tfm once
    all existing users have been converted.
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    6d7d684d
api.c 10 KB